app.js 1.8 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899589005890158902589035890458905589065890758908589095891058911589125891358914589155891658917589185891958920589215892258923589245892558926589275892858929589305893158932589335893458935589365893758938589395894058941589425894358944589455894658947589485894958950589515895258953589545895558956589575895858959589605896158962589635896458965589665896758968589695897058971589725897358974589755897658977589785897958980589815898258983589845898558986589875898858989589905899158992589935899458995589965899758998589995900059001590025900359004590055900659007590085900959010590115901259013590145901559016590175901859019590205902159022590235902459025590265902759028590295903059031590325903359034590355903659037590385903959040590415904259043590445904559046590475904859049590505905159052590535905459055590565905759058590595906059061590625906359064590655906659067590685906959070590715907259073590745907559076590775907859079590805908159082590835908459085590865908759088590895909059091590925909359094590955909659097590985909959100591015910259103591045910559106591075910859109591105911159112591135911459115591165911759118591195912059121591225912359124591255912659127591285912959130591315913259133591345913559136591375913859139591405914159142591435914459145591465914759148591495915059151591525915359154591555915659157591585915959160591615916259163591645916559166591675916859169591705917159172591735917459175591765917759178591795918059181591825918359184591855918659187591885918959190591915919259193591945919559196591975919859199592005920159202592035920459205592065920759208592095921059211592125921359214592155921659217592185921959220592215922259223592245922559226592275922859229592305923159232592335923459235592365923759238592395924059241592425924359244592455924659247592485924959250592515925259253592545925559256592575925859259592605926159262592635926459265592665926759268592695927059271592725927359274592755927659277592785927959280592815928259283592845928559286592875928859289592905929159292592935929459295592965929759298592995930059301593025930359304593055930659307593085930959310593115931259313593145931559316593175931859319593205932159322593235932459325593265932759328593295933059331593325933359334593355933659337593385933959340593415934259343593445934559346593475934859349593505935159352593535935459355593565935759358593595936059361593625936359364593655936659367593685936959370593715937259373593745937559376593775937859379593805938159382593835938459385593865938759388593895939059391593925939359394593955939659397593985939959400594015940259403594045940559406594075940859409594105941159412594135941459415594165941759418594195942059421594225942359424594255942659427594285942959430594315943259433594345943559436594375943859439594405944159442594435944459445594465944759448594495945059451594525945359454594555945659457594585945959460594615946259463594645946559466594675946859469594705947159472594735947459475594765947759478594795948059481594825948359484594855948659487594885948959490594915949259493594945949559496594975949859499595005950159502595035950459505595065950759508595095951059511595125951359514595155951659517595185951959520595215952259523595245952559526595275952859529595305953159532595335953459535595365953759538595395954059541595425954359544595455954659547595485954959550595515955259553595545955559556595575955859559595605956159562595635956459565595665956759568595695957059571595725957359574595755957659577595785957959580595815958259583595845958559586595875958859589595905959159592595935959459595595965959759598595995960059601596025960359604596055960659607596085960959610596115961259613596145961559616596175961859619596205962159622596235962459625596265962759628596295963059631596325963359634596355963659637596385963959640596415964259643596445964559646596475964859649596505965159652596535965459655596565965759658596595966059661596625966359664596655966659667596685966959670596715967259673596745967559676596775967859679596805968159682596835968459685596865968759688596895969059691596925969359694596955969659697596985969959700597015970259703597045970559706597075970859709597105971159712597135971459715597165971759718597195972059721597225972359724597255972659727597285972959730597315973259733597345973559736597375973859739597405974159742597435974459745597465974759748597495975059751597525975359754597555975659757597585975959760597615976259763597645976559766597675976859769597705977159772597735977459775597765977759778597795978059781597825978359784597855978659787597885978959790597915979259793597945979559796597975979859799598005980159802598035980459805598065980759808598095981059811598125981359814598155981659817598185981959820598215982259823598245982559826598275982859829598305983159832598335983459835598365983759838598395984059841598425984359844598455984659847598485984959850598515985259853598545985559856598575985859859598605986159862598635986459865598665986759868598695987059871598725987359874598755987659877598785987959880598815988259883598845988559886598875988859889598905989159892598935989459895598965989759898598995990059901599025990359904599055990659907599085990959910599115991259913599145991559916599175991859919599205992159922599235992459925599265992759928599295993059931599325993359934599355993659937599385993959940599415994259943599445994559946599475994859949599505995159952599535995459955599565995759958599595996059961599625996359964599655996659967599685996959970599715997259973599745997559976599775997859979599805998159982599835998459985599865998759988599895999059991599925999359994599955999659997599985999960000600016000260003600046000560006600076000860009600106001160012600136001460015600166001760018600196002060021600226002360024600256002660027600286002960030600316003260033600346003560036600376003860039600406004160042600436004460045600466004760048600496005060051600526005360054600556005660057600586005960060600616006260063600646006560066600676006860069600706007160072600736007460075600766007760078600796008060081600826008360084600856008660087600886008960090600916009260093600946009560096600976009860099601006010160102601036010460105601066010760108601096011060111601126011360114601156011660117601186011960120601216012260123601246012560126601276012860129601306013160132601336013460135601366013760138601396014060141601426014360144601456014660147601486014960150601516015260153601546015560156601576015860159601606016160162601636016460165601666016760168601696017060171601726017360174601756017660177601786017960180601816018260183601846018560186601876018860189601906019160192601936019460195601966019760198601996020060201602026020360204602056020660207602086020960210602116021260213602146021560216602176021860219602206022160222602236022460225602266022760228602296023060231602326023360234602356023660237602386023960240602416024260243602446024560246602476024860249602506025160252602536025460255602566025760258602596026060261602626026360264602656026660267602686026960270602716027260273602746027560276602776027860279602806028160282602836028460285602866028760288602896029060291602926029360294602956029660297602986029960300603016030260303603046030560306603076030860309603106031160312603136031460315603166031760318603196032060321603226032360324603256032660327603286032960330603316033260333603346033560336603376033860339603406034160342603436034460345603466034760348603496035060351603526035360354603556035660357603586035960360603616036260363603646036560366603676036860369603706037160372603736037460375603766037760378603796038060381603826038360384603856038660387603886038960390603916039260393603946039560396603976039860399604006040160402604036040460405604066040760408604096041060411604126041360414604156041660417604186041960420604216042260423604246042560426604276042860429604306043160432604336043460435604366043760438604396044060441604426044360444604456044660447604486044960450604516045260453604546045560456604576045860459604606046160462604636046460465604666046760468604696047060471604726047360474604756047660477604786047960480604816048260483604846048560486604876048860489604906049160492604936049460495604966049760498604996050060501605026050360504605056050660507605086050960510605116051260513605146051560516605176051860519605206052160522605236052460525605266052760528605296053060531605326053360534605356053660537605386053960540605416054260543605446054560546605476054860549605506055160552605536055460555605566055760558605596056060561605626056360564605656056660567605686056960570605716057260573605746057560576605776057860579605806058160582605836058460585605866058760588605896059060591605926059360594605956059660597605986059960600606016060260603606046060560606606076060860609606106061160612606136061460615606166061760618606196062060621606226062360624606256062660627606286062960630606316063260633606346063560636606376063860639606406064160642606436064460645606466064760648606496065060651606526065360654606556065660657606586065960660606616066260663606646066560666606676066860669606706067160672606736067460675606766067760678606796068060681606826068360684606856068660687606886068960690606916069260693606946069560696606976069860699607006070160702607036070460705607066070760708607096071060711607126071360714607156071660717607186071960720607216072260723607246072560726607276072860729607306073160732607336073460735607366073760738607396074060741607426074360744607456074660747607486074960750607516075260753607546075560756607576075860759607606076160762607636076460765607666076760768607696077060771607726077360774607756077660777607786077960780607816078260783607846078560786607876078860789607906079160792607936079460795607966079760798607996080060801608026080360804608056080660807608086080960810608116081260813608146081560816608176081860819608206082160822608236082460825608266082760828608296083060831608326083360834608356083660837608386083960840608416084260843608446084560846608476084860849608506085160852608536085460855608566085760858608596086060861608626086360864608656086660867608686086960870608716087260873608746087560876608776087860879608806088160882608836088460885608866088760888608896089060891608926089360894608956089660897608986089960900609016090260903609046090560906609076090860909609106091160912609136091460915609166091760918609196092060921609226092360924609256092660927609286092960930609316093260933609346093560936609376093860939609406094160942609436094460945609466094760948609496095060951609526095360954609556095660957609586095960960609616096260963609646096560966609676096860969609706097160972609736097460975609766097760978609796098060981609826098360984609856098660987609886098960990609916099260993609946099560996609976099860999610006100161002610036100461005610066100761008610096101061011610126101361014610156101661017610186101961020610216102261023610246102561026610276102861029610306103161032610336103461035610366103761038610396104061041610426104361044610456104661047610486104961050610516105261053610546105561056610576105861059610606106161062610636106461065610666106761068610696107061071610726107361074610756107661077610786107961080610816108261083610846108561086610876108861089610906109161092610936109461095610966109761098610996110061101611026110361104611056110661107611086110961110611116111261113611146111561116611176111861119611206112161122611236112461125611266112761128611296113061131611326113361134611356113661137611386113961140611416114261143611446114561146611476114861149611506115161152611536115461155611566115761158611596116061161611626116361164611656116661167611686116961170611716117261173611746117561176611776117861179611806118161182611836118461185611866118761188611896119061191611926119361194611956119661197611986119961200612016120261203612046120561206612076120861209612106121161212612136121461215612166121761218612196122061221612226122361224612256122661227612286122961230612316123261233612346123561236612376123861239612406124161242612436124461245612466124761248612496125061251612526125361254612556125661257612586125961260612616126261263612646126561266612676126861269612706127161272612736127461275612766127761278612796128061281612826128361284612856128661287612886128961290612916129261293612946129561296612976129861299613006130161302613036130461305613066130761308613096131061311613126131361314613156131661317613186131961320613216132261323613246132561326613276132861329613306133161332613336133461335613366133761338613396134061341613426134361344613456134661347613486134961350613516135261353613546135561356613576135861359613606136161362613636136461365613666136761368613696137061371613726137361374613756137661377613786137961380613816138261383613846138561386613876138861389613906139161392613936139461395613966139761398613996140061401614026140361404614056140661407614086140961410614116141261413614146141561416614176141861419614206142161422614236142461425614266142761428614296143061431614326143361434614356143661437614386143961440614416144261443614446144561446614476144861449614506145161452614536145461455614566145761458614596146061461614626146361464614656146661467614686146961470614716147261473614746147561476614776147861479614806148161482614836148461485614866148761488614896149061491614926149361494614956149661497614986149961500615016150261503615046150561506615076150861509615106151161512615136151461515615166151761518615196152061521615226152361524615256152661527615286152961530615316153261533615346153561536615376153861539615406154161542615436154461545615466154761548615496155061551615526155361554615556155661557615586155961560615616156261563615646156561566615676156861569615706157161572615736157461575615766157761578615796158061581615826158361584615856158661587615886158961590615916159261593615946159561596615976159861599616006160161602616036160461605616066160761608616096161061611616126161361614616156161661617616186161961620616216162261623616246162561626616276162861629616306163161632616336163461635616366163761638616396164061641616426164361644616456164661647616486164961650616516165261653616546165561656616576165861659616606166161662616636166461665616666166761668616696167061671616726167361674616756167661677616786167961680616816168261683616846168561686616876168861689616906169161692616936169461695616966169761698616996170061701617026170361704617056170661707617086170961710617116171261713617146171561716617176171861719617206172161722617236172461725617266172761728617296173061731617326173361734617356173661737617386173961740617416174261743617446174561746617476174861749617506175161752617536175461755617566175761758617596176061761617626176361764617656176661767617686176961770617716177261773617746177561776617776177861779617806178161782617836178461785617866178761788617896179061791617926179361794617956179661797617986179961800618016180261803618046180561806618076180861809618106181161812618136181461815618166181761818618196182061821618226182361824618256182661827618286182961830618316183261833618346183561836618376183861839618406184161842618436184461845618466184761848618496185061851618526185361854618556185661857618586185961860618616186261863618646186561866618676186861869618706187161872618736187461875618766187761878618796188061881618826188361884618856188661887618886188961890618916189261893618946189561896618976189861899619006190161902619036190461905619066190761908619096191061911619126191361914619156191661917619186191961920619216192261923619246192561926619276192861929619306193161932619336193461935619366193761938619396194061941619426194361944619456194661947619486194961950619516195261953619546195561956619576195861959619606196161962619636196461965619666196761968619696197061971619726197361974619756197661977619786197961980619816198261983619846198561986619876198861989619906199161992619936199461995619966199761998619996200062001620026200362004620056200662007620086200962010620116201262013620146201562016620176201862019620206202162022620236202462025620266202762028620296203062031620326203362034620356203662037620386203962040620416204262043620446204562046620476204862049620506205162052620536205462055620566205762058620596206062061620626206362064620656206662067620686206962070620716207262073620746207562076620776207862079620806208162082620836208462085620866208762088620896209062091620926209362094620956209662097620986209962100621016210262103621046210562106621076210862109621106211162112621136211462115621166211762118621196212062121621226212362124621256212662127621286212962130621316213262133621346213562136621376213862139621406214162142621436214462145621466214762148621496215062151621526215362154621556215662157621586215962160621616216262163621646216562166621676216862169621706217162172621736217462175621766217762178621796218062181621826218362184621856218662187621886218962190621916219262193621946219562196621976219862199622006220162202622036220462205622066220762208622096221062211622126221362214622156221662217622186221962220622216222262223622246222562226622276222862229622306223162232622336223462235622366223762238622396224062241622426224362244622456224662247622486224962250622516225262253622546225562256622576225862259622606226162262622636226462265622666226762268622696227062271622726227362274622756227662277622786227962280622816228262283622846228562286622876228862289622906229162292622936229462295622966229762298622996230062301623026230362304623056230662307623086230962310623116231262313623146231562316623176231862319623206232162322623236232462325623266232762328623296233062331623326233362334623356233662337623386233962340623416234262343623446234562346623476234862349623506235162352623536235462355623566235762358623596236062361623626236362364623656236662367623686236962370623716237262373623746237562376623776237862379623806238162382623836238462385623866238762388623896239062391623926239362394623956239662397623986239962400624016240262403624046240562406624076240862409624106241162412624136241462415624166241762418624196242062421624226242362424624256242662427624286242962430624316243262433624346243562436624376243862439624406244162442624436244462445624466244762448624496245062451624526245362454624556245662457624586245962460624616246262463624646246562466624676246862469624706247162472624736247462475624766247762478624796248062481624826248362484624856248662487624886248962490624916249262493624946249562496624976249862499625006250162502625036250462505625066250762508625096251062511625126251362514625156251662517625186251962520625216252262523625246252562526625276252862529625306253162532625336253462535625366253762538625396254062541625426254362544625456254662547625486254962550625516255262553625546255562556625576255862559625606256162562625636256462565625666256762568625696257062571625726257362574625756257662577625786257962580625816258262583625846258562586625876258862589625906259162592625936259462595625966259762598625996260062601626026260362604626056260662607626086260962610626116261262613626146261562616626176261862619626206262162622626236262462625626266262762628626296263062631626326263362634626356263662637626386263962640626416264262643626446264562646626476264862649626506265162652626536265462655626566265762658626596266062661626626266362664626656266662667626686266962670626716267262673626746267562676626776267862679626806268162682626836268462685626866268762688626896269062691626926269362694626956269662697626986269962700627016270262703627046270562706627076270862709627106271162712627136271462715627166271762718627196272062721627226272362724627256272662727627286272962730627316273262733627346273562736627376273862739627406274162742627436274462745627466274762748627496275062751627526275362754627556275662757627586275962760627616276262763627646276562766627676276862769627706277162772627736277462775627766277762778627796278062781627826278362784627856278662787627886278962790627916279262793627946279562796627976279862799628006280162802628036280462805628066280762808628096281062811628126281362814628156281662817628186281962820628216282262823628246282562826628276282862829628306283162832628336283462835628366283762838628396284062841628426284362844628456284662847628486284962850628516285262853628546285562856628576285862859628606286162862628636286462865628666286762868628696287062871628726287362874628756287662877628786287962880628816288262883628846288562886628876288862889628906289162892628936289462895628966289762898628996290062901629026290362904629056290662907629086290962910629116291262913629146291562916629176291862919629206292162922629236292462925629266292762928629296293062931629326293362934629356293662937629386293962940629416294262943629446294562946629476294862949629506295162952629536295462955629566295762958629596296062961629626296362964629656296662967629686296962970629716297262973629746297562976629776297862979629806298162982629836298462985629866298762988629896299062991629926299362994629956299662997
  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. Echo.channel('credentials').listen('CredentialUpdated', function (e) {
  1760. // This part could potentially use a refactor.
  1761. // Probably needs a credential list component to listen for this
  1762. // even and update the corresponding credential. Currently every
  1763. // credential on the page receives this event and checks whether it was intended
  1764. // for its credential or not. I would imagine this could cause a problem
  1765. // on the group page, which will potentially have a lot more credentials from
  1766. // various assets. Better solution may be to have a credentials list component
  1767. // That listens for credential update events and updates the appropriate credential.
  1768. // There would still be multiples of those on the group credentials page, but an
  1769. // order of magnitude less of those than of individual credentials.
  1770. // It also may not be a big deal performance wise to do it like this, not sure.
  1771. var eData = JSON.parse(e.data);
  1772. if (_this.data.credid === eData.credid) {
  1773. _this.data = eData;
  1774. }
  1775. });
  1776. },
  1777. methods: {
  1778. rndStr: function rndStr(len) {
  1779. var text = "";
  1780. var chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%";
  1781. for (var i = 0; i < len; i++) {
  1782. text += chars.charAt(Math.floor(Math.random() * chars.length));
  1783. }
  1784. return text;
  1785. },
  1786. getRandomPassword: function getRandomPassword(id) {
  1787. this.$refs['newpassword' + id].value = this.rndStr(16);
  1788. },
  1789. updateCredential: function updateCredential() {
  1790. this.data.credpass = this.$refs['newpassword' + this.data.credid].value;
  1791. axios.put('/api/credentials/' + this.data.credid, this.data).then(function (response) {})["catch"](function (error) {
  1792. console.error(error);
  1793. });
  1794. $('#credential' + this.data.credid + 'editModal').modal('hide');
  1795. }
  1796. }
  1797. });
  1798. /***/ }),
  1799. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/errorlist.vue?vue&type=script&lang=js&":
  1800. /*!********************************************************************************************************************************************************************!*\
  1801. !*** ./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& ***!
  1802. \********************************************************************************************************************************************************************/
  1803. /*! exports provided: default */
  1804. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1805. "use strict";
  1806. __webpack_require__.r(__webpack_exports__);
  1807. //
  1808. //
  1809. //
  1810. //
  1811. //
  1812. /* harmony default export */ __webpack_exports__["default"] = ({
  1813. props: ['errors'],
  1814. data: function data() {
  1815. return {
  1816. errorList: this.errors
  1817. };
  1818. },
  1819. watch: {
  1820. errors: function errors(newErrors) {
  1821. this.errorList = newErrors;
  1822. }
  1823. }
  1824. });
  1825. /***/ }),
  1826. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/notes.vue?vue&type=script&lang=js&":
  1827. /*!****************************************************************************************************************************************************************!*\
  1828. !*** ./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& ***!
  1829. \****************************************************************************************************************************************************************/
  1830. /*! exports provided: default */
  1831. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1832. "use strict";
  1833. __webpack_require__.r(__webpack_exports__);
  1834. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  1835. //
  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. /* harmony default export */ __webpack_exports__["default"] = ({
  1875. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  1876. props: ['initialnotes', 'authusername'],
  1877. data: function data() {
  1878. return {
  1879. notes: this.initialnotes
  1880. };
  1881. }
  1882. });
  1883. /***/ }),
  1884. /***/ "./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&":
  1885. /*!****************************************************************************************************************************************************************************!*\
  1886. !*** ./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& ***!
  1887. \****************************************************************************************************************************************************************************/
  1888. /*! exports provided: default */
  1889. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1890. "use strict";
  1891. __webpack_require__.r(__webpack_exports__);
  1892. //
  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. /* harmony default export */ __webpack_exports__["default"] = ({
  1925. props: ['populateWith', 'storeList', 'modalId'],
  1926. data: function data() {
  1927. return {
  1928. // Copies object from prop, so it doesn't mutate the object
  1929. // from the parent component. Parent component will be updated via
  1930. // Websocket if updateWorkOrder is successful.
  1931. data: JSON.parse(JSON.stringify(this.populateWith)),
  1932. storeArray: this.storeList,
  1933. id: this.modalId,
  1934. errors: []
  1935. };
  1936. },
  1937. methods: {
  1938. updateWorkOrder: function updateWorkOrder() {
  1939. var _this = this;
  1940. axios.put('/api/workorders/' + this.data.woid, this.data).then(function (response) {
  1941. $('#workordereditModal').modal('hide');
  1942. })["catch"](function (error) {
  1943. _this.errors = JSON.parse(error.response.request.response).errors;
  1944. });
  1945. }
  1946. }
  1947. });
  1948. /***/ }),
  1949. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/woinfo.vue?vue&type=script&lang=js&":
  1950. /*!*****************************************************************************************************************************************************************!*\
  1951. !*** ./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& ***!
  1952. \*****************************************************************************************************************************************************************/
  1953. /*! exports provided: default */
  1954. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1955. "use strict";
  1956. __webpack_require__.r(__webpack_exports__);
  1957. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  1958. //
  1959. //
  1960. //
  1961. //
  1962. //
  1963. //
  1964. //
  1965. //
  1966. //
  1967. //
  1968. //
  1969. //
  1970. //
  1971. //
  1972. //
  1973. //
  1974. //
  1975. //
  1976. //
  1977. //
  1978. /* harmony default export */ __webpack_exports__["default"] = ({
  1979. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  1980. props: ['workOrder'],
  1981. data: function data() {
  1982. return {
  1983. data: JSON.parse(this.workOrder),
  1984. storeList: null
  1985. };
  1986. },
  1987. mounted: function mounted() {
  1988. var _this = this;
  1989. Echo.channel('work-orders').listen('WorkOrderUpdated', function (e) {
  1990. _this.data = JSON.parse(e.data);
  1991. });
  1992. axios.get('/api/stores').then(function (response) {
  1993. _this.storeList = {};
  1994. response.data.map(function (val) {
  1995. _this.storeList[val.storeid] = val;
  1996. });
  1997. })["catch"](function (error) {
  1998. console.error(error);
  1999. });
  2000. }
  2001. });
  2002. /***/ }),
  2003. /***/ "./node_modules/base64-js/index.js":
  2004. /*!*****************************************!*\
  2005. !*** ./node_modules/base64-js/index.js ***!
  2006. \*****************************************/
  2007. /*! no static exports found */
  2008. /***/ (function(module, exports, __webpack_require__) {
  2009. "use strict";
  2010. exports.byteLength = byteLength
  2011. exports.toByteArray = toByteArray
  2012. exports.fromByteArray = fromByteArray
  2013. var lookup = []
  2014. var revLookup = []
  2015. var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
  2016. var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
  2017. for (var i = 0, len = code.length; i < len; ++i) {
  2018. lookup[i] = code[i]
  2019. revLookup[code.charCodeAt(i)] = i
  2020. }
  2021. // Support decoding URL-safe base64 strings, as Node.js does.
  2022. // See: https://en.wikipedia.org/wiki/Base64#URL_applications
  2023. revLookup['-'.charCodeAt(0)] = 62
  2024. revLookup['_'.charCodeAt(0)] = 63
  2025. function getLens (b64) {
  2026. var len = b64.length
  2027. if (len % 4 > 0) {
  2028. throw new Error('Invalid string. Length must be a multiple of 4')
  2029. }
  2030. // Trim off extra bytes after placeholder bytes are found
  2031. // See: https://github.com/beatgammit/base64-js/issues/42
  2032. var validLen = b64.indexOf('=')
  2033. if (validLen === -1) validLen = len
  2034. var placeHoldersLen = validLen === len
  2035. ? 0
  2036. : 4 - (validLen % 4)
  2037. return [validLen, placeHoldersLen]
  2038. }
  2039. // base64 is 4/3 + up to two characters of the original data
  2040. function byteLength (b64) {
  2041. var lens = getLens(b64)
  2042. var validLen = lens[0]
  2043. var placeHoldersLen = lens[1]
  2044. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  2045. }
  2046. function _byteLength (b64, validLen, placeHoldersLen) {
  2047. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  2048. }
  2049. function toByteArray (b64) {
  2050. var tmp
  2051. var lens = getLens(b64)
  2052. var validLen = lens[0]
  2053. var placeHoldersLen = lens[1]
  2054. var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
  2055. var curByte = 0
  2056. // if there are placeholders, only get up to the last complete 4 chars
  2057. var len = placeHoldersLen > 0
  2058. ? validLen - 4
  2059. : validLen
  2060. var i
  2061. for (i = 0; i < len; i += 4) {
  2062. tmp =
  2063. (revLookup[b64.charCodeAt(i)] << 18) |
  2064. (revLookup[b64.charCodeAt(i + 1)] << 12) |
  2065. (revLookup[b64.charCodeAt(i + 2)] << 6) |
  2066. revLookup[b64.charCodeAt(i + 3)]
  2067. arr[curByte++] = (tmp >> 16) & 0xFF
  2068. arr[curByte++] = (tmp >> 8) & 0xFF
  2069. arr[curByte++] = tmp & 0xFF
  2070. }
  2071. if (placeHoldersLen === 2) {
  2072. tmp =
  2073. (revLookup[b64.charCodeAt(i)] << 2) |
  2074. (revLookup[b64.charCodeAt(i + 1)] >> 4)
  2075. arr[curByte++] = tmp & 0xFF
  2076. }
  2077. if (placeHoldersLen === 1) {
  2078. tmp =
  2079. (revLookup[b64.charCodeAt(i)] << 10) |
  2080. (revLookup[b64.charCodeAt(i + 1)] << 4) |
  2081. (revLookup[b64.charCodeAt(i + 2)] >> 2)
  2082. arr[curByte++] = (tmp >> 8) & 0xFF
  2083. arr[curByte++] = tmp & 0xFF
  2084. }
  2085. return arr
  2086. }
  2087. function tripletToBase64 (num) {
  2088. return lookup[num >> 18 & 0x3F] +
  2089. lookup[num >> 12 & 0x3F] +
  2090. lookup[num >> 6 & 0x3F] +
  2091. lookup[num & 0x3F]
  2092. }
  2093. function encodeChunk (uint8, start, end) {
  2094. var tmp
  2095. var output = []
  2096. for (var i = start; i < end; i += 3) {
  2097. tmp =
  2098. ((uint8[i] << 16) & 0xFF0000) +
  2099. ((uint8[i + 1] << 8) & 0xFF00) +
  2100. (uint8[i + 2] & 0xFF)
  2101. output.push(tripletToBase64(tmp))
  2102. }
  2103. return output.join('')
  2104. }
  2105. function fromByteArray (uint8) {
  2106. var tmp
  2107. var len = uint8.length
  2108. var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
  2109. var parts = []
  2110. var maxChunkLength = 16383 // must be multiple of 3
  2111. // go through the array every three bytes, we'll deal with trailing stuff later
  2112. for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
  2113. parts.push(encodeChunk(
  2114. uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
  2115. ))
  2116. }
  2117. // pad the end with zeros, but make sure to not forget the extra bytes
  2118. if (extraBytes === 1) {
  2119. tmp = uint8[len - 1]
  2120. parts.push(
  2121. lookup[tmp >> 2] +
  2122. lookup[(tmp << 4) & 0x3F] +
  2123. '=='
  2124. )
  2125. } else if (extraBytes === 2) {
  2126. tmp = (uint8[len - 2] << 8) + uint8[len - 1]
  2127. parts.push(
  2128. lookup[tmp >> 10] +
  2129. lookup[(tmp >> 4) & 0x3F] +
  2130. lookup[(tmp << 2) & 0x3F] +
  2131. '='
  2132. )
  2133. }
  2134. return parts.join('')
  2135. }
  2136. /***/ }),
  2137. /***/ "./node_modules/bootstrap/dist/js/bootstrap.js":
  2138. /*!*****************************************************!*\
  2139. !*** ./node_modules/bootstrap/dist/js/bootstrap.js ***!
  2140. \*****************************************************/
  2141. /*! no static exports found */
  2142. /***/ (function(module, exports, __webpack_require__) {
  2143. /*!
  2144. * Bootstrap v4.4.1 (https://getbootstrap.com/)
  2145. * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  2146. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2147. */
  2148. (function (global, factory) {
  2149. true ? factory(exports, __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"), __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")) :
  2150. undefined;
  2151. }(this, (function (exports, $, Popper) { 'use strict';
  2152. $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
  2153. Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper;
  2154. function _defineProperties(target, props) {
  2155. for (var i = 0; i < props.length; i++) {
  2156. var descriptor = props[i];
  2157. descriptor.enumerable = descriptor.enumerable || false;
  2158. descriptor.configurable = true;
  2159. if ("value" in descriptor) descriptor.writable = true;
  2160. Object.defineProperty(target, descriptor.key, descriptor);
  2161. }
  2162. }
  2163. function _createClass(Constructor, protoProps, staticProps) {
  2164. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  2165. if (staticProps) _defineProperties(Constructor, staticProps);
  2166. return Constructor;
  2167. }
  2168. function _defineProperty(obj, key, value) {
  2169. if (key in obj) {
  2170. Object.defineProperty(obj, key, {
  2171. value: value,
  2172. enumerable: true,
  2173. configurable: true,
  2174. writable: true
  2175. });
  2176. } else {
  2177. obj[key] = value;
  2178. }
  2179. return obj;
  2180. }
  2181. function ownKeys(object, enumerableOnly) {
  2182. var keys = Object.keys(object);
  2183. if (Object.getOwnPropertySymbols) {
  2184. var symbols = Object.getOwnPropertySymbols(object);
  2185. if (enumerableOnly) symbols = symbols.filter(function (sym) {
  2186. return Object.getOwnPropertyDescriptor(object, sym).enumerable;
  2187. });
  2188. keys.push.apply(keys, symbols);
  2189. }
  2190. return keys;
  2191. }
  2192. function _objectSpread2(target) {
  2193. for (var i = 1; i < arguments.length; i++) {
  2194. var source = arguments[i] != null ? arguments[i] : {};
  2195. if (i % 2) {
  2196. ownKeys(Object(source), true).forEach(function (key) {
  2197. _defineProperty(target, key, source[key]);
  2198. });
  2199. } else if (Object.getOwnPropertyDescriptors) {
  2200. Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
  2201. } else {
  2202. ownKeys(Object(source)).forEach(function (key) {
  2203. Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
  2204. });
  2205. }
  2206. }
  2207. return target;
  2208. }
  2209. function _inheritsLoose(subClass, superClass) {
  2210. subClass.prototype = Object.create(superClass.prototype);
  2211. subClass.prototype.constructor = subClass;
  2212. subClass.__proto__ = superClass;
  2213. }
  2214. /**
  2215. * --------------------------------------------------------------------------
  2216. * Bootstrap (v4.4.1): util.js
  2217. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2218. * --------------------------------------------------------------------------
  2219. */
  2220. /**
  2221. * ------------------------------------------------------------------------
  2222. * Private TransitionEnd Helpers
  2223. * ------------------------------------------------------------------------
  2224. */
  2225. var TRANSITION_END = 'transitionend';
  2226. var MAX_UID = 1000000;
  2227. var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
  2228. function toType(obj) {
  2229. return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
  2230. }
  2231. function getSpecialTransitionEndEvent() {
  2232. return {
  2233. bindType: TRANSITION_END,
  2234. delegateType: TRANSITION_END,
  2235. handle: function handle(event) {
  2236. if ($(event.target).is(this)) {
  2237. return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
  2238. }
  2239. return undefined; // eslint-disable-line no-undefined
  2240. }
  2241. };
  2242. }
  2243. function transitionEndEmulator(duration) {
  2244. var _this = this;
  2245. var called = false;
  2246. $(this).one(Util.TRANSITION_END, function () {
  2247. called = true;
  2248. });
  2249. setTimeout(function () {
  2250. if (!called) {
  2251. Util.triggerTransitionEnd(_this);
  2252. }
  2253. }, duration);
  2254. return this;
  2255. }
  2256. function setTransitionEndSupport() {
  2257. $.fn.emulateTransitionEnd = transitionEndEmulator;
  2258. $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
  2259. }
  2260. /**
  2261. * --------------------------------------------------------------------------
  2262. * Public Util Api
  2263. * --------------------------------------------------------------------------
  2264. */
  2265. var Util = {
  2266. TRANSITION_END: 'bsTransitionEnd',
  2267. getUID: function getUID(prefix) {
  2268. do {
  2269. // eslint-disable-next-line no-bitwise
  2270. prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
  2271. } while (document.getElementById(prefix));
  2272. return prefix;
  2273. },
  2274. getSelectorFromElement: function getSelectorFromElement(element) {
  2275. var selector = element.getAttribute('data-target');
  2276. if (!selector || selector === '#') {
  2277. var hrefAttr = element.getAttribute('href');
  2278. selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
  2279. }
  2280. try {
  2281. return document.querySelector(selector) ? selector : null;
  2282. } catch (err) {
  2283. return null;
  2284. }
  2285. },
  2286. getTransitionDurationFromElement: function getTransitionDurationFromElement(element) {
  2287. if (!element) {
  2288. return 0;
  2289. } // Get transition-duration of the element
  2290. var transitionDuration = $(element).css('transition-duration');
  2291. var transitionDelay = $(element).css('transition-delay');
  2292. var floatTransitionDuration = parseFloat(transitionDuration);
  2293. var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
  2294. if (!floatTransitionDuration && !floatTransitionDelay) {
  2295. return 0;
  2296. } // If multiple durations are defined, take the first
  2297. transitionDuration = transitionDuration.split(',')[0];
  2298. transitionDelay = transitionDelay.split(',')[0];
  2299. return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
  2300. },
  2301. reflow: function reflow(element) {
  2302. return element.offsetHeight;
  2303. },
  2304. triggerTransitionEnd: function triggerTransitionEnd(element) {
  2305. $(element).trigger(TRANSITION_END);
  2306. },
  2307. // TODO: Remove in v5
  2308. supportsTransitionEnd: function supportsTransitionEnd() {
  2309. return Boolean(TRANSITION_END);
  2310. },
  2311. isElement: function isElement(obj) {
  2312. return (obj[0] || obj).nodeType;
  2313. },
  2314. typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
  2315. for (var property in configTypes) {
  2316. if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
  2317. var expectedTypes = configTypes[property];
  2318. var value = config[property];
  2319. var valueType = value && Util.isElement(value) ? 'element' : toType(value);
  2320. if (!new RegExp(expectedTypes).test(valueType)) {
  2321. throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
  2322. }
  2323. }
  2324. }
  2325. },
  2326. findShadowRoot: function findShadowRoot(element) {
  2327. if (!document.documentElement.attachShadow) {
  2328. return null;
  2329. } // Can find the shadow root otherwise it'll return the document
  2330. if (typeof element.getRootNode === 'function') {
  2331. var root = element.getRootNode();
  2332. return root instanceof ShadowRoot ? root : null;
  2333. }
  2334. if (element instanceof ShadowRoot) {
  2335. return element;
  2336. } // when we don't find a shadow root
  2337. if (!element.parentNode) {
  2338. return null;
  2339. }
  2340. return Util.findShadowRoot(element.parentNode);
  2341. },
  2342. jQueryDetection: function jQueryDetection() {
  2343. if (typeof $ === 'undefined') {
  2344. throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.');
  2345. }
  2346. var version = $.fn.jquery.split(' ')[0].split('.');
  2347. var minMajor = 1;
  2348. var ltMajor = 2;
  2349. var minMinor = 9;
  2350. var minPatch = 1;
  2351. var maxMajor = 4;
  2352. if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
  2353. throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0');
  2354. }
  2355. }
  2356. };
  2357. Util.jQueryDetection();
  2358. setTransitionEndSupport();
  2359. /**
  2360. * ------------------------------------------------------------------------
  2361. * Constants
  2362. * ------------------------------------------------------------------------
  2363. */
  2364. var NAME = 'alert';
  2365. var VERSION = '4.4.1';
  2366. var DATA_KEY = 'bs.alert';
  2367. var EVENT_KEY = "." + DATA_KEY;
  2368. var DATA_API_KEY = '.data-api';
  2369. var JQUERY_NO_CONFLICT = $.fn[NAME];
  2370. var Selector = {
  2371. DISMISS: '[data-dismiss="alert"]'
  2372. };
  2373. var Event = {
  2374. CLOSE: "close" + EVENT_KEY,
  2375. CLOSED: "closed" + EVENT_KEY,
  2376. CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
  2377. };
  2378. var ClassName = {
  2379. ALERT: 'alert',
  2380. FADE: 'fade',
  2381. SHOW: 'show'
  2382. };
  2383. /**
  2384. * ------------------------------------------------------------------------
  2385. * Class Definition
  2386. * ------------------------------------------------------------------------
  2387. */
  2388. var Alert =
  2389. /*#__PURE__*/
  2390. function () {
  2391. function Alert(element) {
  2392. this._element = element;
  2393. } // Getters
  2394. var _proto = Alert.prototype;
  2395. // Public
  2396. _proto.close = function close(element) {
  2397. var rootElement = this._element;
  2398. if (element) {
  2399. rootElement = this._getRootElement(element);
  2400. }
  2401. var customEvent = this._triggerCloseEvent(rootElement);
  2402. if (customEvent.isDefaultPrevented()) {
  2403. return;
  2404. }
  2405. this._removeElement(rootElement);
  2406. };
  2407. _proto.dispose = function dispose() {
  2408. $.removeData(this._element, DATA_KEY);
  2409. this._element = null;
  2410. } // Private
  2411. ;
  2412. _proto._getRootElement = function _getRootElement(element) {
  2413. var selector = Util.getSelectorFromElement(element);
  2414. var parent = false;
  2415. if (selector) {
  2416. parent = document.querySelector(selector);
  2417. }
  2418. if (!parent) {
  2419. parent = $(element).closest("." + ClassName.ALERT)[0];
  2420. }
  2421. return parent;
  2422. };
  2423. _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
  2424. var closeEvent = $.Event(Event.CLOSE);
  2425. $(element).trigger(closeEvent);
  2426. return closeEvent;
  2427. };
  2428. _proto._removeElement = function _removeElement(element) {
  2429. var _this = this;
  2430. $(element).removeClass(ClassName.SHOW);
  2431. if (!$(element).hasClass(ClassName.FADE)) {
  2432. this._destroyElement(element);
  2433. return;
  2434. }
  2435. var transitionDuration = Util.getTransitionDurationFromElement(element);
  2436. $(element).one(Util.TRANSITION_END, function (event) {
  2437. return _this._destroyElement(element, event);
  2438. }).emulateTransitionEnd(transitionDuration);
  2439. };
  2440. _proto._destroyElement = function _destroyElement(element) {
  2441. $(element).detach().trigger(Event.CLOSED).remove();
  2442. } // Static
  2443. ;
  2444. Alert._jQueryInterface = function _jQueryInterface(config) {
  2445. return this.each(function () {
  2446. var $element = $(this);
  2447. var data = $element.data(DATA_KEY);
  2448. if (!data) {
  2449. data = new Alert(this);
  2450. $element.data(DATA_KEY, data);
  2451. }
  2452. if (config === 'close') {
  2453. data[config](this);
  2454. }
  2455. });
  2456. };
  2457. Alert._handleDismiss = function _handleDismiss(alertInstance) {
  2458. return function (event) {
  2459. if (event) {
  2460. event.preventDefault();
  2461. }
  2462. alertInstance.close(this);
  2463. };
  2464. };
  2465. _createClass(Alert, null, [{
  2466. key: "VERSION",
  2467. get: function get() {
  2468. return VERSION;
  2469. }
  2470. }]);
  2471. return Alert;
  2472. }();
  2473. /**
  2474. * ------------------------------------------------------------------------
  2475. * Data Api implementation
  2476. * ------------------------------------------------------------------------
  2477. */
  2478. $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
  2479. /**
  2480. * ------------------------------------------------------------------------
  2481. * jQuery
  2482. * ------------------------------------------------------------------------
  2483. */
  2484. $.fn[NAME] = Alert._jQueryInterface;
  2485. $.fn[NAME].Constructor = Alert;
  2486. $.fn[NAME].noConflict = function () {
  2487. $.fn[NAME] = JQUERY_NO_CONFLICT;
  2488. return Alert._jQueryInterface;
  2489. };
  2490. /**
  2491. * ------------------------------------------------------------------------
  2492. * Constants
  2493. * ------------------------------------------------------------------------
  2494. */
  2495. var NAME$1 = 'button';
  2496. var VERSION$1 = '4.4.1';
  2497. var DATA_KEY$1 = 'bs.button';
  2498. var EVENT_KEY$1 = "." + DATA_KEY$1;
  2499. var DATA_API_KEY$1 = '.data-api';
  2500. var JQUERY_NO_CONFLICT$1 = $.fn[NAME$1];
  2501. var ClassName$1 = {
  2502. ACTIVE: 'active',
  2503. BUTTON: 'btn',
  2504. FOCUS: 'focus'
  2505. };
  2506. var Selector$1 = {
  2507. DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
  2508. DATA_TOGGLES: '[data-toggle="buttons"]',
  2509. DATA_TOGGLE: '[data-toggle="button"]',
  2510. DATA_TOGGLES_BUTTONS: '[data-toggle="buttons"] .btn',
  2511. INPUT: 'input:not([type="hidden"])',
  2512. ACTIVE: '.active',
  2513. BUTTON: '.btn'
  2514. };
  2515. var Event$1 = {
  2516. CLICK_DATA_API: "click" + EVENT_KEY$1 + DATA_API_KEY$1,
  2517. FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1),
  2518. LOAD_DATA_API: "load" + EVENT_KEY$1 + DATA_API_KEY$1
  2519. };
  2520. /**
  2521. * ------------------------------------------------------------------------
  2522. * Class Definition
  2523. * ------------------------------------------------------------------------
  2524. */
  2525. var Button =
  2526. /*#__PURE__*/
  2527. function () {
  2528. function Button(element) {
  2529. this._element = element;
  2530. } // Getters
  2531. var _proto = Button.prototype;
  2532. // Public
  2533. _proto.toggle = function toggle() {
  2534. var triggerChangeEvent = true;
  2535. var addAriaPressed = true;
  2536. var rootElement = $(this._element).closest(Selector$1.DATA_TOGGLES)[0];
  2537. if (rootElement) {
  2538. var input = this._element.querySelector(Selector$1.INPUT);
  2539. if (input) {
  2540. if (input.type === 'radio') {
  2541. if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) {
  2542. triggerChangeEvent = false;
  2543. } else {
  2544. var activeElement = rootElement.querySelector(Selector$1.ACTIVE);
  2545. if (activeElement) {
  2546. $(activeElement).removeClass(ClassName$1.ACTIVE);
  2547. }
  2548. }
  2549. } else if (input.type === 'checkbox') {
  2550. if (this._element.tagName === 'LABEL' && input.checked === this._element.classList.contains(ClassName$1.ACTIVE)) {
  2551. triggerChangeEvent = false;
  2552. }
  2553. } else {
  2554. // if it's not a radio button or checkbox don't add a pointless/invalid checked property to the input
  2555. triggerChangeEvent = false;
  2556. }
  2557. if (triggerChangeEvent) {
  2558. input.checked = !this._element.classList.contains(ClassName$1.ACTIVE);
  2559. $(input).trigger('change');
  2560. }
  2561. input.focus();
  2562. addAriaPressed = false;
  2563. }
  2564. }
  2565. if (!(this._element.hasAttribute('disabled') || this._element.classList.contains('disabled'))) {
  2566. if (addAriaPressed) {
  2567. this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName$1.ACTIVE));
  2568. }
  2569. if (triggerChangeEvent) {
  2570. $(this._element).toggleClass(ClassName$1.ACTIVE);
  2571. }
  2572. }
  2573. };
  2574. _proto.dispose = function dispose() {
  2575. $.removeData(this._element, DATA_KEY$1);
  2576. this._element = null;
  2577. } // Static
  2578. ;
  2579. Button._jQueryInterface = function _jQueryInterface(config) {
  2580. return this.each(function () {
  2581. var data = $(this).data(DATA_KEY$1);
  2582. if (!data) {
  2583. data = new Button(this);
  2584. $(this).data(DATA_KEY$1, data);
  2585. }
  2586. if (config === 'toggle') {
  2587. data[config]();
  2588. }
  2589. });
  2590. };
  2591. _createClass(Button, null, [{
  2592. key: "VERSION",
  2593. get: function get() {
  2594. return VERSION$1;
  2595. }
  2596. }]);
  2597. return Button;
  2598. }();
  2599. /**
  2600. * ------------------------------------------------------------------------
  2601. * Data Api implementation
  2602. * ------------------------------------------------------------------------
  2603. */
  2604. $(document).on(Event$1.CLICK_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  2605. var button = event.target;
  2606. if (!$(button).hasClass(ClassName$1.BUTTON)) {
  2607. button = $(button).closest(Selector$1.BUTTON)[0];
  2608. }
  2609. if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) {
  2610. event.preventDefault(); // work around Firefox bug #1540995
  2611. } else {
  2612. var inputBtn = button.querySelector(Selector$1.INPUT);
  2613. if (inputBtn && (inputBtn.hasAttribute('disabled') || inputBtn.classList.contains('disabled'))) {
  2614. event.preventDefault(); // work around Firefox bug #1540995
  2615. return;
  2616. }
  2617. Button._jQueryInterface.call($(button), 'toggle');
  2618. }
  2619. }).on(Event$1.FOCUS_BLUR_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  2620. var button = $(event.target).closest(Selector$1.BUTTON)[0];
  2621. $(button).toggleClass(ClassName$1.FOCUS, /^focus(in)?$/.test(event.type));
  2622. });
  2623. $(window).on(Event$1.LOAD_DATA_API, function () {
  2624. // ensure correct active class is set to match the controls' actual values/states
  2625. // find all checkboxes/readio buttons inside data-toggle groups
  2626. var buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLES_BUTTONS));
  2627. for (var i = 0, len = buttons.length; i < len; i++) {
  2628. var button = buttons[i];
  2629. var input = button.querySelector(Selector$1.INPUT);
  2630. if (input.checked || input.hasAttribute('checked')) {
  2631. button.classList.add(ClassName$1.ACTIVE);
  2632. } else {
  2633. button.classList.remove(ClassName$1.ACTIVE);
  2634. }
  2635. } // find all button toggles
  2636. buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLE));
  2637. for (var _i = 0, _len = buttons.length; _i < _len; _i++) {
  2638. var _button = buttons[_i];
  2639. if (_button.getAttribute('aria-pressed') === 'true') {
  2640. _button.classList.add(ClassName$1.ACTIVE);
  2641. } else {
  2642. _button.classList.remove(ClassName$1.ACTIVE);
  2643. }
  2644. }
  2645. });
  2646. /**
  2647. * ------------------------------------------------------------------------
  2648. * jQuery
  2649. * ------------------------------------------------------------------------
  2650. */
  2651. $.fn[NAME$1] = Button._jQueryInterface;
  2652. $.fn[NAME$1].Constructor = Button;
  2653. $.fn[NAME$1].noConflict = function () {
  2654. $.fn[NAME$1] = JQUERY_NO_CONFLICT$1;
  2655. return Button._jQueryInterface;
  2656. };
  2657. /**
  2658. * ------------------------------------------------------------------------
  2659. * Constants
  2660. * ------------------------------------------------------------------------
  2661. */
  2662. var NAME$2 = 'carousel';
  2663. var VERSION$2 = '4.4.1';
  2664. var DATA_KEY$2 = 'bs.carousel';
  2665. var EVENT_KEY$2 = "." + DATA_KEY$2;
  2666. var DATA_API_KEY$2 = '.data-api';
  2667. var JQUERY_NO_CONFLICT$2 = $.fn[NAME$2];
  2668. var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
  2669. var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
  2670. var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
  2671. var SWIPE_THRESHOLD = 40;
  2672. var Default = {
  2673. interval: 5000,
  2674. keyboard: true,
  2675. slide: false,
  2676. pause: 'hover',
  2677. wrap: true,
  2678. touch: true
  2679. };
  2680. var DefaultType = {
  2681. interval: '(number|boolean)',
  2682. keyboard: 'boolean',
  2683. slide: '(boolean|string)',
  2684. pause: '(string|boolean)',
  2685. wrap: 'boolean',
  2686. touch: 'boolean'
  2687. };
  2688. var Direction = {
  2689. NEXT: 'next',
  2690. PREV: 'prev',
  2691. LEFT: 'left',
  2692. RIGHT: 'right'
  2693. };
  2694. var Event$2 = {
  2695. SLIDE: "slide" + EVENT_KEY$2,
  2696. SLID: "slid" + EVENT_KEY$2,
  2697. KEYDOWN: "keydown" + EVENT_KEY$2,
  2698. MOUSEENTER: "mouseenter" + EVENT_KEY$2,
  2699. MOUSELEAVE: "mouseleave" + EVENT_KEY$2,
  2700. TOUCHSTART: "touchstart" + EVENT_KEY$2,
  2701. TOUCHMOVE: "touchmove" + EVENT_KEY$2,
  2702. TOUCHEND: "touchend" + EVENT_KEY$2,
  2703. POINTERDOWN: "pointerdown" + EVENT_KEY$2,
  2704. POINTERUP: "pointerup" + EVENT_KEY$2,
  2705. DRAG_START: "dragstart" + EVENT_KEY$2,
  2706. LOAD_DATA_API: "load" + EVENT_KEY$2 + DATA_API_KEY$2,
  2707. CLICK_DATA_API: "click" + EVENT_KEY$2 + DATA_API_KEY$2
  2708. };
  2709. var ClassName$2 = {
  2710. CAROUSEL: 'carousel',
  2711. ACTIVE: 'active',
  2712. SLIDE: 'slide',
  2713. RIGHT: 'carousel-item-right',
  2714. LEFT: 'carousel-item-left',
  2715. NEXT: 'carousel-item-next',
  2716. PREV: 'carousel-item-prev',
  2717. ITEM: 'carousel-item',
  2718. POINTER_EVENT: 'pointer-event'
  2719. };
  2720. var Selector$2 = {
  2721. ACTIVE: '.active',
  2722. ACTIVE_ITEM: '.active.carousel-item',
  2723. ITEM: '.carousel-item',
  2724. ITEM_IMG: '.carousel-item img',
  2725. NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
  2726. INDICATORS: '.carousel-indicators',
  2727. DATA_SLIDE: '[data-slide], [data-slide-to]',
  2728. DATA_RIDE: '[data-ride="carousel"]'
  2729. };
  2730. var PointerType = {
  2731. TOUCH: 'touch',
  2732. PEN: 'pen'
  2733. };
  2734. /**
  2735. * ------------------------------------------------------------------------
  2736. * Class Definition
  2737. * ------------------------------------------------------------------------
  2738. */
  2739. var Carousel =
  2740. /*#__PURE__*/
  2741. function () {
  2742. function Carousel(element, config) {
  2743. this._items = null;
  2744. this._interval = null;
  2745. this._activeElement = null;
  2746. this._isPaused = false;
  2747. this._isSliding = false;
  2748. this.touchTimeout = null;
  2749. this.touchStartX = 0;
  2750. this.touchDeltaX = 0;
  2751. this._config = this._getConfig(config);
  2752. this._element = element;
  2753. this._indicatorsElement = this._element.querySelector(Selector$2.INDICATORS);
  2754. this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
  2755. this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
  2756. this._addEventListeners();
  2757. } // Getters
  2758. var _proto = Carousel.prototype;
  2759. // Public
  2760. _proto.next = function next() {
  2761. if (!this._isSliding) {
  2762. this._slide(Direction.NEXT);
  2763. }
  2764. };
  2765. _proto.nextWhenVisible = function nextWhenVisible() {
  2766. // Don't call next when the page isn't visible
  2767. // or the carousel or its parent isn't visible
  2768. if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') {
  2769. this.next();
  2770. }
  2771. };
  2772. _proto.prev = function prev() {
  2773. if (!this._isSliding) {
  2774. this._slide(Direction.PREV);
  2775. }
  2776. };
  2777. _proto.pause = function pause(event) {
  2778. if (!event) {
  2779. this._isPaused = true;
  2780. }
  2781. if (this._element.querySelector(Selector$2.NEXT_PREV)) {
  2782. Util.triggerTransitionEnd(this._element);
  2783. this.cycle(true);
  2784. }
  2785. clearInterval(this._interval);
  2786. this._interval = null;
  2787. };
  2788. _proto.cycle = function cycle(event) {
  2789. if (!event) {
  2790. this._isPaused = false;
  2791. }
  2792. if (this._interval) {
  2793. clearInterval(this._interval);
  2794. this._interval = null;
  2795. }
  2796. if (this._config.interval && !this._isPaused) {
  2797. this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
  2798. }
  2799. };
  2800. _proto.to = function to(index) {
  2801. var _this = this;
  2802. this._activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  2803. var activeIndex = this._getItemIndex(this._activeElement);
  2804. if (index > this._items.length - 1 || index < 0) {
  2805. return;
  2806. }
  2807. if (this._isSliding) {
  2808. $(this._element).one(Event$2.SLID, function () {
  2809. return _this.to(index);
  2810. });
  2811. return;
  2812. }
  2813. if (activeIndex === index) {
  2814. this.pause();
  2815. this.cycle();
  2816. return;
  2817. }
  2818. var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
  2819. this._slide(direction, this._items[index]);
  2820. };
  2821. _proto.dispose = function dispose() {
  2822. $(this._element).off(EVENT_KEY$2);
  2823. $.removeData(this._element, DATA_KEY$2);
  2824. this._items = null;
  2825. this._config = null;
  2826. this._element = null;
  2827. this._interval = null;
  2828. this._isPaused = null;
  2829. this._isSliding = null;
  2830. this._activeElement = null;
  2831. this._indicatorsElement = null;
  2832. } // Private
  2833. ;
  2834. _proto._getConfig = function _getConfig(config) {
  2835. config = _objectSpread2({}, Default, {}, config);
  2836. Util.typeCheckConfig(NAME$2, config, DefaultType);
  2837. return config;
  2838. };
  2839. _proto._handleSwipe = function _handleSwipe() {
  2840. var absDeltax = Math.abs(this.touchDeltaX);
  2841. if (absDeltax <= SWIPE_THRESHOLD) {
  2842. return;
  2843. }
  2844. var direction = absDeltax / this.touchDeltaX;
  2845. this.touchDeltaX = 0; // swipe left
  2846. if (direction > 0) {
  2847. this.prev();
  2848. } // swipe right
  2849. if (direction < 0) {
  2850. this.next();
  2851. }
  2852. };
  2853. _proto._addEventListeners = function _addEventListeners() {
  2854. var _this2 = this;
  2855. if (this._config.keyboard) {
  2856. $(this._element).on(Event$2.KEYDOWN, function (event) {
  2857. return _this2._keydown(event);
  2858. });
  2859. }
  2860. if (this._config.pause === 'hover') {
  2861. $(this._element).on(Event$2.MOUSEENTER, function (event) {
  2862. return _this2.pause(event);
  2863. }).on(Event$2.MOUSELEAVE, function (event) {
  2864. return _this2.cycle(event);
  2865. });
  2866. }
  2867. if (this._config.touch) {
  2868. this._addTouchEventListeners();
  2869. }
  2870. };
  2871. _proto._addTouchEventListeners = function _addTouchEventListeners() {
  2872. var _this3 = this;
  2873. if (!this._touchSupported) {
  2874. return;
  2875. }
  2876. var start = function start(event) {
  2877. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  2878. _this3.touchStartX = event.originalEvent.clientX;
  2879. } else if (!_this3._pointerEvent) {
  2880. _this3.touchStartX = event.originalEvent.touches[0].clientX;
  2881. }
  2882. };
  2883. var move = function move(event) {
  2884. // ensure swiping with one touch and not pinching
  2885. if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
  2886. _this3.touchDeltaX = 0;
  2887. } else {
  2888. _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX;
  2889. }
  2890. };
  2891. var end = function end(event) {
  2892. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  2893. _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
  2894. }
  2895. _this3._handleSwipe();
  2896. if (_this3._config.pause === 'hover') {
  2897. // If it's a touch-enabled device, mouseenter/leave are fired as
  2898. // part of the mouse compatibility events on first tap - the carousel
  2899. // would stop cycling until user tapped out of it;
  2900. // here, we listen for touchend, explicitly pause the carousel
  2901. // (as if it's the second time we tap on it, mouseenter compat event
  2902. // is NOT fired) and after a timeout (to allow for mouse compatibility
  2903. // events to fire) we explicitly restart cycling
  2904. _this3.pause();
  2905. if (_this3.touchTimeout) {
  2906. clearTimeout(_this3.touchTimeout);
  2907. }
  2908. _this3.touchTimeout = setTimeout(function (event) {
  2909. return _this3.cycle(event);
  2910. }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
  2911. }
  2912. };
  2913. $(this._element.querySelectorAll(Selector$2.ITEM_IMG)).on(Event$2.DRAG_START, function (e) {
  2914. return e.preventDefault();
  2915. });
  2916. if (this._pointerEvent) {
  2917. $(this._element).on(Event$2.POINTERDOWN, function (event) {
  2918. return start(event);
  2919. });
  2920. $(this._element).on(Event$2.POINTERUP, function (event) {
  2921. return end(event);
  2922. });
  2923. this._element.classList.add(ClassName$2.POINTER_EVENT);
  2924. } else {
  2925. $(this._element).on(Event$2.TOUCHSTART, function (event) {
  2926. return start(event);
  2927. });
  2928. $(this._element).on(Event$2.TOUCHMOVE, function (event) {
  2929. return move(event);
  2930. });
  2931. $(this._element).on(Event$2.TOUCHEND, function (event) {
  2932. return end(event);
  2933. });
  2934. }
  2935. };
  2936. _proto._keydown = function _keydown(event) {
  2937. if (/input|textarea/i.test(event.target.tagName)) {
  2938. return;
  2939. }
  2940. switch (event.which) {
  2941. case ARROW_LEFT_KEYCODE:
  2942. event.preventDefault();
  2943. this.prev();
  2944. break;
  2945. case ARROW_RIGHT_KEYCODE:
  2946. event.preventDefault();
  2947. this.next();
  2948. break;
  2949. }
  2950. };
  2951. _proto._getItemIndex = function _getItemIndex(element) {
  2952. this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector$2.ITEM)) : [];
  2953. return this._items.indexOf(element);
  2954. };
  2955. _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
  2956. var isNextDirection = direction === Direction.NEXT;
  2957. var isPrevDirection = direction === Direction.PREV;
  2958. var activeIndex = this._getItemIndex(activeElement);
  2959. var lastItemIndex = this._items.length - 1;
  2960. var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
  2961. if (isGoingToWrap && !this._config.wrap) {
  2962. return activeElement;
  2963. }
  2964. var delta = direction === Direction.PREV ? -1 : 1;
  2965. var itemIndex = (activeIndex + delta) % this._items.length;
  2966. return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
  2967. };
  2968. _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
  2969. var targetIndex = this._getItemIndex(relatedTarget);
  2970. var fromIndex = this._getItemIndex(this._element.querySelector(Selector$2.ACTIVE_ITEM));
  2971. var slideEvent = $.Event(Event$2.SLIDE, {
  2972. relatedTarget: relatedTarget,
  2973. direction: eventDirectionName,
  2974. from: fromIndex,
  2975. to: targetIndex
  2976. });
  2977. $(this._element).trigger(slideEvent);
  2978. return slideEvent;
  2979. };
  2980. _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
  2981. if (this._indicatorsElement) {
  2982. var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector$2.ACTIVE));
  2983. $(indicators).removeClass(ClassName$2.ACTIVE);
  2984. var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
  2985. if (nextIndicator) {
  2986. $(nextIndicator).addClass(ClassName$2.ACTIVE);
  2987. }
  2988. }
  2989. };
  2990. _proto._slide = function _slide(direction, element) {
  2991. var _this4 = this;
  2992. var activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  2993. var activeElementIndex = this._getItemIndex(activeElement);
  2994. var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
  2995. var nextElementIndex = this._getItemIndex(nextElement);
  2996. var isCycling = Boolean(this._interval);
  2997. var directionalClassName;
  2998. var orderClassName;
  2999. var eventDirectionName;
  3000. if (direction === Direction.NEXT) {
  3001. directionalClassName = ClassName$2.LEFT;
  3002. orderClassName = ClassName$2.NEXT;
  3003. eventDirectionName = Direction.LEFT;
  3004. } else {
  3005. directionalClassName = ClassName$2.RIGHT;
  3006. orderClassName = ClassName$2.PREV;
  3007. eventDirectionName = Direction.RIGHT;
  3008. }
  3009. if (nextElement && $(nextElement).hasClass(ClassName$2.ACTIVE)) {
  3010. this._isSliding = false;
  3011. return;
  3012. }
  3013. var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
  3014. if (slideEvent.isDefaultPrevented()) {
  3015. return;
  3016. }
  3017. if (!activeElement || !nextElement) {
  3018. // Some weirdness is happening, so we bail
  3019. return;
  3020. }
  3021. this._isSliding = true;
  3022. if (isCycling) {
  3023. this.pause();
  3024. }
  3025. this._setActiveIndicatorElement(nextElement);
  3026. var slidEvent = $.Event(Event$2.SLID, {
  3027. relatedTarget: nextElement,
  3028. direction: eventDirectionName,
  3029. from: activeElementIndex,
  3030. to: nextElementIndex
  3031. });
  3032. if ($(this._element).hasClass(ClassName$2.SLIDE)) {
  3033. $(nextElement).addClass(orderClassName);
  3034. Util.reflow(nextElement);
  3035. $(activeElement).addClass(directionalClassName);
  3036. $(nextElement).addClass(directionalClassName);
  3037. var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
  3038. if (nextElementInterval) {
  3039. this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
  3040. this._config.interval = nextElementInterval;
  3041. } else {
  3042. this._config.interval = this._config.defaultInterval || this._config.interval;
  3043. }
  3044. var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
  3045. $(activeElement).one(Util.TRANSITION_END, function () {
  3046. $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName$2.ACTIVE);
  3047. $(activeElement).removeClass(ClassName$2.ACTIVE + " " + orderClassName + " " + directionalClassName);
  3048. _this4._isSliding = false;
  3049. setTimeout(function () {
  3050. return $(_this4._element).trigger(slidEvent);
  3051. }, 0);
  3052. }).emulateTransitionEnd(transitionDuration);
  3053. } else {
  3054. $(activeElement).removeClass(ClassName$2.ACTIVE);
  3055. $(nextElement).addClass(ClassName$2.ACTIVE);
  3056. this._isSliding = false;
  3057. $(this._element).trigger(slidEvent);
  3058. }
  3059. if (isCycling) {
  3060. this.cycle();
  3061. }
  3062. } // Static
  3063. ;
  3064. Carousel._jQueryInterface = function _jQueryInterface(config) {
  3065. return this.each(function () {
  3066. var data = $(this).data(DATA_KEY$2);
  3067. var _config = _objectSpread2({}, Default, {}, $(this).data());
  3068. if (typeof config === 'object') {
  3069. _config = _objectSpread2({}, _config, {}, config);
  3070. }
  3071. var action = typeof config === 'string' ? config : _config.slide;
  3072. if (!data) {
  3073. data = new Carousel(this, _config);
  3074. $(this).data(DATA_KEY$2, data);
  3075. }
  3076. if (typeof config === 'number') {
  3077. data.to(config);
  3078. } else if (typeof action === 'string') {
  3079. if (typeof data[action] === 'undefined') {
  3080. throw new TypeError("No method named \"" + action + "\"");
  3081. }
  3082. data[action]();
  3083. } else if (_config.interval && _config.ride) {
  3084. data.pause();
  3085. data.cycle();
  3086. }
  3087. });
  3088. };
  3089. Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
  3090. var selector = Util.getSelectorFromElement(this);
  3091. if (!selector) {
  3092. return;
  3093. }
  3094. var target = $(selector)[0];
  3095. if (!target || !$(target).hasClass(ClassName$2.CAROUSEL)) {
  3096. return;
  3097. }
  3098. var config = _objectSpread2({}, $(target).data(), {}, $(this).data());
  3099. var slideIndex = this.getAttribute('data-slide-to');
  3100. if (slideIndex) {
  3101. config.interval = false;
  3102. }
  3103. Carousel._jQueryInterface.call($(target), config);
  3104. if (slideIndex) {
  3105. $(target).data(DATA_KEY$2).to(slideIndex);
  3106. }
  3107. event.preventDefault();
  3108. };
  3109. _createClass(Carousel, null, [{
  3110. key: "VERSION",
  3111. get: function get() {
  3112. return VERSION$2;
  3113. }
  3114. }, {
  3115. key: "Default",
  3116. get: function get() {
  3117. return Default;
  3118. }
  3119. }]);
  3120. return Carousel;
  3121. }();
  3122. /**
  3123. * ------------------------------------------------------------------------
  3124. * Data Api implementation
  3125. * ------------------------------------------------------------------------
  3126. */
  3127. $(document).on(Event$2.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel._dataApiClickHandler);
  3128. $(window).on(Event$2.LOAD_DATA_API, function () {
  3129. var carousels = [].slice.call(document.querySelectorAll(Selector$2.DATA_RIDE));
  3130. for (var i = 0, len = carousels.length; i < len; i++) {
  3131. var $carousel = $(carousels[i]);
  3132. Carousel._jQueryInterface.call($carousel, $carousel.data());
  3133. }
  3134. });
  3135. /**
  3136. * ------------------------------------------------------------------------
  3137. * jQuery
  3138. * ------------------------------------------------------------------------
  3139. */
  3140. $.fn[NAME$2] = Carousel._jQueryInterface;
  3141. $.fn[NAME$2].Constructor = Carousel;
  3142. $.fn[NAME$2].noConflict = function () {
  3143. $.fn[NAME$2] = JQUERY_NO_CONFLICT$2;
  3144. return Carousel._jQueryInterface;
  3145. };
  3146. /**
  3147. * ------------------------------------------------------------------------
  3148. * Constants
  3149. * ------------------------------------------------------------------------
  3150. */
  3151. var NAME$3 = 'collapse';
  3152. var VERSION$3 = '4.4.1';
  3153. var DATA_KEY$3 = 'bs.collapse';
  3154. var EVENT_KEY$3 = "." + DATA_KEY$3;
  3155. var DATA_API_KEY$3 = '.data-api';
  3156. var JQUERY_NO_CONFLICT$3 = $.fn[NAME$3];
  3157. var Default$1 = {
  3158. toggle: true,
  3159. parent: ''
  3160. };
  3161. var DefaultType$1 = {
  3162. toggle: 'boolean',
  3163. parent: '(string|element)'
  3164. };
  3165. var Event$3 = {
  3166. SHOW: "show" + EVENT_KEY$3,
  3167. SHOWN: "shown" + EVENT_KEY$3,
  3168. HIDE: "hide" + EVENT_KEY$3,
  3169. HIDDEN: "hidden" + EVENT_KEY$3,
  3170. CLICK_DATA_API: "click" + EVENT_KEY$3 + DATA_API_KEY$3
  3171. };
  3172. var ClassName$3 = {
  3173. SHOW: 'show',
  3174. COLLAPSE: 'collapse',
  3175. COLLAPSING: 'collapsing',
  3176. COLLAPSED: 'collapsed'
  3177. };
  3178. var Dimension = {
  3179. WIDTH: 'width',
  3180. HEIGHT: 'height'
  3181. };
  3182. var Selector$3 = {
  3183. ACTIVES: '.show, .collapsing',
  3184. DATA_TOGGLE: '[data-toggle="collapse"]'
  3185. };
  3186. /**
  3187. * ------------------------------------------------------------------------
  3188. * Class Definition
  3189. * ------------------------------------------------------------------------
  3190. */
  3191. var Collapse =
  3192. /*#__PURE__*/
  3193. function () {
  3194. function Collapse(element, config) {
  3195. this._isTransitioning = false;
  3196. this._element = element;
  3197. this._config = this._getConfig(config);
  3198. this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
  3199. var toggleList = [].slice.call(document.querySelectorAll(Selector$3.DATA_TOGGLE));
  3200. for (var i = 0, len = toggleList.length; i < len; i++) {
  3201. var elem = toggleList[i];
  3202. var selector = Util.getSelectorFromElement(elem);
  3203. var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
  3204. return foundElem === element;
  3205. });
  3206. if (selector !== null && filterElement.length > 0) {
  3207. this._selector = selector;
  3208. this._triggerArray.push(elem);
  3209. }
  3210. }
  3211. this._parent = this._config.parent ? this._getParent() : null;
  3212. if (!this._config.parent) {
  3213. this._addAriaAndCollapsedClass(this._element, this._triggerArray);
  3214. }
  3215. if (this._config.toggle) {
  3216. this.toggle();
  3217. }
  3218. } // Getters
  3219. var _proto = Collapse.prototype;
  3220. // Public
  3221. _proto.toggle = function toggle() {
  3222. if ($(this._element).hasClass(ClassName$3.SHOW)) {
  3223. this.hide();
  3224. } else {
  3225. this.show();
  3226. }
  3227. };
  3228. _proto.show = function show() {
  3229. var _this = this;
  3230. if (this._isTransitioning || $(this._element).hasClass(ClassName$3.SHOW)) {
  3231. return;
  3232. }
  3233. var actives;
  3234. var activesData;
  3235. if (this._parent) {
  3236. actives = [].slice.call(this._parent.querySelectorAll(Selector$3.ACTIVES)).filter(function (elem) {
  3237. if (typeof _this._config.parent === 'string') {
  3238. return elem.getAttribute('data-parent') === _this._config.parent;
  3239. }
  3240. return elem.classList.contains(ClassName$3.COLLAPSE);
  3241. });
  3242. if (actives.length === 0) {
  3243. actives = null;
  3244. }
  3245. }
  3246. if (actives) {
  3247. activesData = $(actives).not(this._selector).data(DATA_KEY$3);
  3248. if (activesData && activesData._isTransitioning) {
  3249. return;
  3250. }
  3251. }
  3252. var startEvent = $.Event(Event$3.SHOW);
  3253. $(this._element).trigger(startEvent);
  3254. if (startEvent.isDefaultPrevented()) {
  3255. return;
  3256. }
  3257. if (actives) {
  3258. Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide');
  3259. if (!activesData) {
  3260. $(actives).data(DATA_KEY$3, null);
  3261. }
  3262. }
  3263. var dimension = this._getDimension();
  3264. $(this._element).removeClass(ClassName$3.COLLAPSE).addClass(ClassName$3.COLLAPSING);
  3265. this._element.style[dimension] = 0;
  3266. if (this._triggerArray.length) {
  3267. $(this._triggerArray).removeClass(ClassName$3.COLLAPSED).attr('aria-expanded', true);
  3268. }
  3269. this.setTransitioning(true);
  3270. var complete = function complete() {
  3271. $(_this._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).addClass(ClassName$3.SHOW);
  3272. _this._element.style[dimension] = '';
  3273. _this.setTransitioning(false);
  3274. $(_this._element).trigger(Event$3.SHOWN);
  3275. };
  3276. var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
  3277. var scrollSize = "scroll" + capitalizedDimension;
  3278. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3279. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3280. this._element.style[dimension] = this._element[scrollSize] + "px";
  3281. };
  3282. _proto.hide = function hide() {
  3283. var _this2 = this;
  3284. if (this._isTransitioning || !$(this._element).hasClass(ClassName$3.SHOW)) {
  3285. return;
  3286. }
  3287. var startEvent = $.Event(Event$3.HIDE);
  3288. $(this._element).trigger(startEvent);
  3289. if (startEvent.isDefaultPrevented()) {
  3290. return;
  3291. }
  3292. var dimension = this._getDimension();
  3293. this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
  3294. Util.reflow(this._element);
  3295. $(this._element).addClass(ClassName$3.COLLAPSING).removeClass(ClassName$3.COLLAPSE).removeClass(ClassName$3.SHOW);
  3296. var triggerArrayLength = this._triggerArray.length;
  3297. if (triggerArrayLength > 0) {
  3298. for (var i = 0; i < triggerArrayLength; i++) {
  3299. var trigger = this._triggerArray[i];
  3300. var selector = Util.getSelectorFromElement(trigger);
  3301. if (selector !== null) {
  3302. var $elem = $([].slice.call(document.querySelectorAll(selector)));
  3303. if (!$elem.hasClass(ClassName$3.SHOW)) {
  3304. $(trigger).addClass(ClassName$3.COLLAPSED).attr('aria-expanded', false);
  3305. }
  3306. }
  3307. }
  3308. }
  3309. this.setTransitioning(true);
  3310. var complete = function complete() {
  3311. _this2.setTransitioning(false);
  3312. $(_this2._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).trigger(Event$3.HIDDEN);
  3313. };
  3314. this._element.style[dimension] = '';
  3315. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3316. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3317. };
  3318. _proto.setTransitioning = function setTransitioning(isTransitioning) {
  3319. this._isTransitioning = isTransitioning;
  3320. };
  3321. _proto.dispose = function dispose() {
  3322. $.removeData(this._element, DATA_KEY$3);
  3323. this._config = null;
  3324. this._parent = null;
  3325. this._element = null;
  3326. this._triggerArray = null;
  3327. this._isTransitioning = null;
  3328. } // Private
  3329. ;
  3330. _proto._getConfig = function _getConfig(config) {
  3331. config = _objectSpread2({}, Default$1, {}, config);
  3332. config.toggle = Boolean(config.toggle); // Coerce string values
  3333. Util.typeCheckConfig(NAME$3, config, DefaultType$1);
  3334. return config;
  3335. };
  3336. _proto._getDimension = function _getDimension() {
  3337. var hasWidth = $(this._element).hasClass(Dimension.WIDTH);
  3338. return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
  3339. };
  3340. _proto._getParent = function _getParent() {
  3341. var _this3 = this;
  3342. var parent;
  3343. if (Util.isElement(this._config.parent)) {
  3344. parent = this._config.parent; // It's a jQuery object
  3345. if (typeof this._config.parent.jquery !== 'undefined') {
  3346. parent = this._config.parent[0];
  3347. }
  3348. } else {
  3349. parent = document.querySelector(this._config.parent);
  3350. }
  3351. var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
  3352. var children = [].slice.call(parent.querySelectorAll(selector));
  3353. $(children).each(function (i, element) {
  3354. _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
  3355. });
  3356. return parent;
  3357. };
  3358. _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
  3359. var isOpen = $(element).hasClass(ClassName$3.SHOW);
  3360. if (triggerArray.length) {
  3361. $(triggerArray).toggleClass(ClassName$3.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
  3362. }
  3363. } // Static
  3364. ;
  3365. Collapse._getTargetFromElement = function _getTargetFromElement(element) {
  3366. var selector = Util.getSelectorFromElement(element);
  3367. return selector ? document.querySelector(selector) : null;
  3368. };
  3369. Collapse._jQueryInterface = function _jQueryInterface(config) {
  3370. return this.each(function () {
  3371. var $this = $(this);
  3372. var data = $this.data(DATA_KEY$3);
  3373. var _config = _objectSpread2({}, Default$1, {}, $this.data(), {}, typeof config === 'object' && config ? config : {});
  3374. if (!data && _config.toggle && /show|hide/.test(config)) {
  3375. _config.toggle = false;
  3376. }
  3377. if (!data) {
  3378. data = new Collapse(this, _config);
  3379. $this.data(DATA_KEY$3, data);
  3380. }
  3381. if (typeof config === 'string') {
  3382. if (typeof data[config] === 'undefined') {
  3383. throw new TypeError("No method named \"" + config + "\"");
  3384. }
  3385. data[config]();
  3386. }
  3387. });
  3388. };
  3389. _createClass(Collapse, null, [{
  3390. key: "VERSION",
  3391. get: function get() {
  3392. return VERSION$3;
  3393. }
  3394. }, {
  3395. key: "Default",
  3396. get: function get() {
  3397. return Default$1;
  3398. }
  3399. }]);
  3400. return Collapse;
  3401. }();
  3402. /**
  3403. * ------------------------------------------------------------------------
  3404. * Data Api implementation
  3405. * ------------------------------------------------------------------------
  3406. */
  3407. $(document).on(Event$3.CLICK_DATA_API, Selector$3.DATA_TOGGLE, function (event) {
  3408. // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
  3409. if (event.currentTarget.tagName === 'A') {
  3410. event.preventDefault();
  3411. }
  3412. var $trigger = $(this);
  3413. var selector = Util.getSelectorFromElement(this);
  3414. var selectors = [].slice.call(document.querySelectorAll(selector));
  3415. $(selectors).each(function () {
  3416. var $target = $(this);
  3417. var data = $target.data(DATA_KEY$3);
  3418. var config = data ? 'toggle' : $trigger.data();
  3419. Collapse._jQueryInterface.call($target, config);
  3420. });
  3421. });
  3422. /**
  3423. * ------------------------------------------------------------------------
  3424. * jQuery
  3425. * ------------------------------------------------------------------------
  3426. */
  3427. $.fn[NAME$3] = Collapse._jQueryInterface;
  3428. $.fn[NAME$3].Constructor = Collapse;
  3429. $.fn[NAME$3].noConflict = function () {
  3430. $.fn[NAME$3] = JQUERY_NO_CONFLICT$3;
  3431. return Collapse._jQueryInterface;
  3432. };
  3433. /**
  3434. * ------------------------------------------------------------------------
  3435. * Constants
  3436. * ------------------------------------------------------------------------
  3437. */
  3438. var NAME$4 = 'dropdown';
  3439. var VERSION$4 = '4.4.1';
  3440. var DATA_KEY$4 = 'bs.dropdown';
  3441. var EVENT_KEY$4 = "." + DATA_KEY$4;
  3442. var DATA_API_KEY$4 = '.data-api';
  3443. var JQUERY_NO_CONFLICT$4 = $.fn[NAME$4];
  3444. var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
  3445. var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
  3446. var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
  3447. var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
  3448. var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
  3449. var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
  3450. var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
  3451. var Event$4 = {
  3452. HIDE: "hide" + EVENT_KEY$4,
  3453. HIDDEN: "hidden" + EVENT_KEY$4,
  3454. SHOW: "show" + EVENT_KEY$4,
  3455. SHOWN: "shown" + EVENT_KEY$4,
  3456. CLICK: "click" + EVENT_KEY$4,
  3457. CLICK_DATA_API: "click" + EVENT_KEY$4 + DATA_API_KEY$4,
  3458. KEYDOWN_DATA_API: "keydown" + EVENT_KEY$4 + DATA_API_KEY$4,
  3459. KEYUP_DATA_API: "keyup" + EVENT_KEY$4 + DATA_API_KEY$4
  3460. };
  3461. var ClassName$4 = {
  3462. DISABLED: 'disabled',
  3463. SHOW: 'show',
  3464. DROPUP: 'dropup',
  3465. DROPRIGHT: 'dropright',
  3466. DROPLEFT: 'dropleft',
  3467. MENURIGHT: 'dropdown-menu-right',
  3468. MENULEFT: 'dropdown-menu-left',
  3469. POSITION_STATIC: 'position-static'
  3470. };
  3471. var Selector$4 = {
  3472. DATA_TOGGLE: '[data-toggle="dropdown"]',
  3473. FORM_CHILD: '.dropdown form',
  3474. MENU: '.dropdown-menu',
  3475. NAVBAR_NAV: '.navbar-nav',
  3476. VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'
  3477. };
  3478. var AttachmentMap = {
  3479. TOP: 'top-start',
  3480. TOPEND: 'top-end',
  3481. BOTTOM: 'bottom-start',
  3482. BOTTOMEND: 'bottom-end',
  3483. RIGHT: 'right-start',
  3484. RIGHTEND: 'right-end',
  3485. LEFT: 'left-start',
  3486. LEFTEND: 'left-end'
  3487. };
  3488. var Default$2 = {
  3489. offset: 0,
  3490. flip: true,
  3491. boundary: 'scrollParent',
  3492. reference: 'toggle',
  3493. display: 'dynamic',
  3494. popperConfig: null
  3495. };
  3496. var DefaultType$2 = {
  3497. offset: '(number|string|function)',
  3498. flip: 'boolean',
  3499. boundary: '(string|element)',
  3500. reference: '(string|element)',
  3501. display: 'string',
  3502. popperConfig: '(null|object)'
  3503. };
  3504. /**
  3505. * ------------------------------------------------------------------------
  3506. * Class Definition
  3507. * ------------------------------------------------------------------------
  3508. */
  3509. var Dropdown =
  3510. /*#__PURE__*/
  3511. function () {
  3512. function Dropdown(element, config) {
  3513. this._element = element;
  3514. this._popper = null;
  3515. this._config = this._getConfig(config);
  3516. this._menu = this._getMenuElement();
  3517. this._inNavbar = this._detectNavbar();
  3518. this._addEventListeners();
  3519. } // Getters
  3520. var _proto = Dropdown.prototype;
  3521. // Public
  3522. _proto.toggle = function toggle() {
  3523. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED)) {
  3524. return;
  3525. }
  3526. var isActive = $(this._menu).hasClass(ClassName$4.SHOW);
  3527. Dropdown._clearMenus();
  3528. if (isActive) {
  3529. return;
  3530. }
  3531. this.show(true);
  3532. };
  3533. _proto.show = function show(usePopper) {
  3534. if (usePopper === void 0) {
  3535. usePopper = false;
  3536. }
  3537. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || $(this._menu).hasClass(ClassName$4.SHOW)) {
  3538. return;
  3539. }
  3540. var relatedTarget = {
  3541. relatedTarget: this._element
  3542. };
  3543. var showEvent = $.Event(Event$4.SHOW, relatedTarget);
  3544. var parent = Dropdown._getParentFromElement(this._element);
  3545. $(parent).trigger(showEvent);
  3546. if (showEvent.isDefaultPrevented()) {
  3547. return;
  3548. } // Disable totally Popper.js for Dropdown in Navbar
  3549. if (!this._inNavbar && usePopper) {
  3550. /**
  3551. * Check for Popper dependency
  3552. * Popper - https://popper.js.org
  3553. */
  3554. if (typeof Popper === 'undefined') {
  3555. throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)');
  3556. }
  3557. var referenceElement = this._element;
  3558. if (this._config.reference === 'parent') {
  3559. referenceElement = parent;
  3560. } else if (Util.isElement(this._config.reference)) {
  3561. referenceElement = this._config.reference; // Check if it's jQuery element
  3562. if (typeof this._config.reference.jquery !== 'undefined') {
  3563. referenceElement = this._config.reference[0];
  3564. }
  3565. } // If boundary is not `scrollParent`, then set position to `static`
  3566. // to allow the menu to "escape" the scroll parent's boundaries
  3567. // https://github.com/twbs/bootstrap/issues/24251
  3568. if (this._config.boundary !== 'scrollParent') {
  3569. $(parent).addClass(ClassName$4.POSITION_STATIC);
  3570. }
  3571. this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
  3572. } // If this is a touch-enabled device we add extra
  3573. // empty mouseover listeners to the body's immediate children;
  3574. // only needed because of broken event delegation on iOS
  3575. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  3576. if ('ontouchstart' in document.documentElement && $(parent).closest(Selector$4.NAVBAR_NAV).length === 0) {
  3577. $(document.body).children().on('mouseover', null, $.noop);
  3578. }
  3579. this._element.focus();
  3580. this._element.setAttribute('aria-expanded', true);
  3581. $(this._menu).toggleClass(ClassName$4.SHOW);
  3582. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget));
  3583. };
  3584. _proto.hide = function hide() {
  3585. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || !$(this._menu).hasClass(ClassName$4.SHOW)) {
  3586. return;
  3587. }
  3588. var relatedTarget = {
  3589. relatedTarget: this._element
  3590. };
  3591. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  3592. var parent = Dropdown._getParentFromElement(this._element);
  3593. $(parent).trigger(hideEvent);
  3594. if (hideEvent.isDefaultPrevented()) {
  3595. return;
  3596. }
  3597. if (this._popper) {
  3598. this._popper.destroy();
  3599. }
  3600. $(this._menu).toggleClass(ClassName$4.SHOW);
  3601. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  3602. };
  3603. _proto.dispose = function dispose() {
  3604. $.removeData(this._element, DATA_KEY$4);
  3605. $(this._element).off(EVENT_KEY$4);
  3606. this._element = null;
  3607. this._menu = null;
  3608. if (this._popper !== null) {
  3609. this._popper.destroy();
  3610. this._popper = null;
  3611. }
  3612. };
  3613. _proto.update = function update() {
  3614. this._inNavbar = this._detectNavbar();
  3615. if (this._popper !== null) {
  3616. this._popper.scheduleUpdate();
  3617. }
  3618. } // Private
  3619. ;
  3620. _proto._addEventListeners = function _addEventListeners() {
  3621. var _this = this;
  3622. $(this._element).on(Event$4.CLICK, function (event) {
  3623. event.preventDefault();
  3624. event.stopPropagation();
  3625. _this.toggle();
  3626. });
  3627. };
  3628. _proto._getConfig = function _getConfig(config) {
  3629. config = _objectSpread2({}, this.constructor.Default, {}, $(this._element).data(), {}, config);
  3630. Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
  3631. return config;
  3632. };
  3633. _proto._getMenuElement = function _getMenuElement() {
  3634. if (!this._menu) {
  3635. var parent = Dropdown._getParentFromElement(this._element);
  3636. if (parent) {
  3637. this._menu = parent.querySelector(Selector$4.MENU);
  3638. }
  3639. }
  3640. return this._menu;
  3641. };
  3642. _proto._getPlacement = function _getPlacement() {
  3643. var $parentDropdown = $(this._element.parentNode);
  3644. var placement = AttachmentMap.BOTTOM; // Handle dropup
  3645. if ($parentDropdown.hasClass(ClassName$4.DROPUP)) {
  3646. placement = AttachmentMap.TOP;
  3647. if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  3648. placement = AttachmentMap.TOPEND;
  3649. }
  3650. } else if ($parentDropdown.hasClass(ClassName$4.DROPRIGHT)) {
  3651. placement = AttachmentMap.RIGHT;
  3652. } else if ($parentDropdown.hasClass(ClassName$4.DROPLEFT)) {
  3653. placement = AttachmentMap.LEFT;
  3654. } else if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  3655. placement = AttachmentMap.BOTTOMEND;
  3656. }
  3657. return placement;
  3658. };
  3659. _proto._detectNavbar = function _detectNavbar() {
  3660. return $(this._element).closest('.navbar').length > 0;
  3661. };
  3662. _proto._getOffset = function _getOffset() {
  3663. var _this2 = this;
  3664. var offset = {};
  3665. if (typeof this._config.offset === 'function') {
  3666. offset.fn = function (data) {
  3667. data.offsets = _objectSpread2({}, data.offsets, {}, _this2._config.offset(data.offsets, _this2._element) || {});
  3668. return data;
  3669. };
  3670. } else {
  3671. offset.offset = this._config.offset;
  3672. }
  3673. return offset;
  3674. };
  3675. _proto._getPopperConfig = function _getPopperConfig() {
  3676. var popperConfig = {
  3677. placement: this._getPlacement(),
  3678. modifiers: {
  3679. offset: this._getOffset(),
  3680. flip: {
  3681. enabled: this._config.flip
  3682. },
  3683. preventOverflow: {
  3684. boundariesElement: this._config.boundary
  3685. }
  3686. }
  3687. }; // Disable Popper.js if we have a static display
  3688. if (this._config.display === 'static') {
  3689. popperConfig.modifiers.applyStyle = {
  3690. enabled: false
  3691. };
  3692. }
  3693. return _objectSpread2({}, popperConfig, {}, this._config.popperConfig);
  3694. } // Static
  3695. ;
  3696. Dropdown._jQueryInterface = function _jQueryInterface(config) {
  3697. return this.each(function () {
  3698. var data = $(this).data(DATA_KEY$4);
  3699. var _config = typeof config === 'object' ? config : null;
  3700. if (!data) {
  3701. data = new Dropdown(this, _config);
  3702. $(this).data(DATA_KEY$4, data);
  3703. }
  3704. if (typeof config === 'string') {
  3705. if (typeof data[config] === 'undefined') {
  3706. throw new TypeError("No method named \"" + config + "\"");
  3707. }
  3708. data[config]();
  3709. }
  3710. });
  3711. };
  3712. Dropdown._clearMenus = function _clearMenus(event) {
  3713. if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
  3714. return;
  3715. }
  3716. var toggles = [].slice.call(document.querySelectorAll(Selector$4.DATA_TOGGLE));
  3717. for (var i = 0, len = toggles.length; i < len; i++) {
  3718. var parent = Dropdown._getParentFromElement(toggles[i]);
  3719. var context = $(toggles[i]).data(DATA_KEY$4);
  3720. var relatedTarget = {
  3721. relatedTarget: toggles[i]
  3722. };
  3723. if (event && event.type === 'click') {
  3724. relatedTarget.clickEvent = event;
  3725. }
  3726. if (!context) {
  3727. continue;
  3728. }
  3729. var dropdownMenu = context._menu;
  3730. if (!$(parent).hasClass(ClassName$4.SHOW)) {
  3731. continue;
  3732. }
  3733. if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) {
  3734. continue;
  3735. }
  3736. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  3737. $(parent).trigger(hideEvent);
  3738. if (hideEvent.isDefaultPrevented()) {
  3739. continue;
  3740. } // If this is a touch-enabled device we remove the extra
  3741. // empty mouseover listeners we added for iOS support
  3742. if ('ontouchstart' in document.documentElement) {
  3743. $(document.body).children().off('mouseover', null, $.noop);
  3744. }
  3745. toggles[i].setAttribute('aria-expanded', 'false');
  3746. if (context._popper) {
  3747. context._popper.destroy();
  3748. }
  3749. $(dropdownMenu).removeClass(ClassName$4.SHOW);
  3750. $(parent).removeClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  3751. }
  3752. };
  3753. Dropdown._getParentFromElement = function _getParentFromElement(element) {
  3754. var parent;
  3755. var selector = Util.getSelectorFromElement(element);
  3756. if (selector) {
  3757. parent = document.querySelector(selector);
  3758. }
  3759. return parent || element.parentNode;
  3760. } // eslint-disable-next-line complexity
  3761. ;
  3762. Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
  3763. // If not input/textarea:
  3764. // - And not a key in REGEXP_KEYDOWN => not a dropdown command
  3765. // If input/textarea:
  3766. // - If space key => not a dropdown command
  3767. // - If key is other than escape
  3768. // - If key is not up or down => not a dropdown command
  3769. // - If trigger inside the menu => not a dropdown command
  3770. 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)) {
  3771. return;
  3772. }
  3773. event.preventDefault();
  3774. event.stopPropagation();
  3775. if (this.disabled || $(this).hasClass(ClassName$4.DISABLED)) {
  3776. return;
  3777. }
  3778. var parent = Dropdown._getParentFromElement(this);
  3779. var isActive = $(parent).hasClass(ClassName$4.SHOW);
  3780. if (!isActive && event.which === ESCAPE_KEYCODE) {
  3781. return;
  3782. }
  3783. if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
  3784. if (event.which === ESCAPE_KEYCODE) {
  3785. var toggle = parent.querySelector(Selector$4.DATA_TOGGLE);
  3786. $(toggle).trigger('focus');
  3787. }
  3788. $(this).trigger('click');
  3789. return;
  3790. }
  3791. var items = [].slice.call(parent.querySelectorAll(Selector$4.VISIBLE_ITEMS)).filter(function (item) {
  3792. return $(item).is(':visible');
  3793. });
  3794. if (items.length === 0) {
  3795. return;
  3796. }
  3797. var index = items.indexOf(event.target);
  3798. if (event.which === ARROW_UP_KEYCODE && index > 0) {
  3799. // Up
  3800. index--;
  3801. }
  3802. if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
  3803. // Down
  3804. index++;
  3805. }
  3806. if (index < 0) {
  3807. index = 0;
  3808. }
  3809. items[index].focus();
  3810. };
  3811. _createClass(Dropdown, null, [{
  3812. key: "VERSION",
  3813. get: function get() {
  3814. return VERSION$4;
  3815. }
  3816. }, {
  3817. key: "Default",
  3818. get: function get() {
  3819. return Default$2;
  3820. }
  3821. }, {
  3822. key: "DefaultType",
  3823. get: function get() {
  3824. return DefaultType$2;
  3825. }
  3826. }]);
  3827. return Dropdown;
  3828. }();
  3829. /**
  3830. * ------------------------------------------------------------------------
  3831. * Data Api implementation
  3832. * ------------------------------------------------------------------------
  3833. */
  3834. $(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) {
  3835. event.preventDefault();
  3836. event.stopPropagation();
  3837. Dropdown._jQueryInterface.call($(this), 'toggle');
  3838. }).on(Event$4.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) {
  3839. e.stopPropagation();
  3840. });
  3841. /**
  3842. * ------------------------------------------------------------------------
  3843. * jQuery
  3844. * ------------------------------------------------------------------------
  3845. */
  3846. $.fn[NAME$4] = Dropdown._jQueryInterface;
  3847. $.fn[NAME$4].Constructor = Dropdown;
  3848. $.fn[NAME$4].noConflict = function () {
  3849. $.fn[NAME$4] = JQUERY_NO_CONFLICT$4;
  3850. return Dropdown._jQueryInterface;
  3851. };
  3852. /**
  3853. * ------------------------------------------------------------------------
  3854. * Constants
  3855. * ------------------------------------------------------------------------
  3856. */
  3857. var NAME$5 = 'modal';
  3858. var VERSION$5 = '4.4.1';
  3859. var DATA_KEY$5 = 'bs.modal';
  3860. var EVENT_KEY$5 = "." + DATA_KEY$5;
  3861. var DATA_API_KEY$5 = '.data-api';
  3862. var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5];
  3863. var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key
  3864. var Default$3 = {
  3865. backdrop: true,
  3866. keyboard: true,
  3867. focus: true,
  3868. show: true
  3869. };
  3870. var DefaultType$3 = {
  3871. backdrop: '(boolean|string)',
  3872. keyboard: 'boolean',
  3873. focus: 'boolean',
  3874. show: 'boolean'
  3875. };
  3876. var Event$5 = {
  3877. HIDE: "hide" + EVENT_KEY$5,
  3878. HIDE_PREVENTED: "hidePrevented" + EVENT_KEY$5,
  3879. HIDDEN: "hidden" + EVENT_KEY$5,
  3880. SHOW: "show" + EVENT_KEY$5,
  3881. SHOWN: "shown" + EVENT_KEY$5,
  3882. FOCUSIN: "focusin" + EVENT_KEY$5,
  3883. RESIZE: "resize" + EVENT_KEY$5,
  3884. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$5,
  3885. KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY$5,
  3886. MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY$5,
  3887. MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY$5,
  3888. CLICK_DATA_API: "click" + EVENT_KEY$5 + DATA_API_KEY$5
  3889. };
  3890. var ClassName$5 = {
  3891. SCROLLABLE: 'modal-dialog-scrollable',
  3892. SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
  3893. BACKDROP: 'modal-backdrop',
  3894. OPEN: 'modal-open',
  3895. FADE: 'fade',
  3896. SHOW: 'show',
  3897. STATIC: 'modal-static'
  3898. };
  3899. var Selector$5 = {
  3900. DIALOG: '.modal-dialog',
  3901. MODAL_BODY: '.modal-body',
  3902. DATA_TOGGLE: '[data-toggle="modal"]',
  3903. DATA_DISMISS: '[data-dismiss="modal"]',
  3904. FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
  3905. STICKY_CONTENT: '.sticky-top'
  3906. };
  3907. /**
  3908. * ------------------------------------------------------------------------
  3909. * Class Definition
  3910. * ------------------------------------------------------------------------
  3911. */
  3912. var Modal =
  3913. /*#__PURE__*/
  3914. function () {
  3915. function Modal(element, config) {
  3916. this._config = this._getConfig(config);
  3917. this._element = element;
  3918. this._dialog = element.querySelector(Selector$5.DIALOG);
  3919. this._backdrop = null;
  3920. this._isShown = false;
  3921. this._isBodyOverflowing = false;
  3922. this._ignoreBackdropClick = false;
  3923. this._isTransitioning = false;
  3924. this._scrollbarWidth = 0;
  3925. } // Getters
  3926. var _proto = Modal.prototype;
  3927. // Public
  3928. _proto.toggle = function toggle(relatedTarget) {
  3929. return this._isShown ? this.hide() : this.show(relatedTarget);
  3930. };
  3931. _proto.show = function show(relatedTarget) {
  3932. var _this = this;
  3933. if (this._isShown || this._isTransitioning) {
  3934. return;
  3935. }
  3936. if ($(this._element).hasClass(ClassName$5.FADE)) {
  3937. this._isTransitioning = true;
  3938. }
  3939. var showEvent = $.Event(Event$5.SHOW, {
  3940. relatedTarget: relatedTarget
  3941. });
  3942. $(this._element).trigger(showEvent);
  3943. if (this._isShown || showEvent.isDefaultPrevented()) {
  3944. return;
  3945. }
  3946. this._isShown = true;
  3947. this._checkScrollbar();
  3948. this._setScrollbar();
  3949. this._adjustDialog();
  3950. this._setEscapeEvent();
  3951. this._setResizeEvent();
  3952. $(this._element).on(Event$5.CLICK_DISMISS, Selector$5.DATA_DISMISS, function (event) {
  3953. return _this.hide(event);
  3954. });
  3955. $(this._dialog).on(Event$5.MOUSEDOWN_DISMISS, function () {
  3956. $(_this._element).one(Event$5.MOUSEUP_DISMISS, function (event) {
  3957. if ($(event.target).is(_this._element)) {
  3958. _this._ignoreBackdropClick = true;
  3959. }
  3960. });
  3961. });
  3962. this._showBackdrop(function () {
  3963. return _this._showElement(relatedTarget);
  3964. });
  3965. };
  3966. _proto.hide = function hide(event) {
  3967. var _this2 = this;
  3968. if (event) {
  3969. event.preventDefault();
  3970. }
  3971. if (!this._isShown || this._isTransitioning) {
  3972. return;
  3973. }
  3974. var hideEvent = $.Event(Event$5.HIDE);
  3975. $(this._element).trigger(hideEvent);
  3976. if (!this._isShown || hideEvent.isDefaultPrevented()) {
  3977. return;
  3978. }
  3979. this._isShown = false;
  3980. var transition = $(this._element).hasClass(ClassName$5.FADE);
  3981. if (transition) {
  3982. this._isTransitioning = true;
  3983. }
  3984. this._setEscapeEvent();
  3985. this._setResizeEvent();
  3986. $(document).off(Event$5.FOCUSIN);
  3987. $(this._element).removeClass(ClassName$5.SHOW);
  3988. $(this._element).off(Event$5.CLICK_DISMISS);
  3989. $(this._dialog).off(Event$5.MOUSEDOWN_DISMISS);
  3990. if (transition) {
  3991. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3992. $(this._element).one(Util.TRANSITION_END, function (event) {
  3993. return _this2._hideModal(event);
  3994. }).emulateTransitionEnd(transitionDuration);
  3995. } else {
  3996. this._hideModal();
  3997. }
  3998. };
  3999. _proto.dispose = function dispose() {
  4000. [window, this._element, this._dialog].forEach(function (htmlElement) {
  4001. return $(htmlElement).off(EVENT_KEY$5);
  4002. });
  4003. /**
  4004. * `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API`
  4005. * Do not move `document` in `htmlElements` array
  4006. * It will remove `Event.CLICK_DATA_API` event that should remain
  4007. */
  4008. $(document).off(Event$5.FOCUSIN);
  4009. $.removeData(this._element, DATA_KEY$5);
  4010. this._config = null;
  4011. this._element = null;
  4012. this._dialog = null;
  4013. this._backdrop = null;
  4014. this._isShown = null;
  4015. this._isBodyOverflowing = null;
  4016. this._ignoreBackdropClick = null;
  4017. this._isTransitioning = null;
  4018. this._scrollbarWidth = null;
  4019. };
  4020. _proto.handleUpdate = function handleUpdate() {
  4021. this._adjustDialog();
  4022. } // Private
  4023. ;
  4024. _proto._getConfig = function _getConfig(config) {
  4025. config = _objectSpread2({}, Default$3, {}, config);
  4026. Util.typeCheckConfig(NAME$5, config, DefaultType$3);
  4027. return config;
  4028. };
  4029. _proto._triggerBackdropTransition = function _triggerBackdropTransition() {
  4030. var _this3 = this;
  4031. if (this._config.backdrop === 'static') {
  4032. var hideEventPrevented = $.Event(Event$5.HIDE_PREVENTED);
  4033. $(this._element).trigger(hideEventPrevented);
  4034. if (hideEventPrevented.defaultPrevented) {
  4035. return;
  4036. }
  4037. this._element.classList.add(ClassName$5.STATIC);
  4038. var modalTransitionDuration = Util.getTransitionDurationFromElement(this._element);
  4039. $(this._element).one(Util.TRANSITION_END, function () {
  4040. _this3._element.classList.remove(ClassName$5.STATIC);
  4041. }).emulateTransitionEnd(modalTransitionDuration);
  4042. this._element.focus();
  4043. } else {
  4044. this.hide();
  4045. }
  4046. };
  4047. _proto._showElement = function _showElement(relatedTarget) {
  4048. var _this4 = this;
  4049. var transition = $(this._element).hasClass(ClassName$5.FADE);
  4050. var modalBody = this._dialog ? this._dialog.querySelector(Selector$5.MODAL_BODY) : null;
  4051. if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
  4052. // Don't move modal's DOM position
  4053. document.body.appendChild(this._element);
  4054. }
  4055. this._element.style.display = 'block';
  4056. this._element.removeAttribute('aria-hidden');
  4057. this._element.setAttribute('aria-modal', true);
  4058. if ($(this._dialog).hasClass(ClassName$5.SCROLLABLE) && modalBody) {
  4059. modalBody.scrollTop = 0;
  4060. } else {
  4061. this._element.scrollTop = 0;
  4062. }
  4063. if (transition) {
  4064. Util.reflow(this._element);
  4065. }
  4066. $(this._element).addClass(ClassName$5.SHOW);
  4067. if (this._config.focus) {
  4068. this._enforceFocus();
  4069. }
  4070. var shownEvent = $.Event(Event$5.SHOWN, {
  4071. relatedTarget: relatedTarget
  4072. });
  4073. var transitionComplete = function transitionComplete() {
  4074. if (_this4._config.focus) {
  4075. _this4._element.focus();
  4076. }
  4077. _this4._isTransitioning = false;
  4078. $(_this4._element).trigger(shownEvent);
  4079. };
  4080. if (transition) {
  4081. var transitionDuration = Util.getTransitionDurationFromElement(this._dialog);
  4082. $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration);
  4083. } else {
  4084. transitionComplete();
  4085. }
  4086. };
  4087. _proto._enforceFocus = function _enforceFocus() {
  4088. var _this5 = this;
  4089. $(document).off(Event$5.FOCUSIN) // Guard against infinite focus loop
  4090. .on(Event$5.FOCUSIN, function (event) {
  4091. if (document !== event.target && _this5._element !== event.target && $(_this5._element).has(event.target).length === 0) {
  4092. _this5._element.focus();
  4093. }
  4094. });
  4095. };
  4096. _proto._setEscapeEvent = function _setEscapeEvent() {
  4097. var _this6 = this;
  4098. if (this._isShown && this._config.keyboard) {
  4099. $(this._element).on(Event$5.KEYDOWN_DISMISS, function (event) {
  4100. if (event.which === ESCAPE_KEYCODE$1) {
  4101. _this6._triggerBackdropTransition();
  4102. }
  4103. });
  4104. } else if (!this._isShown) {
  4105. $(this._element).off(Event$5.KEYDOWN_DISMISS);
  4106. }
  4107. };
  4108. _proto._setResizeEvent = function _setResizeEvent() {
  4109. var _this7 = this;
  4110. if (this._isShown) {
  4111. $(window).on(Event$5.RESIZE, function (event) {
  4112. return _this7.handleUpdate(event);
  4113. });
  4114. } else {
  4115. $(window).off(Event$5.RESIZE);
  4116. }
  4117. };
  4118. _proto._hideModal = function _hideModal() {
  4119. var _this8 = this;
  4120. this._element.style.display = 'none';
  4121. this._element.setAttribute('aria-hidden', true);
  4122. this._element.removeAttribute('aria-modal');
  4123. this._isTransitioning = false;
  4124. this._showBackdrop(function () {
  4125. $(document.body).removeClass(ClassName$5.OPEN);
  4126. _this8._resetAdjustments();
  4127. _this8._resetScrollbar();
  4128. $(_this8._element).trigger(Event$5.HIDDEN);
  4129. });
  4130. };
  4131. _proto._removeBackdrop = function _removeBackdrop() {
  4132. if (this._backdrop) {
  4133. $(this._backdrop).remove();
  4134. this._backdrop = null;
  4135. }
  4136. };
  4137. _proto._showBackdrop = function _showBackdrop(callback) {
  4138. var _this9 = this;
  4139. var animate = $(this._element).hasClass(ClassName$5.FADE) ? ClassName$5.FADE : '';
  4140. if (this._isShown && this._config.backdrop) {
  4141. this._backdrop = document.createElement('div');
  4142. this._backdrop.className = ClassName$5.BACKDROP;
  4143. if (animate) {
  4144. this._backdrop.classList.add(animate);
  4145. }
  4146. $(this._backdrop).appendTo(document.body);
  4147. $(this._element).on(Event$5.CLICK_DISMISS, function (event) {
  4148. if (_this9._ignoreBackdropClick) {
  4149. _this9._ignoreBackdropClick = false;
  4150. return;
  4151. }
  4152. if (event.target !== event.currentTarget) {
  4153. return;
  4154. }
  4155. _this9._triggerBackdropTransition();
  4156. });
  4157. if (animate) {
  4158. Util.reflow(this._backdrop);
  4159. }
  4160. $(this._backdrop).addClass(ClassName$5.SHOW);
  4161. if (!callback) {
  4162. return;
  4163. }
  4164. if (!animate) {
  4165. callback();
  4166. return;
  4167. }
  4168. var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4169. $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration);
  4170. } else if (!this._isShown && this._backdrop) {
  4171. $(this._backdrop).removeClass(ClassName$5.SHOW);
  4172. var callbackRemove = function callbackRemove() {
  4173. _this9._removeBackdrop();
  4174. if (callback) {
  4175. callback();
  4176. }
  4177. };
  4178. if ($(this._element).hasClass(ClassName$5.FADE)) {
  4179. var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4180. $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration);
  4181. } else {
  4182. callbackRemove();
  4183. }
  4184. } else if (callback) {
  4185. callback();
  4186. }
  4187. } // ----------------------------------------------------------------------
  4188. // the following methods are used to handle overflowing modals
  4189. // todo (fat): these should probably be refactored out of modal.js
  4190. // ----------------------------------------------------------------------
  4191. ;
  4192. _proto._adjustDialog = function _adjustDialog() {
  4193. var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  4194. if (!this._isBodyOverflowing && isModalOverflowing) {
  4195. this._element.style.paddingLeft = this._scrollbarWidth + "px";
  4196. }
  4197. if (this._isBodyOverflowing && !isModalOverflowing) {
  4198. this._element.style.paddingRight = this._scrollbarWidth + "px";
  4199. }
  4200. };
  4201. _proto._resetAdjustments = function _resetAdjustments() {
  4202. this._element.style.paddingLeft = '';
  4203. this._element.style.paddingRight = '';
  4204. };
  4205. _proto._checkScrollbar = function _checkScrollbar() {
  4206. var rect = document.body.getBoundingClientRect();
  4207. this._isBodyOverflowing = rect.left + rect.right < window.innerWidth;
  4208. this._scrollbarWidth = this._getScrollbarWidth();
  4209. };
  4210. _proto._setScrollbar = function _setScrollbar() {
  4211. var _this10 = this;
  4212. if (this._isBodyOverflowing) {
  4213. // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
  4214. // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
  4215. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4216. var stickyContent = [].slice.call(document.querySelectorAll(Selector$5.STICKY_CONTENT)); // Adjust fixed content padding
  4217. $(fixedContent).each(function (index, element) {
  4218. var actualPadding = element.style.paddingRight;
  4219. var calculatedPadding = $(element).css('padding-right');
  4220. $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px");
  4221. }); // Adjust sticky content margin
  4222. $(stickyContent).each(function (index, element) {
  4223. var actualMargin = element.style.marginRight;
  4224. var calculatedMargin = $(element).css('margin-right');
  4225. $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px");
  4226. }); // Adjust body padding
  4227. var actualPadding = document.body.style.paddingRight;
  4228. var calculatedPadding = $(document.body).css('padding-right');
  4229. $(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px");
  4230. }
  4231. $(document.body).addClass(ClassName$5.OPEN);
  4232. };
  4233. _proto._resetScrollbar = function _resetScrollbar() {
  4234. // Restore fixed content padding
  4235. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4236. $(fixedContent).each(function (index, element) {
  4237. var padding = $(element).data('padding-right');
  4238. $(element).removeData('padding-right');
  4239. element.style.paddingRight = padding ? padding : '';
  4240. }); // Restore sticky content
  4241. var elements = [].slice.call(document.querySelectorAll("" + Selector$5.STICKY_CONTENT));
  4242. $(elements).each(function (index, element) {
  4243. var margin = $(element).data('margin-right');
  4244. if (typeof margin !== 'undefined') {
  4245. $(element).css('margin-right', margin).removeData('margin-right');
  4246. }
  4247. }); // Restore body padding
  4248. var padding = $(document.body).data('padding-right');
  4249. $(document.body).removeData('padding-right');
  4250. document.body.style.paddingRight = padding ? padding : '';
  4251. };
  4252. _proto._getScrollbarWidth = function _getScrollbarWidth() {
  4253. // thx d.walsh
  4254. var scrollDiv = document.createElement('div');
  4255. scrollDiv.className = ClassName$5.SCROLLBAR_MEASURER;
  4256. document.body.appendChild(scrollDiv);
  4257. var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
  4258. document.body.removeChild(scrollDiv);
  4259. return scrollbarWidth;
  4260. } // Static
  4261. ;
  4262. Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
  4263. return this.each(function () {
  4264. var data = $(this).data(DATA_KEY$5);
  4265. var _config = _objectSpread2({}, Default$3, {}, $(this).data(), {}, typeof config === 'object' && config ? config : {});
  4266. if (!data) {
  4267. data = new Modal(this, _config);
  4268. $(this).data(DATA_KEY$5, data);
  4269. }
  4270. if (typeof config === 'string') {
  4271. if (typeof data[config] === 'undefined') {
  4272. throw new TypeError("No method named \"" + config + "\"");
  4273. }
  4274. data[config](relatedTarget);
  4275. } else if (_config.show) {
  4276. data.show(relatedTarget);
  4277. }
  4278. });
  4279. };
  4280. _createClass(Modal, null, [{
  4281. key: "VERSION",
  4282. get: function get() {
  4283. return VERSION$5;
  4284. }
  4285. }, {
  4286. key: "Default",
  4287. get: function get() {
  4288. return Default$3;
  4289. }
  4290. }]);
  4291. return Modal;
  4292. }();
  4293. /**
  4294. * ------------------------------------------------------------------------
  4295. * Data Api implementation
  4296. * ------------------------------------------------------------------------
  4297. */
  4298. $(document).on(Event$5.CLICK_DATA_API, Selector$5.DATA_TOGGLE, function (event) {
  4299. var _this11 = this;
  4300. var target;
  4301. var selector = Util.getSelectorFromElement(this);
  4302. if (selector) {
  4303. target = document.querySelector(selector);
  4304. }
  4305. var config = $(target).data(DATA_KEY$5) ? 'toggle' : _objectSpread2({}, $(target).data(), {}, $(this).data());
  4306. if (this.tagName === 'A' || this.tagName === 'AREA') {
  4307. event.preventDefault();
  4308. }
  4309. var $target = $(target).one(Event$5.SHOW, function (showEvent) {
  4310. if (showEvent.isDefaultPrevented()) {
  4311. // Only register focus restorer if modal will actually get shown
  4312. return;
  4313. }
  4314. $target.one(Event$5.HIDDEN, function () {
  4315. if ($(_this11).is(':visible')) {
  4316. _this11.focus();
  4317. }
  4318. });
  4319. });
  4320. Modal._jQueryInterface.call($(target), config, this);
  4321. });
  4322. /**
  4323. * ------------------------------------------------------------------------
  4324. * jQuery
  4325. * ------------------------------------------------------------------------
  4326. */
  4327. $.fn[NAME$5] = Modal._jQueryInterface;
  4328. $.fn[NAME$5].Constructor = Modal;
  4329. $.fn[NAME$5].noConflict = function () {
  4330. $.fn[NAME$5] = JQUERY_NO_CONFLICT$5;
  4331. return Modal._jQueryInterface;
  4332. };
  4333. /**
  4334. * --------------------------------------------------------------------------
  4335. * Bootstrap (v4.4.1): tools/sanitizer.js
  4336. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  4337. * --------------------------------------------------------------------------
  4338. */
  4339. var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
  4340. var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
  4341. var DefaultWhitelist = {
  4342. // Global attributes allowed on any supplied element below.
  4343. '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
  4344. a: ['target', 'href', 'title', 'rel'],
  4345. area: [],
  4346. b: [],
  4347. br: [],
  4348. col: [],
  4349. code: [],
  4350. div: [],
  4351. em: [],
  4352. hr: [],
  4353. h1: [],
  4354. h2: [],
  4355. h3: [],
  4356. h4: [],
  4357. h5: [],
  4358. h6: [],
  4359. i: [],
  4360. img: ['src', 'alt', 'title', 'width', 'height'],
  4361. li: [],
  4362. ol: [],
  4363. p: [],
  4364. pre: [],
  4365. s: [],
  4366. small: [],
  4367. span: [],
  4368. sub: [],
  4369. sup: [],
  4370. strong: [],
  4371. u: [],
  4372. ul: []
  4373. };
  4374. /**
  4375. * A pattern that recognizes a commonly useful subset of URLs that are safe.
  4376. *
  4377. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4378. */
  4379. var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi;
  4380. /**
  4381. * A pattern that matches safe data URLs. Only matches image, video and audio types.
  4382. *
  4383. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4384. */
  4385. 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;
  4386. function allowedAttribute(attr, allowedAttributeList) {
  4387. var attrName = attr.nodeName.toLowerCase();
  4388. if (allowedAttributeList.indexOf(attrName) !== -1) {
  4389. if (uriAttrs.indexOf(attrName) !== -1) {
  4390. return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
  4391. }
  4392. return true;
  4393. }
  4394. var regExp = allowedAttributeList.filter(function (attrRegex) {
  4395. return attrRegex instanceof RegExp;
  4396. }); // Check if a regular expression validates the attribute.
  4397. for (var i = 0, l = regExp.length; i < l; i++) {
  4398. if (attrName.match(regExp[i])) {
  4399. return true;
  4400. }
  4401. }
  4402. return false;
  4403. }
  4404. function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
  4405. if (unsafeHtml.length === 0) {
  4406. return unsafeHtml;
  4407. }
  4408. if (sanitizeFn && typeof sanitizeFn === 'function') {
  4409. return sanitizeFn(unsafeHtml);
  4410. }
  4411. var domParser = new window.DOMParser();
  4412. var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
  4413. var whitelistKeys = Object.keys(whiteList);
  4414. var elements = [].slice.call(createdDocument.body.querySelectorAll('*'));
  4415. var _loop = function _loop(i, len) {
  4416. var el = elements[i];
  4417. var elName = el.nodeName.toLowerCase();
  4418. if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) {
  4419. el.parentNode.removeChild(el);
  4420. return "continue";
  4421. }
  4422. var attributeList = [].slice.call(el.attributes);
  4423. var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
  4424. attributeList.forEach(function (attr) {
  4425. if (!allowedAttribute(attr, whitelistedAttributes)) {
  4426. el.removeAttribute(attr.nodeName);
  4427. }
  4428. });
  4429. };
  4430. for (var i = 0, len = elements.length; i < len; i++) {
  4431. var _ret = _loop(i);
  4432. if (_ret === "continue") continue;
  4433. }
  4434. return createdDocument.body.innerHTML;
  4435. }
  4436. /**
  4437. * ------------------------------------------------------------------------
  4438. * Constants
  4439. * ------------------------------------------------------------------------
  4440. */
  4441. var NAME$6 = 'tooltip';
  4442. var VERSION$6 = '4.4.1';
  4443. var DATA_KEY$6 = 'bs.tooltip';
  4444. var EVENT_KEY$6 = "." + DATA_KEY$6;
  4445. var JQUERY_NO_CONFLICT$6 = $.fn[NAME$6];
  4446. var CLASS_PREFIX = 'bs-tooltip';
  4447. var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
  4448. var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
  4449. var DefaultType$4 = {
  4450. animation: 'boolean',
  4451. template: 'string',
  4452. title: '(string|element|function)',
  4453. trigger: 'string',
  4454. delay: '(number|object)',
  4455. html: 'boolean',
  4456. selector: '(string|boolean)',
  4457. placement: '(string|function)',
  4458. offset: '(number|string|function)',
  4459. container: '(string|element|boolean)',
  4460. fallbackPlacement: '(string|array)',
  4461. boundary: '(string|element)',
  4462. sanitize: 'boolean',
  4463. sanitizeFn: '(null|function)',
  4464. whiteList: 'object',
  4465. popperConfig: '(null|object)'
  4466. };
  4467. var AttachmentMap$1 = {
  4468. AUTO: 'auto',
  4469. TOP: 'top',
  4470. RIGHT: 'right',
  4471. BOTTOM: 'bottom',
  4472. LEFT: 'left'
  4473. };
  4474. var Default$4 = {
  4475. animation: true,
  4476. template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
  4477. trigger: 'hover focus',
  4478. title: '',
  4479. delay: 0,
  4480. html: false,
  4481. selector: false,
  4482. placement: 'top',
  4483. offset: 0,
  4484. container: false,
  4485. fallbackPlacement: 'flip',
  4486. boundary: 'scrollParent',
  4487. sanitize: true,
  4488. sanitizeFn: null,
  4489. whiteList: DefaultWhitelist,
  4490. popperConfig: null
  4491. };
  4492. var HoverState = {
  4493. SHOW: 'show',
  4494. OUT: 'out'
  4495. };
  4496. var Event$6 = {
  4497. HIDE: "hide" + EVENT_KEY$6,
  4498. HIDDEN: "hidden" + EVENT_KEY$6,
  4499. SHOW: "show" + EVENT_KEY$6,
  4500. SHOWN: "shown" + EVENT_KEY$6,
  4501. INSERTED: "inserted" + EVENT_KEY$6,
  4502. CLICK: "click" + EVENT_KEY$6,
  4503. FOCUSIN: "focusin" + EVENT_KEY$6,
  4504. FOCUSOUT: "focusout" + EVENT_KEY$6,
  4505. MOUSEENTER: "mouseenter" + EVENT_KEY$6,
  4506. MOUSELEAVE: "mouseleave" + EVENT_KEY$6
  4507. };
  4508. var ClassName$6 = {
  4509. FADE: 'fade',
  4510. SHOW: 'show'
  4511. };
  4512. var Selector$6 = {
  4513. TOOLTIP: '.tooltip',
  4514. TOOLTIP_INNER: '.tooltip-inner',
  4515. ARROW: '.arrow'
  4516. };
  4517. var Trigger = {
  4518. HOVER: 'hover',
  4519. FOCUS: 'focus',
  4520. CLICK: 'click',
  4521. MANUAL: 'manual'
  4522. };
  4523. /**
  4524. * ------------------------------------------------------------------------
  4525. * Class Definition
  4526. * ------------------------------------------------------------------------
  4527. */
  4528. var Tooltip =
  4529. /*#__PURE__*/
  4530. function () {
  4531. function Tooltip(element, config) {
  4532. if (typeof Popper === 'undefined') {
  4533. throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)');
  4534. } // private
  4535. this._isEnabled = true;
  4536. this._timeout = 0;
  4537. this._hoverState = '';
  4538. this._activeTrigger = {};
  4539. this._popper = null; // Protected
  4540. this.element = element;
  4541. this.config = this._getConfig(config);
  4542. this.tip = null;
  4543. this._setListeners();
  4544. } // Getters
  4545. var _proto = Tooltip.prototype;
  4546. // Public
  4547. _proto.enable = function enable() {
  4548. this._isEnabled = true;
  4549. };
  4550. _proto.disable = function disable() {
  4551. this._isEnabled = false;
  4552. };
  4553. _proto.toggleEnabled = function toggleEnabled() {
  4554. this._isEnabled = !this._isEnabled;
  4555. };
  4556. _proto.toggle = function toggle(event) {
  4557. if (!this._isEnabled) {
  4558. return;
  4559. }
  4560. if (event) {
  4561. var dataKey = this.constructor.DATA_KEY;
  4562. var context = $(event.currentTarget).data(dataKey);
  4563. if (!context) {
  4564. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4565. $(event.currentTarget).data(dataKey, context);
  4566. }
  4567. context._activeTrigger.click = !context._activeTrigger.click;
  4568. if (context._isWithActiveTrigger()) {
  4569. context._enter(null, context);
  4570. } else {
  4571. context._leave(null, context);
  4572. }
  4573. } else {
  4574. if ($(this.getTipElement()).hasClass(ClassName$6.SHOW)) {
  4575. this._leave(null, this);
  4576. return;
  4577. }
  4578. this._enter(null, this);
  4579. }
  4580. };
  4581. _proto.dispose = function dispose() {
  4582. clearTimeout(this._timeout);
  4583. $.removeData(this.element, this.constructor.DATA_KEY);
  4584. $(this.element).off(this.constructor.EVENT_KEY);
  4585. $(this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler);
  4586. if (this.tip) {
  4587. $(this.tip).remove();
  4588. }
  4589. this._isEnabled = null;
  4590. this._timeout = null;
  4591. this._hoverState = null;
  4592. this._activeTrigger = null;
  4593. if (this._popper) {
  4594. this._popper.destroy();
  4595. }
  4596. this._popper = null;
  4597. this.element = null;
  4598. this.config = null;
  4599. this.tip = null;
  4600. };
  4601. _proto.show = function show() {
  4602. var _this = this;
  4603. if ($(this.element).css('display') === 'none') {
  4604. throw new Error('Please use show on visible elements');
  4605. }
  4606. var showEvent = $.Event(this.constructor.Event.SHOW);
  4607. if (this.isWithContent() && this._isEnabled) {
  4608. $(this.element).trigger(showEvent);
  4609. var shadowRoot = Util.findShadowRoot(this.element);
  4610. var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element);
  4611. if (showEvent.isDefaultPrevented() || !isInTheDom) {
  4612. return;
  4613. }
  4614. var tip = this.getTipElement();
  4615. var tipId = Util.getUID(this.constructor.NAME);
  4616. tip.setAttribute('id', tipId);
  4617. this.element.setAttribute('aria-describedby', tipId);
  4618. this.setContent();
  4619. if (this.config.animation) {
  4620. $(tip).addClass(ClassName$6.FADE);
  4621. }
  4622. var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
  4623. var attachment = this._getAttachment(placement);
  4624. this.addAttachmentClass(attachment);
  4625. var container = this._getContainer();
  4626. $(tip).data(this.constructor.DATA_KEY, this);
  4627. if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
  4628. $(tip).appendTo(container);
  4629. }
  4630. $(this.element).trigger(this.constructor.Event.INSERTED);
  4631. this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment));
  4632. $(tip).addClass(ClassName$6.SHOW); // If this is a touch-enabled device we add extra
  4633. // empty mouseover listeners to the body's immediate children;
  4634. // only needed because of broken event delegation on iOS
  4635. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  4636. if ('ontouchstart' in document.documentElement) {
  4637. $(document.body).children().on('mouseover', null, $.noop);
  4638. }
  4639. var complete = function complete() {
  4640. if (_this.config.animation) {
  4641. _this._fixTransition();
  4642. }
  4643. var prevHoverState = _this._hoverState;
  4644. _this._hoverState = null;
  4645. $(_this.element).trigger(_this.constructor.Event.SHOWN);
  4646. if (prevHoverState === HoverState.OUT) {
  4647. _this._leave(null, _this);
  4648. }
  4649. };
  4650. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  4651. var transitionDuration = Util.getTransitionDurationFromElement(this.tip);
  4652. $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4653. } else {
  4654. complete();
  4655. }
  4656. }
  4657. };
  4658. _proto.hide = function hide(callback) {
  4659. var _this2 = this;
  4660. var tip = this.getTipElement();
  4661. var hideEvent = $.Event(this.constructor.Event.HIDE);
  4662. var complete = function complete() {
  4663. if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) {
  4664. tip.parentNode.removeChild(tip);
  4665. }
  4666. _this2._cleanTipClass();
  4667. _this2.element.removeAttribute('aria-describedby');
  4668. $(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
  4669. if (_this2._popper !== null) {
  4670. _this2._popper.destroy();
  4671. }
  4672. if (callback) {
  4673. callback();
  4674. }
  4675. };
  4676. $(this.element).trigger(hideEvent);
  4677. if (hideEvent.isDefaultPrevented()) {
  4678. return;
  4679. }
  4680. $(tip).removeClass(ClassName$6.SHOW); // If this is a touch-enabled device we remove the extra
  4681. // empty mouseover listeners we added for iOS support
  4682. if ('ontouchstart' in document.documentElement) {
  4683. $(document.body).children().off('mouseover', null, $.noop);
  4684. }
  4685. this._activeTrigger[Trigger.CLICK] = false;
  4686. this._activeTrigger[Trigger.FOCUS] = false;
  4687. this._activeTrigger[Trigger.HOVER] = false;
  4688. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  4689. var transitionDuration = Util.getTransitionDurationFromElement(tip);
  4690. $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4691. } else {
  4692. complete();
  4693. }
  4694. this._hoverState = '';
  4695. };
  4696. _proto.update = function update() {
  4697. if (this._popper !== null) {
  4698. this._popper.scheduleUpdate();
  4699. }
  4700. } // Protected
  4701. ;
  4702. _proto.isWithContent = function isWithContent() {
  4703. return Boolean(this.getTitle());
  4704. };
  4705. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  4706. $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
  4707. };
  4708. _proto.getTipElement = function getTipElement() {
  4709. this.tip = this.tip || $(this.config.template)[0];
  4710. return this.tip;
  4711. };
  4712. _proto.setContent = function setContent() {
  4713. var tip = this.getTipElement();
  4714. this.setElementContent($(tip.querySelectorAll(Selector$6.TOOLTIP_INNER)), this.getTitle());
  4715. $(tip).removeClass(ClassName$6.FADE + " " + ClassName$6.SHOW);
  4716. };
  4717. _proto.setElementContent = function setElementContent($element, content) {
  4718. if (typeof content === 'object' && (content.nodeType || content.jquery)) {
  4719. // Content is a DOM node or a jQuery
  4720. if (this.config.html) {
  4721. if (!$(content).parent().is($element)) {
  4722. $element.empty().append(content);
  4723. }
  4724. } else {
  4725. $element.text($(content).text());
  4726. }
  4727. return;
  4728. }
  4729. if (this.config.html) {
  4730. if (this.config.sanitize) {
  4731. content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);
  4732. }
  4733. $element.html(content);
  4734. } else {
  4735. $element.text(content);
  4736. }
  4737. };
  4738. _proto.getTitle = function getTitle() {
  4739. var title = this.element.getAttribute('data-original-title');
  4740. if (!title) {
  4741. title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
  4742. }
  4743. return title;
  4744. } // Private
  4745. ;
  4746. _proto._getPopperConfig = function _getPopperConfig(attachment) {
  4747. var _this3 = this;
  4748. var defaultBsConfig = {
  4749. placement: attachment,
  4750. modifiers: {
  4751. offset: this._getOffset(),
  4752. flip: {
  4753. behavior: this.config.fallbackPlacement
  4754. },
  4755. arrow: {
  4756. element: Selector$6.ARROW
  4757. },
  4758. preventOverflow: {
  4759. boundariesElement: this.config.boundary
  4760. }
  4761. },
  4762. onCreate: function onCreate(data) {
  4763. if (data.originalPlacement !== data.placement) {
  4764. _this3._handlePopperPlacementChange(data);
  4765. }
  4766. },
  4767. onUpdate: function onUpdate(data) {
  4768. return _this3._handlePopperPlacementChange(data);
  4769. }
  4770. };
  4771. return _objectSpread2({}, defaultBsConfig, {}, this.config.popperConfig);
  4772. };
  4773. _proto._getOffset = function _getOffset() {
  4774. var _this4 = this;
  4775. var offset = {};
  4776. if (typeof this.config.offset === 'function') {
  4777. offset.fn = function (data) {
  4778. data.offsets = _objectSpread2({}, data.offsets, {}, _this4.config.offset(data.offsets, _this4.element) || {});
  4779. return data;
  4780. };
  4781. } else {
  4782. offset.offset = this.config.offset;
  4783. }
  4784. return offset;
  4785. };
  4786. _proto._getContainer = function _getContainer() {
  4787. if (this.config.container === false) {
  4788. return document.body;
  4789. }
  4790. if (Util.isElement(this.config.container)) {
  4791. return $(this.config.container);
  4792. }
  4793. return $(document).find(this.config.container);
  4794. };
  4795. _proto._getAttachment = function _getAttachment(placement) {
  4796. return AttachmentMap$1[placement.toUpperCase()];
  4797. };
  4798. _proto._setListeners = function _setListeners() {
  4799. var _this5 = this;
  4800. var triggers = this.config.trigger.split(' ');
  4801. triggers.forEach(function (trigger) {
  4802. if (trigger === 'click') {
  4803. $(_this5.element).on(_this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
  4804. return _this5.toggle(event);
  4805. });
  4806. } else if (trigger !== Trigger.MANUAL) {
  4807. var eventIn = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
  4808. var eventOut = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
  4809. $(_this5.element).on(eventIn, _this5.config.selector, function (event) {
  4810. return _this5._enter(event);
  4811. }).on(eventOut, _this5.config.selector, function (event) {
  4812. return _this5._leave(event);
  4813. });
  4814. }
  4815. });
  4816. this._hideModalHandler = function () {
  4817. if (_this5.element) {
  4818. _this5.hide();
  4819. }
  4820. };
  4821. $(this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler);
  4822. if (this.config.selector) {
  4823. this.config = _objectSpread2({}, this.config, {
  4824. trigger: 'manual',
  4825. selector: ''
  4826. });
  4827. } else {
  4828. this._fixTitle();
  4829. }
  4830. };
  4831. _proto._fixTitle = function _fixTitle() {
  4832. var titleType = typeof this.element.getAttribute('data-original-title');
  4833. if (this.element.getAttribute('title') || titleType !== 'string') {
  4834. this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
  4835. this.element.setAttribute('title', '');
  4836. }
  4837. };
  4838. _proto._enter = function _enter(event, context) {
  4839. var dataKey = this.constructor.DATA_KEY;
  4840. context = context || $(event.currentTarget).data(dataKey);
  4841. if (!context) {
  4842. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4843. $(event.currentTarget).data(dataKey, context);
  4844. }
  4845. if (event) {
  4846. context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
  4847. }
  4848. if ($(context.getTipElement()).hasClass(ClassName$6.SHOW) || context._hoverState === HoverState.SHOW) {
  4849. context._hoverState = HoverState.SHOW;
  4850. return;
  4851. }
  4852. clearTimeout(context._timeout);
  4853. context._hoverState = HoverState.SHOW;
  4854. if (!context.config.delay || !context.config.delay.show) {
  4855. context.show();
  4856. return;
  4857. }
  4858. context._timeout = setTimeout(function () {
  4859. if (context._hoverState === HoverState.SHOW) {
  4860. context.show();
  4861. }
  4862. }, context.config.delay.show);
  4863. };
  4864. _proto._leave = function _leave(event, context) {
  4865. var dataKey = this.constructor.DATA_KEY;
  4866. context = context || $(event.currentTarget).data(dataKey);
  4867. if (!context) {
  4868. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4869. $(event.currentTarget).data(dataKey, context);
  4870. }
  4871. if (event) {
  4872. context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
  4873. }
  4874. if (context._isWithActiveTrigger()) {
  4875. return;
  4876. }
  4877. clearTimeout(context._timeout);
  4878. context._hoverState = HoverState.OUT;
  4879. if (!context.config.delay || !context.config.delay.hide) {
  4880. context.hide();
  4881. return;
  4882. }
  4883. context._timeout = setTimeout(function () {
  4884. if (context._hoverState === HoverState.OUT) {
  4885. context.hide();
  4886. }
  4887. }, context.config.delay.hide);
  4888. };
  4889. _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
  4890. for (var trigger in this._activeTrigger) {
  4891. if (this._activeTrigger[trigger]) {
  4892. return true;
  4893. }
  4894. }
  4895. return false;
  4896. };
  4897. _proto._getConfig = function _getConfig(config) {
  4898. var dataAttributes = $(this.element).data();
  4899. Object.keys(dataAttributes).forEach(function (dataAttr) {
  4900. if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
  4901. delete dataAttributes[dataAttr];
  4902. }
  4903. });
  4904. config = _objectSpread2({}, this.constructor.Default, {}, dataAttributes, {}, typeof config === 'object' && config ? config : {});
  4905. if (typeof config.delay === 'number') {
  4906. config.delay = {
  4907. show: config.delay,
  4908. hide: config.delay
  4909. };
  4910. }
  4911. if (typeof config.title === 'number') {
  4912. config.title = config.title.toString();
  4913. }
  4914. if (typeof config.content === 'number') {
  4915. config.content = config.content.toString();
  4916. }
  4917. Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
  4918. if (config.sanitize) {
  4919. config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
  4920. }
  4921. return config;
  4922. };
  4923. _proto._getDelegateConfig = function _getDelegateConfig() {
  4924. var config = {};
  4925. if (this.config) {
  4926. for (var key in this.config) {
  4927. if (this.constructor.Default[key] !== this.config[key]) {
  4928. config[key] = this.config[key];
  4929. }
  4930. }
  4931. }
  4932. return config;
  4933. };
  4934. _proto._cleanTipClass = function _cleanTipClass() {
  4935. var $tip = $(this.getTipElement());
  4936. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
  4937. if (tabClass !== null && tabClass.length) {
  4938. $tip.removeClass(tabClass.join(''));
  4939. }
  4940. };
  4941. _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
  4942. var popperInstance = popperData.instance;
  4943. this.tip = popperInstance.popper;
  4944. this._cleanTipClass();
  4945. this.addAttachmentClass(this._getAttachment(popperData.placement));
  4946. };
  4947. _proto._fixTransition = function _fixTransition() {
  4948. var tip = this.getTipElement();
  4949. var initConfigAnimation = this.config.animation;
  4950. if (tip.getAttribute('x-placement') !== null) {
  4951. return;
  4952. }
  4953. $(tip).removeClass(ClassName$6.FADE);
  4954. this.config.animation = false;
  4955. this.hide();
  4956. this.show();
  4957. this.config.animation = initConfigAnimation;
  4958. } // Static
  4959. ;
  4960. Tooltip._jQueryInterface = function _jQueryInterface(config) {
  4961. return this.each(function () {
  4962. var data = $(this).data(DATA_KEY$6);
  4963. var _config = typeof config === 'object' && config;
  4964. if (!data && /dispose|hide/.test(config)) {
  4965. return;
  4966. }
  4967. if (!data) {
  4968. data = new Tooltip(this, _config);
  4969. $(this).data(DATA_KEY$6, data);
  4970. }
  4971. if (typeof config === 'string') {
  4972. if (typeof data[config] === 'undefined') {
  4973. throw new TypeError("No method named \"" + config + "\"");
  4974. }
  4975. data[config]();
  4976. }
  4977. });
  4978. };
  4979. _createClass(Tooltip, null, [{
  4980. key: "VERSION",
  4981. get: function get() {
  4982. return VERSION$6;
  4983. }
  4984. }, {
  4985. key: "Default",
  4986. get: function get() {
  4987. return Default$4;
  4988. }
  4989. }, {
  4990. key: "NAME",
  4991. get: function get() {
  4992. return NAME$6;
  4993. }
  4994. }, {
  4995. key: "DATA_KEY",
  4996. get: function get() {
  4997. return DATA_KEY$6;
  4998. }
  4999. }, {
  5000. key: "Event",
  5001. get: function get() {
  5002. return Event$6;
  5003. }
  5004. }, {
  5005. key: "EVENT_KEY",
  5006. get: function get() {
  5007. return EVENT_KEY$6;
  5008. }
  5009. }, {
  5010. key: "DefaultType",
  5011. get: function get() {
  5012. return DefaultType$4;
  5013. }
  5014. }]);
  5015. return Tooltip;
  5016. }();
  5017. /**
  5018. * ------------------------------------------------------------------------
  5019. * jQuery
  5020. * ------------------------------------------------------------------------
  5021. */
  5022. $.fn[NAME$6] = Tooltip._jQueryInterface;
  5023. $.fn[NAME$6].Constructor = Tooltip;
  5024. $.fn[NAME$6].noConflict = function () {
  5025. $.fn[NAME$6] = JQUERY_NO_CONFLICT$6;
  5026. return Tooltip._jQueryInterface;
  5027. };
  5028. /**
  5029. * ------------------------------------------------------------------------
  5030. * Constants
  5031. * ------------------------------------------------------------------------
  5032. */
  5033. var NAME$7 = 'popover';
  5034. var VERSION$7 = '4.4.1';
  5035. var DATA_KEY$7 = 'bs.popover';
  5036. var EVENT_KEY$7 = "." + DATA_KEY$7;
  5037. var JQUERY_NO_CONFLICT$7 = $.fn[NAME$7];
  5038. var CLASS_PREFIX$1 = 'bs-popover';
  5039. var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g');
  5040. var Default$5 = _objectSpread2({}, Tooltip.Default, {
  5041. placement: 'right',
  5042. trigger: 'click',
  5043. content: '',
  5044. template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
  5045. });
  5046. var DefaultType$5 = _objectSpread2({}, Tooltip.DefaultType, {
  5047. content: '(string|element|function)'
  5048. });
  5049. var ClassName$7 = {
  5050. FADE: 'fade',
  5051. SHOW: 'show'
  5052. };
  5053. var Selector$7 = {
  5054. TITLE: '.popover-header',
  5055. CONTENT: '.popover-body'
  5056. };
  5057. var Event$7 = {
  5058. HIDE: "hide" + EVENT_KEY$7,
  5059. HIDDEN: "hidden" + EVENT_KEY$7,
  5060. SHOW: "show" + EVENT_KEY$7,
  5061. SHOWN: "shown" + EVENT_KEY$7,
  5062. INSERTED: "inserted" + EVENT_KEY$7,
  5063. CLICK: "click" + EVENT_KEY$7,
  5064. FOCUSIN: "focusin" + EVENT_KEY$7,
  5065. FOCUSOUT: "focusout" + EVENT_KEY$7,
  5066. MOUSEENTER: "mouseenter" + EVENT_KEY$7,
  5067. MOUSELEAVE: "mouseleave" + EVENT_KEY$7
  5068. };
  5069. /**
  5070. * ------------------------------------------------------------------------
  5071. * Class Definition
  5072. * ------------------------------------------------------------------------
  5073. */
  5074. var Popover =
  5075. /*#__PURE__*/
  5076. function (_Tooltip) {
  5077. _inheritsLoose(Popover, _Tooltip);
  5078. function Popover() {
  5079. return _Tooltip.apply(this, arguments) || this;
  5080. }
  5081. var _proto = Popover.prototype;
  5082. // Overrides
  5083. _proto.isWithContent = function isWithContent() {
  5084. return this.getTitle() || this._getContent();
  5085. };
  5086. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  5087. $(this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment);
  5088. };
  5089. _proto.getTipElement = function getTipElement() {
  5090. this.tip = this.tip || $(this.config.template)[0];
  5091. return this.tip;
  5092. };
  5093. _proto.setContent = function setContent() {
  5094. var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events
  5095. this.setElementContent($tip.find(Selector$7.TITLE), this.getTitle());
  5096. var content = this._getContent();
  5097. if (typeof content === 'function') {
  5098. content = content.call(this.element);
  5099. }
  5100. this.setElementContent($tip.find(Selector$7.CONTENT), content);
  5101. $tip.removeClass(ClassName$7.FADE + " " + ClassName$7.SHOW);
  5102. } // Private
  5103. ;
  5104. _proto._getContent = function _getContent() {
  5105. return this.element.getAttribute('data-content') || this.config.content;
  5106. };
  5107. _proto._cleanTipClass = function _cleanTipClass() {
  5108. var $tip = $(this.getTipElement());
  5109. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1);
  5110. if (tabClass !== null && tabClass.length > 0) {
  5111. $tip.removeClass(tabClass.join(''));
  5112. }
  5113. } // Static
  5114. ;
  5115. Popover._jQueryInterface = function _jQueryInterface(config) {
  5116. return this.each(function () {
  5117. var data = $(this).data(DATA_KEY$7);
  5118. var _config = typeof config === 'object' ? config : null;
  5119. if (!data && /dispose|hide/.test(config)) {
  5120. return;
  5121. }
  5122. if (!data) {
  5123. data = new Popover(this, _config);
  5124. $(this).data(DATA_KEY$7, data);
  5125. }
  5126. if (typeof config === 'string') {
  5127. if (typeof data[config] === 'undefined') {
  5128. throw new TypeError("No method named \"" + config + "\"");
  5129. }
  5130. data[config]();
  5131. }
  5132. });
  5133. };
  5134. _createClass(Popover, null, [{
  5135. key: "VERSION",
  5136. // Getters
  5137. get: function get() {
  5138. return VERSION$7;
  5139. }
  5140. }, {
  5141. key: "Default",
  5142. get: function get() {
  5143. return Default$5;
  5144. }
  5145. }, {
  5146. key: "NAME",
  5147. get: function get() {
  5148. return NAME$7;
  5149. }
  5150. }, {
  5151. key: "DATA_KEY",
  5152. get: function get() {
  5153. return DATA_KEY$7;
  5154. }
  5155. }, {
  5156. key: "Event",
  5157. get: function get() {
  5158. return Event$7;
  5159. }
  5160. }, {
  5161. key: "EVENT_KEY",
  5162. get: function get() {
  5163. return EVENT_KEY$7;
  5164. }
  5165. }, {
  5166. key: "DefaultType",
  5167. get: function get() {
  5168. return DefaultType$5;
  5169. }
  5170. }]);
  5171. return Popover;
  5172. }(Tooltip);
  5173. /**
  5174. * ------------------------------------------------------------------------
  5175. * jQuery
  5176. * ------------------------------------------------------------------------
  5177. */
  5178. $.fn[NAME$7] = Popover._jQueryInterface;
  5179. $.fn[NAME$7].Constructor = Popover;
  5180. $.fn[NAME$7].noConflict = function () {
  5181. $.fn[NAME$7] = JQUERY_NO_CONFLICT$7;
  5182. return Popover._jQueryInterface;
  5183. };
  5184. /**
  5185. * ------------------------------------------------------------------------
  5186. * Constants
  5187. * ------------------------------------------------------------------------
  5188. */
  5189. var NAME$8 = 'scrollspy';
  5190. var VERSION$8 = '4.4.1';
  5191. var DATA_KEY$8 = 'bs.scrollspy';
  5192. var EVENT_KEY$8 = "." + DATA_KEY$8;
  5193. var DATA_API_KEY$6 = '.data-api';
  5194. var JQUERY_NO_CONFLICT$8 = $.fn[NAME$8];
  5195. var Default$6 = {
  5196. offset: 10,
  5197. method: 'auto',
  5198. target: ''
  5199. };
  5200. var DefaultType$6 = {
  5201. offset: 'number',
  5202. method: 'string',
  5203. target: '(string|element)'
  5204. };
  5205. var Event$8 = {
  5206. ACTIVATE: "activate" + EVENT_KEY$8,
  5207. SCROLL: "scroll" + EVENT_KEY$8,
  5208. LOAD_DATA_API: "load" + EVENT_KEY$8 + DATA_API_KEY$6
  5209. };
  5210. var ClassName$8 = {
  5211. DROPDOWN_ITEM: 'dropdown-item',
  5212. DROPDOWN_MENU: 'dropdown-menu',
  5213. ACTIVE: 'active'
  5214. };
  5215. var Selector$8 = {
  5216. DATA_SPY: '[data-spy="scroll"]',
  5217. ACTIVE: '.active',
  5218. NAV_LIST_GROUP: '.nav, .list-group',
  5219. NAV_LINKS: '.nav-link',
  5220. NAV_ITEMS: '.nav-item',
  5221. LIST_ITEMS: '.list-group-item',
  5222. DROPDOWN: '.dropdown',
  5223. DROPDOWN_ITEMS: '.dropdown-item',
  5224. DROPDOWN_TOGGLE: '.dropdown-toggle'
  5225. };
  5226. var OffsetMethod = {
  5227. OFFSET: 'offset',
  5228. POSITION: 'position'
  5229. };
  5230. /**
  5231. * ------------------------------------------------------------------------
  5232. * Class Definition
  5233. * ------------------------------------------------------------------------
  5234. */
  5235. var ScrollSpy =
  5236. /*#__PURE__*/
  5237. function () {
  5238. function ScrollSpy(element, config) {
  5239. var _this = this;
  5240. this._element = element;
  5241. this._scrollElement = element.tagName === 'BODY' ? window : element;
  5242. this._config = this._getConfig(config);
  5243. this._selector = this._config.target + " " + Selector$8.NAV_LINKS + "," + (this._config.target + " " + Selector$8.LIST_ITEMS + ",") + (this._config.target + " " + Selector$8.DROPDOWN_ITEMS);
  5244. this._offsets = [];
  5245. this._targets = [];
  5246. this._activeTarget = null;
  5247. this._scrollHeight = 0;
  5248. $(this._scrollElement).on(Event$8.SCROLL, function (event) {
  5249. return _this._process(event);
  5250. });
  5251. this.refresh();
  5252. this._process();
  5253. } // Getters
  5254. var _proto = ScrollSpy.prototype;
  5255. // Public
  5256. _proto.refresh = function refresh() {
  5257. var _this2 = this;
  5258. var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION;
  5259. var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
  5260. var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
  5261. this._offsets = [];
  5262. this._targets = [];
  5263. this._scrollHeight = this._getScrollHeight();
  5264. var targets = [].slice.call(document.querySelectorAll(this._selector));
  5265. targets.map(function (element) {
  5266. var target;
  5267. var targetSelector = Util.getSelectorFromElement(element);
  5268. if (targetSelector) {
  5269. target = document.querySelector(targetSelector);
  5270. }
  5271. if (target) {
  5272. var targetBCR = target.getBoundingClientRect();
  5273. if (targetBCR.width || targetBCR.height) {
  5274. // TODO (fat): remove sketch reliance on jQuery position/offset
  5275. return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
  5276. }
  5277. }
  5278. return null;
  5279. }).filter(function (item) {
  5280. return item;
  5281. }).sort(function (a, b) {
  5282. return a[0] - b[0];
  5283. }).forEach(function (item) {
  5284. _this2._offsets.push(item[0]);
  5285. _this2._targets.push(item[1]);
  5286. });
  5287. };
  5288. _proto.dispose = function dispose() {
  5289. $.removeData(this._element, DATA_KEY$8);
  5290. $(this._scrollElement).off(EVENT_KEY$8);
  5291. this._element = null;
  5292. this._scrollElement = null;
  5293. this._config = null;
  5294. this._selector = null;
  5295. this._offsets = null;
  5296. this._targets = null;
  5297. this._activeTarget = null;
  5298. this._scrollHeight = null;
  5299. } // Private
  5300. ;
  5301. _proto._getConfig = function _getConfig(config) {
  5302. config = _objectSpread2({}, Default$6, {}, typeof config === 'object' && config ? config : {});
  5303. if (typeof config.target !== 'string') {
  5304. var id = $(config.target).attr('id');
  5305. if (!id) {
  5306. id = Util.getUID(NAME$8);
  5307. $(config.target).attr('id', id);
  5308. }
  5309. config.target = "#" + id;
  5310. }
  5311. Util.typeCheckConfig(NAME$8, config, DefaultType$6);
  5312. return config;
  5313. };
  5314. _proto._getScrollTop = function _getScrollTop() {
  5315. return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
  5316. };
  5317. _proto._getScrollHeight = function _getScrollHeight() {
  5318. return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
  5319. };
  5320. _proto._getOffsetHeight = function _getOffsetHeight() {
  5321. return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
  5322. };
  5323. _proto._process = function _process() {
  5324. var scrollTop = this._getScrollTop() + this._config.offset;
  5325. var scrollHeight = this._getScrollHeight();
  5326. var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
  5327. if (this._scrollHeight !== scrollHeight) {
  5328. this.refresh();
  5329. }
  5330. if (scrollTop >= maxScroll) {
  5331. var target = this._targets[this._targets.length - 1];
  5332. if (this._activeTarget !== target) {
  5333. this._activate(target);
  5334. }
  5335. return;
  5336. }
  5337. if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
  5338. this._activeTarget = null;
  5339. this._clear();
  5340. return;
  5341. }
  5342. var offsetLength = this._offsets.length;
  5343. for (var i = offsetLength; i--;) {
  5344. var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
  5345. if (isActiveTarget) {
  5346. this._activate(this._targets[i]);
  5347. }
  5348. }
  5349. };
  5350. _proto._activate = function _activate(target) {
  5351. this._activeTarget = target;
  5352. this._clear();
  5353. var queries = this._selector.split(',').map(function (selector) {
  5354. return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
  5355. });
  5356. var $link = $([].slice.call(document.querySelectorAll(queries.join(','))));
  5357. if ($link.hasClass(ClassName$8.DROPDOWN_ITEM)) {
  5358. $link.closest(Selector$8.DROPDOWN).find(Selector$8.DROPDOWN_TOGGLE).addClass(ClassName$8.ACTIVE);
  5359. $link.addClass(ClassName$8.ACTIVE);
  5360. } else {
  5361. // Set triggered link as active
  5362. $link.addClass(ClassName$8.ACTIVE); // Set triggered links parents as active
  5363. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  5364. $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
  5365. $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_ITEMS).children(Selector$8.NAV_LINKS).addClass(ClassName$8.ACTIVE);
  5366. }
  5367. $(this._scrollElement).trigger(Event$8.ACTIVATE, {
  5368. relatedTarget: target
  5369. });
  5370. };
  5371. _proto._clear = function _clear() {
  5372. [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) {
  5373. return node.classList.contains(ClassName$8.ACTIVE);
  5374. }).forEach(function (node) {
  5375. return node.classList.remove(ClassName$8.ACTIVE);
  5376. });
  5377. } // Static
  5378. ;
  5379. ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
  5380. return this.each(function () {
  5381. var data = $(this).data(DATA_KEY$8);
  5382. var _config = typeof config === 'object' && config;
  5383. if (!data) {
  5384. data = new ScrollSpy(this, _config);
  5385. $(this).data(DATA_KEY$8, data);
  5386. }
  5387. if (typeof config === 'string') {
  5388. if (typeof data[config] === 'undefined') {
  5389. throw new TypeError("No method named \"" + config + "\"");
  5390. }
  5391. data[config]();
  5392. }
  5393. });
  5394. };
  5395. _createClass(ScrollSpy, null, [{
  5396. key: "VERSION",
  5397. get: function get() {
  5398. return VERSION$8;
  5399. }
  5400. }, {
  5401. key: "Default",
  5402. get: function get() {
  5403. return Default$6;
  5404. }
  5405. }]);
  5406. return ScrollSpy;
  5407. }();
  5408. /**
  5409. * ------------------------------------------------------------------------
  5410. * Data Api implementation
  5411. * ------------------------------------------------------------------------
  5412. */
  5413. $(window).on(Event$8.LOAD_DATA_API, function () {
  5414. var scrollSpys = [].slice.call(document.querySelectorAll(Selector$8.DATA_SPY));
  5415. var scrollSpysLength = scrollSpys.length;
  5416. for (var i = scrollSpysLength; i--;) {
  5417. var $spy = $(scrollSpys[i]);
  5418. ScrollSpy._jQueryInterface.call($spy, $spy.data());
  5419. }
  5420. });
  5421. /**
  5422. * ------------------------------------------------------------------------
  5423. * jQuery
  5424. * ------------------------------------------------------------------------
  5425. */
  5426. $.fn[NAME$8] = ScrollSpy._jQueryInterface;
  5427. $.fn[NAME$8].Constructor = ScrollSpy;
  5428. $.fn[NAME$8].noConflict = function () {
  5429. $.fn[NAME$8] = JQUERY_NO_CONFLICT$8;
  5430. return ScrollSpy._jQueryInterface;
  5431. };
  5432. /**
  5433. * ------------------------------------------------------------------------
  5434. * Constants
  5435. * ------------------------------------------------------------------------
  5436. */
  5437. var NAME$9 = 'tab';
  5438. var VERSION$9 = '4.4.1';
  5439. var DATA_KEY$9 = 'bs.tab';
  5440. var EVENT_KEY$9 = "." + DATA_KEY$9;
  5441. var DATA_API_KEY$7 = '.data-api';
  5442. var JQUERY_NO_CONFLICT$9 = $.fn[NAME$9];
  5443. var Event$9 = {
  5444. HIDE: "hide" + EVENT_KEY$9,
  5445. HIDDEN: "hidden" + EVENT_KEY$9,
  5446. SHOW: "show" + EVENT_KEY$9,
  5447. SHOWN: "shown" + EVENT_KEY$9,
  5448. CLICK_DATA_API: "click" + EVENT_KEY$9 + DATA_API_KEY$7
  5449. };
  5450. var ClassName$9 = {
  5451. DROPDOWN_MENU: 'dropdown-menu',
  5452. ACTIVE: 'active',
  5453. DISABLED: 'disabled',
  5454. FADE: 'fade',
  5455. SHOW: 'show'
  5456. };
  5457. var Selector$9 = {
  5458. DROPDOWN: '.dropdown',
  5459. NAV_LIST_GROUP: '.nav, .list-group',
  5460. ACTIVE: '.active',
  5461. ACTIVE_UL: '> li > .active',
  5462. DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
  5463. DROPDOWN_TOGGLE: '.dropdown-toggle',
  5464. DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
  5465. };
  5466. /**
  5467. * ------------------------------------------------------------------------
  5468. * Class Definition
  5469. * ------------------------------------------------------------------------
  5470. */
  5471. var Tab =
  5472. /*#__PURE__*/
  5473. function () {
  5474. function Tab(element) {
  5475. this._element = element;
  5476. } // Getters
  5477. var _proto = Tab.prototype;
  5478. // Public
  5479. _proto.show = function show() {
  5480. var _this = this;
  5481. if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName$9.ACTIVE) || $(this._element).hasClass(ClassName$9.DISABLED)) {
  5482. return;
  5483. }
  5484. var target;
  5485. var previous;
  5486. var listElement = $(this._element).closest(Selector$9.NAV_LIST_GROUP)[0];
  5487. var selector = Util.getSelectorFromElement(this._element);
  5488. if (listElement) {
  5489. var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector$9.ACTIVE_UL : Selector$9.ACTIVE;
  5490. previous = $.makeArray($(listElement).find(itemSelector));
  5491. previous = previous[previous.length - 1];
  5492. }
  5493. var hideEvent = $.Event(Event$9.HIDE, {
  5494. relatedTarget: this._element
  5495. });
  5496. var showEvent = $.Event(Event$9.SHOW, {
  5497. relatedTarget: previous
  5498. });
  5499. if (previous) {
  5500. $(previous).trigger(hideEvent);
  5501. }
  5502. $(this._element).trigger(showEvent);
  5503. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
  5504. return;
  5505. }
  5506. if (selector) {
  5507. target = document.querySelector(selector);
  5508. }
  5509. this._activate(this._element, listElement);
  5510. var complete = function complete() {
  5511. var hiddenEvent = $.Event(Event$9.HIDDEN, {
  5512. relatedTarget: _this._element
  5513. });
  5514. var shownEvent = $.Event(Event$9.SHOWN, {
  5515. relatedTarget: previous
  5516. });
  5517. $(previous).trigger(hiddenEvent);
  5518. $(_this._element).trigger(shownEvent);
  5519. };
  5520. if (target) {
  5521. this._activate(target, target.parentNode, complete);
  5522. } else {
  5523. complete();
  5524. }
  5525. };
  5526. _proto.dispose = function dispose() {
  5527. $.removeData(this._element, DATA_KEY$9);
  5528. this._element = null;
  5529. } // Private
  5530. ;
  5531. _proto._activate = function _activate(element, container, callback) {
  5532. var _this2 = this;
  5533. var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $(container).find(Selector$9.ACTIVE_UL) : $(container).children(Selector$9.ACTIVE);
  5534. var active = activeElements[0];
  5535. var isTransitioning = callback && active && $(active).hasClass(ClassName$9.FADE);
  5536. var complete = function complete() {
  5537. return _this2._transitionComplete(element, active, callback);
  5538. };
  5539. if (active && isTransitioning) {
  5540. var transitionDuration = Util.getTransitionDurationFromElement(active);
  5541. $(active).removeClass(ClassName$9.SHOW).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5542. } else {
  5543. complete();
  5544. }
  5545. };
  5546. _proto._transitionComplete = function _transitionComplete(element, active, callback) {
  5547. if (active) {
  5548. $(active).removeClass(ClassName$9.ACTIVE);
  5549. var dropdownChild = $(active.parentNode).find(Selector$9.DROPDOWN_ACTIVE_CHILD)[0];
  5550. if (dropdownChild) {
  5551. $(dropdownChild).removeClass(ClassName$9.ACTIVE);
  5552. }
  5553. if (active.getAttribute('role') === 'tab') {
  5554. active.setAttribute('aria-selected', false);
  5555. }
  5556. }
  5557. $(element).addClass(ClassName$9.ACTIVE);
  5558. if (element.getAttribute('role') === 'tab') {
  5559. element.setAttribute('aria-selected', true);
  5560. }
  5561. Util.reflow(element);
  5562. if (element.classList.contains(ClassName$9.FADE)) {
  5563. element.classList.add(ClassName$9.SHOW);
  5564. }
  5565. if (element.parentNode && $(element.parentNode).hasClass(ClassName$9.DROPDOWN_MENU)) {
  5566. var dropdownElement = $(element).closest(Selector$9.DROPDOWN)[0];
  5567. if (dropdownElement) {
  5568. var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector$9.DROPDOWN_TOGGLE));
  5569. $(dropdownToggleList).addClass(ClassName$9.ACTIVE);
  5570. }
  5571. element.setAttribute('aria-expanded', true);
  5572. }
  5573. if (callback) {
  5574. callback();
  5575. }
  5576. } // Static
  5577. ;
  5578. Tab._jQueryInterface = function _jQueryInterface(config) {
  5579. return this.each(function () {
  5580. var $this = $(this);
  5581. var data = $this.data(DATA_KEY$9);
  5582. if (!data) {
  5583. data = new Tab(this);
  5584. $this.data(DATA_KEY$9, data);
  5585. }
  5586. if (typeof config === 'string') {
  5587. if (typeof data[config] === 'undefined') {
  5588. throw new TypeError("No method named \"" + config + "\"");
  5589. }
  5590. data[config]();
  5591. }
  5592. });
  5593. };
  5594. _createClass(Tab, null, [{
  5595. key: "VERSION",
  5596. get: function get() {
  5597. return VERSION$9;
  5598. }
  5599. }]);
  5600. return Tab;
  5601. }();
  5602. /**
  5603. * ------------------------------------------------------------------------
  5604. * Data Api implementation
  5605. * ------------------------------------------------------------------------
  5606. */
  5607. $(document).on(Event$9.CLICK_DATA_API, Selector$9.DATA_TOGGLE, function (event) {
  5608. event.preventDefault();
  5609. Tab._jQueryInterface.call($(this), 'show');
  5610. });
  5611. /**
  5612. * ------------------------------------------------------------------------
  5613. * jQuery
  5614. * ------------------------------------------------------------------------
  5615. */
  5616. $.fn[NAME$9] = Tab._jQueryInterface;
  5617. $.fn[NAME$9].Constructor = Tab;
  5618. $.fn[NAME$9].noConflict = function () {
  5619. $.fn[NAME$9] = JQUERY_NO_CONFLICT$9;
  5620. return Tab._jQueryInterface;
  5621. };
  5622. /**
  5623. * ------------------------------------------------------------------------
  5624. * Constants
  5625. * ------------------------------------------------------------------------
  5626. */
  5627. var NAME$a = 'toast';
  5628. var VERSION$a = '4.4.1';
  5629. var DATA_KEY$a = 'bs.toast';
  5630. var EVENT_KEY$a = "." + DATA_KEY$a;
  5631. var JQUERY_NO_CONFLICT$a = $.fn[NAME$a];
  5632. var Event$a = {
  5633. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$a,
  5634. HIDE: "hide" + EVENT_KEY$a,
  5635. HIDDEN: "hidden" + EVENT_KEY$a,
  5636. SHOW: "show" + EVENT_KEY$a,
  5637. SHOWN: "shown" + EVENT_KEY$a
  5638. };
  5639. var ClassName$a = {
  5640. FADE: 'fade',
  5641. HIDE: 'hide',
  5642. SHOW: 'show',
  5643. SHOWING: 'showing'
  5644. };
  5645. var DefaultType$7 = {
  5646. animation: 'boolean',
  5647. autohide: 'boolean',
  5648. delay: 'number'
  5649. };
  5650. var Default$7 = {
  5651. animation: true,
  5652. autohide: true,
  5653. delay: 500
  5654. };
  5655. var Selector$a = {
  5656. DATA_DISMISS: '[data-dismiss="toast"]'
  5657. };
  5658. /**
  5659. * ------------------------------------------------------------------------
  5660. * Class Definition
  5661. * ------------------------------------------------------------------------
  5662. */
  5663. var Toast =
  5664. /*#__PURE__*/
  5665. function () {
  5666. function Toast(element, config) {
  5667. this._element = element;
  5668. this._config = this._getConfig(config);
  5669. this._timeout = null;
  5670. this._setListeners();
  5671. } // Getters
  5672. var _proto = Toast.prototype;
  5673. // Public
  5674. _proto.show = function show() {
  5675. var _this = this;
  5676. var showEvent = $.Event(Event$a.SHOW);
  5677. $(this._element).trigger(showEvent);
  5678. if (showEvent.isDefaultPrevented()) {
  5679. return;
  5680. }
  5681. if (this._config.animation) {
  5682. this._element.classList.add(ClassName$a.FADE);
  5683. }
  5684. var complete = function complete() {
  5685. _this._element.classList.remove(ClassName$a.SHOWING);
  5686. _this._element.classList.add(ClassName$a.SHOW);
  5687. $(_this._element).trigger(Event$a.SHOWN);
  5688. if (_this._config.autohide) {
  5689. _this._timeout = setTimeout(function () {
  5690. _this.hide();
  5691. }, _this._config.delay);
  5692. }
  5693. };
  5694. this._element.classList.remove(ClassName$a.HIDE);
  5695. Util.reflow(this._element);
  5696. this._element.classList.add(ClassName$a.SHOWING);
  5697. if (this._config.animation) {
  5698. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  5699. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5700. } else {
  5701. complete();
  5702. }
  5703. };
  5704. _proto.hide = function hide() {
  5705. if (!this._element.classList.contains(ClassName$a.SHOW)) {
  5706. return;
  5707. }
  5708. var hideEvent = $.Event(Event$a.HIDE);
  5709. $(this._element).trigger(hideEvent);
  5710. if (hideEvent.isDefaultPrevented()) {
  5711. return;
  5712. }
  5713. this._close();
  5714. };
  5715. _proto.dispose = function dispose() {
  5716. clearTimeout(this._timeout);
  5717. this._timeout = null;
  5718. if (this._element.classList.contains(ClassName$a.SHOW)) {
  5719. this._element.classList.remove(ClassName$a.SHOW);
  5720. }
  5721. $(this._element).off(Event$a.CLICK_DISMISS);
  5722. $.removeData(this._element, DATA_KEY$a);
  5723. this._element = null;
  5724. this._config = null;
  5725. } // Private
  5726. ;
  5727. _proto._getConfig = function _getConfig(config) {
  5728. config = _objectSpread2({}, Default$7, {}, $(this._element).data(), {}, typeof config === 'object' && config ? config : {});
  5729. Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
  5730. return config;
  5731. };
  5732. _proto._setListeners = function _setListeners() {
  5733. var _this2 = this;
  5734. $(this._element).on(Event$a.CLICK_DISMISS, Selector$a.DATA_DISMISS, function () {
  5735. return _this2.hide();
  5736. });
  5737. };
  5738. _proto._close = function _close() {
  5739. var _this3 = this;
  5740. var complete = function complete() {
  5741. _this3._element.classList.add(ClassName$a.HIDE);
  5742. $(_this3._element).trigger(Event$a.HIDDEN);
  5743. };
  5744. this._element.classList.remove(ClassName$a.SHOW);
  5745. if (this._config.animation) {
  5746. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  5747. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5748. } else {
  5749. complete();
  5750. }
  5751. } // Static
  5752. ;
  5753. Toast._jQueryInterface = function _jQueryInterface(config) {
  5754. return this.each(function () {
  5755. var $element = $(this);
  5756. var data = $element.data(DATA_KEY$a);
  5757. var _config = typeof config === 'object' && config;
  5758. if (!data) {
  5759. data = new Toast(this, _config);
  5760. $element.data(DATA_KEY$a, data);
  5761. }
  5762. if (typeof config === 'string') {
  5763. if (typeof data[config] === 'undefined') {
  5764. throw new TypeError("No method named \"" + config + "\"");
  5765. }
  5766. data[config](this);
  5767. }
  5768. });
  5769. };
  5770. _createClass(Toast, null, [{
  5771. key: "VERSION",
  5772. get: function get() {
  5773. return VERSION$a;
  5774. }
  5775. }, {
  5776. key: "DefaultType",
  5777. get: function get() {
  5778. return DefaultType$7;
  5779. }
  5780. }, {
  5781. key: "Default",
  5782. get: function get() {
  5783. return Default$7;
  5784. }
  5785. }]);
  5786. return Toast;
  5787. }();
  5788. /**
  5789. * ------------------------------------------------------------------------
  5790. * jQuery
  5791. * ------------------------------------------------------------------------
  5792. */
  5793. $.fn[NAME$a] = Toast._jQueryInterface;
  5794. $.fn[NAME$a].Constructor = Toast;
  5795. $.fn[NAME$a].noConflict = function () {
  5796. $.fn[NAME$a] = JQUERY_NO_CONFLICT$a;
  5797. return Toast._jQueryInterface;
  5798. };
  5799. exports.Alert = Alert;
  5800. exports.Button = Button;
  5801. exports.Carousel = Carousel;
  5802. exports.Collapse = Collapse;
  5803. exports.Dropdown = Dropdown;
  5804. exports.Modal = Modal;
  5805. exports.Popover = Popover;
  5806. exports.Scrollspy = ScrollSpy;
  5807. exports.Tab = Tab;
  5808. exports.Toast = Toast;
  5809. exports.Tooltip = Tooltip;
  5810. exports.Util = Util;
  5811. Object.defineProperty(exports, '__esModule', { value: true });
  5812. })));
  5813. //# sourceMappingURL=bootstrap.js.map
  5814. /***/ }),
  5815. /***/ "./node_modules/buffer/index.js":
  5816. /*!**************************************!*\
  5817. !*** ./node_modules/buffer/index.js ***!
  5818. \**************************************/
  5819. /*! no static exports found */
  5820. /***/ (function(module, exports, __webpack_require__) {
  5821. "use strict";
  5822. /* WEBPACK VAR INJECTION */(function(global) {/*!
  5823. * The buffer module from node.js, for the browser.
  5824. *
  5825. * @author Feross Aboukhadijeh <http://feross.org>
  5826. * @license MIT
  5827. */
  5828. /* eslint-disable no-proto */
  5829. var base64 = __webpack_require__(/*! base64-js */ "./node_modules/base64-js/index.js")
  5830. var ieee754 = __webpack_require__(/*! ieee754 */ "./node_modules/ieee754/index.js")
  5831. var isArray = __webpack_require__(/*! isarray */ "./node_modules/isarray/index.js")
  5832. exports.Buffer = Buffer
  5833. exports.SlowBuffer = SlowBuffer
  5834. exports.INSPECT_MAX_BYTES = 50
  5835. /**
  5836. * If `Buffer.TYPED_ARRAY_SUPPORT`:
  5837. * === true Use Uint8Array implementation (fastest)
  5838. * === false Use Object implementation (most compatible, even IE6)
  5839. *
  5840. * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
  5841. * Opera 11.6+, iOS 4.2+.
  5842. *
  5843. * Due to various browser bugs, sometimes the Object implementation will be used even
  5844. * when the browser supports typed arrays.
  5845. *
  5846. * Note:
  5847. *
  5848. * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
  5849. * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
  5850. *
  5851. * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
  5852. *
  5853. * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
  5854. * incorrect length in some situations.
  5855. * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
  5856. * get the Object implementation, which is slower but behaves correctly.
  5857. */
  5858. Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
  5859. ? global.TYPED_ARRAY_SUPPORT
  5860. : typedArraySupport()
  5861. /*
  5862. * Export kMaxLength after typed array support is determined.
  5863. */
  5864. exports.kMaxLength = kMaxLength()
  5865. function typedArraySupport () {
  5866. try {
  5867. var arr = new Uint8Array(1)
  5868. arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
  5869. return arr.foo() === 42 && // typed array instances can be augmented
  5870. typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
  5871. arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
  5872. } catch (e) {
  5873. return false
  5874. }
  5875. }
  5876. function kMaxLength () {
  5877. return Buffer.TYPED_ARRAY_SUPPORT
  5878. ? 0x7fffffff
  5879. : 0x3fffffff
  5880. }
  5881. function createBuffer (that, length) {
  5882. if (kMaxLength() < length) {
  5883. throw new RangeError('Invalid typed array length')
  5884. }
  5885. if (Buffer.TYPED_ARRAY_SUPPORT) {
  5886. // Return an augmented `Uint8Array` instance, for best performance
  5887. that = new Uint8Array(length)
  5888. that.__proto__ = Buffer.prototype
  5889. } else {
  5890. // Fallback: Return an object instance of the Buffer class
  5891. if (that === null) {
  5892. that = new Buffer(length)
  5893. }
  5894. that.length = length
  5895. }
  5896. return that
  5897. }
  5898. /**
  5899. * The Buffer constructor returns instances of `Uint8Array` that have their
  5900. * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
  5901. * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
  5902. * and the `Uint8Array` methods. Square bracket notation works as expected -- it
  5903. * returns a single octet.
  5904. *
  5905. * The `Uint8Array` prototype remains unmodified.
  5906. */
  5907. function Buffer (arg, encodingOrOffset, length) {
  5908. if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
  5909. return new Buffer(arg, encodingOrOffset, length)
  5910. }
  5911. // Common case.
  5912. if (typeof arg === 'number') {
  5913. if (typeof encodingOrOffset === 'string') {
  5914. throw new Error(
  5915. 'If encoding is specified then the first argument must be a string'
  5916. )
  5917. }
  5918. return allocUnsafe(this, arg)
  5919. }
  5920. return from(this, arg, encodingOrOffset, length)
  5921. }
  5922. Buffer.poolSize = 8192 // not used by this implementation
  5923. // TODO: Legacy, not needed anymore. Remove in next major version.
  5924. Buffer._augment = function (arr) {
  5925. arr.__proto__ = Buffer.prototype
  5926. return arr
  5927. }
  5928. function from (that, value, encodingOrOffset, length) {
  5929. if (typeof value === 'number') {
  5930. throw new TypeError('"value" argument must not be a number')
  5931. }
  5932. if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
  5933. return fromArrayBuffer(that, value, encodingOrOffset, length)
  5934. }
  5935. if (typeof value === 'string') {
  5936. return fromString(that, value, encodingOrOffset)
  5937. }
  5938. return fromObject(that, value)
  5939. }
  5940. /**
  5941. * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
  5942. * if value is a number.
  5943. * Buffer.from(str[, encoding])
  5944. * Buffer.from(array)
  5945. * Buffer.from(buffer)
  5946. * Buffer.from(arrayBuffer[, byteOffset[, length]])
  5947. **/
  5948. Buffer.from = function (value, encodingOrOffset, length) {
  5949. return from(null, value, encodingOrOffset, length)
  5950. }
  5951. if (Buffer.TYPED_ARRAY_SUPPORT) {
  5952. Buffer.prototype.__proto__ = Uint8Array.prototype
  5953. Buffer.__proto__ = Uint8Array
  5954. if (typeof Symbol !== 'undefined' && Symbol.species &&
  5955. Buffer[Symbol.species] === Buffer) {
  5956. // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
  5957. Object.defineProperty(Buffer, Symbol.species, {
  5958. value: null,
  5959. configurable: true
  5960. })
  5961. }
  5962. }
  5963. function assertSize (size) {
  5964. if (typeof size !== 'number') {
  5965. throw new TypeError('"size" argument must be a number')
  5966. } else if (size < 0) {
  5967. throw new RangeError('"size" argument must not be negative')
  5968. }
  5969. }
  5970. function alloc (that, size, fill, encoding) {
  5971. assertSize(size)
  5972. if (size <= 0) {
  5973. return createBuffer(that, size)
  5974. }
  5975. if (fill !== undefined) {
  5976. // Only pay attention to encoding if it's a string. This
  5977. // prevents accidentally sending in a number that would
  5978. // be interpretted as a start offset.
  5979. return typeof encoding === 'string'
  5980. ? createBuffer(that, size).fill(fill, encoding)
  5981. : createBuffer(that, size).fill(fill)
  5982. }
  5983. return createBuffer(that, size)
  5984. }
  5985. /**
  5986. * Creates a new filled Buffer instance.
  5987. * alloc(size[, fill[, encoding]])
  5988. **/
  5989. Buffer.alloc = function (size, fill, encoding) {
  5990. return alloc(null, size, fill, encoding)
  5991. }
  5992. function allocUnsafe (that, size) {
  5993. assertSize(size)
  5994. that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
  5995. if (!Buffer.TYPED_ARRAY_SUPPORT) {
  5996. for (var i = 0; i < size; ++i) {
  5997. that[i] = 0
  5998. }
  5999. }
  6000. return that
  6001. }
  6002. /**
  6003. * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
  6004. * */
  6005. Buffer.allocUnsafe = function (size) {
  6006. return allocUnsafe(null, size)
  6007. }
  6008. /**
  6009. * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
  6010. */
  6011. Buffer.allocUnsafeSlow = function (size) {
  6012. return allocUnsafe(null, size)
  6013. }
  6014. function fromString (that, string, encoding) {
  6015. if (typeof encoding !== 'string' || encoding === '') {
  6016. encoding = 'utf8'
  6017. }
  6018. if (!Buffer.isEncoding(encoding)) {
  6019. throw new TypeError('"encoding" must be a valid string encoding')
  6020. }
  6021. var length = byteLength(string, encoding) | 0
  6022. that = createBuffer(that, length)
  6023. var actual = that.write(string, encoding)
  6024. if (actual !== length) {
  6025. // Writing a hex string, for example, that contains invalid characters will
  6026. // cause everything after the first invalid character to be ignored. (e.g.
  6027. // 'abxxcd' will be treated as 'ab')
  6028. that = that.slice(0, actual)
  6029. }
  6030. return that
  6031. }
  6032. function fromArrayLike (that, array) {
  6033. var length = array.length < 0 ? 0 : checked(array.length) | 0
  6034. that = createBuffer(that, length)
  6035. for (var i = 0; i < length; i += 1) {
  6036. that[i] = array[i] & 255
  6037. }
  6038. return that
  6039. }
  6040. function fromArrayBuffer (that, array, byteOffset, length) {
  6041. array.byteLength // this throws if `array` is not a valid ArrayBuffer
  6042. if (byteOffset < 0 || array.byteLength < byteOffset) {
  6043. throw new RangeError('\'offset\' is out of bounds')
  6044. }
  6045. if (array.byteLength < byteOffset + (length || 0)) {
  6046. throw new RangeError('\'length\' is out of bounds')
  6047. }
  6048. if (byteOffset === undefined && length === undefined) {
  6049. array = new Uint8Array(array)
  6050. } else if (length === undefined) {
  6051. array = new Uint8Array(array, byteOffset)
  6052. } else {
  6053. array = new Uint8Array(array, byteOffset, length)
  6054. }
  6055. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6056. // Return an augmented `Uint8Array` instance, for best performance
  6057. that = array
  6058. that.__proto__ = Buffer.prototype
  6059. } else {
  6060. // Fallback: Return an object instance of the Buffer class
  6061. that = fromArrayLike(that, array)
  6062. }
  6063. return that
  6064. }
  6065. function fromObject (that, obj) {
  6066. if (Buffer.isBuffer(obj)) {
  6067. var len = checked(obj.length) | 0
  6068. that = createBuffer(that, len)
  6069. if (that.length === 0) {
  6070. return that
  6071. }
  6072. obj.copy(that, 0, 0, len)
  6073. return that
  6074. }
  6075. if (obj) {
  6076. if ((typeof ArrayBuffer !== 'undefined' &&
  6077. obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
  6078. if (typeof obj.length !== 'number' || isnan(obj.length)) {
  6079. return createBuffer(that, 0)
  6080. }
  6081. return fromArrayLike(that, obj)
  6082. }
  6083. if (obj.type === 'Buffer' && isArray(obj.data)) {
  6084. return fromArrayLike(that, obj.data)
  6085. }
  6086. }
  6087. throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
  6088. }
  6089. function checked (length) {
  6090. // Note: cannot use `length < kMaxLength()` here because that fails when
  6091. // length is NaN (which is otherwise coerced to zero.)
  6092. if (length >= kMaxLength()) {
  6093. throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
  6094. 'size: 0x' + kMaxLength().toString(16) + ' bytes')
  6095. }
  6096. return length | 0
  6097. }
  6098. function SlowBuffer (length) {
  6099. if (+length != length) { // eslint-disable-line eqeqeq
  6100. length = 0
  6101. }
  6102. return Buffer.alloc(+length)
  6103. }
  6104. Buffer.isBuffer = function isBuffer (b) {
  6105. return !!(b != null && b._isBuffer)
  6106. }
  6107. Buffer.compare = function compare (a, b) {
  6108. if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
  6109. throw new TypeError('Arguments must be Buffers')
  6110. }
  6111. if (a === b) return 0
  6112. var x = a.length
  6113. var y = b.length
  6114. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  6115. if (a[i] !== b[i]) {
  6116. x = a[i]
  6117. y = b[i]
  6118. break
  6119. }
  6120. }
  6121. if (x < y) return -1
  6122. if (y < x) return 1
  6123. return 0
  6124. }
  6125. Buffer.isEncoding = function isEncoding (encoding) {
  6126. switch (String(encoding).toLowerCase()) {
  6127. case 'hex':
  6128. case 'utf8':
  6129. case 'utf-8':
  6130. case 'ascii':
  6131. case 'latin1':
  6132. case 'binary':
  6133. case 'base64':
  6134. case 'ucs2':
  6135. case 'ucs-2':
  6136. case 'utf16le':
  6137. case 'utf-16le':
  6138. return true
  6139. default:
  6140. return false
  6141. }
  6142. }
  6143. Buffer.concat = function concat (list, length) {
  6144. if (!isArray(list)) {
  6145. throw new TypeError('"list" argument must be an Array of Buffers')
  6146. }
  6147. if (list.length === 0) {
  6148. return Buffer.alloc(0)
  6149. }
  6150. var i
  6151. if (length === undefined) {
  6152. length = 0
  6153. for (i = 0; i < list.length; ++i) {
  6154. length += list[i].length
  6155. }
  6156. }
  6157. var buffer = Buffer.allocUnsafe(length)
  6158. var pos = 0
  6159. for (i = 0; i < list.length; ++i) {
  6160. var buf = list[i]
  6161. if (!Buffer.isBuffer(buf)) {
  6162. throw new TypeError('"list" argument must be an Array of Buffers')
  6163. }
  6164. buf.copy(buffer, pos)
  6165. pos += buf.length
  6166. }
  6167. return buffer
  6168. }
  6169. function byteLength (string, encoding) {
  6170. if (Buffer.isBuffer(string)) {
  6171. return string.length
  6172. }
  6173. if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
  6174. (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
  6175. return string.byteLength
  6176. }
  6177. if (typeof string !== 'string') {
  6178. string = '' + string
  6179. }
  6180. var len = string.length
  6181. if (len === 0) return 0
  6182. // Use a for loop to avoid recursion
  6183. var loweredCase = false
  6184. for (;;) {
  6185. switch (encoding) {
  6186. case 'ascii':
  6187. case 'latin1':
  6188. case 'binary':
  6189. return len
  6190. case 'utf8':
  6191. case 'utf-8':
  6192. case undefined:
  6193. return utf8ToBytes(string).length
  6194. case 'ucs2':
  6195. case 'ucs-2':
  6196. case 'utf16le':
  6197. case 'utf-16le':
  6198. return len * 2
  6199. case 'hex':
  6200. return len >>> 1
  6201. case 'base64':
  6202. return base64ToBytes(string).length
  6203. default:
  6204. if (loweredCase) return utf8ToBytes(string).length // assume utf8
  6205. encoding = ('' + encoding).toLowerCase()
  6206. loweredCase = true
  6207. }
  6208. }
  6209. }
  6210. Buffer.byteLength = byteLength
  6211. function slowToString (encoding, start, end) {
  6212. var loweredCase = false
  6213. // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  6214. // property of a typed array.
  6215. // This behaves neither like String nor Uint8Array in that we set start/end
  6216. // to their upper/lower bounds if the value passed is out of range.
  6217. // undefined is handled specially as per ECMA-262 6th Edition,
  6218. // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  6219. if (start === undefined || start < 0) {
  6220. start = 0
  6221. }
  6222. // Return early if start > this.length. Done here to prevent potential uint32
  6223. // coercion fail below.
  6224. if (start > this.length) {
  6225. return ''
  6226. }
  6227. if (end === undefined || end > this.length) {
  6228. end = this.length
  6229. }
  6230. if (end <= 0) {
  6231. return ''
  6232. }
  6233. // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  6234. end >>>= 0
  6235. start >>>= 0
  6236. if (end <= start) {
  6237. return ''
  6238. }
  6239. if (!encoding) encoding = 'utf8'
  6240. while (true) {
  6241. switch (encoding) {
  6242. case 'hex':
  6243. return hexSlice(this, start, end)
  6244. case 'utf8':
  6245. case 'utf-8':
  6246. return utf8Slice(this, start, end)
  6247. case 'ascii':
  6248. return asciiSlice(this, start, end)
  6249. case 'latin1':
  6250. case 'binary':
  6251. return latin1Slice(this, start, end)
  6252. case 'base64':
  6253. return base64Slice(this, start, end)
  6254. case 'ucs2':
  6255. case 'ucs-2':
  6256. case 'utf16le':
  6257. case 'utf-16le':
  6258. return utf16leSlice(this, start, end)
  6259. default:
  6260. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  6261. encoding = (encoding + '').toLowerCase()
  6262. loweredCase = true
  6263. }
  6264. }
  6265. }
  6266. // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
  6267. // Buffer instances.
  6268. Buffer.prototype._isBuffer = true
  6269. function swap (b, n, m) {
  6270. var i = b[n]
  6271. b[n] = b[m]
  6272. b[m] = i
  6273. }
  6274. Buffer.prototype.swap16 = function swap16 () {
  6275. var len = this.length
  6276. if (len % 2 !== 0) {
  6277. throw new RangeError('Buffer size must be a multiple of 16-bits')
  6278. }
  6279. for (var i = 0; i < len; i += 2) {
  6280. swap(this, i, i + 1)
  6281. }
  6282. return this
  6283. }
  6284. Buffer.prototype.swap32 = function swap32 () {
  6285. var len = this.length
  6286. if (len % 4 !== 0) {
  6287. throw new RangeError('Buffer size must be a multiple of 32-bits')
  6288. }
  6289. for (var i = 0; i < len; i += 4) {
  6290. swap(this, i, i + 3)
  6291. swap(this, i + 1, i + 2)
  6292. }
  6293. return this
  6294. }
  6295. Buffer.prototype.swap64 = function swap64 () {
  6296. var len = this.length
  6297. if (len % 8 !== 0) {
  6298. throw new RangeError('Buffer size must be a multiple of 64-bits')
  6299. }
  6300. for (var i = 0; i < len; i += 8) {
  6301. swap(this, i, i + 7)
  6302. swap(this, i + 1, i + 6)
  6303. swap(this, i + 2, i + 5)
  6304. swap(this, i + 3, i + 4)
  6305. }
  6306. return this
  6307. }
  6308. Buffer.prototype.toString = function toString () {
  6309. var length = this.length | 0
  6310. if (length === 0) return ''
  6311. if (arguments.length === 0) return utf8Slice(this, 0, length)
  6312. return slowToString.apply(this, arguments)
  6313. }
  6314. Buffer.prototype.equals = function equals (b) {
  6315. if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
  6316. if (this === b) return true
  6317. return Buffer.compare(this, b) === 0
  6318. }
  6319. Buffer.prototype.inspect = function inspect () {
  6320. var str = ''
  6321. var max = exports.INSPECT_MAX_BYTES
  6322. if (this.length > 0) {
  6323. str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
  6324. if (this.length > max) str += ' ... '
  6325. }
  6326. return '<Buffer ' + str + '>'
  6327. }
  6328. Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
  6329. if (!Buffer.isBuffer(target)) {
  6330. throw new TypeError('Argument must be a Buffer')
  6331. }
  6332. if (start === undefined) {
  6333. start = 0
  6334. }
  6335. if (end === undefined) {
  6336. end = target ? target.length : 0
  6337. }
  6338. if (thisStart === undefined) {
  6339. thisStart = 0
  6340. }
  6341. if (thisEnd === undefined) {
  6342. thisEnd = this.length
  6343. }
  6344. if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
  6345. throw new RangeError('out of range index')
  6346. }
  6347. if (thisStart >= thisEnd && start >= end) {
  6348. return 0
  6349. }
  6350. if (thisStart >= thisEnd) {
  6351. return -1
  6352. }
  6353. if (start >= end) {
  6354. return 1
  6355. }
  6356. start >>>= 0
  6357. end >>>= 0
  6358. thisStart >>>= 0
  6359. thisEnd >>>= 0
  6360. if (this === target) return 0
  6361. var x = thisEnd - thisStart
  6362. var y = end - start
  6363. var len = Math.min(x, y)
  6364. var thisCopy = this.slice(thisStart, thisEnd)
  6365. var targetCopy = target.slice(start, end)
  6366. for (var i = 0; i < len; ++i) {
  6367. if (thisCopy[i] !== targetCopy[i]) {
  6368. x = thisCopy[i]
  6369. y = targetCopy[i]
  6370. break
  6371. }
  6372. }
  6373. if (x < y) return -1
  6374. if (y < x) return 1
  6375. return 0
  6376. }
  6377. // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
  6378. // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
  6379. //
  6380. // Arguments:
  6381. // - buffer - a Buffer to search
  6382. // - val - a string, Buffer, or number
  6383. // - byteOffset - an index into `buffer`; will be clamped to an int32
  6384. // - encoding - an optional encoding, relevant is val is a string
  6385. // - dir - true for indexOf, false for lastIndexOf
  6386. function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
  6387. // Empty buffer means no match
  6388. if (buffer.length === 0) return -1
  6389. // Normalize byteOffset
  6390. if (typeof byteOffset === 'string') {
  6391. encoding = byteOffset
  6392. byteOffset = 0
  6393. } else if (byteOffset > 0x7fffffff) {
  6394. byteOffset = 0x7fffffff
  6395. } else if (byteOffset < -0x80000000) {
  6396. byteOffset = -0x80000000
  6397. }
  6398. byteOffset = +byteOffset // Coerce to Number.
  6399. if (isNaN(byteOffset)) {
  6400. // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
  6401. byteOffset = dir ? 0 : (buffer.length - 1)
  6402. }
  6403. // Normalize byteOffset: negative offsets start from the end of the buffer
  6404. if (byteOffset < 0) byteOffset = buffer.length + byteOffset
  6405. if (byteOffset >= buffer.length) {
  6406. if (dir) return -1
  6407. else byteOffset = buffer.length - 1
  6408. } else if (byteOffset < 0) {
  6409. if (dir) byteOffset = 0
  6410. else return -1
  6411. }
  6412. // Normalize val
  6413. if (typeof val === 'string') {
  6414. val = Buffer.from(val, encoding)
  6415. }
  6416. // Finally, search either indexOf (if dir is true) or lastIndexOf
  6417. if (Buffer.isBuffer(val)) {
  6418. // Special case: looking for empty string/buffer always fails
  6419. if (val.length === 0) {
  6420. return -1
  6421. }
  6422. return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
  6423. } else if (typeof val === 'number') {
  6424. val = val & 0xFF // Search for a byte value [0-255]
  6425. if (Buffer.TYPED_ARRAY_SUPPORT &&
  6426. typeof Uint8Array.prototype.indexOf === 'function') {
  6427. if (dir) {
  6428. return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
  6429. } else {
  6430. return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
  6431. }
  6432. }
  6433. return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
  6434. }
  6435. throw new TypeError('val must be string, number or Buffer')
  6436. }
  6437. function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
  6438. var indexSize = 1
  6439. var arrLength = arr.length
  6440. var valLength = val.length
  6441. if (encoding !== undefined) {
  6442. encoding = String(encoding).toLowerCase()
  6443. if (encoding === 'ucs2' || encoding === 'ucs-2' ||
  6444. encoding === 'utf16le' || encoding === 'utf-16le') {
  6445. if (arr.length < 2 || val.length < 2) {
  6446. return -1
  6447. }
  6448. indexSize = 2
  6449. arrLength /= 2
  6450. valLength /= 2
  6451. byteOffset /= 2
  6452. }
  6453. }
  6454. function read (buf, i) {
  6455. if (indexSize === 1) {
  6456. return buf[i]
  6457. } else {
  6458. return buf.readUInt16BE(i * indexSize)
  6459. }
  6460. }
  6461. var i
  6462. if (dir) {
  6463. var foundIndex = -1
  6464. for (i = byteOffset; i < arrLength; i++) {
  6465. if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
  6466. if (foundIndex === -1) foundIndex = i
  6467. if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
  6468. } else {
  6469. if (foundIndex !== -1) i -= i - foundIndex
  6470. foundIndex = -1
  6471. }
  6472. }
  6473. } else {
  6474. if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
  6475. for (i = byteOffset; i >= 0; i--) {
  6476. var found = true
  6477. for (var j = 0; j < valLength; j++) {
  6478. if (read(arr, i + j) !== read(val, j)) {
  6479. found = false
  6480. break
  6481. }
  6482. }
  6483. if (found) return i
  6484. }
  6485. }
  6486. return -1
  6487. }
  6488. Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
  6489. return this.indexOf(val, byteOffset, encoding) !== -1
  6490. }
  6491. Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
  6492. return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
  6493. }
  6494. Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
  6495. return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
  6496. }
  6497. function hexWrite (buf, string, offset, length) {
  6498. offset = Number(offset) || 0
  6499. var remaining = buf.length - offset
  6500. if (!length) {
  6501. length = remaining
  6502. } else {
  6503. length = Number(length)
  6504. if (length > remaining) {
  6505. length = remaining
  6506. }
  6507. }
  6508. // must be an even number of digits
  6509. var strLen = string.length
  6510. if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
  6511. if (length > strLen / 2) {
  6512. length = strLen / 2
  6513. }
  6514. for (var i = 0; i < length; ++i) {
  6515. var parsed = parseInt(string.substr(i * 2, 2), 16)
  6516. if (isNaN(parsed)) return i
  6517. buf[offset + i] = parsed
  6518. }
  6519. return i
  6520. }
  6521. function utf8Write (buf, string, offset, length) {
  6522. return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
  6523. }
  6524. function asciiWrite (buf, string, offset, length) {
  6525. return blitBuffer(asciiToBytes(string), buf, offset, length)
  6526. }
  6527. function latin1Write (buf, string, offset, length) {
  6528. return asciiWrite(buf, string, offset, length)
  6529. }
  6530. function base64Write (buf, string, offset, length) {
  6531. return blitBuffer(base64ToBytes(string), buf, offset, length)
  6532. }
  6533. function ucs2Write (buf, string, offset, length) {
  6534. return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
  6535. }
  6536. Buffer.prototype.write = function write (string, offset, length, encoding) {
  6537. // Buffer#write(string)
  6538. if (offset === undefined) {
  6539. encoding = 'utf8'
  6540. length = this.length
  6541. offset = 0
  6542. // Buffer#write(string, encoding)
  6543. } else if (length === undefined && typeof offset === 'string') {
  6544. encoding = offset
  6545. length = this.length
  6546. offset = 0
  6547. // Buffer#write(string, offset[, length][, encoding])
  6548. } else if (isFinite(offset)) {
  6549. offset = offset | 0
  6550. if (isFinite(length)) {
  6551. length = length | 0
  6552. if (encoding === undefined) encoding = 'utf8'
  6553. } else {
  6554. encoding = length
  6555. length = undefined
  6556. }
  6557. // legacy write(string, encoding, offset, length) - remove in v0.13
  6558. } else {
  6559. throw new Error(
  6560. 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
  6561. )
  6562. }
  6563. var remaining = this.length - offset
  6564. if (length === undefined || length > remaining) length = remaining
  6565. if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
  6566. throw new RangeError('Attempt to write outside buffer bounds')
  6567. }
  6568. if (!encoding) encoding = 'utf8'
  6569. var loweredCase = false
  6570. for (;;) {
  6571. switch (encoding) {
  6572. case 'hex':
  6573. return hexWrite(this, string, offset, length)
  6574. case 'utf8':
  6575. case 'utf-8':
  6576. return utf8Write(this, string, offset, length)
  6577. case 'ascii':
  6578. return asciiWrite(this, string, offset, length)
  6579. case 'latin1':
  6580. case 'binary':
  6581. return latin1Write(this, string, offset, length)
  6582. case 'base64':
  6583. // Warning: maxLength not taken into account in base64Write
  6584. return base64Write(this, string, offset, length)
  6585. case 'ucs2':
  6586. case 'ucs-2':
  6587. case 'utf16le':
  6588. case 'utf-16le':
  6589. return ucs2Write(this, string, offset, length)
  6590. default:
  6591. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  6592. encoding = ('' + encoding).toLowerCase()
  6593. loweredCase = true
  6594. }
  6595. }
  6596. }
  6597. Buffer.prototype.toJSON = function toJSON () {
  6598. return {
  6599. type: 'Buffer',
  6600. data: Array.prototype.slice.call(this._arr || this, 0)
  6601. }
  6602. }
  6603. function base64Slice (buf, start, end) {
  6604. if (start === 0 && end === buf.length) {
  6605. return base64.fromByteArray(buf)
  6606. } else {
  6607. return base64.fromByteArray(buf.slice(start, end))
  6608. }
  6609. }
  6610. function utf8Slice (buf, start, end) {
  6611. end = Math.min(buf.length, end)
  6612. var res = []
  6613. var i = start
  6614. while (i < end) {
  6615. var firstByte = buf[i]
  6616. var codePoint = null
  6617. var bytesPerSequence = (firstByte > 0xEF) ? 4
  6618. : (firstByte > 0xDF) ? 3
  6619. : (firstByte > 0xBF) ? 2
  6620. : 1
  6621. if (i + bytesPerSequence <= end) {
  6622. var secondByte, thirdByte, fourthByte, tempCodePoint
  6623. switch (bytesPerSequence) {
  6624. case 1:
  6625. if (firstByte < 0x80) {
  6626. codePoint = firstByte
  6627. }
  6628. break
  6629. case 2:
  6630. secondByte = buf[i + 1]
  6631. if ((secondByte & 0xC0) === 0x80) {
  6632. tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
  6633. if (tempCodePoint > 0x7F) {
  6634. codePoint = tempCodePoint
  6635. }
  6636. }
  6637. break
  6638. case 3:
  6639. secondByte = buf[i + 1]
  6640. thirdByte = buf[i + 2]
  6641. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
  6642. tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
  6643. if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
  6644. codePoint = tempCodePoint
  6645. }
  6646. }
  6647. break
  6648. case 4:
  6649. secondByte = buf[i + 1]
  6650. thirdByte = buf[i + 2]
  6651. fourthByte = buf[i + 3]
  6652. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
  6653. tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
  6654. if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
  6655. codePoint = tempCodePoint
  6656. }
  6657. }
  6658. }
  6659. }
  6660. if (codePoint === null) {
  6661. // we did not generate a valid codePoint so insert a
  6662. // replacement char (U+FFFD) and advance only 1 byte
  6663. codePoint = 0xFFFD
  6664. bytesPerSequence = 1
  6665. } else if (codePoint > 0xFFFF) {
  6666. // encode to utf16 (surrogate pair dance)
  6667. codePoint -= 0x10000
  6668. res.push(codePoint >>> 10 & 0x3FF | 0xD800)
  6669. codePoint = 0xDC00 | codePoint & 0x3FF
  6670. }
  6671. res.push(codePoint)
  6672. i += bytesPerSequence
  6673. }
  6674. return decodeCodePointsArray(res)
  6675. }
  6676. // Based on http://stackoverflow.com/a/22747272/680742, the browser with
  6677. // the lowest limit is Chrome, with 0x10000 args.
  6678. // We go 1 magnitude less, for safety
  6679. var MAX_ARGUMENTS_LENGTH = 0x1000
  6680. function decodeCodePointsArray (codePoints) {
  6681. var len = codePoints.length
  6682. if (len <= MAX_ARGUMENTS_LENGTH) {
  6683. return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
  6684. }
  6685. // Decode in chunks to avoid "call stack size exceeded".
  6686. var res = ''
  6687. var i = 0
  6688. while (i < len) {
  6689. res += String.fromCharCode.apply(
  6690. String,
  6691. codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
  6692. )
  6693. }
  6694. return res
  6695. }
  6696. function asciiSlice (buf, start, end) {
  6697. var ret = ''
  6698. end = Math.min(buf.length, end)
  6699. for (var i = start; i < end; ++i) {
  6700. ret += String.fromCharCode(buf[i] & 0x7F)
  6701. }
  6702. return ret
  6703. }
  6704. function latin1Slice (buf, start, end) {
  6705. var ret = ''
  6706. end = Math.min(buf.length, end)
  6707. for (var i = start; i < end; ++i) {
  6708. ret += String.fromCharCode(buf[i])
  6709. }
  6710. return ret
  6711. }
  6712. function hexSlice (buf, start, end) {
  6713. var len = buf.length
  6714. if (!start || start < 0) start = 0
  6715. if (!end || end < 0 || end > len) end = len
  6716. var out = ''
  6717. for (var i = start; i < end; ++i) {
  6718. out += toHex(buf[i])
  6719. }
  6720. return out
  6721. }
  6722. function utf16leSlice (buf, start, end) {
  6723. var bytes = buf.slice(start, end)
  6724. var res = ''
  6725. for (var i = 0; i < bytes.length; i += 2) {
  6726. res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
  6727. }
  6728. return res
  6729. }
  6730. Buffer.prototype.slice = function slice (start, end) {
  6731. var len = this.length
  6732. start = ~~start
  6733. end = end === undefined ? len : ~~end
  6734. if (start < 0) {
  6735. start += len
  6736. if (start < 0) start = 0
  6737. } else if (start > len) {
  6738. start = len
  6739. }
  6740. if (end < 0) {
  6741. end += len
  6742. if (end < 0) end = 0
  6743. } else if (end > len) {
  6744. end = len
  6745. }
  6746. if (end < start) end = start
  6747. var newBuf
  6748. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6749. newBuf = this.subarray(start, end)
  6750. newBuf.__proto__ = Buffer.prototype
  6751. } else {
  6752. var sliceLen = end - start
  6753. newBuf = new Buffer(sliceLen, undefined)
  6754. for (var i = 0; i < sliceLen; ++i) {
  6755. newBuf[i] = this[i + start]
  6756. }
  6757. }
  6758. return newBuf
  6759. }
  6760. /*
  6761. * Need to make sure that buffer isn't trying to write out of bounds.
  6762. */
  6763. function checkOffset (offset, ext, length) {
  6764. if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
  6765. if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
  6766. }
  6767. Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
  6768. offset = offset | 0
  6769. byteLength = byteLength | 0
  6770. if (!noAssert) checkOffset(offset, byteLength, this.length)
  6771. var val = this[offset]
  6772. var mul = 1
  6773. var i = 0
  6774. while (++i < byteLength && (mul *= 0x100)) {
  6775. val += this[offset + i] * mul
  6776. }
  6777. return val
  6778. }
  6779. Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
  6780. offset = offset | 0
  6781. byteLength = byteLength | 0
  6782. if (!noAssert) {
  6783. checkOffset(offset, byteLength, this.length)
  6784. }
  6785. var val = this[offset + --byteLength]
  6786. var mul = 1
  6787. while (byteLength > 0 && (mul *= 0x100)) {
  6788. val += this[offset + --byteLength] * mul
  6789. }
  6790. return val
  6791. }
  6792. Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
  6793. if (!noAssert) checkOffset(offset, 1, this.length)
  6794. return this[offset]
  6795. }
  6796. Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
  6797. if (!noAssert) checkOffset(offset, 2, this.length)
  6798. return this[offset] | (this[offset + 1] << 8)
  6799. }
  6800. Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
  6801. if (!noAssert) checkOffset(offset, 2, this.length)
  6802. return (this[offset] << 8) | this[offset + 1]
  6803. }
  6804. Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
  6805. if (!noAssert) checkOffset(offset, 4, this.length)
  6806. return ((this[offset]) |
  6807. (this[offset + 1] << 8) |
  6808. (this[offset + 2] << 16)) +
  6809. (this[offset + 3] * 0x1000000)
  6810. }
  6811. Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
  6812. if (!noAssert) checkOffset(offset, 4, this.length)
  6813. return (this[offset] * 0x1000000) +
  6814. ((this[offset + 1] << 16) |
  6815. (this[offset + 2] << 8) |
  6816. this[offset + 3])
  6817. }
  6818. Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
  6819. offset = offset | 0
  6820. byteLength = byteLength | 0
  6821. if (!noAssert) checkOffset(offset, byteLength, this.length)
  6822. var val = this[offset]
  6823. var mul = 1
  6824. var i = 0
  6825. while (++i < byteLength && (mul *= 0x100)) {
  6826. val += this[offset + i] * mul
  6827. }
  6828. mul *= 0x80
  6829. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  6830. return val
  6831. }
  6832. Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
  6833. offset = offset | 0
  6834. byteLength = byteLength | 0
  6835. if (!noAssert) checkOffset(offset, byteLength, this.length)
  6836. var i = byteLength
  6837. var mul = 1
  6838. var val = this[offset + --i]
  6839. while (i > 0 && (mul *= 0x100)) {
  6840. val += this[offset + --i] * mul
  6841. }
  6842. mul *= 0x80
  6843. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  6844. return val
  6845. }
  6846. Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
  6847. if (!noAssert) checkOffset(offset, 1, this.length)
  6848. if (!(this[offset] & 0x80)) return (this[offset])
  6849. return ((0xff - this[offset] + 1) * -1)
  6850. }
  6851. Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
  6852. if (!noAssert) checkOffset(offset, 2, this.length)
  6853. var val = this[offset] | (this[offset + 1] << 8)
  6854. return (val & 0x8000) ? val | 0xFFFF0000 : val
  6855. }
  6856. Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
  6857. if (!noAssert) checkOffset(offset, 2, this.length)
  6858. var val = this[offset + 1] | (this[offset] << 8)
  6859. return (val & 0x8000) ? val | 0xFFFF0000 : val
  6860. }
  6861. Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
  6862. if (!noAssert) checkOffset(offset, 4, this.length)
  6863. return (this[offset]) |
  6864. (this[offset + 1] << 8) |
  6865. (this[offset + 2] << 16) |
  6866. (this[offset + 3] << 24)
  6867. }
  6868. Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
  6869. if (!noAssert) checkOffset(offset, 4, this.length)
  6870. return (this[offset] << 24) |
  6871. (this[offset + 1] << 16) |
  6872. (this[offset + 2] << 8) |
  6873. (this[offset + 3])
  6874. }
  6875. Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
  6876. if (!noAssert) checkOffset(offset, 4, this.length)
  6877. return ieee754.read(this, offset, true, 23, 4)
  6878. }
  6879. Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
  6880. if (!noAssert) checkOffset(offset, 4, this.length)
  6881. return ieee754.read(this, offset, false, 23, 4)
  6882. }
  6883. Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
  6884. if (!noAssert) checkOffset(offset, 8, this.length)
  6885. return ieee754.read(this, offset, true, 52, 8)
  6886. }
  6887. Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
  6888. if (!noAssert) checkOffset(offset, 8, this.length)
  6889. return ieee754.read(this, offset, false, 52, 8)
  6890. }
  6891. function checkInt (buf, value, offset, ext, max, min) {
  6892. if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
  6893. if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
  6894. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  6895. }
  6896. Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
  6897. value = +value
  6898. offset = offset | 0
  6899. byteLength = byteLength | 0
  6900. if (!noAssert) {
  6901. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  6902. checkInt(this, value, offset, byteLength, maxBytes, 0)
  6903. }
  6904. var mul = 1
  6905. var i = 0
  6906. this[offset] = value & 0xFF
  6907. while (++i < byteLength && (mul *= 0x100)) {
  6908. this[offset + i] = (value / mul) & 0xFF
  6909. }
  6910. return offset + byteLength
  6911. }
  6912. Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
  6913. value = +value
  6914. offset = offset | 0
  6915. byteLength = byteLength | 0
  6916. if (!noAssert) {
  6917. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  6918. checkInt(this, value, offset, byteLength, maxBytes, 0)
  6919. }
  6920. var i = byteLength - 1
  6921. var mul = 1
  6922. this[offset + i] = value & 0xFF
  6923. while (--i >= 0 && (mul *= 0x100)) {
  6924. this[offset + i] = (value / mul) & 0xFF
  6925. }
  6926. return offset + byteLength
  6927. }
  6928. Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
  6929. value = +value
  6930. offset = offset | 0
  6931. if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
  6932. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  6933. this[offset] = (value & 0xff)
  6934. return offset + 1
  6935. }
  6936. function objectWriteUInt16 (buf, value, offset, littleEndian) {
  6937. if (value < 0) value = 0xffff + value + 1
  6938. for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
  6939. buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
  6940. (littleEndian ? i : 1 - i) * 8
  6941. }
  6942. }
  6943. Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
  6944. value = +value
  6945. offset = offset | 0
  6946. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  6947. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6948. this[offset] = (value & 0xff)
  6949. this[offset + 1] = (value >>> 8)
  6950. } else {
  6951. objectWriteUInt16(this, value, offset, true)
  6952. }
  6953. return offset + 2
  6954. }
  6955. Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
  6956. value = +value
  6957. offset = offset | 0
  6958. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  6959. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6960. this[offset] = (value >>> 8)
  6961. this[offset + 1] = (value & 0xff)
  6962. } else {
  6963. objectWriteUInt16(this, value, offset, false)
  6964. }
  6965. return offset + 2
  6966. }
  6967. function objectWriteUInt32 (buf, value, offset, littleEndian) {
  6968. if (value < 0) value = 0xffffffff + value + 1
  6969. for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
  6970. buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
  6971. }
  6972. }
  6973. Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
  6974. value = +value
  6975. offset = offset | 0
  6976. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  6977. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6978. this[offset + 3] = (value >>> 24)
  6979. this[offset + 2] = (value >>> 16)
  6980. this[offset + 1] = (value >>> 8)
  6981. this[offset] = (value & 0xff)
  6982. } else {
  6983. objectWriteUInt32(this, value, offset, true)
  6984. }
  6985. return offset + 4
  6986. }
  6987. Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
  6988. value = +value
  6989. offset = offset | 0
  6990. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  6991. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6992. this[offset] = (value >>> 24)
  6993. this[offset + 1] = (value >>> 16)
  6994. this[offset + 2] = (value >>> 8)
  6995. this[offset + 3] = (value & 0xff)
  6996. } else {
  6997. objectWriteUInt32(this, value, offset, false)
  6998. }
  6999. return offset + 4
  7000. }
  7001. Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
  7002. value = +value
  7003. offset = offset | 0
  7004. if (!noAssert) {
  7005. var limit = Math.pow(2, 8 * byteLength - 1)
  7006. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  7007. }
  7008. var i = 0
  7009. var mul = 1
  7010. var sub = 0
  7011. this[offset] = value & 0xFF
  7012. while (++i < byteLength && (mul *= 0x100)) {
  7013. if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
  7014. sub = 1
  7015. }
  7016. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  7017. }
  7018. return offset + byteLength
  7019. }
  7020. Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
  7021. value = +value
  7022. offset = offset | 0
  7023. if (!noAssert) {
  7024. var limit = Math.pow(2, 8 * byteLength - 1)
  7025. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  7026. }
  7027. var i = byteLength - 1
  7028. var mul = 1
  7029. var sub = 0
  7030. this[offset + i] = value & 0xFF
  7031. while (--i >= 0 && (mul *= 0x100)) {
  7032. if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
  7033. sub = 1
  7034. }
  7035. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  7036. }
  7037. return offset + byteLength
  7038. }
  7039. Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
  7040. value = +value
  7041. offset = offset | 0
  7042. if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
  7043. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  7044. if (value < 0) value = 0xff + value + 1
  7045. this[offset] = (value & 0xff)
  7046. return offset + 1
  7047. }
  7048. Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
  7049. value = +value
  7050. offset = offset | 0
  7051. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  7052. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7053. this[offset] = (value & 0xff)
  7054. this[offset + 1] = (value >>> 8)
  7055. } else {
  7056. objectWriteUInt16(this, value, offset, true)
  7057. }
  7058. return offset + 2
  7059. }
  7060. Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
  7061. value = +value
  7062. offset = offset | 0
  7063. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  7064. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7065. this[offset] = (value >>> 8)
  7066. this[offset + 1] = (value & 0xff)
  7067. } else {
  7068. objectWriteUInt16(this, value, offset, false)
  7069. }
  7070. return offset + 2
  7071. }
  7072. Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
  7073. value = +value
  7074. offset = offset | 0
  7075. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  7076. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7077. this[offset] = (value & 0xff)
  7078. this[offset + 1] = (value >>> 8)
  7079. this[offset + 2] = (value >>> 16)
  7080. this[offset + 3] = (value >>> 24)
  7081. } else {
  7082. objectWriteUInt32(this, value, offset, true)
  7083. }
  7084. return offset + 4
  7085. }
  7086. Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
  7087. value = +value
  7088. offset = offset | 0
  7089. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  7090. if (value < 0) value = 0xffffffff + value + 1
  7091. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7092. this[offset] = (value >>> 24)
  7093. this[offset + 1] = (value >>> 16)
  7094. this[offset + 2] = (value >>> 8)
  7095. this[offset + 3] = (value & 0xff)
  7096. } else {
  7097. objectWriteUInt32(this, value, offset, false)
  7098. }
  7099. return offset + 4
  7100. }
  7101. function checkIEEE754 (buf, value, offset, ext, max, min) {
  7102. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  7103. if (offset < 0) throw new RangeError('Index out of range')
  7104. }
  7105. function writeFloat (buf, value, offset, littleEndian, noAssert) {
  7106. if (!noAssert) {
  7107. checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
  7108. }
  7109. ieee754.write(buf, value, offset, littleEndian, 23, 4)
  7110. return offset + 4
  7111. }
  7112. Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
  7113. return writeFloat(this, value, offset, true, noAssert)
  7114. }
  7115. Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
  7116. return writeFloat(this, value, offset, false, noAssert)
  7117. }
  7118. function writeDouble (buf, value, offset, littleEndian, noAssert) {
  7119. if (!noAssert) {
  7120. checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
  7121. }
  7122. ieee754.write(buf, value, offset, littleEndian, 52, 8)
  7123. return offset + 8
  7124. }
  7125. Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
  7126. return writeDouble(this, value, offset, true, noAssert)
  7127. }
  7128. Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
  7129. return writeDouble(this, value, offset, false, noAssert)
  7130. }
  7131. // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
  7132. Buffer.prototype.copy = function copy (target, targetStart, start, end) {
  7133. if (!start) start = 0
  7134. if (!end && end !== 0) end = this.length
  7135. if (targetStart >= target.length) targetStart = target.length
  7136. if (!targetStart) targetStart = 0
  7137. if (end > 0 && end < start) end = start
  7138. // Copy 0 bytes; we're done
  7139. if (end === start) return 0
  7140. if (target.length === 0 || this.length === 0) return 0
  7141. // Fatal error conditions
  7142. if (targetStart < 0) {
  7143. throw new RangeError('targetStart out of bounds')
  7144. }
  7145. if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
  7146. if (end < 0) throw new RangeError('sourceEnd out of bounds')
  7147. // Are we oob?
  7148. if (end > this.length) end = this.length
  7149. if (target.length - targetStart < end - start) {
  7150. end = target.length - targetStart + start
  7151. }
  7152. var len = end - start
  7153. var i
  7154. if (this === target && start < targetStart && targetStart < end) {
  7155. // descending copy from end
  7156. for (i = len - 1; i >= 0; --i) {
  7157. target[i + targetStart] = this[i + start]
  7158. }
  7159. } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
  7160. // ascending copy from start
  7161. for (i = 0; i < len; ++i) {
  7162. target[i + targetStart] = this[i + start]
  7163. }
  7164. } else {
  7165. Uint8Array.prototype.set.call(
  7166. target,
  7167. this.subarray(start, start + len),
  7168. targetStart
  7169. )
  7170. }
  7171. return len
  7172. }
  7173. // Usage:
  7174. // buffer.fill(number[, offset[, end]])
  7175. // buffer.fill(buffer[, offset[, end]])
  7176. // buffer.fill(string[, offset[, end]][, encoding])
  7177. Buffer.prototype.fill = function fill (val, start, end, encoding) {
  7178. // Handle string cases:
  7179. if (typeof val === 'string') {
  7180. if (typeof start === 'string') {
  7181. encoding = start
  7182. start = 0
  7183. end = this.length
  7184. } else if (typeof end === 'string') {
  7185. encoding = end
  7186. end = this.length
  7187. }
  7188. if (val.length === 1) {
  7189. var code = val.charCodeAt(0)
  7190. if (code < 256) {
  7191. val = code
  7192. }
  7193. }
  7194. if (encoding !== undefined && typeof encoding !== 'string') {
  7195. throw new TypeError('encoding must be a string')
  7196. }
  7197. if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
  7198. throw new TypeError('Unknown encoding: ' + encoding)
  7199. }
  7200. } else if (typeof val === 'number') {
  7201. val = val & 255
  7202. }
  7203. // Invalid ranges are not set to a default, so can range check early.
  7204. if (start < 0 || this.length < start || this.length < end) {
  7205. throw new RangeError('Out of range index')
  7206. }
  7207. if (end <= start) {
  7208. return this
  7209. }
  7210. start = start >>> 0
  7211. end = end === undefined ? this.length : end >>> 0
  7212. if (!val) val = 0
  7213. var i
  7214. if (typeof val === 'number') {
  7215. for (i = start; i < end; ++i) {
  7216. this[i] = val
  7217. }
  7218. } else {
  7219. var bytes = Buffer.isBuffer(val)
  7220. ? val
  7221. : utf8ToBytes(new Buffer(val, encoding).toString())
  7222. var len = bytes.length
  7223. for (i = 0; i < end - start; ++i) {
  7224. this[i + start] = bytes[i % len]
  7225. }
  7226. }
  7227. return this
  7228. }
  7229. // HELPER FUNCTIONS
  7230. // ================
  7231. var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
  7232. function base64clean (str) {
  7233. // Node strips out invalid characters like \n and \t from the string, base64-js does not
  7234. str = stringtrim(str).replace(INVALID_BASE64_RE, '')
  7235. // Node converts strings with length < 2 to ''
  7236. if (str.length < 2) return ''
  7237. // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  7238. while (str.length % 4 !== 0) {
  7239. str = str + '='
  7240. }
  7241. return str
  7242. }
  7243. function stringtrim (str) {
  7244. if (str.trim) return str.trim()
  7245. return str.replace(/^\s+|\s+$/g, '')
  7246. }
  7247. function toHex (n) {
  7248. if (n < 16) return '0' + n.toString(16)
  7249. return n.toString(16)
  7250. }
  7251. function utf8ToBytes (string, units) {
  7252. units = units || Infinity
  7253. var codePoint
  7254. var length = string.length
  7255. var leadSurrogate = null
  7256. var bytes = []
  7257. for (var i = 0; i < length; ++i) {
  7258. codePoint = string.charCodeAt(i)
  7259. // is surrogate component
  7260. if (codePoint > 0xD7FF && codePoint < 0xE000) {
  7261. // last char was a lead
  7262. if (!leadSurrogate) {
  7263. // no lead yet
  7264. if (codePoint > 0xDBFF) {
  7265. // unexpected trail
  7266. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7267. continue
  7268. } else if (i + 1 === length) {
  7269. // unpaired lead
  7270. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7271. continue
  7272. }
  7273. // valid lead
  7274. leadSurrogate = codePoint
  7275. continue
  7276. }
  7277. // 2 leads in a row
  7278. if (codePoint < 0xDC00) {
  7279. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7280. leadSurrogate = codePoint
  7281. continue
  7282. }
  7283. // valid surrogate pair
  7284. codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
  7285. } else if (leadSurrogate) {
  7286. // valid bmp char, but last char was a lead
  7287. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7288. }
  7289. leadSurrogate = null
  7290. // encode utf8
  7291. if (codePoint < 0x80) {
  7292. if ((units -= 1) < 0) break
  7293. bytes.push(codePoint)
  7294. } else if (codePoint < 0x800) {
  7295. if ((units -= 2) < 0) break
  7296. bytes.push(
  7297. codePoint >> 0x6 | 0xC0,
  7298. codePoint & 0x3F | 0x80
  7299. )
  7300. } else if (codePoint < 0x10000) {
  7301. if ((units -= 3) < 0) break
  7302. bytes.push(
  7303. codePoint >> 0xC | 0xE0,
  7304. codePoint >> 0x6 & 0x3F | 0x80,
  7305. codePoint & 0x3F | 0x80
  7306. )
  7307. } else if (codePoint < 0x110000) {
  7308. if ((units -= 4) < 0) break
  7309. bytes.push(
  7310. codePoint >> 0x12 | 0xF0,
  7311. codePoint >> 0xC & 0x3F | 0x80,
  7312. codePoint >> 0x6 & 0x3F | 0x80,
  7313. codePoint & 0x3F | 0x80
  7314. )
  7315. } else {
  7316. throw new Error('Invalid code point')
  7317. }
  7318. }
  7319. return bytes
  7320. }
  7321. function asciiToBytes (str) {
  7322. var byteArray = []
  7323. for (var i = 0; i < str.length; ++i) {
  7324. // Node's code seems to be doing this and not & 0x7F..
  7325. byteArray.push(str.charCodeAt(i) & 0xFF)
  7326. }
  7327. return byteArray
  7328. }
  7329. function utf16leToBytes (str, units) {
  7330. var c, hi, lo
  7331. var byteArray = []
  7332. for (var i = 0; i < str.length; ++i) {
  7333. if ((units -= 2) < 0) break
  7334. c = str.charCodeAt(i)
  7335. hi = c >> 8
  7336. lo = c % 256
  7337. byteArray.push(lo)
  7338. byteArray.push(hi)
  7339. }
  7340. return byteArray
  7341. }
  7342. function base64ToBytes (str) {
  7343. return base64.toByteArray(base64clean(str))
  7344. }
  7345. function blitBuffer (src, dst, offset, length) {
  7346. for (var i = 0; i < length; ++i) {
  7347. if ((i + offset >= dst.length) || (i >= src.length)) break
  7348. dst[i + offset] = src[i]
  7349. }
  7350. return i
  7351. }
  7352. function isnan (val) {
  7353. return val !== val // eslint-disable-line no-self-compare
  7354. }
  7355. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  7356. /***/ }),
  7357. /***/ "./node_modules/clipboard/dist/clipboard.js":
  7358. /*!**************************************************!*\
  7359. !*** ./node_modules/clipboard/dist/clipboard.js ***!
  7360. \**************************************************/
  7361. /*! no static exports found */
  7362. /***/ (function(module, exports, __webpack_require__) {
  7363. /*!
  7364. * clipboard.js v2.0.4
  7365. * https://zenorocha.github.io/clipboard.js
  7366. *
  7367. * Licensed MIT © Zeno Rocha
  7368. */
  7369. (function webpackUniversalModuleDefinition(root, factory) {
  7370. if(true)
  7371. module.exports = factory();
  7372. else {}
  7373. })(this, function() {
  7374. return /******/ (function(modules) { // webpackBootstrap
  7375. /******/ // The module cache
  7376. /******/ var installedModules = {};
  7377. /******/
  7378. /******/ // The require function
  7379. /******/ function __webpack_require__(moduleId) {
  7380. /******/
  7381. /******/ // Check if module is in cache
  7382. /******/ if(installedModules[moduleId]) {
  7383. /******/ return installedModules[moduleId].exports;
  7384. /******/ }
  7385. /******/ // Create a new module (and put it into the cache)
  7386. /******/ var module = installedModules[moduleId] = {
  7387. /******/ i: moduleId,
  7388. /******/ l: false,
  7389. /******/ exports: {}
  7390. /******/ };
  7391. /******/
  7392. /******/ // Execute the module function
  7393. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  7394. /******/
  7395. /******/ // Flag the module as loaded
  7396. /******/ module.l = true;
  7397. /******/
  7398. /******/ // Return the exports of the module
  7399. /******/ return module.exports;
  7400. /******/ }
  7401. /******/
  7402. /******/
  7403. /******/ // expose the modules object (__webpack_modules__)
  7404. /******/ __webpack_require__.m = modules;
  7405. /******/
  7406. /******/ // expose the module cache
  7407. /******/ __webpack_require__.c = installedModules;
  7408. /******/
  7409. /******/ // define getter function for harmony exports
  7410. /******/ __webpack_require__.d = function(exports, name, getter) {
  7411. /******/ if(!__webpack_require__.o(exports, name)) {
  7412. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  7413. /******/ }
  7414. /******/ };
  7415. /******/
  7416. /******/ // define __esModule on exports
  7417. /******/ __webpack_require__.r = function(exports) {
  7418. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  7419. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  7420. /******/ }
  7421. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  7422. /******/ };
  7423. /******/
  7424. /******/ // create a fake namespace object
  7425. /******/ // mode & 1: value is a module id, require it
  7426. /******/ // mode & 2: merge all properties of value into the ns
  7427. /******/ // mode & 4: return value when already ns object
  7428. /******/ // mode & 8|1: behave like require
  7429. /******/ __webpack_require__.t = function(value, mode) {
  7430. /******/ if(mode & 1) value = __webpack_require__(value);
  7431. /******/ if(mode & 8) return value;
  7432. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  7433. /******/ var ns = Object.create(null);
  7434. /******/ __webpack_require__.r(ns);
  7435. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  7436. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  7437. /******/ return ns;
  7438. /******/ };
  7439. /******/
  7440. /******/ // getDefaultExport function for compatibility with non-harmony modules
  7441. /******/ __webpack_require__.n = function(module) {
  7442. /******/ var getter = module && module.__esModule ?
  7443. /******/ function getDefault() { return module['default']; } :
  7444. /******/ function getModuleExports() { return module; };
  7445. /******/ __webpack_require__.d(getter, 'a', getter);
  7446. /******/ return getter;
  7447. /******/ };
  7448. /******/
  7449. /******/ // Object.prototype.hasOwnProperty.call
  7450. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  7451. /******/
  7452. /******/ // __webpack_public_path__
  7453. /******/ __webpack_require__.p = "";
  7454. /******/
  7455. /******/
  7456. /******/ // Load entry module and return exports
  7457. /******/ return __webpack_require__(__webpack_require__.s = 0);
  7458. /******/ })
  7459. /************************************************************************/
  7460. /******/ ([
  7461. /* 0 */
  7462. /***/ (function(module, exports, __webpack_require__) {
  7463. "use strict";
  7464. 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; };
  7465. 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; }; }();
  7466. var _clipboardAction = __webpack_require__(1);
  7467. var _clipboardAction2 = _interopRequireDefault(_clipboardAction);
  7468. var _tinyEmitter = __webpack_require__(3);
  7469. var _tinyEmitter2 = _interopRequireDefault(_tinyEmitter);
  7470. var _goodListener = __webpack_require__(4);
  7471. var _goodListener2 = _interopRequireDefault(_goodListener);
  7472. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7473. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7474. 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; }
  7475. 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; }
  7476. /**
  7477. * Base class which takes one or more elements, adds event listeners to them,
  7478. * and instantiates a new `ClipboardAction` on each click.
  7479. */
  7480. var Clipboard = function (_Emitter) {
  7481. _inherits(Clipboard, _Emitter);
  7482. /**
  7483. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  7484. * @param {Object} options
  7485. */
  7486. function Clipboard(trigger, options) {
  7487. _classCallCheck(this, Clipboard);
  7488. var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this));
  7489. _this.resolveOptions(options);
  7490. _this.listenClick(trigger);
  7491. return _this;
  7492. }
  7493. /**
  7494. * Defines if attributes would be resolved using internal setter functions
  7495. * or custom functions that were passed in the constructor.
  7496. * @param {Object} options
  7497. */
  7498. _createClass(Clipboard, [{
  7499. key: 'resolveOptions',
  7500. value: function resolveOptions() {
  7501. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  7502. this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
  7503. this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
  7504. this.text = typeof options.text === 'function' ? options.text : this.defaultText;
  7505. this.container = _typeof(options.container) === 'object' ? options.container : document.body;
  7506. }
  7507. /**
  7508. * Adds a click event listener to the passed trigger.
  7509. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  7510. */
  7511. }, {
  7512. key: 'listenClick',
  7513. value: function listenClick(trigger) {
  7514. var _this2 = this;
  7515. this.listener = (0, _goodListener2.default)(trigger, 'click', function (e) {
  7516. return _this2.onClick(e);
  7517. });
  7518. }
  7519. /**
  7520. * Defines a new `ClipboardAction` on each click event.
  7521. * @param {Event} e
  7522. */
  7523. }, {
  7524. key: 'onClick',
  7525. value: function onClick(e) {
  7526. var trigger = e.delegateTarget || e.currentTarget;
  7527. if (this.clipboardAction) {
  7528. this.clipboardAction = null;
  7529. }
  7530. this.clipboardAction = new _clipboardAction2.default({
  7531. action: this.action(trigger),
  7532. target: this.target(trigger),
  7533. text: this.text(trigger),
  7534. container: this.container,
  7535. trigger: trigger,
  7536. emitter: this
  7537. });
  7538. }
  7539. /**
  7540. * Default `action` lookup function.
  7541. * @param {Element} trigger
  7542. */
  7543. }, {
  7544. key: 'defaultAction',
  7545. value: function defaultAction(trigger) {
  7546. return getAttributeValue('action', trigger);
  7547. }
  7548. /**
  7549. * Default `target` lookup function.
  7550. * @param {Element} trigger
  7551. */
  7552. }, {
  7553. key: 'defaultTarget',
  7554. value: function defaultTarget(trigger) {
  7555. var selector = getAttributeValue('target', trigger);
  7556. if (selector) {
  7557. return document.querySelector(selector);
  7558. }
  7559. }
  7560. /**
  7561. * Returns the support of the given action, or all actions if no action is
  7562. * given.
  7563. * @param {String} [action]
  7564. */
  7565. }, {
  7566. key: 'defaultText',
  7567. /**
  7568. * Default `text` lookup function.
  7569. * @param {Element} trigger
  7570. */
  7571. value: function defaultText(trigger) {
  7572. return getAttributeValue('text', trigger);
  7573. }
  7574. /**
  7575. * Destroy lifecycle.
  7576. */
  7577. }, {
  7578. key: 'destroy',
  7579. value: function destroy() {
  7580. this.listener.destroy();
  7581. if (this.clipboardAction) {
  7582. this.clipboardAction.destroy();
  7583. this.clipboardAction = null;
  7584. }
  7585. }
  7586. }], [{
  7587. key: 'isSupported',
  7588. value: function isSupported() {
  7589. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut'];
  7590. var actions = typeof action === 'string' ? [action] : action;
  7591. var support = !!document.queryCommandSupported;
  7592. actions.forEach(function (action) {
  7593. support = support && !!document.queryCommandSupported(action);
  7594. });
  7595. return support;
  7596. }
  7597. }]);
  7598. return Clipboard;
  7599. }(_tinyEmitter2.default);
  7600. /**
  7601. * Helper function to retrieve attribute value.
  7602. * @param {String} suffix
  7603. * @param {Element} element
  7604. */
  7605. function getAttributeValue(suffix, element) {
  7606. var attribute = 'data-clipboard-' + suffix;
  7607. if (!element.hasAttribute(attribute)) {
  7608. return;
  7609. }
  7610. return element.getAttribute(attribute);
  7611. }
  7612. module.exports = Clipboard;
  7613. /***/ }),
  7614. /* 1 */
  7615. /***/ (function(module, exports, __webpack_require__) {
  7616. "use strict";
  7617. 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; };
  7618. 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; }; }();
  7619. var _select = __webpack_require__(2);
  7620. var _select2 = _interopRequireDefault(_select);
  7621. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7622. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7623. /**
  7624. * Inner class which performs selection from either `text` or `target`
  7625. * properties and then executes copy or cut operations.
  7626. */
  7627. var ClipboardAction = function () {
  7628. /**
  7629. * @param {Object} options
  7630. */
  7631. function ClipboardAction(options) {
  7632. _classCallCheck(this, ClipboardAction);
  7633. this.resolveOptions(options);
  7634. this.initSelection();
  7635. }
  7636. /**
  7637. * Defines base properties passed from constructor.
  7638. * @param {Object} options
  7639. */
  7640. _createClass(ClipboardAction, [{
  7641. key: 'resolveOptions',
  7642. value: function resolveOptions() {
  7643. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  7644. this.action = options.action;
  7645. this.container = options.container;
  7646. this.emitter = options.emitter;
  7647. this.target = options.target;
  7648. this.text = options.text;
  7649. this.trigger = options.trigger;
  7650. this.selectedText = '';
  7651. }
  7652. /**
  7653. * Decides which selection strategy is going to be applied based
  7654. * on the existence of `text` and `target` properties.
  7655. */
  7656. }, {
  7657. key: 'initSelection',
  7658. value: function initSelection() {
  7659. if (this.text) {
  7660. this.selectFake();
  7661. } else if (this.target) {
  7662. this.selectTarget();
  7663. }
  7664. }
  7665. /**
  7666. * Creates a fake textarea element, sets its value from `text` property,
  7667. * and makes a selection on it.
  7668. */
  7669. }, {
  7670. key: 'selectFake',
  7671. value: function selectFake() {
  7672. var _this = this;
  7673. var isRTL = document.documentElement.getAttribute('dir') == 'rtl';
  7674. this.removeFake();
  7675. this.fakeHandlerCallback = function () {
  7676. return _this.removeFake();
  7677. };
  7678. this.fakeHandler = this.container.addEventListener('click', this.fakeHandlerCallback) || true;
  7679. this.fakeElem = document.createElement('textarea');
  7680. // Prevent zooming on iOS
  7681. this.fakeElem.style.fontSize = '12pt';
  7682. // Reset box model
  7683. this.fakeElem.style.border = '0';
  7684. this.fakeElem.style.padding = '0';
  7685. this.fakeElem.style.margin = '0';
  7686. // Move element out of screen horizontally
  7687. this.fakeElem.style.position = 'absolute';
  7688. this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
  7689. // Move element to the same position vertically
  7690. var yPosition = window.pageYOffset || document.documentElement.scrollTop;
  7691. this.fakeElem.style.top = yPosition + 'px';
  7692. this.fakeElem.setAttribute('readonly', '');
  7693. this.fakeElem.value = this.text;
  7694. this.container.appendChild(this.fakeElem);
  7695. this.selectedText = (0, _select2.default)(this.fakeElem);
  7696. this.copyText();
  7697. }
  7698. /**
  7699. * Only removes the fake element after another click event, that way
  7700. * a user can hit `Ctrl+C` to copy because selection still exists.
  7701. */
  7702. }, {
  7703. key: 'removeFake',
  7704. value: function removeFake() {
  7705. if (this.fakeHandler) {
  7706. this.container.removeEventListener('click', this.fakeHandlerCallback);
  7707. this.fakeHandler = null;
  7708. this.fakeHandlerCallback = null;
  7709. }
  7710. if (this.fakeElem) {
  7711. this.container.removeChild(this.fakeElem);
  7712. this.fakeElem = null;
  7713. }
  7714. }
  7715. /**
  7716. * Selects the content from element passed on `target` property.
  7717. */
  7718. }, {
  7719. key: 'selectTarget',
  7720. value: function selectTarget() {
  7721. this.selectedText = (0, _select2.default)(this.target);
  7722. this.copyText();
  7723. }
  7724. /**
  7725. * Executes the copy operation based on the current selection.
  7726. */
  7727. }, {
  7728. key: 'copyText',
  7729. value: function copyText() {
  7730. var succeeded = void 0;
  7731. try {
  7732. succeeded = document.execCommand(this.action);
  7733. } catch (err) {
  7734. succeeded = false;
  7735. }
  7736. this.handleResult(succeeded);
  7737. }
  7738. /**
  7739. * Fires an event based on the copy operation result.
  7740. * @param {Boolean} succeeded
  7741. */
  7742. }, {
  7743. key: 'handleResult',
  7744. value: function handleResult(succeeded) {
  7745. this.emitter.emit(succeeded ? 'success' : 'error', {
  7746. action: this.action,
  7747. text: this.selectedText,
  7748. trigger: this.trigger,
  7749. clearSelection: this.clearSelection.bind(this)
  7750. });
  7751. }
  7752. /**
  7753. * Moves focus away from `target` and back to the trigger, removes current selection.
  7754. */
  7755. }, {
  7756. key: 'clearSelection',
  7757. value: function clearSelection() {
  7758. if (this.trigger) {
  7759. this.trigger.focus();
  7760. }
  7761. window.getSelection().removeAllRanges();
  7762. }
  7763. /**
  7764. * Sets the `action` to be performed which can be either 'copy' or 'cut'.
  7765. * @param {String} action
  7766. */
  7767. }, {
  7768. key: 'destroy',
  7769. /**
  7770. * Destroy lifecycle.
  7771. */
  7772. value: function destroy() {
  7773. this.removeFake();
  7774. }
  7775. }, {
  7776. key: 'action',
  7777. set: function set() {
  7778. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy';
  7779. this._action = action;
  7780. if (this._action !== 'copy' && this._action !== 'cut') {
  7781. throw new Error('Invalid "action" value, use either "copy" or "cut"');
  7782. }
  7783. }
  7784. /**
  7785. * Gets the `action` property.
  7786. * @return {String}
  7787. */
  7788. ,
  7789. get: function get() {
  7790. return this._action;
  7791. }
  7792. /**
  7793. * Sets the `target` property using an element
  7794. * that will be have its content copied.
  7795. * @param {Element} target
  7796. */
  7797. }, {
  7798. key: 'target',
  7799. set: function set(target) {
  7800. if (target !== undefined) {
  7801. if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target.nodeType === 1) {
  7802. if (this.action === 'copy' && target.hasAttribute('disabled')) {
  7803. throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');
  7804. }
  7805. if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) {
  7806. throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');
  7807. }
  7808. this._target = target;
  7809. } else {
  7810. throw new Error('Invalid "target" value, use a valid Element');
  7811. }
  7812. }
  7813. }
  7814. /**
  7815. * Gets the `target` property.
  7816. * @return {String|HTMLElement}
  7817. */
  7818. ,
  7819. get: function get() {
  7820. return this._target;
  7821. }
  7822. }]);
  7823. return ClipboardAction;
  7824. }();
  7825. module.exports = ClipboardAction;
  7826. /***/ }),
  7827. /* 2 */
  7828. /***/ (function(module, exports) {
  7829. function select(element) {
  7830. var selectedText;
  7831. if (element.nodeName === 'SELECT') {
  7832. element.focus();
  7833. selectedText = element.value;
  7834. }
  7835. else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
  7836. var isReadOnly = element.hasAttribute('readonly');
  7837. if (!isReadOnly) {
  7838. element.setAttribute('readonly', '');
  7839. }
  7840. element.select();
  7841. element.setSelectionRange(0, element.value.length);
  7842. if (!isReadOnly) {
  7843. element.removeAttribute('readonly');
  7844. }
  7845. selectedText = element.value;
  7846. }
  7847. else {
  7848. if (element.hasAttribute('contenteditable')) {
  7849. element.focus();
  7850. }
  7851. var selection = window.getSelection();
  7852. var range = document.createRange();
  7853. range.selectNodeContents(element);
  7854. selection.removeAllRanges();
  7855. selection.addRange(range);
  7856. selectedText = selection.toString();
  7857. }
  7858. return selectedText;
  7859. }
  7860. module.exports = select;
  7861. /***/ }),
  7862. /* 3 */
  7863. /***/ (function(module, exports) {
  7864. function E () {
  7865. // Keep this empty so it's easier to inherit from
  7866. // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
  7867. }
  7868. E.prototype = {
  7869. on: function (name, callback, ctx) {
  7870. var e = this.e || (this.e = {});
  7871. (e[name] || (e[name] = [])).push({
  7872. fn: callback,
  7873. ctx: ctx
  7874. });
  7875. return this;
  7876. },
  7877. once: function (name, callback, ctx) {
  7878. var self = this;
  7879. function listener () {
  7880. self.off(name, listener);
  7881. callback.apply(ctx, arguments);
  7882. };
  7883. listener._ = callback
  7884. return this.on(name, listener, ctx);
  7885. },
  7886. emit: function (name) {
  7887. var data = [].slice.call(arguments, 1);
  7888. var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
  7889. var i = 0;
  7890. var len = evtArr.length;
  7891. for (i; i < len; i++) {
  7892. evtArr[i].fn.apply(evtArr[i].ctx, data);
  7893. }
  7894. return this;
  7895. },
  7896. off: function (name, callback) {
  7897. var e = this.e || (this.e = {});
  7898. var evts = e[name];
  7899. var liveEvents = [];
  7900. if (evts && callback) {
  7901. for (var i = 0, len = evts.length; i < len; i++) {
  7902. if (evts[i].fn !== callback && evts[i].fn._ !== callback)
  7903. liveEvents.push(evts[i]);
  7904. }
  7905. }
  7906. // Remove event from queue to prevent memory leak
  7907. // Suggested by https://github.com/lazd
  7908. // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
  7909. (liveEvents.length)
  7910. ? e[name] = liveEvents
  7911. : delete e[name];
  7912. return this;
  7913. }
  7914. };
  7915. module.exports = E;
  7916. /***/ }),
  7917. /* 4 */
  7918. /***/ (function(module, exports, __webpack_require__) {
  7919. var is = __webpack_require__(5);
  7920. var delegate = __webpack_require__(6);
  7921. /**
  7922. * Validates all params and calls the right
  7923. * listener function based on its target type.
  7924. *
  7925. * @param {String|HTMLElement|HTMLCollection|NodeList} target
  7926. * @param {String} type
  7927. * @param {Function} callback
  7928. * @return {Object}
  7929. */
  7930. function listen(target, type, callback) {
  7931. if (!target && !type && !callback) {
  7932. throw new Error('Missing required arguments');
  7933. }
  7934. if (!is.string(type)) {
  7935. throw new TypeError('Second argument must be a String');
  7936. }
  7937. if (!is.fn(callback)) {
  7938. throw new TypeError('Third argument must be a Function');
  7939. }
  7940. if (is.node(target)) {
  7941. return listenNode(target, type, callback);
  7942. }
  7943. else if (is.nodeList(target)) {
  7944. return listenNodeList(target, type, callback);
  7945. }
  7946. else if (is.string(target)) {
  7947. return listenSelector(target, type, callback);
  7948. }
  7949. else {
  7950. throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList');
  7951. }
  7952. }
  7953. /**
  7954. * Adds an event listener to a HTML element
  7955. * and returns a remove listener function.
  7956. *
  7957. * @param {HTMLElement} node
  7958. * @param {String} type
  7959. * @param {Function} callback
  7960. * @return {Object}
  7961. */
  7962. function listenNode(node, type, callback) {
  7963. node.addEventListener(type, callback);
  7964. return {
  7965. destroy: function() {
  7966. node.removeEventListener(type, callback);
  7967. }
  7968. }
  7969. }
  7970. /**
  7971. * Add an event listener to a list of HTML elements
  7972. * and returns a remove listener function.
  7973. *
  7974. * @param {NodeList|HTMLCollection} nodeList
  7975. * @param {String} type
  7976. * @param {Function} callback
  7977. * @return {Object}
  7978. */
  7979. function listenNodeList(nodeList, type, callback) {
  7980. Array.prototype.forEach.call(nodeList, function(node) {
  7981. node.addEventListener(type, callback);
  7982. });
  7983. return {
  7984. destroy: function() {
  7985. Array.prototype.forEach.call(nodeList, function(node) {
  7986. node.removeEventListener(type, callback);
  7987. });
  7988. }
  7989. }
  7990. }
  7991. /**
  7992. * Add an event listener to a selector
  7993. * and returns a remove listener function.
  7994. *
  7995. * @param {String} selector
  7996. * @param {String} type
  7997. * @param {Function} callback
  7998. * @return {Object}
  7999. */
  8000. function listenSelector(selector, type, callback) {
  8001. return delegate(document.body, selector, type, callback);
  8002. }
  8003. module.exports = listen;
  8004. /***/ }),
  8005. /* 5 */
  8006. /***/ (function(module, exports) {
  8007. /**
  8008. * Check if argument is a HTML element.
  8009. *
  8010. * @param {Object} value
  8011. * @return {Boolean}
  8012. */
  8013. exports.node = function(value) {
  8014. return value !== undefined
  8015. && value instanceof HTMLElement
  8016. && value.nodeType === 1;
  8017. };
  8018. /**
  8019. * Check if argument is a list of HTML elements.
  8020. *
  8021. * @param {Object} value
  8022. * @return {Boolean}
  8023. */
  8024. exports.nodeList = function(value) {
  8025. var type = Object.prototype.toString.call(value);
  8026. return value !== undefined
  8027. && (type === '[object NodeList]' || type === '[object HTMLCollection]')
  8028. && ('length' in value)
  8029. && (value.length === 0 || exports.node(value[0]));
  8030. };
  8031. /**
  8032. * Check if argument is a string.
  8033. *
  8034. * @param {Object} value
  8035. * @return {Boolean}
  8036. */
  8037. exports.string = function(value) {
  8038. return typeof value === 'string'
  8039. || value instanceof String;
  8040. };
  8041. /**
  8042. * Check if argument is a function.
  8043. *
  8044. * @param {Object} value
  8045. * @return {Boolean}
  8046. */
  8047. exports.fn = function(value) {
  8048. var type = Object.prototype.toString.call(value);
  8049. return type === '[object Function]';
  8050. };
  8051. /***/ }),
  8052. /* 6 */
  8053. /***/ (function(module, exports, __webpack_require__) {
  8054. var closest = __webpack_require__(7);
  8055. /**
  8056. * Delegates event to a selector.
  8057. *
  8058. * @param {Element} element
  8059. * @param {String} selector
  8060. * @param {String} type
  8061. * @param {Function} callback
  8062. * @param {Boolean} useCapture
  8063. * @return {Object}
  8064. */
  8065. function _delegate(element, selector, type, callback, useCapture) {
  8066. var listenerFn = listener.apply(this, arguments);
  8067. element.addEventListener(type, listenerFn, useCapture);
  8068. return {
  8069. destroy: function() {
  8070. element.removeEventListener(type, listenerFn, useCapture);
  8071. }
  8072. }
  8073. }
  8074. /**
  8075. * Delegates event to a selector.
  8076. *
  8077. * @param {Element|String|Array} [elements]
  8078. * @param {String} selector
  8079. * @param {String} type
  8080. * @param {Function} callback
  8081. * @param {Boolean} useCapture
  8082. * @return {Object}
  8083. */
  8084. function delegate(elements, selector, type, callback, useCapture) {
  8085. // Handle the regular Element usage
  8086. if (typeof elements.addEventListener === 'function') {
  8087. return _delegate.apply(null, arguments);
  8088. }
  8089. // Handle Element-less usage, it defaults to global delegation
  8090. if (typeof type === 'function') {
  8091. // Use `document` as the first parameter, then apply arguments
  8092. // This is a short way to .unshift `arguments` without running into deoptimizations
  8093. return _delegate.bind(null, document).apply(null, arguments);
  8094. }
  8095. // Handle Selector-based usage
  8096. if (typeof elements === 'string') {
  8097. elements = document.querySelectorAll(elements);
  8098. }
  8099. // Handle Array-like based usage
  8100. return Array.prototype.map.call(elements, function (element) {
  8101. return _delegate(element, selector, type, callback, useCapture);
  8102. });
  8103. }
  8104. /**
  8105. * Finds closest match and invokes callback.
  8106. *
  8107. * @param {Element} element
  8108. * @param {String} selector
  8109. * @param {String} type
  8110. * @param {Function} callback
  8111. * @return {Function}
  8112. */
  8113. function listener(element, selector, type, callback) {
  8114. return function(e) {
  8115. e.delegateTarget = closest(e.target, selector);
  8116. if (e.delegateTarget) {
  8117. callback.call(element, e);
  8118. }
  8119. }
  8120. }
  8121. module.exports = delegate;
  8122. /***/ }),
  8123. /* 7 */
  8124. /***/ (function(module, exports) {
  8125. var DOCUMENT_NODE_TYPE = 9;
  8126. /**
  8127. * A polyfill for Element.matches()
  8128. */
  8129. if (typeof Element !== 'undefined' && !Element.prototype.matches) {
  8130. var proto = Element.prototype;
  8131. proto.matches = proto.matchesSelector ||
  8132. proto.mozMatchesSelector ||
  8133. proto.msMatchesSelector ||
  8134. proto.oMatchesSelector ||
  8135. proto.webkitMatchesSelector;
  8136. }
  8137. /**
  8138. * Finds the closest parent that matches a selector.
  8139. *
  8140. * @param {Element} element
  8141. * @param {String} selector
  8142. * @return {Function}
  8143. */
  8144. function closest (element, selector) {
  8145. while (element && element.nodeType !== DOCUMENT_NODE_TYPE) {
  8146. if (typeof element.matches === 'function' &&
  8147. element.matches(selector)) {
  8148. return element;
  8149. }
  8150. element = element.parentNode;
  8151. }
  8152. }
  8153. module.exports = closest;
  8154. /***/ })
  8155. /******/ ]);
  8156. });
  8157. /***/ }),
  8158. /***/ "./node_modules/ieee754/index.js":
  8159. /*!***************************************!*\
  8160. !*** ./node_modules/ieee754/index.js ***!
  8161. \***************************************/
  8162. /*! no static exports found */
  8163. /***/ (function(module, exports) {
  8164. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  8165. var e, m
  8166. var eLen = (nBytes * 8) - mLen - 1
  8167. var eMax = (1 << eLen) - 1
  8168. var eBias = eMax >> 1
  8169. var nBits = -7
  8170. var i = isLE ? (nBytes - 1) : 0
  8171. var d = isLE ? -1 : 1
  8172. var s = buffer[offset + i]
  8173. i += d
  8174. e = s & ((1 << (-nBits)) - 1)
  8175. s >>= (-nBits)
  8176. nBits += eLen
  8177. for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  8178. m = e & ((1 << (-nBits)) - 1)
  8179. e >>= (-nBits)
  8180. nBits += mLen
  8181. for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  8182. if (e === 0) {
  8183. e = 1 - eBias
  8184. } else if (e === eMax) {
  8185. return m ? NaN : ((s ? -1 : 1) * Infinity)
  8186. } else {
  8187. m = m + Math.pow(2, mLen)
  8188. e = e - eBias
  8189. }
  8190. return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  8191. }
  8192. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  8193. var e, m, c
  8194. var eLen = (nBytes * 8) - mLen - 1
  8195. var eMax = (1 << eLen) - 1
  8196. var eBias = eMax >> 1
  8197. var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  8198. var i = isLE ? 0 : (nBytes - 1)
  8199. var d = isLE ? 1 : -1
  8200. var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
  8201. value = Math.abs(value)
  8202. if (isNaN(value) || value === Infinity) {
  8203. m = isNaN(value) ? 1 : 0
  8204. e = eMax
  8205. } else {
  8206. e = Math.floor(Math.log(value) / Math.LN2)
  8207. if (value * (c = Math.pow(2, -e)) < 1) {
  8208. e--
  8209. c *= 2
  8210. }
  8211. if (e + eBias >= 1) {
  8212. value += rt / c
  8213. } else {
  8214. value += rt * Math.pow(2, 1 - eBias)
  8215. }
  8216. if (value * c >= 2) {
  8217. e++
  8218. c /= 2
  8219. }
  8220. if (e + eBias >= eMax) {
  8221. m = 0
  8222. e = eMax
  8223. } else if (e + eBias >= 1) {
  8224. m = ((value * c) - 1) * Math.pow(2, mLen)
  8225. e = e + eBias
  8226. } else {
  8227. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
  8228. e = 0
  8229. }
  8230. }
  8231. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  8232. e = (e << mLen) | m
  8233. eLen += mLen
  8234. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  8235. buffer[offset + i - d] |= s * 128
  8236. }
  8237. /***/ }),
  8238. /***/ "./node_modules/isarray/index.js":
  8239. /*!***************************************!*\
  8240. !*** ./node_modules/isarray/index.js ***!
  8241. \***************************************/
  8242. /*! no static exports found */
  8243. /***/ (function(module, exports) {
  8244. var toString = {}.toString;
  8245. module.exports = Array.isArray || function (arr) {
  8246. return toString.call(arr) == '[object Array]';
  8247. };
  8248. /***/ }),
  8249. /***/ "./node_modules/jquery/dist/jquery.js":
  8250. /*!********************************************!*\
  8251. !*** ./node_modules/jquery/dist/jquery.js ***!
  8252. \********************************************/
  8253. /*! no static exports found */
  8254. /***/ (function(module, exports, __webpack_require__) {
  8255. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  8256. * jQuery JavaScript Library v3.4.1
  8257. * https://jquery.com/
  8258. *
  8259. * Includes Sizzle.js
  8260. * https://sizzlejs.com/
  8261. *
  8262. * Copyright JS Foundation and other contributors
  8263. * Released under the MIT license
  8264. * https://jquery.org/license
  8265. *
  8266. * Date: 2019-05-01T21:04Z
  8267. */
  8268. ( function( global, factory ) {
  8269. "use strict";
  8270. if ( true && typeof module.exports === "object" ) {
  8271. // For CommonJS and CommonJS-like environments where a proper `window`
  8272. // is present, execute the factory and get jQuery.
  8273. // For environments that do not have a `window` with a `document`
  8274. // (such as Node.js), expose a factory as module.exports.
  8275. // This accentuates the need for the creation of a real `window`.
  8276. // e.g. var jQuery = require("jquery")(window);
  8277. // See ticket #14549 for more info.
  8278. module.exports = global.document ?
  8279. factory( global, true ) :
  8280. function( w ) {
  8281. if ( !w.document ) {
  8282. throw new Error( "jQuery requires a window with a document" );
  8283. }
  8284. return factory( w );
  8285. };
  8286. } else {
  8287. factory( global );
  8288. }
  8289. // Pass this if window is not defined yet
  8290. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  8291. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  8292. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  8293. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  8294. // enough that all such attempts are guarded in a try block.
  8295. "use strict";
  8296. var arr = [];
  8297. var document = window.document;
  8298. var getProto = Object.getPrototypeOf;
  8299. var slice = arr.slice;
  8300. var concat = arr.concat;
  8301. var push = arr.push;
  8302. var indexOf = arr.indexOf;
  8303. var class2type = {};
  8304. var toString = class2type.toString;
  8305. var hasOwn = class2type.hasOwnProperty;
  8306. var fnToString = hasOwn.toString;
  8307. var ObjectFunctionString = fnToString.call( Object );
  8308. var support = {};
  8309. var isFunction = function isFunction( obj ) {
  8310. // Support: Chrome <=57, Firefox <=52
  8311. // In some browsers, typeof returns "function" for HTML <object> elements
  8312. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  8313. // We don't want to classify *any* DOM node as a function.
  8314. return typeof obj === "function" && typeof obj.nodeType !== "number";
  8315. };
  8316. var isWindow = function isWindow( obj ) {
  8317. return obj != null && obj === obj.window;
  8318. };
  8319. var preservedScriptAttributes = {
  8320. type: true,
  8321. src: true,
  8322. nonce: true,
  8323. noModule: true
  8324. };
  8325. function DOMEval( code, node, doc ) {
  8326. doc = doc || document;
  8327. var i, val,
  8328. script = doc.createElement( "script" );
  8329. script.text = code;
  8330. if ( node ) {
  8331. for ( i in preservedScriptAttributes ) {
  8332. // Support: Firefox 64+, Edge 18+
  8333. // Some browsers don't support the "nonce" property on scripts.
  8334. // On the other hand, just using `getAttribute` is not enough as
  8335. // the `nonce` attribute is reset to an empty string whenever it
  8336. // becomes browsing-context connected.
  8337. // See https://github.com/whatwg/html/issues/2369
  8338. // See https://html.spec.whatwg.org/#nonce-attributes
  8339. // The `node.getAttribute` check was added for the sake of
  8340. // `jQuery.globalEval` so that it can fake a nonce-containing node
  8341. // via an object.
  8342. val = node[ i ] || node.getAttribute && node.getAttribute( i );
  8343. if ( val ) {
  8344. script.setAttribute( i, val );
  8345. }
  8346. }
  8347. }
  8348. doc.head.appendChild( script ).parentNode.removeChild( script );
  8349. }
  8350. function toType( obj ) {
  8351. if ( obj == null ) {
  8352. return obj + "";
  8353. }
  8354. // Support: Android <=2.3 only (functionish RegExp)
  8355. return typeof obj === "object" || typeof obj === "function" ?
  8356. class2type[ toString.call( obj ) ] || "object" :
  8357. typeof obj;
  8358. }
  8359. /* global Symbol */
  8360. // Defining this global in .eslintrc.json would create a danger of using the global
  8361. // unguarded in another place, it seems safer to define global only for this module
  8362. var
  8363. version = "3.4.1",
  8364. // Define a local copy of jQuery
  8365. jQuery = function( selector, context ) {
  8366. // The jQuery object is actually just the init constructor 'enhanced'
  8367. // Need init if jQuery is called (just allow error to be thrown if not included)
  8368. return new jQuery.fn.init( selector, context );
  8369. },
  8370. // Support: Android <=4.0 only
  8371. // Make sure we trim BOM and NBSP
  8372. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  8373. jQuery.fn = jQuery.prototype = {
  8374. // The current version of jQuery being used
  8375. jquery: version,
  8376. constructor: jQuery,
  8377. // The default length of a jQuery object is 0
  8378. length: 0,
  8379. toArray: function() {
  8380. return slice.call( this );
  8381. },
  8382. // Get the Nth element in the matched element set OR
  8383. // Get the whole matched element set as a clean array
  8384. get: function( num ) {
  8385. // Return all the elements in a clean array
  8386. if ( num == null ) {
  8387. return slice.call( this );
  8388. }
  8389. // Return just the one element from the set
  8390. return num < 0 ? this[ num + this.length ] : this[ num ];
  8391. },
  8392. // Take an array of elements and push it onto the stack
  8393. // (returning the new matched element set)
  8394. pushStack: function( elems ) {
  8395. // Build a new jQuery matched element set
  8396. var ret = jQuery.merge( this.constructor(), elems );
  8397. // Add the old object onto the stack (as a reference)
  8398. ret.prevObject = this;
  8399. // Return the newly-formed element set
  8400. return ret;
  8401. },
  8402. // Execute a callback for every element in the matched set.
  8403. each: function( callback ) {
  8404. return jQuery.each( this, callback );
  8405. },
  8406. map: function( callback ) {
  8407. return this.pushStack( jQuery.map( this, function( elem, i ) {
  8408. return callback.call( elem, i, elem );
  8409. } ) );
  8410. },
  8411. slice: function() {
  8412. return this.pushStack( slice.apply( this, arguments ) );
  8413. },
  8414. first: function() {
  8415. return this.eq( 0 );
  8416. },
  8417. last: function() {
  8418. return this.eq( -1 );
  8419. },
  8420. eq: function( i ) {
  8421. var len = this.length,
  8422. j = +i + ( i < 0 ? len : 0 );
  8423. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  8424. },
  8425. end: function() {
  8426. return this.prevObject || this.constructor();
  8427. },
  8428. // For internal use only.
  8429. // Behaves like an Array's method, not like a jQuery method.
  8430. push: push,
  8431. sort: arr.sort,
  8432. splice: arr.splice
  8433. };
  8434. jQuery.extend = jQuery.fn.extend = function() {
  8435. var options, name, src, copy, copyIsArray, clone,
  8436. target = arguments[ 0 ] || {},
  8437. i = 1,
  8438. length = arguments.length,
  8439. deep = false;
  8440. // Handle a deep copy situation
  8441. if ( typeof target === "boolean" ) {
  8442. deep = target;
  8443. // Skip the boolean and the target
  8444. target = arguments[ i ] || {};
  8445. i++;
  8446. }
  8447. // Handle case when target is a string or something (possible in deep copy)
  8448. if ( typeof target !== "object" && !isFunction( target ) ) {
  8449. target = {};
  8450. }
  8451. // Extend jQuery itself if only one argument is passed
  8452. if ( i === length ) {
  8453. target = this;
  8454. i--;
  8455. }
  8456. for ( ; i < length; i++ ) {
  8457. // Only deal with non-null/undefined values
  8458. if ( ( options = arguments[ i ] ) != null ) {
  8459. // Extend the base object
  8460. for ( name in options ) {
  8461. copy = options[ name ];
  8462. // Prevent Object.prototype pollution
  8463. // Prevent never-ending loop
  8464. if ( name === "__proto__" || target === copy ) {
  8465. continue;
  8466. }
  8467. // Recurse if we're merging plain objects or arrays
  8468. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  8469. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  8470. src = target[ name ];
  8471. // Ensure proper type for the source value
  8472. if ( copyIsArray && !Array.isArray( src ) ) {
  8473. clone = [];
  8474. } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
  8475. clone = {};
  8476. } else {
  8477. clone = src;
  8478. }
  8479. copyIsArray = false;
  8480. // Never move original objects, clone them
  8481. target[ name ] = jQuery.extend( deep, clone, copy );
  8482. // Don't bring in undefined values
  8483. } else if ( copy !== undefined ) {
  8484. target[ name ] = copy;
  8485. }
  8486. }
  8487. }
  8488. }
  8489. // Return the modified object
  8490. return target;
  8491. };
  8492. jQuery.extend( {
  8493. // Unique for each copy of jQuery on the page
  8494. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  8495. // Assume jQuery is ready without the ready module
  8496. isReady: true,
  8497. error: function( msg ) {
  8498. throw new Error( msg );
  8499. },
  8500. noop: function() {},
  8501. isPlainObject: function( obj ) {
  8502. var proto, Ctor;
  8503. // Detect obvious negatives
  8504. // Use toString instead of jQuery.type to catch host objects
  8505. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  8506. return false;
  8507. }
  8508. proto = getProto( obj );
  8509. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  8510. if ( !proto ) {
  8511. return true;
  8512. }
  8513. // Objects with prototype are plain iff they were constructed by a global Object function
  8514. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  8515. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  8516. },
  8517. isEmptyObject: function( obj ) {
  8518. var name;
  8519. for ( name in obj ) {
  8520. return false;
  8521. }
  8522. return true;
  8523. },
  8524. // Evaluates a script in a global context
  8525. globalEval: function( code, options ) {
  8526. DOMEval( code, { nonce: options && options.nonce } );
  8527. },
  8528. each: function( obj, callback ) {
  8529. var length, i = 0;
  8530. if ( isArrayLike( obj ) ) {
  8531. length = obj.length;
  8532. for ( ; i < length; i++ ) {
  8533. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  8534. break;
  8535. }
  8536. }
  8537. } else {
  8538. for ( i in obj ) {
  8539. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  8540. break;
  8541. }
  8542. }
  8543. }
  8544. return obj;
  8545. },
  8546. // Support: Android <=4.0 only
  8547. trim: function( text ) {
  8548. return text == null ?
  8549. "" :
  8550. ( text + "" ).replace( rtrim, "" );
  8551. },
  8552. // results is for internal usage only
  8553. makeArray: function( arr, results ) {
  8554. var ret = results || [];
  8555. if ( arr != null ) {
  8556. if ( isArrayLike( Object( arr ) ) ) {
  8557. jQuery.merge( ret,
  8558. typeof arr === "string" ?
  8559. [ arr ] : arr
  8560. );
  8561. } else {
  8562. push.call( ret, arr );
  8563. }
  8564. }
  8565. return ret;
  8566. },
  8567. inArray: function( elem, arr, i ) {
  8568. return arr == null ? -1 : indexOf.call( arr, elem, i );
  8569. },
  8570. // Support: Android <=4.0 only, PhantomJS 1 only
  8571. // push.apply(_, arraylike) throws on ancient WebKit
  8572. merge: function( first, second ) {
  8573. var len = +second.length,
  8574. j = 0,
  8575. i = first.length;
  8576. for ( ; j < len; j++ ) {
  8577. first[ i++ ] = second[ j ];
  8578. }
  8579. first.length = i;
  8580. return first;
  8581. },
  8582. grep: function( elems, callback, invert ) {
  8583. var callbackInverse,
  8584. matches = [],
  8585. i = 0,
  8586. length = elems.length,
  8587. callbackExpect = !invert;
  8588. // Go through the array, only saving the items
  8589. // that pass the validator function
  8590. for ( ; i < length; i++ ) {
  8591. callbackInverse = !callback( elems[ i ], i );
  8592. if ( callbackInverse !== callbackExpect ) {
  8593. matches.push( elems[ i ] );
  8594. }
  8595. }
  8596. return matches;
  8597. },
  8598. // arg is for internal usage only
  8599. map: function( elems, callback, arg ) {
  8600. var length, value,
  8601. i = 0,
  8602. ret = [];
  8603. // Go through the array, translating each of the items to their new values
  8604. if ( isArrayLike( elems ) ) {
  8605. length = elems.length;
  8606. for ( ; i < length; i++ ) {
  8607. value = callback( elems[ i ], i, arg );
  8608. if ( value != null ) {
  8609. ret.push( value );
  8610. }
  8611. }
  8612. // Go through every key on the object,
  8613. } else {
  8614. for ( i in elems ) {
  8615. value = callback( elems[ i ], i, arg );
  8616. if ( value != null ) {
  8617. ret.push( value );
  8618. }
  8619. }
  8620. }
  8621. // Flatten any nested arrays
  8622. return concat.apply( [], ret );
  8623. },
  8624. // A global GUID counter for objects
  8625. guid: 1,
  8626. // jQuery.support is not used in Core but other projects attach their
  8627. // properties to it so it needs to exist.
  8628. support: support
  8629. } );
  8630. if ( typeof Symbol === "function" ) {
  8631. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  8632. }
  8633. // Populate the class2type map
  8634. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  8635. function( i, name ) {
  8636. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  8637. } );
  8638. function isArrayLike( obj ) {
  8639. // Support: real iOS 8.2 only (not reproducible in simulator)
  8640. // `in` check used to prevent JIT error (gh-2145)
  8641. // hasOwn isn't used here due to false negatives
  8642. // regarding Nodelist length in IE
  8643. var length = !!obj && "length" in obj && obj.length,
  8644. type = toType( obj );
  8645. if ( isFunction( obj ) || isWindow( obj ) ) {
  8646. return false;
  8647. }
  8648. return type === "array" || length === 0 ||
  8649. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  8650. }
  8651. var Sizzle =
  8652. /*!
  8653. * Sizzle CSS Selector Engine v2.3.4
  8654. * https://sizzlejs.com/
  8655. *
  8656. * Copyright JS Foundation and other contributors
  8657. * Released under the MIT license
  8658. * https://js.foundation/
  8659. *
  8660. * Date: 2019-04-08
  8661. */
  8662. (function( window ) {
  8663. var i,
  8664. support,
  8665. Expr,
  8666. getText,
  8667. isXML,
  8668. tokenize,
  8669. compile,
  8670. select,
  8671. outermostContext,
  8672. sortInput,
  8673. hasDuplicate,
  8674. // Local document vars
  8675. setDocument,
  8676. document,
  8677. docElem,
  8678. documentIsHTML,
  8679. rbuggyQSA,
  8680. rbuggyMatches,
  8681. matches,
  8682. contains,
  8683. // Instance-specific data
  8684. expando = "sizzle" + 1 * new Date(),
  8685. preferredDoc = window.document,
  8686. dirruns = 0,
  8687. done = 0,
  8688. classCache = createCache(),
  8689. tokenCache = createCache(),
  8690. compilerCache = createCache(),
  8691. nonnativeSelectorCache = createCache(),
  8692. sortOrder = function( a, b ) {
  8693. if ( a === b ) {
  8694. hasDuplicate = true;
  8695. }
  8696. return 0;
  8697. },
  8698. // Instance methods
  8699. hasOwn = ({}).hasOwnProperty,
  8700. arr = [],
  8701. pop = arr.pop,
  8702. push_native = arr.push,
  8703. push = arr.push,
  8704. slice = arr.slice,
  8705. // Use a stripped-down indexOf as it's faster than native
  8706. // https://jsperf.com/thor-indexof-vs-for/5
  8707. indexOf = function( list, elem ) {
  8708. var i = 0,
  8709. len = list.length;
  8710. for ( ; i < len; i++ ) {
  8711. if ( list[i] === elem ) {
  8712. return i;
  8713. }
  8714. }
  8715. return -1;
  8716. },
  8717. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  8718. // Regular expressions
  8719. // http://www.w3.org/TR/css3-selectors/#whitespace
  8720. whitespace = "[\\x20\\t\\r\\n\\f]",
  8721. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  8722. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  8723. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  8724. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  8725. // Operator (capture 2)
  8726. "*([*^$|!~]?=)" + whitespace +
  8727. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  8728. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  8729. "*\\]",
  8730. pseudos = ":(" + identifier + ")(?:\\((" +
  8731. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  8732. // 1. quoted (capture 3; capture 4 or capture 5)
  8733. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  8734. // 2. simple (capture 6)
  8735. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  8736. // 3. anything else (capture 2)
  8737. ".*" +
  8738. ")\\)|)",
  8739. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  8740. rwhitespace = new RegExp( whitespace + "+", "g" ),
  8741. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  8742. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  8743. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  8744. rdescend = new RegExp( whitespace + "|>" ),
  8745. rpseudo = new RegExp( pseudos ),
  8746. ridentifier = new RegExp( "^" + identifier + "$" ),
  8747. matchExpr = {
  8748. "ID": new RegExp( "^#(" + identifier + ")" ),
  8749. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  8750. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  8751. "ATTR": new RegExp( "^" + attributes ),
  8752. "PSEUDO": new RegExp( "^" + pseudos ),
  8753. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  8754. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  8755. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  8756. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  8757. // For use in libraries implementing .is()
  8758. // We use this for POS matching in `select`
  8759. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  8760. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  8761. },
  8762. rhtml = /HTML$/i,
  8763. rinputs = /^(?:input|select|textarea|button)$/i,
  8764. rheader = /^h\d$/i,
  8765. rnative = /^[^{]+\{\s*\[native \w/,
  8766. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  8767. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  8768. rsibling = /[+~]/,
  8769. // CSS escapes
  8770. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  8771. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  8772. funescape = function( _, escaped, escapedWhitespace ) {
  8773. var high = "0x" + escaped - 0x10000;
  8774. // NaN means non-codepoint
  8775. // Support: Firefox<24
  8776. // Workaround erroneous numeric interpretation of +"0x"
  8777. return high !== high || escapedWhitespace ?
  8778. escaped :
  8779. high < 0 ?
  8780. // BMP codepoint
  8781. String.fromCharCode( high + 0x10000 ) :
  8782. // Supplemental Plane codepoint (surrogate pair)
  8783. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  8784. },
  8785. // CSS string/identifier serialization
  8786. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  8787. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  8788. fcssescape = function( ch, asCodePoint ) {
  8789. if ( asCodePoint ) {
  8790. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  8791. if ( ch === "\0" ) {
  8792. return "\uFFFD";
  8793. }
  8794. // Control characters and (dependent upon position) numbers get escaped as code points
  8795. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  8796. }
  8797. // Other potentially-special ASCII characters get backslash-escaped
  8798. return "\\" + ch;
  8799. },
  8800. // Used for iframes
  8801. // See setDocument()
  8802. // Removing the function wrapper causes a "Permission Denied"
  8803. // error in IE
  8804. unloadHandler = function() {
  8805. setDocument();
  8806. },
  8807. inDisabledFieldset = addCombinator(
  8808. function( elem ) {
  8809. return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset";
  8810. },
  8811. { dir: "parentNode", next: "legend" }
  8812. );
  8813. // Optimize for push.apply( _, NodeList )
  8814. try {
  8815. push.apply(
  8816. (arr = slice.call( preferredDoc.childNodes )),
  8817. preferredDoc.childNodes
  8818. );
  8819. // Support: Android<4.0
  8820. // Detect silently failing push.apply
  8821. arr[ preferredDoc.childNodes.length ].nodeType;
  8822. } catch ( e ) {
  8823. push = { apply: arr.length ?
  8824. // Leverage slice if possible
  8825. function( target, els ) {
  8826. push_native.apply( target, slice.call(els) );
  8827. } :
  8828. // Support: IE<9
  8829. // Otherwise append directly
  8830. function( target, els ) {
  8831. var j = target.length,
  8832. i = 0;
  8833. // Can't trust NodeList.length
  8834. while ( (target[j++] = els[i++]) ) {}
  8835. target.length = j - 1;
  8836. }
  8837. };
  8838. }
  8839. function Sizzle( selector, context, results, seed ) {
  8840. var m, i, elem, nid, match, groups, newSelector,
  8841. newContext = context && context.ownerDocument,
  8842. // nodeType defaults to 9, since context defaults to document
  8843. nodeType = context ? context.nodeType : 9;
  8844. results = results || [];
  8845. // Return early from calls with invalid selector or context
  8846. if ( typeof selector !== "string" || !selector ||
  8847. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  8848. return results;
  8849. }
  8850. // Try to shortcut find operations (as opposed to filters) in HTML documents
  8851. if ( !seed ) {
  8852. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  8853. setDocument( context );
  8854. }
  8855. context = context || document;
  8856. if ( documentIsHTML ) {
  8857. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  8858. // (excepting DocumentFragment context, where the methods don't exist)
  8859. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  8860. // ID selector
  8861. if ( (m = match[1]) ) {
  8862. // Document context
  8863. if ( nodeType === 9 ) {
  8864. if ( (elem = context.getElementById( m )) ) {
  8865. // Support: IE, Opera, Webkit
  8866. // TODO: identify versions
  8867. // getElementById can match elements by name instead of ID
  8868. if ( elem.id === m ) {
  8869. results.push( elem );
  8870. return results;
  8871. }
  8872. } else {
  8873. return results;
  8874. }
  8875. // Element context
  8876. } else {
  8877. // Support: IE, Opera, Webkit
  8878. // TODO: identify versions
  8879. // getElementById can match elements by name instead of ID
  8880. if ( newContext && (elem = newContext.getElementById( m )) &&
  8881. contains( context, elem ) &&
  8882. elem.id === m ) {
  8883. results.push( elem );
  8884. return results;
  8885. }
  8886. }
  8887. // Type selector
  8888. } else if ( match[2] ) {
  8889. push.apply( results, context.getElementsByTagName( selector ) );
  8890. return results;
  8891. // Class selector
  8892. } else if ( (m = match[3]) && support.getElementsByClassName &&
  8893. context.getElementsByClassName ) {
  8894. push.apply( results, context.getElementsByClassName( m ) );
  8895. return results;
  8896. }
  8897. }
  8898. // Take advantage of querySelectorAll
  8899. if ( support.qsa &&
  8900. !nonnativeSelectorCache[ selector + " " ] &&
  8901. (!rbuggyQSA || !rbuggyQSA.test( selector )) &&
  8902. // Support: IE 8 only
  8903. // Exclude object elements
  8904. (nodeType !== 1 || context.nodeName.toLowerCase() !== "object") ) {
  8905. newSelector = selector;
  8906. newContext = context;
  8907. // qSA considers elements outside a scoping root when evaluating child or
  8908. // descendant combinators, which is not what we want.
  8909. // In such cases, we work around the behavior by prefixing every selector in the
  8910. // list with an ID selector referencing the scope context.
  8911. // Thanks to Andrew Dupont for this technique.
  8912. if ( nodeType === 1 && rdescend.test( selector ) ) {
  8913. // Capture the context ID, setting it first if necessary
  8914. if ( (nid = context.getAttribute( "id" )) ) {
  8915. nid = nid.replace( rcssescape, fcssescape );
  8916. } else {
  8917. context.setAttribute( "id", (nid = expando) );
  8918. }
  8919. // Prefix every selector in the list
  8920. groups = tokenize( selector );
  8921. i = groups.length;
  8922. while ( i-- ) {
  8923. groups[i] = "#" + nid + " " + toSelector( groups[i] );
  8924. }
  8925. newSelector = groups.join( "," );
  8926. // Expand context for sibling selectors
  8927. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  8928. context;
  8929. }
  8930. try {
  8931. push.apply( results,
  8932. newContext.querySelectorAll( newSelector )
  8933. );
  8934. return results;
  8935. } catch ( qsaError ) {
  8936. nonnativeSelectorCache( selector, true );
  8937. } finally {
  8938. if ( nid === expando ) {
  8939. context.removeAttribute( "id" );
  8940. }
  8941. }
  8942. }
  8943. }
  8944. }
  8945. // All others
  8946. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  8947. }
  8948. /**
  8949. * Create key-value caches of limited size
  8950. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  8951. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  8952. * deleting the oldest entry
  8953. */
  8954. function createCache() {
  8955. var keys = [];
  8956. function cache( key, value ) {
  8957. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  8958. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  8959. // Only keep the most recent entries
  8960. delete cache[ keys.shift() ];
  8961. }
  8962. return (cache[ key + " " ] = value);
  8963. }
  8964. return cache;
  8965. }
  8966. /**
  8967. * Mark a function for special use by Sizzle
  8968. * @param {Function} fn The function to mark
  8969. */
  8970. function markFunction( fn ) {
  8971. fn[ expando ] = true;
  8972. return fn;
  8973. }
  8974. /**
  8975. * Support testing using an element
  8976. * @param {Function} fn Passed the created element and returns a boolean result
  8977. */
  8978. function assert( fn ) {
  8979. var el = document.createElement("fieldset");
  8980. try {
  8981. return !!fn( el );
  8982. } catch (e) {
  8983. return false;
  8984. } finally {
  8985. // Remove from its parent by default
  8986. if ( el.parentNode ) {
  8987. el.parentNode.removeChild( el );
  8988. }
  8989. // release memory in IE
  8990. el = null;
  8991. }
  8992. }
  8993. /**
  8994. * Adds the same handler for all of the specified attrs
  8995. * @param {String} attrs Pipe-separated list of attributes
  8996. * @param {Function} handler The method that will be applied
  8997. */
  8998. function addHandle( attrs, handler ) {
  8999. var arr = attrs.split("|"),
  9000. i = arr.length;
  9001. while ( i-- ) {
  9002. Expr.attrHandle[ arr[i] ] = handler;
  9003. }
  9004. }
  9005. /**
  9006. * Checks document order of two siblings
  9007. * @param {Element} a
  9008. * @param {Element} b
  9009. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  9010. */
  9011. function siblingCheck( a, b ) {
  9012. var cur = b && a,
  9013. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  9014. a.sourceIndex - b.sourceIndex;
  9015. // Use IE sourceIndex if available on both nodes
  9016. if ( diff ) {
  9017. return diff;
  9018. }
  9019. // Check if b follows a
  9020. if ( cur ) {
  9021. while ( (cur = cur.nextSibling) ) {
  9022. if ( cur === b ) {
  9023. return -1;
  9024. }
  9025. }
  9026. }
  9027. return a ? 1 : -1;
  9028. }
  9029. /**
  9030. * Returns a function to use in pseudos for input types
  9031. * @param {String} type
  9032. */
  9033. function createInputPseudo( type ) {
  9034. return function( elem ) {
  9035. var name = elem.nodeName.toLowerCase();
  9036. return name === "input" && elem.type === type;
  9037. };
  9038. }
  9039. /**
  9040. * Returns a function to use in pseudos for buttons
  9041. * @param {String} type
  9042. */
  9043. function createButtonPseudo( type ) {
  9044. return function( elem ) {
  9045. var name = elem.nodeName.toLowerCase();
  9046. return (name === "input" || name === "button") && elem.type === type;
  9047. };
  9048. }
  9049. /**
  9050. * Returns a function to use in pseudos for :enabled/:disabled
  9051. * @param {Boolean} disabled true for :disabled; false for :enabled
  9052. */
  9053. function createDisabledPseudo( disabled ) {
  9054. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  9055. return function( elem ) {
  9056. // Only certain elements can match :enabled or :disabled
  9057. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  9058. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  9059. if ( "form" in elem ) {
  9060. // Check for inherited disabledness on relevant non-disabled elements:
  9061. // * listed form-associated elements in a disabled fieldset
  9062. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  9063. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  9064. // * option elements in a disabled optgroup
  9065. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  9066. // All such elements have a "form" property.
  9067. if ( elem.parentNode && elem.disabled === false ) {
  9068. // Option elements defer to a parent optgroup if present
  9069. if ( "label" in elem ) {
  9070. if ( "label" in elem.parentNode ) {
  9071. return elem.parentNode.disabled === disabled;
  9072. } else {
  9073. return elem.disabled === disabled;
  9074. }
  9075. }
  9076. // Support: IE 6 - 11
  9077. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  9078. return elem.isDisabled === disabled ||
  9079. // Where there is no isDisabled, check manually
  9080. /* jshint -W018 */
  9081. elem.isDisabled !== !disabled &&
  9082. inDisabledFieldset( elem ) === disabled;
  9083. }
  9084. return elem.disabled === disabled;
  9085. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  9086. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  9087. // even exist on them, let alone have a boolean value.
  9088. } else if ( "label" in elem ) {
  9089. return elem.disabled === disabled;
  9090. }
  9091. // Remaining elements are neither :enabled nor :disabled
  9092. return false;
  9093. };
  9094. }
  9095. /**
  9096. * Returns a function to use in pseudos for positionals
  9097. * @param {Function} fn
  9098. */
  9099. function createPositionalPseudo( fn ) {
  9100. return markFunction(function( argument ) {
  9101. argument = +argument;
  9102. return markFunction(function( seed, matches ) {
  9103. var j,
  9104. matchIndexes = fn( [], seed.length, argument ),
  9105. i = matchIndexes.length;
  9106. // Match elements found at the specified indexes
  9107. while ( i-- ) {
  9108. if ( seed[ (j = matchIndexes[i]) ] ) {
  9109. seed[j] = !(matches[j] = seed[j]);
  9110. }
  9111. }
  9112. });
  9113. });
  9114. }
  9115. /**
  9116. * Checks a node for validity as a Sizzle context
  9117. * @param {Element|Object=} context
  9118. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  9119. */
  9120. function testContext( context ) {
  9121. return context && typeof context.getElementsByTagName !== "undefined" && context;
  9122. }
  9123. // Expose support vars for convenience
  9124. support = Sizzle.support = {};
  9125. /**
  9126. * Detects XML nodes
  9127. * @param {Element|Object} elem An element or a document
  9128. * @returns {Boolean} True iff elem is a non-HTML XML node
  9129. */
  9130. isXML = Sizzle.isXML = function( elem ) {
  9131. var namespace = elem.namespaceURI,
  9132. docElem = (elem.ownerDocument || elem).documentElement;
  9133. // Support: IE <=8
  9134. // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
  9135. // https://bugs.jquery.com/ticket/4833
  9136. return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" );
  9137. };
  9138. /**
  9139. * Sets document-related variables once based on the current document
  9140. * @param {Element|Object} [doc] An element or document object to use to set the document
  9141. * @returns {Object} Returns the current document
  9142. */
  9143. setDocument = Sizzle.setDocument = function( node ) {
  9144. var hasCompare, subWindow,
  9145. doc = node ? node.ownerDocument || node : preferredDoc;
  9146. // Return early if doc is invalid or already selected
  9147. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  9148. return document;
  9149. }
  9150. // Update global variables
  9151. document = doc;
  9152. docElem = document.documentElement;
  9153. documentIsHTML = !isXML( document );
  9154. // Support: IE 9-11, Edge
  9155. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  9156. if ( preferredDoc !== document &&
  9157. (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
  9158. // Support: IE 11, Edge
  9159. if ( subWindow.addEventListener ) {
  9160. subWindow.addEventListener( "unload", unloadHandler, false );
  9161. // Support: IE 9 - 10 only
  9162. } else if ( subWindow.attachEvent ) {
  9163. subWindow.attachEvent( "onunload", unloadHandler );
  9164. }
  9165. }
  9166. /* Attributes
  9167. ---------------------------------------------------------------------- */
  9168. // Support: IE<8
  9169. // Verify that getAttribute really returns attributes and not properties
  9170. // (excepting IE8 booleans)
  9171. support.attributes = assert(function( el ) {
  9172. el.className = "i";
  9173. return !el.getAttribute("className");
  9174. });
  9175. /* getElement(s)By*
  9176. ---------------------------------------------------------------------- */
  9177. // Check if getElementsByTagName("*") returns only elements
  9178. support.getElementsByTagName = assert(function( el ) {
  9179. el.appendChild( document.createComment("") );
  9180. return !el.getElementsByTagName("*").length;
  9181. });
  9182. // Support: IE<9
  9183. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  9184. // Support: IE<10
  9185. // Check if getElementById returns elements by name
  9186. // The broken getElementById methods don't pick up programmatically-set names,
  9187. // so use a roundabout getElementsByName test
  9188. support.getById = assert(function( el ) {
  9189. docElem.appendChild( el ).id = expando;
  9190. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  9191. });
  9192. // ID filter and find
  9193. if ( support.getById ) {
  9194. Expr.filter["ID"] = function( id ) {
  9195. var attrId = id.replace( runescape, funescape );
  9196. return function( elem ) {
  9197. return elem.getAttribute("id") === attrId;
  9198. };
  9199. };
  9200. Expr.find["ID"] = function( id, context ) {
  9201. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  9202. var elem = context.getElementById( id );
  9203. return elem ? [ elem ] : [];
  9204. }
  9205. };
  9206. } else {
  9207. Expr.filter["ID"] = function( id ) {
  9208. var attrId = id.replace( runescape, funescape );
  9209. return function( elem ) {
  9210. var node = typeof elem.getAttributeNode !== "undefined" &&
  9211. elem.getAttributeNode("id");
  9212. return node && node.value === attrId;
  9213. };
  9214. };
  9215. // Support: IE 6 - 7 only
  9216. // getElementById is not reliable as a find shortcut
  9217. Expr.find["ID"] = function( id, context ) {
  9218. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  9219. var node, i, elems,
  9220. elem = context.getElementById( id );
  9221. if ( elem ) {
  9222. // Verify the id attribute
  9223. node = elem.getAttributeNode("id");
  9224. if ( node && node.value === id ) {
  9225. return [ elem ];
  9226. }
  9227. // Fall back on getElementsByName
  9228. elems = context.getElementsByName( id );
  9229. i = 0;
  9230. while ( (elem = elems[i++]) ) {
  9231. node = elem.getAttributeNode("id");
  9232. if ( node && node.value === id ) {
  9233. return [ elem ];
  9234. }
  9235. }
  9236. }
  9237. return [];
  9238. }
  9239. };
  9240. }
  9241. // Tag
  9242. Expr.find["TAG"] = support.getElementsByTagName ?
  9243. function( tag, context ) {
  9244. if ( typeof context.getElementsByTagName !== "undefined" ) {
  9245. return context.getElementsByTagName( tag );
  9246. // DocumentFragment nodes don't have gEBTN
  9247. } else if ( support.qsa ) {
  9248. return context.querySelectorAll( tag );
  9249. }
  9250. } :
  9251. function( tag, context ) {
  9252. var elem,
  9253. tmp = [],
  9254. i = 0,
  9255. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  9256. results = context.getElementsByTagName( tag );
  9257. // Filter out possible comments
  9258. if ( tag === "*" ) {
  9259. while ( (elem = results[i++]) ) {
  9260. if ( elem.nodeType === 1 ) {
  9261. tmp.push( elem );
  9262. }
  9263. }
  9264. return tmp;
  9265. }
  9266. return results;
  9267. };
  9268. // Class
  9269. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  9270. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  9271. return context.getElementsByClassName( className );
  9272. }
  9273. };
  9274. /* QSA/matchesSelector
  9275. ---------------------------------------------------------------------- */
  9276. // QSA and matchesSelector support
  9277. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  9278. rbuggyMatches = [];
  9279. // qSa(:focus) reports false when true (Chrome 21)
  9280. // We allow this because of a bug in IE8/9 that throws an error
  9281. // whenever `document.activeElement` is accessed on an iframe
  9282. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  9283. // See https://bugs.jquery.com/ticket/13378
  9284. rbuggyQSA = [];
  9285. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  9286. // Build QSA regex
  9287. // Regex strategy adopted from Diego Perini
  9288. assert(function( el ) {
  9289. // Select is set to empty string on purpose
  9290. // This is to test IE's treatment of not explicitly
  9291. // setting a boolean content attribute,
  9292. // since its presence should be enough
  9293. // https://bugs.jquery.com/ticket/12359
  9294. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  9295. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  9296. "<option selected=''></option></select>";
  9297. // Support: IE8, Opera 11-12.16
  9298. // Nothing should be selected when empty strings follow ^= or $= or *=
  9299. // The test attribute must be unknown in Opera but "safe" for WinRT
  9300. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  9301. if ( el.querySelectorAll("[msallowcapture^='']").length ) {
  9302. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  9303. }
  9304. // Support: IE8
  9305. // Boolean attributes and "value" are not treated correctly
  9306. if ( !el.querySelectorAll("[selected]").length ) {
  9307. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  9308. }
  9309. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  9310. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  9311. rbuggyQSA.push("~=");
  9312. }
  9313. // Webkit/Opera - :checked should return selected option elements
  9314. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  9315. // IE8 throws error here and will not see later tests
  9316. if ( !el.querySelectorAll(":checked").length ) {
  9317. rbuggyQSA.push(":checked");
  9318. }
  9319. // Support: Safari 8+, iOS 8+
  9320. // https://bugs.webkit.org/show_bug.cgi?id=136851
  9321. // In-page `selector#id sibling-combinator selector` fails
  9322. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  9323. rbuggyQSA.push(".#.+[+~]");
  9324. }
  9325. });
  9326. assert(function( el ) {
  9327. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  9328. "<select disabled='disabled'><option/></select>";
  9329. // Support: Windows 8 Native Apps
  9330. // The type and name attributes are restricted during .innerHTML assignment
  9331. var input = document.createElement("input");
  9332. input.setAttribute( "type", "hidden" );
  9333. el.appendChild( input ).setAttribute( "name", "D" );
  9334. // Support: IE8
  9335. // Enforce case-sensitivity of name attribute
  9336. if ( el.querySelectorAll("[name=d]").length ) {
  9337. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  9338. }
  9339. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  9340. // IE8 throws error here and will not see later tests
  9341. if ( el.querySelectorAll(":enabled").length !== 2 ) {
  9342. rbuggyQSA.push( ":enabled", ":disabled" );
  9343. }
  9344. // Support: IE9-11+
  9345. // IE's :disabled selector does not pick up the children of disabled fieldsets
  9346. docElem.appendChild( el ).disabled = true;
  9347. if ( el.querySelectorAll(":disabled").length !== 2 ) {
  9348. rbuggyQSA.push( ":enabled", ":disabled" );
  9349. }
  9350. // Opera 10-11 does not throw on post-comma invalid pseudos
  9351. el.querySelectorAll("*,:x");
  9352. rbuggyQSA.push(",.*:");
  9353. });
  9354. }
  9355. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  9356. docElem.webkitMatchesSelector ||
  9357. docElem.mozMatchesSelector ||
  9358. docElem.oMatchesSelector ||
  9359. docElem.msMatchesSelector) )) ) {
  9360. assert(function( el ) {
  9361. // Check to see if it's possible to do matchesSelector
  9362. // on a disconnected node (IE 9)
  9363. support.disconnectedMatch = matches.call( el, "*" );
  9364. // This should fail with an exception
  9365. // Gecko does not error, returns false instead
  9366. matches.call( el, "[s!='']:x" );
  9367. rbuggyMatches.push( "!=", pseudos );
  9368. });
  9369. }
  9370. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  9371. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  9372. /* Contains
  9373. ---------------------------------------------------------------------- */
  9374. hasCompare = rnative.test( docElem.compareDocumentPosition );
  9375. // Element contains another
  9376. // Purposefully self-exclusive
  9377. // As in, an element does not contain itself
  9378. contains = hasCompare || rnative.test( docElem.contains ) ?
  9379. function( a, b ) {
  9380. var adown = a.nodeType === 9 ? a.documentElement : a,
  9381. bup = b && b.parentNode;
  9382. return a === bup || !!( bup && bup.nodeType === 1 && (
  9383. adown.contains ?
  9384. adown.contains( bup ) :
  9385. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  9386. ));
  9387. } :
  9388. function( a, b ) {
  9389. if ( b ) {
  9390. while ( (b = b.parentNode) ) {
  9391. if ( b === a ) {
  9392. return true;
  9393. }
  9394. }
  9395. }
  9396. return false;
  9397. };
  9398. /* Sorting
  9399. ---------------------------------------------------------------------- */
  9400. // Document order sorting
  9401. sortOrder = hasCompare ?
  9402. function( a, b ) {
  9403. // Flag for duplicate removal
  9404. if ( a === b ) {
  9405. hasDuplicate = true;
  9406. return 0;
  9407. }
  9408. // Sort on method existence if only one input has compareDocumentPosition
  9409. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  9410. if ( compare ) {
  9411. return compare;
  9412. }
  9413. // Calculate position if both inputs belong to the same document
  9414. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  9415. a.compareDocumentPosition( b ) :
  9416. // Otherwise we know they are disconnected
  9417. 1;
  9418. // Disconnected nodes
  9419. if ( compare & 1 ||
  9420. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  9421. // Choose the first element that is related to our preferred document
  9422. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  9423. return -1;
  9424. }
  9425. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  9426. return 1;
  9427. }
  9428. // Maintain original order
  9429. return sortInput ?
  9430. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  9431. 0;
  9432. }
  9433. return compare & 4 ? -1 : 1;
  9434. } :
  9435. function( a, b ) {
  9436. // Exit early if the nodes are identical
  9437. if ( a === b ) {
  9438. hasDuplicate = true;
  9439. return 0;
  9440. }
  9441. var cur,
  9442. i = 0,
  9443. aup = a.parentNode,
  9444. bup = b.parentNode,
  9445. ap = [ a ],
  9446. bp = [ b ];
  9447. // Parentless nodes are either documents or disconnected
  9448. if ( !aup || !bup ) {
  9449. return a === document ? -1 :
  9450. b === document ? 1 :
  9451. aup ? -1 :
  9452. bup ? 1 :
  9453. sortInput ?
  9454. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  9455. 0;
  9456. // If the nodes are siblings, we can do a quick check
  9457. } else if ( aup === bup ) {
  9458. return siblingCheck( a, b );
  9459. }
  9460. // Otherwise we need full lists of their ancestors for comparison
  9461. cur = a;
  9462. while ( (cur = cur.parentNode) ) {
  9463. ap.unshift( cur );
  9464. }
  9465. cur = b;
  9466. while ( (cur = cur.parentNode) ) {
  9467. bp.unshift( cur );
  9468. }
  9469. // Walk down the tree looking for a discrepancy
  9470. while ( ap[i] === bp[i] ) {
  9471. i++;
  9472. }
  9473. return i ?
  9474. // Do a sibling check if the nodes have a common ancestor
  9475. siblingCheck( ap[i], bp[i] ) :
  9476. // Otherwise nodes in our document sort first
  9477. ap[i] === preferredDoc ? -1 :
  9478. bp[i] === preferredDoc ? 1 :
  9479. 0;
  9480. };
  9481. return document;
  9482. };
  9483. Sizzle.matches = function( expr, elements ) {
  9484. return Sizzle( expr, null, null, elements );
  9485. };
  9486. Sizzle.matchesSelector = function( elem, expr ) {
  9487. // Set document vars if needed
  9488. if ( ( elem.ownerDocument || elem ) !== document ) {
  9489. setDocument( elem );
  9490. }
  9491. if ( support.matchesSelector && documentIsHTML &&
  9492. !nonnativeSelectorCache[ expr + " " ] &&
  9493. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  9494. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  9495. try {
  9496. var ret = matches.call( elem, expr );
  9497. // IE 9's matchesSelector returns false on disconnected nodes
  9498. if ( ret || support.disconnectedMatch ||
  9499. // As well, disconnected nodes are said to be in a document
  9500. // fragment in IE 9
  9501. elem.document && elem.document.nodeType !== 11 ) {
  9502. return ret;
  9503. }
  9504. } catch (e) {
  9505. nonnativeSelectorCache( expr, true );
  9506. }
  9507. }
  9508. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  9509. };
  9510. Sizzle.contains = function( context, elem ) {
  9511. // Set document vars if needed
  9512. if ( ( context.ownerDocument || context ) !== document ) {
  9513. setDocument( context );
  9514. }
  9515. return contains( context, elem );
  9516. };
  9517. Sizzle.attr = function( elem, name ) {
  9518. // Set document vars if needed
  9519. if ( ( elem.ownerDocument || elem ) !== document ) {
  9520. setDocument( elem );
  9521. }
  9522. var fn = Expr.attrHandle[ name.toLowerCase() ],
  9523. // Don't get fooled by Object.prototype properties (jQuery #13807)
  9524. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  9525. fn( elem, name, !documentIsHTML ) :
  9526. undefined;
  9527. return val !== undefined ?
  9528. val :
  9529. support.attributes || !documentIsHTML ?
  9530. elem.getAttribute( name ) :
  9531. (val = elem.getAttributeNode(name)) && val.specified ?
  9532. val.value :
  9533. null;
  9534. };
  9535. Sizzle.escape = function( sel ) {
  9536. return (sel + "").replace( rcssescape, fcssescape );
  9537. };
  9538. Sizzle.error = function( msg ) {
  9539. throw new Error( "Syntax error, unrecognized expression: " + msg );
  9540. };
  9541. /**
  9542. * Document sorting and removing duplicates
  9543. * @param {ArrayLike} results
  9544. */
  9545. Sizzle.uniqueSort = function( results ) {
  9546. var elem,
  9547. duplicates = [],
  9548. j = 0,
  9549. i = 0;
  9550. // Unless we *know* we can detect duplicates, assume their presence
  9551. hasDuplicate = !support.detectDuplicates;
  9552. sortInput = !support.sortStable && results.slice( 0 );
  9553. results.sort( sortOrder );
  9554. if ( hasDuplicate ) {
  9555. while ( (elem = results[i++]) ) {
  9556. if ( elem === results[ i ] ) {
  9557. j = duplicates.push( i );
  9558. }
  9559. }
  9560. while ( j-- ) {
  9561. results.splice( duplicates[ j ], 1 );
  9562. }
  9563. }
  9564. // Clear input after sorting to release objects
  9565. // See https://github.com/jquery/sizzle/pull/225
  9566. sortInput = null;
  9567. return results;
  9568. };
  9569. /**
  9570. * Utility function for retrieving the text value of an array of DOM nodes
  9571. * @param {Array|Element} elem
  9572. */
  9573. getText = Sizzle.getText = function( elem ) {
  9574. var node,
  9575. ret = "",
  9576. i = 0,
  9577. nodeType = elem.nodeType;
  9578. if ( !nodeType ) {
  9579. // If no nodeType, this is expected to be an array
  9580. while ( (node = elem[i++]) ) {
  9581. // Do not traverse comment nodes
  9582. ret += getText( node );
  9583. }
  9584. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  9585. // Use textContent for elements
  9586. // innerText usage removed for consistency of new lines (jQuery #11153)
  9587. if ( typeof elem.textContent === "string" ) {
  9588. return elem.textContent;
  9589. } else {
  9590. // Traverse its children
  9591. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  9592. ret += getText( elem );
  9593. }
  9594. }
  9595. } else if ( nodeType === 3 || nodeType === 4 ) {
  9596. return elem.nodeValue;
  9597. }
  9598. // Do not include comment or processing instruction nodes
  9599. return ret;
  9600. };
  9601. Expr = Sizzle.selectors = {
  9602. // Can be adjusted by the user
  9603. cacheLength: 50,
  9604. createPseudo: markFunction,
  9605. match: matchExpr,
  9606. attrHandle: {},
  9607. find: {},
  9608. relative: {
  9609. ">": { dir: "parentNode", first: true },
  9610. " ": { dir: "parentNode" },
  9611. "+": { dir: "previousSibling", first: true },
  9612. "~": { dir: "previousSibling" }
  9613. },
  9614. preFilter: {
  9615. "ATTR": function( match ) {
  9616. match[1] = match[1].replace( runescape, funescape );
  9617. // Move the given value to match[3] whether quoted or unquoted
  9618. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  9619. if ( match[2] === "~=" ) {
  9620. match[3] = " " + match[3] + " ";
  9621. }
  9622. return match.slice( 0, 4 );
  9623. },
  9624. "CHILD": function( match ) {
  9625. /* matches from matchExpr["CHILD"]
  9626. 1 type (only|nth|...)
  9627. 2 what (child|of-type)
  9628. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  9629. 4 xn-component of xn+y argument ([+-]?\d*n|)
  9630. 5 sign of xn-component
  9631. 6 x of xn-component
  9632. 7 sign of y-component
  9633. 8 y of y-component
  9634. */
  9635. match[1] = match[1].toLowerCase();
  9636. if ( match[1].slice( 0, 3 ) === "nth" ) {
  9637. // nth-* requires argument
  9638. if ( !match[3] ) {
  9639. Sizzle.error( match[0] );
  9640. }
  9641. // numeric x and y parameters for Expr.filter.CHILD
  9642. // remember that false/true cast respectively to 0/1
  9643. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  9644. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  9645. // other types prohibit arguments
  9646. } else if ( match[3] ) {
  9647. Sizzle.error( match[0] );
  9648. }
  9649. return match;
  9650. },
  9651. "PSEUDO": function( match ) {
  9652. var excess,
  9653. unquoted = !match[6] && match[2];
  9654. if ( matchExpr["CHILD"].test( match[0] ) ) {
  9655. return null;
  9656. }
  9657. // Accept quoted arguments as-is
  9658. if ( match[3] ) {
  9659. match[2] = match[4] || match[5] || "";
  9660. // Strip excess characters from unquoted arguments
  9661. } else if ( unquoted && rpseudo.test( unquoted ) &&
  9662. // Get excess from tokenize (recursively)
  9663. (excess = tokenize( unquoted, true )) &&
  9664. // advance to the next closing parenthesis
  9665. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  9666. // excess is a negative index
  9667. match[0] = match[0].slice( 0, excess );
  9668. match[2] = unquoted.slice( 0, excess );
  9669. }
  9670. // Return only captures needed by the pseudo filter method (type and argument)
  9671. return match.slice( 0, 3 );
  9672. }
  9673. },
  9674. filter: {
  9675. "TAG": function( nodeNameSelector ) {
  9676. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  9677. return nodeNameSelector === "*" ?
  9678. function() { return true; } :
  9679. function( elem ) {
  9680. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  9681. };
  9682. },
  9683. "CLASS": function( className ) {
  9684. var pattern = classCache[ className + " " ];
  9685. return pattern ||
  9686. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  9687. classCache( className, function( elem ) {
  9688. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  9689. });
  9690. },
  9691. "ATTR": function( name, operator, check ) {
  9692. return function( elem ) {
  9693. var result = Sizzle.attr( elem, name );
  9694. if ( result == null ) {
  9695. return operator === "!=";
  9696. }
  9697. if ( !operator ) {
  9698. return true;
  9699. }
  9700. result += "";
  9701. return operator === "=" ? result === check :
  9702. operator === "!=" ? result !== check :
  9703. operator === "^=" ? check && result.indexOf( check ) === 0 :
  9704. operator === "*=" ? check && result.indexOf( check ) > -1 :
  9705. operator === "$=" ? check && result.slice( -check.length ) === check :
  9706. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  9707. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  9708. false;
  9709. };
  9710. },
  9711. "CHILD": function( type, what, argument, first, last ) {
  9712. var simple = type.slice( 0, 3 ) !== "nth",
  9713. forward = type.slice( -4 ) !== "last",
  9714. ofType = what === "of-type";
  9715. return first === 1 && last === 0 ?
  9716. // Shortcut for :nth-*(n)
  9717. function( elem ) {
  9718. return !!elem.parentNode;
  9719. } :
  9720. function( elem, context, xml ) {
  9721. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  9722. dir = simple !== forward ? "nextSibling" : "previousSibling",
  9723. parent = elem.parentNode,
  9724. name = ofType && elem.nodeName.toLowerCase(),
  9725. useCache = !xml && !ofType,
  9726. diff = false;
  9727. if ( parent ) {
  9728. // :(first|last|only)-(child|of-type)
  9729. if ( simple ) {
  9730. while ( dir ) {
  9731. node = elem;
  9732. while ( (node = node[ dir ]) ) {
  9733. if ( ofType ?
  9734. node.nodeName.toLowerCase() === name :
  9735. node.nodeType === 1 ) {
  9736. return false;
  9737. }
  9738. }
  9739. // Reverse direction for :only-* (if we haven't yet done so)
  9740. start = dir = type === "only" && !start && "nextSibling";
  9741. }
  9742. return true;
  9743. }
  9744. start = [ forward ? parent.firstChild : parent.lastChild ];
  9745. // non-xml :nth-child(...) stores cache data on `parent`
  9746. if ( forward && useCache ) {
  9747. // Seek `elem` from a previously-cached index
  9748. // ...in a gzip-friendly way
  9749. node = parent;
  9750. outerCache = node[ expando ] || (node[ expando ] = {});
  9751. // Support: IE <9 only
  9752. // Defend against cloned attroperties (jQuery gh-1709)
  9753. uniqueCache = outerCache[ node.uniqueID ] ||
  9754. (outerCache[ node.uniqueID ] = {});
  9755. cache = uniqueCache[ type ] || [];
  9756. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  9757. diff = nodeIndex && cache[ 2 ];
  9758. node = nodeIndex && parent.childNodes[ nodeIndex ];
  9759. while ( (node = ++nodeIndex && node && node[ dir ] ||
  9760. // Fallback to seeking `elem` from the start
  9761. (diff = nodeIndex = 0) || start.pop()) ) {
  9762. // When found, cache indexes on `parent` and break
  9763. if ( node.nodeType === 1 && ++diff && node === elem ) {
  9764. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  9765. break;
  9766. }
  9767. }
  9768. } else {
  9769. // Use previously-cached element index if available
  9770. if ( useCache ) {
  9771. // ...in a gzip-friendly way
  9772. node = elem;
  9773. outerCache = node[ expando ] || (node[ expando ] = {});
  9774. // Support: IE <9 only
  9775. // Defend against cloned attroperties (jQuery gh-1709)
  9776. uniqueCache = outerCache[ node.uniqueID ] ||
  9777. (outerCache[ node.uniqueID ] = {});
  9778. cache = uniqueCache[ type ] || [];
  9779. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  9780. diff = nodeIndex;
  9781. }
  9782. // xml :nth-child(...)
  9783. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  9784. if ( diff === false ) {
  9785. // Use the same loop as above to seek `elem` from the start
  9786. while ( (node = ++nodeIndex && node && node[ dir ] ||
  9787. (diff = nodeIndex = 0) || start.pop()) ) {
  9788. if ( ( ofType ?
  9789. node.nodeName.toLowerCase() === name :
  9790. node.nodeType === 1 ) &&
  9791. ++diff ) {
  9792. // Cache the index of each encountered element
  9793. if ( useCache ) {
  9794. outerCache = node[ expando ] || (node[ expando ] = {});
  9795. // Support: IE <9 only
  9796. // Defend against cloned attroperties (jQuery gh-1709)
  9797. uniqueCache = outerCache[ node.uniqueID ] ||
  9798. (outerCache[ node.uniqueID ] = {});
  9799. uniqueCache[ type ] = [ dirruns, diff ];
  9800. }
  9801. if ( node === elem ) {
  9802. break;
  9803. }
  9804. }
  9805. }
  9806. }
  9807. }
  9808. // Incorporate the offset, then check against cycle size
  9809. diff -= last;
  9810. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  9811. }
  9812. };
  9813. },
  9814. "PSEUDO": function( pseudo, argument ) {
  9815. // pseudo-class names are case-insensitive
  9816. // http://www.w3.org/TR/selectors/#pseudo-classes
  9817. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  9818. // Remember that setFilters inherits from pseudos
  9819. var args,
  9820. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  9821. Sizzle.error( "unsupported pseudo: " + pseudo );
  9822. // The user may use createPseudo to indicate that
  9823. // arguments are needed to create the filter function
  9824. // just as Sizzle does
  9825. if ( fn[ expando ] ) {
  9826. return fn( argument );
  9827. }
  9828. // But maintain support for old signatures
  9829. if ( fn.length > 1 ) {
  9830. args = [ pseudo, pseudo, "", argument ];
  9831. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  9832. markFunction(function( seed, matches ) {
  9833. var idx,
  9834. matched = fn( seed, argument ),
  9835. i = matched.length;
  9836. while ( i-- ) {
  9837. idx = indexOf( seed, matched[i] );
  9838. seed[ idx ] = !( matches[ idx ] = matched[i] );
  9839. }
  9840. }) :
  9841. function( elem ) {
  9842. return fn( elem, 0, args );
  9843. };
  9844. }
  9845. return fn;
  9846. }
  9847. },
  9848. pseudos: {
  9849. // Potentially complex pseudos
  9850. "not": markFunction(function( selector ) {
  9851. // Trim the selector passed to compile
  9852. // to avoid treating leading and trailing
  9853. // spaces as combinators
  9854. var input = [],
  9855. results = [],
  9856. matcher = compile( selector.replace( rtrim, "$1" ) );
  9857. return matcher[ expando ] ?
  9858. markFunction(function( seed, matches, context, xml ) {
  9859. var elem,
  9860. unmatched = matcher( seed, null, xml, [] ),
  9861. i = seed.length;
  9862. // Match elements unmatched by `matcher`
  9863. while ( i-- ) {
  9864. if ( (elem = unmatched[i]) ) {
  9865. seed[i] = !(matches[i] = elem);
  9866. }
  9867. }
  9868. }) :
  9869. function( elem, context, xml ) {
  9870. input[0] = elem;
  9871. matcher( input, null, xml, results );
  9872. // Don't keep the element (issue #299)
  9873. input[0] = null;
  9874. return !results.pop();
  9875. };
  9876. }),
  9877. "has": markFunction(function( selector ) {
  9878. return function( elem ) {
  9879. return Sizzle( selector, elem ).length > 0;
  9880. };
  9881. }),
  9882. "contains": markFunction(function( text ) {
  9883. text = text.replace( runescape, funescape );
  9884. return function( elem ) {
  9885. return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1;
  9886. };
  9887. }),
  9888. // "Whether an element is represented by a :lang() selector
  9889. // is based solely on the element's language value
  9890. // being equal to the identifier C,
  9891. // or beginning with the identifier C immediately followed by "-".
  9892. // The matching of C against the element's language value is performed case-insensitively.
  9893. // The identifier C does not have to be a valid language name."
  9894. // http://www.w3.org/TR/selectors/#lang-pseudo
  9895. "lang": markFunction( function( lang ) {
  9896. // lang value must be a valid identifier
  9897. if ( !ridentifier.test(lang || "") ) {
  9898. Sizzle.error( "unsupported lang: " + lang );
  9899. }
  9900. lang = lang.replace( runescape, funescape ).toLowerCase();
  9901. return function( elem ) {
  9902. var elemLang;
  9903. do {
  9904. if ( (elemLang = documentIsHTML ?
  9905. elem.lang :
  9906. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  9907. elemLang = elemLang.toLowerCase();
  9908. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  9909. }
  9910. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  9911. return false;
  9912. };
  9913. }),
  9914. // Miscellaneous
  9915. "target": function( elem ) {
  9916. var hash = window.location && window.location.hash;
  9917. return hash && hash.slice( 1 ) === elem.id;
  9918. },
  9919. "root": function( elem ) {
  9920. return elem === docElem;
  9921. },
  9922. "focus": function( elem ) {
  9923. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  9924. },
  9925. // Boolean properties
  9926. "enabled": createDisabledPseudo( false ),
  9927. "disabled": createDisabledPseudo( true ),
  9928. "checked": function( elem ) {
  9929. // In CSS3, :checked should return both checked and selected elements
  9930. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  9931. var nodeName = elem.nodeName.toLowerCase();
  9932. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  9933. },
  9934. "selected": function( elem ) {
  9935. // Accessing this property makes selected-by-default
  9936. // options in Safari work properly
  9937. if ( elem.parentNode ) {
  9938. elem.parentNode.selectedIndex;
  9939. }
  9940. return elem.selected === true;
  9941. },
  9942. // Contents
  9943. "empty": function( elem ) {
  9944. // http://www.w3.org/TR/selectors/#empty-pseudo
  9945. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  9946. // but not by others (comment: 8; processing instruction: 7; etc.)
  9947. // nodeType < 6 works because attributes (2) do not appear as children
  9948. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  9949. if ( elem.nodeType < 6 ) {
  9950. return false;
  9951. }
  9952. }
  9953. return true;
  9954. },
  9955. "parent": function( elem ) {
  9956. return !Expr.pseudos["empty"]( elem );
  9957. },
  9958. // Element/input types
  9959. "header": function( elem ) {
  9960. return rheader.test( elem.nodeName );
  9961. },
  9962. "input": function( elem ) {
  9963. return rinputs.test( elem.nodeName );
  9964. },
  9965. "button": function( elem ) {
  9966. var name = elem.nodeName.toLowerCase();
  9967. return name === "input" && elem.type === "button" || name === "button";
  9968. },
  9969. "text": function( elem ) {
  9970. var attr;
  9971. return elem.nodeName.toLowerCase() === "input" &&
  9972. elem.type === "text" &&
  9973. // Support: IE<8
  9974. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  9975. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  9976. },
  9977. // Position-in-collection
  9978. "first": createPositionalPseudo(function() {
  9979. return [ 0 ];
  9980. }),
  9981. "last": createPositionalPseudo(function( matchIndexes, length ) {
  9982. return [ length - 1 ];
  9983. }),
  9984. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  9985. return [ argument < 0 ? argument + length : argument ];
  9986. }),
  9987. "even": createPositionalPseudo(function( matchIndexes, length ) {
  9988. var i = 0;
  9989. for ( ; i < length; i += 2 ) {
  9990. matchIndexes.push( i );
  9991. }
  9992. return matchIndexes;
  9993. }),
  9994. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  9995. var i = 1;
  9996. for ( ; i < length; i += 2 ) {
  9997. matchIndexes.push( i );
  9998. }
  9999. return matchIndexes;
  10000. }),
  10001. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10002. var i = argument < 0 ?
  10003. argument + length :
  10004. argument > length ?
  10005. length :
  10006. argument;
  10007. for ( ; --i >= 0; ) {
  10008. matchIndexes.push( i );
  10009. }
  10010. return matchIndexes;
  10011. }),
  10012. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10013. var i = argument < 0 ? argument + length : argument;
  10014. for ( ; ++i < length; ) {
  10015. matchIndexes.push( i );
  10016. }
  10017. return matchIndexes;
  10018. })
  10019. }
  10020. };
  10021. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  10022. // Add button/input type pseudos
  10023. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  10024. Expr.pseudos[ i ] = createInputPseudo( i );
  10025. }
  10026. for ( i in { submit: true, reset: true } ) {
  10027. Expr.pseudos[ i ] = createButtonPseudo( i );
  10028. }
  10029. // Easy API for creating new setFilters
  10030. function setFilters() {}
  10031. setFilters.prototype = Expr.filters = Expr.pseudos;
  10032. Expr.setFilters = new setFilters();
  10033. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  10034. var matched, match, tokens, type,
  10035. soFar, groups, preFilters,
  10036. cached = tokenCache[ selector + " " ];
  10037. if ( cached ) {
  10038. return parseOnly ? 0 : cached.slice( 0 );
  10039. }
  10040. soFar = selector;
  10041. groups = [];
  10042. preFilters = Expr.preFilter;
  10043. while ( soFar ) {
  10044. // Comma and first run
  10045. if ( !matched || (match = rcomma.exec( soFar )) ) {
  10046. if ( match ) {
  10047. // Don't consume trailing commas as valid
  10048. soFar = soFar.slice( match[0].length ) || soFar;
  10049. }
  10050. groups.push( (tokens = []) );
  10051. }
  10052. matched = false;
  10053. // Combinators
  10054. if ( (match = rcombinators.exec( soFar )) ) {
  10055. matched = match.shift();
  10056. tokens.push({
  10057. value: matched,
  10058. // Cast descendant combinators to space
  10059. type: match[0].replace( rtrim, " " )
  10060. });
  10061. soFar = soFar.slice( matched.length );
  10062. }
  10063. // Filters
  10064. for ( type in Expr.filter ) {
  10065. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  10066. (match = preFilters[ type ]( match ))) ) {
  10067. matched = match.shift();
  10068. tokens.push({
  10069. value: matched,
  10070. type: type,
  10071. matches: match
  10072. });
  10073. soFar = soFar.slice( matched.length );
  10074. }
  10075. }
  10076. if ( !matched ) {
  10077. break;
  10078. }
  10079. }
  10080. // Return the length of the invalid excess
  10081. // if we're just parsing
  10082. // Otherwise, throw an error or return tokens
  10083. return parseOnly ?
  10084. soFar.length :
  10085. soFar ?
  10086. Sizzle.error( selector ) :
  10087. // Cache the tokens
  10088. tokenCache( selector, groups ).slice( 0 );
  10089. };
  10090. function toSelector( tokens ) {
  10091. var i = 0,
  10092. len = tokens.length,
  10093. selector = "";
  10094. for ( ; i < len; i++ ) {
  10095. selector += tokens[i].value;
  10096. }
  10097. return selector;
  10098. }
  10099. function addCombinator( matcher, combinator, base ) {
  10100. var dir = combinator.dir,
  10101. skip = combinator.next,
  10102. key = skip || dir,
  10103. checkNonElements = base && key === "parentNode",
  10104. doneName = done++;
  10105. return combinator.first ?
  10106. // Check against closest ancestor/preceding element
  10107. function( elem, context, xml ) {
  10108. while ( (elem = elem[ dir ]) ) {
  10109. if ( elem.nodeType === 1 || checkNonElements ) {
  10110. return matcher( elem, context, xml );
  10111. }
  10112. }
  10113. return false;
  10114. } :
  10115. // Check against all ancestor/preceding elements
  10116. function( elem, context, xml ) {
  10117. var oldCache, uniqueCache, outerCache,
  10118. newCache = [ dirruns, doneName ];
  10119. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  10120. if ( xml ) {
  10121. while ( (elem = elem[ dir ]) ) {
  10122. if ( elem.nodeType === 1 || checkNonElements ) {
  10123. if ( matcher( elem, context, xml ) ) {
  10124. return true;
  10125. }
  10126. }
  10127. }
  10128. } else {
  10129. while ( (elem = elem[ dir ]) ) {
  10130. if ( elem.nodeType === 1 || checkNonElements ) {
  10131. outerCache = elem[ expando ] || (elem[ expando ] = {});
  10132. // Support: IE <9 only
  10133. // Defend against cloned attroperties (jQuery gh-1709)
  10134. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  10135. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  10136. elem = elem[ dir ] || elem;
  10137. } else if ( (oldCache = uniqueCache[ key ]) &&
  10138. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  10139. // Assign to newCache so results back-propagate to previous elements
  10140. return (newCache[ 2 ] = oldCache[ 2 ]);
  10141. } else {
  10142. // Reuse newcache so results back-propagate to previous elements
  10143. uniqueCache[ key ] = newCache;
  10144. // A match means we're done; a fail means we have to keep checking
  10145. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  10146. return true;
  10147. }
  10148. }
  10149. }
  10150. }
  10151. }
  10152. return false;
  10153. };
  10154. }
  10155. function elementMatcher( matchers ) {
  10156. return matchers.length > 1 ?
  10157. function( elem, context, xml ) {
  10158. var i = matchers.length;
  10159. while ( i-- ) {
  10160. if ( !matchers[i]( elem, context, xml ) ) {
  10161. return false;
  10162. }
  10163. }
  10164. return true;
  10165. } :
  10166. matchers[0];
  10167. }
  10168. function multipleContexts( selector, contexts, results ) {
  10169. var i = 0,
  10170. len = contexts.length;
  10171. for ( ; i < len; i++ ) {
  10172. Sizzle( selector, contexts[i], results );
  10173. }
  10174. return results;
  10175. }
  10176. function condense( unmatched, map, filter, context, xml ) {
  10177. var elem,
  10178. newUnmatched = [],
  10179. i = 0,
  10180. len = unmatched.length,
  10181. mapped = map != null;
  10182. for ( ; i < len; i++ ) {
  10183. if ( (elem = unmatched[i]) ) {
  10184. if ( !filter || filter( elem, context, xml ) ) {
  10185. newUnmatched.push( elem );
  10186. if ( mapped ) {
  10187. map.push( i );
  10188. }
  10189. }
  10190. }
  10191. }
  10192. return newUnmatched;
  10193. }
  10194. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  10195. if ( postFilter && !postFilter[ expando ] ) {
  10196. postFilter = setMatcher( postFilter );
  10197. }
  10198. if ( postFinder && !postFinder[ expando ] ) {
  10199. postFinder = setMatcher( postFinder, postSelector );
  10200. }
  10201. return markFunction(function( seed, results, context, xml ) {
  10202. var temp, i, elem,
  10203. preMap = [],
  10204. postMap = [],
  10205. preexisting = results.length,
  10206. // Get initial elements from seed or context
  10207. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  10208. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  10209. matcherIn = preFilter && ( seed || !selector ) ?
  10210. condense( elems, preMap, preFilter, context, xml ) :
  10211. elems,
  10212. matcherOut = matcher ?
  10213. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  10214. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  10215. // ...intermediate processing is necessary
  10216. [] :
  10217. // ...otherwise use results directly
  10218. results :
  10219. matcherIn;
  10220. // Find primary matches
  10221. if ( matcher ) {
  10222. matcher( matcherIn, matcherOut, context, xml );
  10223. }
  10224. // Apply postFilter
  10225. if ( postFilter ) {
  10226. temp = condense( matcherOut, postMap );
  10227. postFilter( temp, [], context, xml );
  10228. // Un-match failing elements by moving them back to matcherIn
  10229. i = temp.length;
  10230. while ( i-- ) {
  10231. if ( (elem = temp[i]) ) {
  10232. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  10233. }
  10234. }
  10235. }
  10236. if ( seed ) {
  10237. if ( postFinder || preFilter ) {
  10238. if ( postFinder ) {
  10239. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  10240. temp = [];
  10241. i = matcherOut.length;
  10242. while ( i-- ) {
  10243. if ( (elem = matcherOut[i]) ) {
  10244. // Restore matcherIn since elem is not yet a final match
  10245. temp.push( (matcherIn[i] = elem) );
  10246. }
  10247. }
  10248. postFinder( null, (matcherOut = []), temp, xml );
  10249. }
  10250. // Move matched elements from seed to results to keep them synchronized
  10251. i = matcherOut.length;
  10252. while ( i-- ) {
  10253. if ( (elem = matcherOut[i]) &&
  10254. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  10255. seed[temp] = !(results[temp] = elem);
  10256. }
  10257. }
  10258. }
  10259. // Add elements to results, through postFinder if defined
  10260. } else {
  10261. matcherOut = condense(
  10262. matcherOut === results ?
  10263. matcherOut.splice( preexisting, matcherOut.length ) :
  10264. matcherOut
  10265. );
  10266. if ( postFinder ) {
  10267. postFinder( null, results, matcherOut, xml );
  10268. } else {
  10269. push.apply( results, matcherOut );
  10270. }
  10271. }
  10272. });
  10273. }
  10274. function matcherFromTokens( tokens ) {
  10275. var checkContext, matcher, j,
  10276. len = tokens.length,
  10277. leadingRelative = Expr.relative[ tokens[0].type ],
  10278. implicitRelative = leadingRelative || Expr.relative[" "],
  10279. i = leadingRelative ? 1 : 0,
  10280. // The foundational matcher ensures that elements are reachable from top-level context(s)
  10281. matchContext = addCombinator( function( elem ) {
  10282. return elem === checkContext;
  10283. }, implicitRelative, true ),
  10284. matchAnyContext = addCombinator( function( elem ) {
  10285. return indexOf( checkContext, elem ) > -1;
  10286. }, implicitRelative, true ),
  10287. matchers = [ function( elem, context, xml ) {
  10288. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  10289. (checkContext = context).nodeType ?
  10290. matchContext( elem, context, xml ) :
  10291. matchAnyContext( elem, context, xml ) );
  10292. // Avoid hanging onto element (issue #299)
  10293. checkContext = null;
  10294. return ret;
  10295. } ];
  10296. for ( ; i < len; i++ ) {
  10297. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  10298. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  10299. } else {
  10300. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  10301. // Return special upon seeing a positional matcher
  10302. if ( matcher[ expando ] ) {
  10303. // Find the next relative operator (if any) for proper handling
  10304. j = ++i;
  10305. for ( ; j < len; j++ ) {
  10306. if ( Expr.relative[ tokens[j].type ] ) {
  10307. break;
  10308. }
  10309. }
  10310. return setMatcher(
  10311. i > 1 && elementMatcher( matchers ),
  10312. i > 1 && toSelector(
  10313. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  10314. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  10315. ).replace( rtrim, "$1" ),
  10316. matcher,
  10317. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  10318. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  10319. j < len && toSelector( tokens )
  10320. );
  10321. }
  10322. matchers.push( matcher );
  10323. }
  10324. }
  10325. return elementMatcher( matchers );
  10326. }
  10327. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  10328. var bySet = setMatchers.length > 0,
  10329. byElement = elementMatchers.length > 0,
  10330. superMatcher = function( seed, context, xml, results, outermost ) {
  10331. var elem, j, matcher,
  10332. matchedCount = 0,
  10333. i = "0",
  10334. unmatched = seed && [],
  10335. setMatched = [],
  10336. contextBackup = outermostContext,
  10337. // We must always have either seed elements or outermost context
  10338. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  10339. // Use integer dirruns iff this is the outermost matcher
  10340. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  10341. len = elems.length;
  10342. if ( outermost ) {
  10343. outermostContext = context === document || context || outermost;
  10344. }
  10345. // Add elements passing elementMatchers directly to results
  10346. // Support: IE<9, Safari
  10347. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  10348. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  10349. if ( byElement && elem ) {
  10350. j = 0;
  10351. if ( !context && elem.ownerDocument !== document ) {
  10352. setDocument( elem );
  10353. xml = !documentIsHTML;
  10354. }
  10355. while ( (matcher = elementMatchers[j++]) ) {
  10356. if ( matcher( elem, context || document, xml) ) {
  10357. results.push( elem );
  10358. break;
  10359. }
  10360. }
  10361. if ( outermost ) {
  10362. dirruns = dirrunsUnique;
  10363. }
  10364. }
  10365. // Track unmatched elements for set filters
  10366. if ( bySet ) {
  10367. // They will have gone through all possible matchers
  10368. if ( (elem = !matcher && elem) ) {
  10369. matchedCount--;
  10370. }
  10371. // Lengthen the array for every element, matched or not
  10372. if ( seed ) {
  10373. unmatched.push( elem );
  10374. }
  10375. }
  10376. }
  10377. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  10378. // makes the latter nonnegative.
  10379. matchedCount += i;
  10380. // Apply set filters to unmatched elements
  10381. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  10382. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  10383. // no element matchers and no seed.
  10384. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  10385. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  10386. // numerically zero.
  10387. if ( bySet && i !== matchedCount ) {
  10388. j = 0;
  10389. while ( (matcher = setMatchers[j++]) ) {
  10390. matcher( unmatched, setMatched, context, xml );
  10391. }
  10392. if ( seed ) {
  10393. // Reintegrate element matches to eliminate the need for sorting
  10394. if ( matchedCount > 0 ) {
  10395. while ( i-- ) {
  10396. if ( !(unmatched[i] || setMatched[i]) ) {
  10397. setMatched[i] = pop.call( results );
  10398. }
  10399. }
  10400. }
  10401. // Discard index placeholder values to get only actual matches
  10402. setMatched = condense( setMatched );
  10403. }
  10404. // Add matches to results
  10405. push.apply( results, setMatched );
  10406. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  10407. if ( outermost && !seed && setMatched.length > 0 &&
  10408. ( matchedCount + setMatchers.length ) > 1 ) {
  10409. Sizzle.uniqueSort( results );
  10410. }
  10411. }
  10412. // Override manipulation of globals by nested matchers
  10413. if ( outermost ) {
  10414. dirruns = dirrunsUnique;
  10415. outermostContext = contextBackup;
  10416. }
  10417. return unmatched;
  10418. };
  10419. return bySet ?
  10420. markFunction( superMatcher ) :
  10421. superMatcher;
  10422. }
  10423. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  10424. var i,
  10425. setMatchers = [],
  10426. elementMatchers = [],
  10427. cached = compilerCache[ selector + " " ];
  10428. if ( !cached ) {
  10429. // Generate a function of recursive functions that can be used to check each element
  10430. if ( !match ) {
  10431. match = tokenize( selector );
  10432. }
  10433. i = match.length;
  10434. while ( i-- ) {
  10435. cached = matcherFromTokens( match[i] );
  10436. if ( cached[ expando ] ) {
  10437. setMatchers.push( cached );
  10438. } else {
  10439. elementMatchers.push( cached );
  10440. }
  10441. }
  10442. // Cache the compiled function
  10443. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  10444. // Save selector and tokenization
  10445. cached.selector = selector;
  10446. }
  10447. return cached;
  10448. };
  10449. /**
  10450. * A low-level selection function that works with Sizzle's compiled
  10451. * selector functions
  10452. * @param {String|Function} selector A selector or a pre-compiled
  10453. * selector function built with Sizzle.compile
  10454. * @param {Element} context
  10455. * @param {Array} [results]
  10456. * @param {Array} [seed] A set of elements to match against
  10457. */
  10458. select = Sizzle.select = function( selector, context, results, seed ) {
  10459. var i, tokens, token, type, find,
  10460. compiled = typeof selector === "function" && selector,
  10461. match = !seed && tokenize( (selector = compiled.selector || selector) );
  10462. results = results || [];
  10463. // Try to minimize operations if there is only one selector in the list and no seed
  10464. // (the latter of which guarantees us context)
  10465. if ( match.length === 1 ) {
  10466. // Reduce context if the leading compound selector is an ID
  10467. tokens = match[0] = match[0].slice( 0 );
  10468. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  10469. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
  10470. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  10471. if ( !context ) {
  10472. return results;
  10473. // Precompiled matchers will still verify ancestry, so step up a level
  10474. } else if ( compiled ) {
  10475. context = context.parentNode;
  10476. }
  10477. selector = selector.slice( tokens.shift().value.length );
  10478. }
  10479. // Fetch a seed set for right-to-left matching
  10480. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  10481. while ( i-- ) {
  10482. token = tokens[i];
  10483. // Abort if we hit a combinator
  10484. if ( Expr.relative[ (type = token.type) ] ) {
  10485. break;
  10486. }
  10487. if ( (find = Expr.find[ type ]) ) {
  10488. // Search, expanding context for leading sibling combinators
  10489. if ( (seed = find(
  10490. token.matches[0].replace( runescape, funescape ),
  10491. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  10492. )) ) {
  10493. // If seed is empty or no tokens remain, we can return early
  10494. tokens.splice( i, 1 );
  10495. selector = seed.length && toSelector( tokens );
  10496. if ( !selector ) {
  10497. push.apply( results, seed );
  10498. return results;
  10499. }
  10500. break;
  10501. }
  10502. }
  10503. }
  10504. }
  10505. // Compile and execute a filtering function if one is not provided
  10506. // Provide `match` to avoid retokenization if we modified the selector above
  10507. ( compiled || compile( selector, match ) )(
  10508. seed,
  10509. context,
  10510. !documentIsHTML,
  10511. results,
  10512. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  10513. );
  10514. return results;
  10515. };
  10516. // One-time assignments
  10517. // Sort stability
  10518. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  10519. // Support: Chrome 14-35+
  10520. // Always assume duplicates if they aren't passed to the comparison function
  10521. support.detectDuplicates = !!hasDuplicate;
  10522. // Initialize against the default document
  10523. setDocument();
  10524. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  10525. // Detached nodes confoundingly follow *each other*
  10526. support.sortDetached = assert(function( el ) {
  10527. // Should return 1, but returns 4 (following)
  10528. return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
  10529. });
  10530. // Support: IE<8
  10531. // Prevent attribute/property "interpolation"
  10532. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  10533. if ( !assert(function( el ) {
  10534. el.innerHTML = "<a href='#'></a>";
  10535. return el.firstChild.getAttribute("href") === "#" ;
  10536. }) ) {
  10537. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  10538. if ( !isXML ) {
  10539. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  10540. }
  10541. });
  10542. }
  10543. // Support: IE<9
  10544. // Use defaultValue in place of getAttribute("value")
  10545. if ( !support.attributes || !assert(function( el ) {
  10546. el.innerHTML = "<input/>";
  10547. el.firstChild.setAttribute( "value", "" );
  10548. return el.firstChild.getAttribute( "value" ) === "";
  10549. }) ) {
  10550. addHandle( "value", function( elem, name, isXML ) {
  10551. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  10552. return elem.defaultValue;
  10553. }
  10554. });
  10555. }
  10556. // Support: IE<9
  10557. // Use getAttributeNode to fetch booleans when getAttribute lies
  10558. if ( !assert(function( el ) {
  10559. return el.getAttribute("disabled") == null;
  10560. }) ) {
  10561. addHandle( booleans, function( elem, name, isXML ) {
  10562. var val;
  10563. if ( !isXML ) {
  10564. return elem[ name ] === true ? name.toLowerCase() :
  10565. (val = elem.getAttributeNode( name )) && val.specified ?
  10566. val.value :
  10567. null;
  10568. }
  10569. });
  10570. }
  10571. return Sizzle;
  10572. })( window );
  10573. jQuery.find = Sizzle;
  10574. jQuery.expr = Sizzle.selectors;
  10575. // Deprecated
  10576. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  10577. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  10578. jQuery.text = Sizzle.getText;
  10579. jQuery.isXMLDoc = Sizzle.isXML;
  10580. jQuery.contains = Sizzle.contains;
  10581. jQuery.escapeSelector = Sizzle.escape;
  10582. var dir = function( elem, dir, until ) {
  10583. var matched = [],
  10584. truncate = until !== undefined;
  10585. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  10586. if ( elem.nodeType === 1 ) {
  10587. if ( truncate && jQuery( elem ).is( until ) ) {
  10588. break;
  10589. }
  10590. matched.push( elem );
  10591. }
  10592. }
  10593. return matched;
  10594. };
  10595. var siblings = function( n, elem ) {
  10596. var matched = [];
  10597. for ( ; n; n = n.nextSibling ) {
  10598. if ( n.nodeType === 1 && n !== elem ) {
  10599. matched.push( n );
  10600. }
  10601. }
  10602. return matched;
  10603. };
  10604. var rneedsContext = jQuery.expr.match.needsContext;
  10605. function nodeName( elem, name ) {
  10606. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  10607. };
  10608. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  10609. // Implement the identical functionality for filter and not
  10610. function winnow( elements, qualifier, not ) {
  10611. if ( isFunction( qualifier ) ) {
  10612. return jQuery.grep( elements, function( elem, i ) {
  10613. return !!qualifier.call( elem, i, elem ) !== not;
  10614. } );
  10615. }
  10616. // Single element
  10617. if ( qualifier.nodeType ) {
  10618. return jQuery.grep( elements, function( elem ) {
  10619. return ( elem === qualifier ) !== not;
  10620. } );
  10621. }
  10622. // Arraylike of elements (jQuery, arguments, Array)
  10623. if ( typeof qualifier !== "string" ) {
  10624. return jQuery.grep( elements, function( elem ) {
  10625. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  10626. } );
  10627. }
  10628. // Filtered directly for both simple and complex selectors
  10629. return jQuery.filter( qualifier, elements, not );
  10630. }
  10631. jQuery.filter = function( expr, elems, not ) {
  10632. var elem = elems[ 0 ];
  10633. if ( not ) {
  10634. expr = ":not(" + expr + ")";
  10635. }
  10636. if ( elems.length === 1 && elem.nodeType === 1 ) {
  10637. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  10638. }
  10639. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  10640. return elem.nodeType === 1;
  10641. } ) );
  10642. };
  10643. jQuery.fn.extend( {
  10644. find: function( selector ) {
  10645. var i, ret,
  10646. len = this.length,
  10647. self = this;
  10648. if ( typeof selector !== "string" ) {
  10649. return this.pushStack( jQuery( selector ).filter( function() {
  10650. for ( i = 0; i < len; i++ ) {
  10651. if ( jQuery.contains( self[ i ], this ) ) {
  10652. return true;
  10653. }
  10654. }
  10655. } ) );
  10656. }
  10657. ret = this.pushStack( [] );
  10658. for ( i = 0; i < len; i++ ) {
  10659. jQuery.find( selector, self[ i ], ret );
  10660. }
  10661. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  10662. },
  10663. filter: function( selector ) {
  10664. return this.pushStack( winnow( this, selector || [], false ) );
  10665. },
  10666. not: function( selector ) {
  10667. return this.pushStack( winnow( this, selector || [], true ) );
  10668. },
  10669. is: function( selector ) {
  10670. return !!winnow(
  10671. this,
  10672. // If this is a positional/relative selector, check membership in the returned set
  10673. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  10674. typeof selector === "string" && rneedsContext.test( selector ) ?
  10675. jQuery( selector ) :
  10676. selector || [],
  10677. false
  10678. ).length;
  10679. }
  10680. } );
  10681. // Initialize a jQuery object
  10682. // A central reference to the root jQuery(document)
  10683. var rootjQuery,
  10684. // A simple way to check for HTML strings
  10685. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  10686. // Strict HTML recognition (#11290: must start with <)
  10687. // Shortcut simple #id case for speed
  10688. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  10689. init = jQuery.fn.init = function( selector, context, root ) {
  10690. var match, elem;
  10691. // HANDLE: $(""), $(null), $(undefined), $(false)
  10692. if ( !selector ) {
  10693. return this;
  10694. }
  10695. // Method init() accepts an alternate rootjQuery
  10696. // so migrate can support jQuery.sub (gh-2101)
  10697. root = root || rootjQuery;
  10698. // Handle HTML strings
  10699. if ( typeof selector === "string" ) {
  10700. if ( selector[ 0 ] === "<" &&
  10701. selector[ selector.length - 1 ] === ">" &&
  10702. selector.length >= 3 ) {
  10703. // Assume that strings that start and end with <> are HTML and skip the regex check
  10704. match = [ null, selector, null ];
  10705. } else {
  10706. match = rquickExpr.exec( selector );
  10707. }
  10708. // Match html or make sure no context is specified for #id
  10709. if ( match && ( match[ 1 ] || !context ) ) {
  10710. // HANDLE: $(html) -> $(array)
  10711. if ( match[ 1 ] ) {
  10712. context = context instanceof jQuery ? context[ 0 ] : context;
  10713. // Option to run scripts is true for back-compat
  10714. // Intentionally let the error be thrown if parseHTML is not present
  10715. jQuery.merge( this, jQuery.parseHTML(
  10716. match[ 1 ],
  10717. context && context.nodeType ? context.ownerDocument || context : document,
  10718. true
  10719. ) );
  10720. // HANDLE: $(html, props)
  10721. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  10722. for ( match in context ) {
  10723. // Properties of context are called as methods if possible
  10724. if ( isFunction( this[ match ] ) ) {
  10725. this[ match ]( context[ match ] );
  10726. // ...and otherwise set as attributes
  10727. } else {
  10728. this.attr( match, context[ match ] );
  10729. }
  10730. }
  10731. }
  10732. return this;
  10733. // HANDLE: $(#id)
  10734. } else {
  10735. elem = document.getElementById( match[ 2 ] );
  10736. if ( elem ) {
  10737. // Inject the element directly into the jQuery object
  10738. this[ 0 ] = elem;
  10739. this.length = 1;
  10740. }
  10741. return this;
  10742. }
  10743. // HANDLE: $(expr, $(...))
  10744. } else if ( !context || context.jquery ) {
  10745. return ( context || root ).find( selector );
  10746. // HANDLE: $(expr, context)
  10747. // (which is just equivalent to: $(context).find(expr)
  10748. } else {
  10749. return this.constructor( context ).find( selector );
  10750. }
  10751. // HANDLE: $(DOMElement)
  10752. } else if ( selector.nodeType ) {
  10753. this[ 0 ] = selector;
  10754. this.length = 1;
  10755. return this;
  10756. // HANDLE: $(function)
  10757. // Shortcut for document ready
  10758. } else if ( isFunction( selector ) ) {
  10759. return root.ready !== undefined ?
  10760. root.ready( selector ) :
  10761. // Execute immediately if ready is not present
  10762. selector( jQuery );
  10763. }
  10764. return jQuery.makeArray( selector, this );
  10765. };
  10766. // Give the init function the jQuery prototype for later instantiation
  10767. init.prototype = jQuery.fn;
  10768. // Initialize central reference
  10769. rootjQuery = jQuery( document );
  10770. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  10771. // Methods guaranteed to produce a unique set when starting from a unique set
  10772. guaranteedUnique = {
  10773. children: true,
  10774. contents: true,
  10775. next: true,
  10776. prev: true
  10777. };
  10778. jQuery.fn.extend( {
  10779. has: function( target ) {
  10780. var targets = jQuery( target, this ),
  10781. l = targets.length;
  10782. return this.filter( function() {
  10783. var i = 0;
  10784. for ( ; i < l; i++ ) {
  10785. if ( jQuery.contains( this, targets[ i ] ) ) {
  10786. return true;
  10787. }
  10788. }
  10789. } );
  10790. },
  10791. closest: function( selectors, context ) {
  10792. var cur,
  10793. i = 0,
  10794. l = this.length,
  10795. matched = [],
  10796. targets = typeof selectors !== "string" && jQuery( selectors );
  10797. // Positional selectors never match, since there's no _selection_ context
  10798. if ( !rneedsContext.test( selectors ) ) {
  10799. for ( ; i < l; i++ ) {
  10800. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  10801. // Always skip document fragments
  10802. if ( cur.nodeType < 11 && ( targets ?
  10803. targets.index( cur ) > -1 :
  10804. // Don't pass non-elements to Sizzle
  10805. cur.nodeType === 1 &&
  10806. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  10807. matched.push( cur );
  10808. break;
  10809. }
  10810. }
  10811. }
  10812. }
  10813. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  10814. },
  10815. // Determine the position of an element within the set
  10816. index: function( elem ) {
  10817. // No argument, return index in parent
  10818. if ( !elem ) {
  10819. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  10820. }
  10821. // Index in selector
  10822. if ( typeof elem === "string" ) {
  10823. return indexOf.call( jQuery( elem ), this[ 0 ] );
  10824. }
  10825. // Locate the position of the desired element
  10826. return indexOf.call( this,
  10827. // If it receives a jQuery object, the first element is used
  10828. elem.jquery ? elem[ 0 ] : elem
  10829. );
  10830. },
  10831. add: function( selector, context ) {
  10832. return this.pushStack(
  10833. jQuery.uniqueSort(
  10834. jQuery.merge( this.get(), jQuery( selector, context ) )
  10835. )
  10836. );
  10837. },
  10838. addBack: function( selector ) {
  10839. return this.add( selector == null ?
  10840. this.prevObject : this.prevObject.filter( selector )
  10841. );
  10842. }
  10843. } );
  10844. function sibling( cur, dir ) {
  10845. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  10846. return cur;
  10847. }
  10848. jQuery.each( {
  10849. parent: function( elem ) {
  10850. var parent = elem.parentNode;
  10851. return parent && parent.nodeType !== 11 ? parent : null;
  10852. },
  10853. parents: function( elem ) {
  10854. return dir( elem, "parentNode" );
  10855. },
  10856. parentsUntil: function( elem, i, until ) {
  10857. return dir( elem, "parentNode", until );
  10858. },
  10859. next: function( elem ) {
  10860. return sibling( elem, "nextSibling" );
  10861. },
  10862. prev: function( elem ) {
  10863. return sibling( elem, "previousSibling" );
  10864. },
  10865. nextAll: function( elem ) {
  10866. return dir( elem, "nextSibling" );
  10867. },
  10868. prevAll: function( elem ) {
  10869. return dir( elem, "previousSibling" );
  10870. },
  10871. nextUntil: function( elem, i, until ) {
  10872. return dir( elem, "nextSibling", until );
  10873. },
  10874. prevUntil: function( elem, i, until ) {
  10875. return dir( elem, "previousSibling", until );
  10876. },
  10877. siblings: function( elem ) {
  10878. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  10879. },
  10880. children: function( elem ) {
  10881. return siblings( elem.firstChild );
  10882. },
  10883. contents: function( elem ) {
  10884. if ( typeof elem.contentDocument !== "undefined" ) {
  10885. return elem.contentDocument;
  10886. }
  10887. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  10888. // Treat the template element as a regular one in browsers that
  10889. // don't support it.
  10890. if ( nodeName( elem, "template" ) ) {
  10891. elem = elem.content || elem;
  10892. }
  10893. return jQuery.merge( [], elem.childNodes );
  10894. }
  10895. }, function( name, fn ) {
  10896. jQuery.fn[ name ] = function( until, selector ) {
  10897. var matched = jQuery.map( this, fn, until );
  10898. if ( name.slice( -5 ) !== "Until" ) {
  10899. selector = until;
  10900. }
  10901. if ( selector && typeof selector === "string" ) {
  10902. matched = jQuery.filter( selector, matched );
  10903. }
  10904. if ( this.length > 1 ) {
  10905. // Remove duplicates
  10906. if ( !guaranteedUnique[ name ] ) {
  10907. jQuery.uniqueSort( matched );
  10908. }
  10909. // Reverse order for parents* and prev-derivatives
  10910. if ( rparentsprev.test( name ) ) {
  10911. matched.reverse();
  10912. }
  10913. }
  10914. return this.pushStack( matched );
  10915. };
  10916. } );
  10917. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  10918. // Convert String-formatted options into Object-formatted ones
  10919. function createOptions( options ) {
  10920. var object = {};
  10921. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  10922. object[ flag ] = true;
  10923. } );
  10924. return object;
  10925. }
  10926. /*
  10927. * Create a callback list using the following parameters:
  10928. *
  10929. * options: an optional list of space-separated options that will change how
  10930. * the callback list behaves or a more traditional option object
  10931. *
  10932. * By default a callback list will act like an event callback list and can be
  10933. * "fired" multiple times.
  10934. *
  10935. * Possible options:
  10936. *
  10937. * once: will ensure the callback list can only be fired once (like a Deferred)
  10938. *
  10939. * memory: will keep track of previous values and will call any callback added
  10940. * after the list has been fired right away with the latest "memorized"
  10941. * values (like a Deferred)
  10942. *
  10943. * unique: will ensure a callback can only be added once (no duplicate in the list)
  10944. *
  10945. * stopOnFalse: interrupt callings when a callback returns false
  10946. *
  10947. */
  10948. jQuery.Callbacks = function( options ) {
  10949. // Convert options from String-formatted to Object-formatted if needed
  10950. // (we check in cache first)
  10951. options = typeof options === "string" ?
  10952. createOptions( options ) :
  10953. jQuery.extend( {}, options );
  10954. var // Flag to know if list is currently firing
  10955. firing,
  10956. // Last fire value for non-forgettable lists
  10957. memory,
  10958. // Flag to know if list was already fired
  10959. fired,
  10960. // Flag to prevent firing
  10961. locked,
  10962. // Actual callback list
  10963. list = [],
  10964. // Queue of execution data for repeatable lists
  10965. queue = [],
  10966. // Index of currently firing callback (modified by add/remove as needed)
  10967. firingIndex = -1,
  10968. // Fire callbacks
  10969. fire = function() {
  10970. // Enforce single-firing
  10971. locked = locked || options.once;
  10972. // Execute callbacks for all pending executions,
  10973. // respecting firingIndex overrides and runtime changes
  10974. fired = firing = true;
  10975. for ( ; queue.length; firingIndex = -1 ) {
  10976. memory = queue.shift();
  10977. while ( ++firingIndex < list.length ) {
  10978. // Run callback and check for early termination
  10979. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  10980. options.stopOnFalse ) {
  10981. // Jump to end and forget the data so .add doesn't re-fire
  10982. firingIndex = list.length;
  10983. memory = false;
  10984. }
  10985. }
  10986. }
  10987. // Forget the data if we're done with it
  10988. if ( !options.memory ) {
  10989. memory = false;
  10990. }
  10991. firing = false;
  10992. // Clean up if we're done firing for good
  10993. if ( locked ) {
  10994. // Keep an empty list if we have data for future add calls
  10995. if ( memory ) {
  10996. list = [];
  10997. // Otherwise, this object is spent
  10998. } else {
  10999. list = "";
  11000. }
  11001. }
  11002. },
  11003. // Actual Callbacks object
  11004. self = {
  11005. // Add a callback or a collection of callbacks to the list
  11006. add: function() {
  11007. if ( list ) {
  11008. // If we have memory from a past run, we should fire after adding
  11009. if ( memory && !firing ) {
  11010. firingIndex = list.length - 1;
  11011. queue.push( memory );
  11012. }
  11013. ( function add( args ) {
  11014. jQuery.each( args, function( _, arg ) {
  11015. if ( isFunction( arg ) ) {
  11016. if ( !options.unique || !self.has( arg ) ) {
  11017. list.push( arg );
  11018. }
  11019. } else if ( arg && arg.length && toType( arg ) !== "string" ) {
  11020. // Inspect recursively
  11021. add( arg );
  11022. }
  11023. } );
  11024. } )( arguments );
  11025. if ( memory && !firing ) {
  11026. fire();
  11027. }
  11028. }
  11029. return this;
  11030. },
  11031. // Remove a callback from the list
  11032. remove: function() {
  11033. jQuery.each( arguments, function( _, arg ) {
  11034. var index;
  11035. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  11036. list.splice( index, 1 );
  11037. // Handle firing indexes
  11038. if ( index <= firingIndex ) {
  11039. firingIndex--;
  11040. }
  11041. }
  11042. } );
  11043. return this;
  11044. },
  11045. // Check if a given callback is in the list.
  11046. // If no argument is given, return whether or not list has callbacks attached.
  11047. has: function( fn ) {
  11048. return fn ?
  11049. jQuery.inArray( fn, list ) > -1 :
  11050. list.length > 0;
  11051. },
  11052. // Remove all callbacks from the list
  11053. empty: function() {
  11054. if ( list ) {
  11055. list = [];
  11056. }
  11057. return this;
  11058. },
  11059. // Disable .fire and .add
  11060. // Abort any current/pending executions
  11061. // Clear all callbacks and values
  11062. disable: function() {
  11063. locked = queue = [];
  11064. list = memory = "";
  11065. return this;
  11066. },
  11067. disabled: function() {
  11068. return !list;
  11069. },
  11070. // Disable .fire
  11071. // Also disable .add unless we have memory (since it would have no effect)
  11072. // Abort any pending executions
  11073. lock: function() {
  11074. locked = queue = [];
  11075. if ( !memory && !firing ) {
  11076. list = memory = "";
  11077. }
  11078. return this;
  11079. },
  11080. locked: function() {
  11081. return !!locked;
  11082. },
  11083. // Call all callbacks with the given context and arguments
  11084. fireWith: function( context, args ) {
  11085. if ( !locked ) {
  11086. args = args || [];
  11087. args = [ context, args.slice ? args.slice() : args ];
  11088. queue.push( args );
  11089. if ( !firing ) {
  11090. fire();
  11091. }
  11092. }
  11093. return this;
  11094. },
  11095. // Call all the callbacks with the given arguments
  11096. fire: function() {
  11097. self.fireWith( this, arguments );
  11098. return this;
  11099. },
  11100. // To know if the callbacks have already been called at least once
  11101. fired: function() {
  11102. return !!fired;
  11103. }
  11104. };
  11105. return self;
  11106. };
  11107. function Identity( v ) {
  11108. return v;
  11109. }
  11110. function Thrower( ex ) {
  11111. throw ex;
  11112. }
  11113. function adoptValue( value, resolve, reject, noValue ) {
  11114. var method;
  11115. try {
  11116. // Check for promise aspect first to privilege synchronous behavior
  11117. if ( value && isFunction( ( method = value.promise ) ) ) {
  11118. method.call( value ).done( resolve ).fail( reject );
  11119. // Other thenables
  11120. } else if ( value && isFunction( ( method = value.then ) ) ) {
  11121. method.call( value, resolve, reject );
  11122. // Other non-thenables
  11123. } else {
  11124. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  11125. // * false: [ value ].slice( 0 ) => resolve( value )
  11126. // * true: [ value ].slice( 1 ) => resolve()
  11127. resolve.apply( undefined, [ value ].slice( noValue ) );
  11128. }
  11129. // For Promises/A+, convert exceptions into rejections
  11130. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  11131. // Deferred#then to conditionally suppress rejection.
  11132. } catch ( value ) {
  11133. // Support: Android 4.0 only
  11134. // Strict mode functions invoked without .call/.apply get global-object context
  11135. reject.apply( undefined, [ value ] );
  11136. }
  11137. }
  11138. jQuery.extend( {
  11139. Deferred: function( func ) {
  11140. var tuples = [
  11141. // action, add listener, callbacks,
  11142. // ... .then handlers, argument index, [final state]
  11143. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  11144. jQuery.Callbacks( "memory" ), 2 ],
  11145. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  11146. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  11147. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  11148. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  11149. ],
  11150. state = "pending",
  11151. promise = {
  11152. state: function() {
  11153. return state;
  11154. },
  11155. always: function() {
  11156. deferred.done( arguments ).fail( arguments );
  11157. return this;
  11158. },
  11159. "catch": function( fn ) {
  11160. return promise.then( null, fn );
  11161. },
  11162. // Keep pipe for back-compat
  11163. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  11164. var fns = arguments;
  11165. return jQuery.Deferred( function( newDefer ) {
  11166. jQuery.each( tuples, function( i, tuple ) {
  11167. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  11168. var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  11169. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  11170. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  11171. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  11172. deferred[ tuple[ 1 ] ]( function() {
  11173. var returned = fn && fn.apply( this, arguments );
  11174. if ( returned && isFunction( returned.promise ) ) {
  11175. returned.promise()
  11176. .progress( newDefer.notify )
  11177. .done( newDefer.resolve )
  11178. .fail( newDefer.reject );
  11179. } else {
  11180. newDefer[ tuple[ 0 ] + "With" ](
  11181. this,
  11182. fn ? [ returned ] : arguments
  11183. );
  11184. }
  11185. } );
  11186. } );
  11187. fns = null;
  11188. } ).promise();
  11189. },
  11190. then: function( onFulfilled, onRejected, onProgress ) {
  11191. var maxDepth = 0;
  11192. function resolve( depth, deferred, handler, special ) {
  11193. return function() {
  11194. var that = this,
  11195. args = arguments,
  11196. mightThrow = function() {
  11197. var returned, then;
  11198. // Support: Promises/A+ section 2.3.3.3.3
  11199. // https://promisesaplus.com/#point-59
  11200. // Ignore double-resolution attempts
  11201. if ( depth < maxDepth ) {
  11202. return;
  11203. }
  11204. returned = handler.apply( that, args );
  11205. // Support: Promises/A+ section 2.3.1
  11206. // https://promisesaplus.com/#point-48
  11207. if ( returned === deferred.promise() ) {
  11208. throw new TypeError( "Thenable self-resolution" );
  11209. }
  11210. // Support: Promises/A+ sections 2.3.3.1, 3.5
  11211. // https://promisesaplus.com/#point-54
  11212. // https://promisesaplus.com/#point-75
  11213. // Retrieve `then` only once
  11214. then = returned &&
  11215. // Support: Promises/A+ section 2.3.4
  11216. // https://promisesaplus.com/#point-64
  11217. // Only check objects and functions for thenability
  11218. ( typeof returned === "object" ||
  11219. typeof returned === "function" ) &&
  11220. returned.then;
  11221. // Handle a returned thenable
  11222. if ( isFunction( then ) ) {
  11223. // Special processors (notify) just wait for resolution
  11224. if ( special ) {
  11225. then.call(
  11226. returned,
  11227. resolve( maxDepth, deferred, Identity, special ),
  11228. resolve( maxDepth, deferred, Thrower, special )
  11229. );
  11230. // Normal processors (resolve) also hook into progress
  11231. } else {
  11232. // ...and disregard older resolution values
  11233. maxDepth++;
  11234. then.call(
  11235. returned,
  11236. resolve( maxDepth, deferred, Identity, special ),
  11237. resolve( maxDepth, deferred, Thrower, special ),
  11238. resolve( maxDepth, deferred, Identity,
  11239. deferred.notifyWith )
  11240. );
  11241. }
  11242. // Handle all other returned values
  11243. } else {
  11244. // Only substitute handlers pass on context
  11245. // and multiple values (non-spec behavior)
  11246. if ( handler !== Identity ) {
  11247. that = undefined;
  11248. args = [ returned ];
  11249. }
  11250. // Process the value(s)
  11251. // Default process is resolve
  11252. ( special || deferred.resolveWith )( that, args );
  11253. }
  11254. },
  11255. // Only normal processors (resolve) catch and reject exceptions
  11256. process = special ?
  11257. mightThrow :
  11258. function() {
  11259. try {
  11260. mightThrow();
  11261. } catch ( e ) {
  11262. if ( jQuery.Deferred.exceptionHook ) {
  11263. jQuery.Deferred.exceptionHook( e,
  11264. process.stackTrace );
  11265. }
  11266. // Support: Promises/A+ section 2.3.3.3.4.1
  11267. // https://promisesaplus.com/#point-61
  11268. // Ignore post-resolution exceptions
  11269. if ( depth + 1 >= maxDepth ) {
  11270. // Only substitute handlers pass on context
  11271. // and multiple values (non-spec behavior)
  11272. if ( handler !== Thrower ) {
  11273. that = undefined;
  11274. args = [ e ];
  11275. }
  11276. deferred.rejectWith( that, args );
  11277. }
  11278. }
  11279. };
  11280. // Support: Promises/A+ section 2.3.3.3.1
  11281. // https://promisesaplus.com/#point-57
  11282. // Re-resolve promises immediately to dodge false rejection from
  11283. // subsequent errors
  11284. if ( depth ) {
  11285. process();
  11286. } else {
  11287. // Call an optional hook to record the stack, in case of exception
  11288. // since it's otherwise lost when execution goes async
  11289. if ( jQuery.Deferred.getStackHook ) {
  11290. process.stackTrace = jQuery.Deferred.getStackHook();
  11291. }
  11292. window.setTimeout( process );
  11293. }
  11294. };
  11295. }
  11296. return jQuery.Deferred( function( newDefer ) {
  11297. // progress_handlers.add( ... )
  11298. tuples[ 0 ][ 3 ].add(
  11299. resolve(
  11300. 0,
  11301. newDefer,
  11302. isFunction( onProgress ) ?
  11303. onProgress :
  11304. Identity,
  11305. newDefer.notifyWith
  11306. )
  11307. );
  11308. // fulfilled_handlers.add( ... )
  11309. tuples[ 1 ][ 3 ].add(
  11310. resolve(
  11311. 0,
  11312. newDefer,
  11313. isFunction( onFulfilled ) ?
  11314. onFulfilled :
  11315. Identity
  11316. )
  11317. );
  11318. // rejected_handlers.add( ... )
  11319. tuples[ 2 ][ 3 ].add(
  11320. resolve(
  11321. 0,
  11322. newDefer,
  11323. isFunction( onRejected ) ?
  11324. onRejected :
  11325. Thrower
  11326. )
  11327. );
  11328. } ).promise();
  11329. },
  11330. // Get a promise for this deferred
  11331. // If obj is provided, the promise aspect is added to the object
  11332. promise: function( obj ) {
  11333. return obj != null ? jQuery.extend( obj, promise ) : promise;
  11334. }
  11335. },
  11336. deferred = {};
  11337. // Add list-specific methods
  11338. jQuery.each( tuples, function( i, tuple ) {
  11339. var list = tuple[ 2 ],
  11340. stateString = tuple[ 5 ];
  11341. // promise.progress = list.add
  11342. // promise.done = list.add
  11343. // promise.fail = list.add
  11344. promise[ tuple[ 1 ] ] = list.add;
  11345. // Handle state
  11346. if ( stateString ) {
  11347. list.add(
  11348. function() {
  11349. // state = "resolved" (i.e., fulfilled)
  11350. // state = "rejected"
  11351. state = stateString;
  11352. },
  11353. // rejected_callbacks.disable
  11354. // fulfilled_callbacks.disable
  11355. tuples[ 3 - i ][ 2 ].disable,
  11356. // rejected_handlers.disable
  11357. // fulfilled_handlers.disable
  11358. tuples[ 3 - i ][ 3 ].disable,
  11359. // progress_callbacks.lock
  11360. tuples[ 0 ][ 2 ].lock,
  11361. // progress_handlers.lock
  11362. tuples[ 0 ][ 3 ].lock
  11363. );
  11364. }
  11365. // progress_handlers.fire
  11366. // fulfilled_handlers.fire
  11367. // rejected_handlers.fire
  11368. list.add( tuple[ 3 ].fire );
  11369. // deferred.notify = function() { deferred.notifyWith(...) }
  11370. // deferred.resolve = function() { deferred.resolveWith(...) }
  11371. // deferred.reject = function() { deferred.rejectWith(...) }
  11372. deferred[ tuple[ 0 ] ] = function() {
  11373. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  11374. return this;
  11375. };
  11376. // deferred.notifyWith = list.fireWith
  11377. // deferred.resolveWith = list.fireWith
  11378. // deferred.rejectWith = list.fireWith
  11379. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  11380. } );
  11381. // Make the deferred a promise
  11382. promise.promise( deferred );
  11383. // Call given func if any
  11384. if ( func ) {
  11385. func.call( deferred, deferred );
  11386. }
  11387. // All done!
  11388. return deferred;
  11389. },
  11390. // Deferred helper
  11391. when: function( singleValue ) {
  11392. var
  11393. // count of uncompleted subordinates
  11394. remaining = arguments.length,
  11395. // count of unprocessed arguments
  11396. i = remaining,
  11397. // subordinate fulfillment data
  11398. resolveContexts = Array( i ),
  11399. resolveValues = slice.call( arguments ),
  11400. // the master Deferred
  11401. master = jQuery.Deferred(),
  11402. // subordinate callback factory
  11403. updateFunc = function( i ) {
  11404. return function( value ) {
  11405. resolveContexts[ i ] = this;
  11406. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  11407. if ( !( --remaining ) ) {
  11408. master.resolveWith( resolveContexts, resolveValues );
  11409. }
  11410. };
  11411. };
  11412. // Single- and empty arguments are adopted like Promise.resolve
  11413. if ( remaining <= 1 ) {
  11414. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
  11415. !remaining );
  11416. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  11417. if ( master.state() === "pending" ||
  11418. isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  11419. return master.then();
  11420. }
  11421. }
  11422. // Multiple arguments are aggregated like Promise.all array elements
  11423. while ( i-- ) {
  11424. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  11425. }
  11426. return master.promise();
  11427. }
  11428. } );
  11429. // These usually indicate a programmer mistake during development,
  11430. // warn about them ASAP rather than swallowing them by default.
  11431. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  11432. jQuery.Deferred.exceptionHook = function( error, stack ) {
  11433. // Support: IE 8 - 9 only
  11434. // Console exists when dev tools are open, which can happen at any time
  11435. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  11436. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  11437. }
  11438. };
  11439. jQuery.readyException = function( error ) {
  11440. window.setTimeout( function() {
  11441. throw error;
  11442. } );
  11443. };
  11444. // The deferred used on DOM ready
  11445. var readyList = jQuery.Deferred();
  11446. jQuery.fn.ready = function( fn ) {
  11447. readyList
  11448. .then( fn )
  11449. // Wrap jQuery.readyException in a function so that the lookup
  11450. // happens at the time of error handling instead of callback
  11451. // registration.
  11452. .catch( function( error ) {
  11453. jQuery.readyException( error );
  11454. } );
  11455. return this;
  11456. };
  11457. jQuery.extend( {
  11458. // Is the DOM ready to be used? Set to true once it occurs.
  11459. isReady: false,
  11460. // A counter to track how many items to wait for before
  11461. // the ready event fires. See #6781
  11462. readyWait: 1,
  11463. // Handle when the DOM is ready
  11464. ready: function( wait ) {
  11465. // Abort if there are pending holds or we're already ready
  11466. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  11467. return;
  11468. }
  11469. // Remember that the DOM is ready
  11470. jQuery.isReady = true;
  11471. // If a normal DOM Ready event fired, decrement, and wait if need be
  11472. if ( wait !== true && --jQuery.readyWait > 0 ) {
  11473. return;
  11474. }
  11475. // If there are functions bound, to execute
  11476. readyList.resolveWith( document, [ jQuery ] );
  11477. }
  11478. } );
  11479. jQuery.ready.then = readyList.then;
  11480. // The ready event handler and self cleanup method
  11481. function completed() {
  11482. document.removeEventListener( "DOMContentLoaded", completed );
  11483. window.removeEventListener( "load", completed );
  11484. jQuery.ready();
  11485. }
  11486. // Catch cases where $(document).ready() is called
  11487. // after the browser event has already occurred.
  11488. // Support: IE <=9 - 10 only
  11489. // Older IE sometimes signals "interactive" too soon
  11490. if ( document.readyState === "complete" ||
  11491. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  11492. // Handle it asynchronously to allow scripts the opportunity to delay ready
  11493. window.setTimeout( jQuery.ready );
  11494. } else {
  11495. // Use the handy event callback
  11496. document.addEventListener( "DOMContentLoaded", completed );
  11497. // A fallback to window.onload, that will always work
  11498. window.addEventListener( "load", completed );
  11499. }
  11500. // Multifunctional method to get and set values of a collection
  11501. // The value/s can optionally be executed if it's a function
  11502. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  11503. var i = 0,
  11504. len = elems.length,
  11505. bulk = key == null;
  11506. // Sets many values
  11507. if ( toType( key ) === "object" ) {
  11508. chainable = true;
  11509. for ( i in key ) {
  11510. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  11511. }
  11512. // Sets one value
  11513. } else if ( value !== undefined ) {
  11514. chainable = true;
  11515. if ( !isFunction( value ) ) {
  11516. raw = true;
  11517. }
  11518. if ( bulk ) {
  11519. // Bulk operations run against the entire set
  11520. if ( raw ) {
  11521. fn.call( elems, value );
  11522. fn = null;
  11523. // ...except when executing function values
  11524. } else {
  11525. bulk = fn;
  11526. fn = function( elem, key, value ) {
  11527. return bulk.call( jQuery( elem ), value );
  11528. };
  11529. }
  11530. }
  11531. if ( fn ) {
  11532. for ( ; i < len; i++ ) {
  11533. fn(
  11534. elems[ i ], key, raw ?
  11535. value :
  11536. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  11537. );
  11538. }
  11539. }
  11540. }
  11541. if ( chainable ) {
  11542. return elems;
  11543. }
  11544. // Gets
  11545. if ( bulk ) {
  11546. return fn.call( elems );
  11547. }
  11548. return len ? fn( elems[ 0 ], key ) : emptyGet;
  11549. };
  11550. // Matches dashed string for camelizing
  11551. var rmsPrefix = /^-ms-/,
  11552. rdashAlpha = /-([a-z])/g;
  11553. // Used by camelCase as callback to replace()
  11554. function fcamelCase( all, letter ) {
  11555. return letter.toUpperCase();
  11556. }
  11557. // Convert dashed to camelCase; used by the css and data modules
  11558. // Support: IE <=9 - 11, Edge 12 - 15
  11559. // Microsoft forgot to hump their vendor prefix (#9572)
  11560. function camelCase( string ) {
  11561. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  11562. }
  11563. var acceptData = function( owner ) {
  11564. // Accepts only:
  11565. // - Node
  11566. // - Node.ELEMENT_NODE
  11567. // - Node.DOCUMENT_NODE
  11568. // - Object
  11569. // - Any
  11570. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  11571. };
  11572. function Data() {
  11573. this.expando = jQuery.expando + Data.uid++;
  11574. }
  11575. Data.uid = 1;
  11576. Data.prototype = {
  11577. cache: function( owner ) {
  11578. // Check if the owner object already has a cache
  11579. var value = owner[ this.expando ];
  11580. // If not, create one
  11581. if ( !value ) {
  11582. value = {};
  11583. // We can accept data for non-element nodes in modern browsers,
  11584. // but we should not, see #8335.
  11585. // Always return an empty object.
  11586. if ( acceptData( owner ) ) {
  11587. // If it is a node unlikely to be stringify-ed or looped over
  11588. // use plain assignment
  11589. if ( owner.nodeType ) {
  11590. owner[ this.expando ] = value;
  11591. // Otherwise secure it in a non-enumerable property
  11592. // configurable must be true to allow the property to be
  11593. // deleted when data is removed
  11594. } else {
  11595. Object.defineProperty( owner, this.expando, {
  11596. value: value,
  11597. configurable: true
  11598. } );
  11599. }
  11600. }
  11601. }
  11602. return value;
  11603. },
  11604. set: function( owner, data, value ) {
  11605. var prop,
  11606. cache = this.cache( owner );
  11607. // Handle: [ owner, key, value ] args
  11608. // Always use camelCase key (gh-2257)
  11609. if ( typeof data === "string" ) {
  11610. cache[ camelCase( data ) ] = value;
  11611. // Handle: [ owner, { properties } ] args
  11612. } else {
  11613. // Copy the properties one-by-one to the cache object
  11614. for ( prop in data ) {
  11615. cache[ camelCase( prop ) ] = data[ prop ];
  11616. }
  11617. }
  11618. return cache;
  11619. },
  11620. get: function( owner, key ) {
  11621. return key === undefined ?
  11622. this.cache( owner ) :
  11623. // Always use camelCase key (gh-2257)
  11624. owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
  11625. },
  11626. access: function( owner, key, value ) {
  11627. // In cases where either:
  11628. //
  11629. // 1. No key was specified
  11630. // 2. A string key was specified, but no value provided
  11631. //
  11632. // Take the "read" path and allow the get method to determine
  11633. // which value to return, respectively either:
  11634. //
  11635. // 1. The entire cache object
  11636. // 2. The data stored at the key
  11637. //
  11638. if ( key === undefined ||
  11639. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  11640. return this.get( owner, key );
  11641. }
  11642. // When the key is not a string, or both a key and value
  11643. // are specified, set or extend (existing objects) with either:
  11644. //
  11645. // 1. An object of properties
  11646. // 2. A key and value
  11647. //
  11648. this.set( owner, key, value );
  11649. // Since the "set" path can have two possible entry points
  11650. // return the expected data based on which path was taken[*]
  11651. return value !== undefined ? value : key;
  11652. },
  11653. remove: function( owner, key ) {
  11654. var i,
  11655. cache = owner[ this.expando ];
  11656. if ( cache === undefined ) {
  11657. return;
  11658. }
  11659. if ( key !== undefined ) {
  11660. // Support array or space separated string of keys
  11661. if ( Array.isArray( key ) ) {
  11662. // If key is an array of keys...
  11663. // We always set camelCase keys, so remove that.
  11664. key = key.map( camelCase );
  11665. } else {
  11666. key = camelCase( key );
  11667. // If a key with the spaces exists, use it.
  11668. // Otherwise, create an array by matching non-whitespace
  11669. key = key in cache ?
  11670. [ key ] :
  11671. ( key.match( rnothtmlwhite ) || [] );
  11672. }
  11673. i = key.length;
  11674. while ( i-- ) {
  11675. delete cache[ key[ i ] ];
  11676. }
  11677. }
  11678. // Remove the expando if there's no more data
  11679. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  11680. // Support: Chrome <=35 - 45
  11681. // Webkit & Blink performance suffers when deleting properties
  11682. // from DOM nodes, so set to undefined instead
  11683. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  11684. if ( owner.nodeType ) {
  11685. owner[ this.expando ] = undefined;
  11686. } else {
  11687. delete owner[ this.expando ];
  11688. }
  11689. }
  11690. },
  11691. hasData: function( owner ) {
  11692. var cache = owner[ this.expando ];
  11693. return cache !== undefined && !jQuery.isEmptyObject( cache );
  11694. }
  11695. };
  11696. var dataPriv = new Data();
  11697. var dataUser = new Data();
  11698. // Implementation Summary
  11699. //
  11700. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  11701. // 2. Improve the module's maintainability by reducing the storage
  11702. // paths to a single mechanism.
  11703. // 3. Use the same single mechanism to support "private" and "user" data.
  11704. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  11705. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  11706. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  11707. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  11708. rmultiDash = /[A-Z]/g;
  11709. function getData( data ) {
  11710. if ( data === "true" ) {
  11711. return true;
  11712. }
  11713. if ( data === "false" ) {
  11714. return false;
  11715. }
  11716. if ( data === "null" ) {
  11717. return null;
  11718. }
  11719. // Only convert to a number if it doesn't change the string
  11720. if ( data === +data + "" ) {
  11721. return +data;
  11722. }
  11723. if ( rbrace.test( data ) ) {
  11724. return JSON.parse( data );
  11725. }
  11726. return data;
  11727. }
  11728. function dataAttr( elem, key, data ) {
  11729. var name;
  11730. // If nothing was found internally, try to fetch any
  11731. // data from the HTML5 data-* attribute
  11732. if ( data === undefined && elem.nodeType === 1 ) {
  11733. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  11734. data = elem.getAttribute( name );
  11735. if ( typeof data === "string" ) {
  11736. try {
  11737. data = getData( data );
  11738. } catch ( e ) {}
  11739. // Make sure we set the data so it isn't changed later
  11740. dataUser.set( elem, key, data );
  11741. } else {
  11742. data = undefined;
  11743. }
  11744. }
  11745. return data;
  11746. }
  11747. jQuery.extend( {
  11748. hasData: function( elem ) {
  11749. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  11750. },
  11751. data: function( elem, name, data ) {
  11752. return dataUser.access( elem, name, data );
  11753. },
  11754. removeData: function( elem, name ) {
  11755. dataUser.remove( elem, name );
  11756. },
  11757. // TODO: Now that all calls to _data and _removeData have been replaced
  11758. // with direct calls to dataPriv methods, these can be deprecated.
  11759. _data: function( elem, name, data ) {
  11760. return dataPriv.access( elem, name, data );
  11761. },
  11762. _removeData: function( elem, name ) {
  11763. dataPriv.remove( elem, name );
  11764. }
  11765. } );
  11766. jQuery.fn.extend( {
  11767. data: function( key, value ) {
  11768. var i, name, data,
  11769. elem = this[ 0 ],
  11770. attrs = elem && elem.attributes;
  11771. // Gets all values
  11772. if ( key === undefined ) {
  11773. if ( this.length ) {
  11774. data = dataUser.get( elem );
  11775. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  11776. i = attrs.length;
  11777. while ( i-- ) {
  11778. // Support: IE 11 only
  11779. // The attrs elements can be null (#14894)
  11780. if ( attrs[ i ] ) {
  11781. name = attrs[ i ].name;
  11782. if ( name.indexOf( "data-" ) === 0 ) {
  11783. name = camelCase( name.slice( 5 ) );
  11784. dataAttr( elem, name, data[ name ] );
  11785. }
  11786. }
  11787. }
  11788. dataPriv.set( elem, "hasDataAttrs", true );
  11789. }
  11790. }
  11791. return data;
  11792. }
  11793. // Sets multiple values
  11794. if ( typeof key === "object" ) {
  11795. return this.each( function() {
  11796. dataUser.set( this, key );
  11797. } );
  11798. }
  11799. return access( this, function( value ) {
  11800. var data;
  11801. // The calling jQuery object (element matches) is not empty
  11802. // (and therefore has an element appears at this[ 0 ]) and the
  11803. // `value` parameter was not undefined. An empty jQuery object
  11804. // will result in `undefined` for elem = this[ 0 ] which will
  11805. // throw an exception if an attempt to read a data cache is made.
  11806. if ( elem && value === undefined ) {
  11807. // Attempt to get data from the cache
  11808. // The key will always be camelCased in Data
  11809. data = dataUser.get( elem, key );
  11810. if ( data !== undefined ) {
  11811. return data;
  11812. }
  11813. // Attempt to "discover" the data in
  11814. // HTML5 custom data-* attrs
  11815. data = dataAttr( elem, key );
  11816. if ( data !== undefined ) {
  11817. return data;
  11818. }
  11819. // We tried really hard, but the data doesn't exist.
  11820. return;
  11821. }
  11822. // Set the data...
  11823. this.each( function() {
  11824. // We always store the camelCased key
  11825. dataUser.set( this, key, value );
  11826. } );
  11827. }, null, value, arguments.length > 1, null, true );
  11828. },
  11829. removeData: function( key ) {
  11830. return this.each( function() {
  11831. dataUser.remove( this, key );
  11832. } );
  11833. }
  11834. } );
  11835. jQuery.extend( {
  11836. queue: function( elem, type, data ) {
  11837. var queue;
  11838. if ( elem ) {
  11839. type = ( type || "fx" ) + "queue";
  11840. queue = dataPriv.get( elem, type );
  11841. // Speed up dequeue by getting out quickly if this is just a lookup
  11842. if ( data ) {
  11843. if ( !queue || Array.isArray( data ) ) {
  11844. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  11845. } else {
  11846. queue.push( data );
  11847. }
  11848. }
  11849. return queue || [];
  11850. }
  11851. },
  11852. dequeue: function( elem, type ) {
  11853. type = type || "fx";
  11854. var queue = jQuery.queue( elem, type ),
  11855. startLength = queue.length,
  11856. fn = queue.shift(),
  11857. hooks = jQuery._queueHooks( elem, type ),
  11858. next = function() {
  11859. jQuery.dequeue( elem, type );
  11860. };
  11861. // If the fx queue is dequeued, always remove the progress sentinel
  11862. if ( fn === "inprogress" ) {
  11863. fn = queue.shift();
  11864. startLength--;
  11865. }
  11866. if ( fn ) {
  11867. // Add a progress sentinel to prevent the fx queue from being
  11868. // automatically dequeued
  11869. if ( type === "fx" ) {
  11870. queue.unshift( "inprogress" );
  11871. }
  11872. // Clear up the last queue stop function
  11873. delete hooks.stop;
  11874. fn.call( elem, next, hooks );
  11875. }
  11876. if ( !startLength && hooks ) {
  11877. hooks.empty.fire();
  11878. }
  11879. },
  11880. // Not public - generate a queueHooks object, or return the current one
  11881. _queueHooks: function( elem, type ) {
  11882. var key = type + "queueHooks";
  11883. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  11884. empty: jQuery.Callbacks( "once memory" ).add( function() {
  11885. dataPriv.remove( elem, [ type + "queue", key ] );
  11886. } )
  11887. } );
  11888. }
  11889. } );
  11890. jQuery.fn.extend( {
  11891. queue: function( type, data ) {
  11892. var setter = 2;
  11893. if ( typeof type !== "string" ) {
  11894. data = type;
  11895. type = "fx";
  11896. setter--;
  11897. }
  11898. if ( arguments.length < setter ) {
  11899. return jQuery.queue( this[ 0 ], type );
  11900. }
  11901. return data === undefined ?
  11902. this :
  11903. this.each( function() {
  11904. var queue = jQuery.queue( this, type, data );
  11905. // Ensure a hooks for this queue
  11906. jQuery._queueHooks( this, type );
  11907. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  11908. jQuery.dequeue( this, type );
  11909. }
  11910. } );
  11911. },
  11912. dequeue: function( type ) {
  11913. return this.each( function() {
  11914. jQuery.dequeue( this, type );
  11915. } );
  11916. },
  11917. clearQueue: function( type ) {
  11918. return this.queue( type || "fx", [] );
  11919. },
  11920. // Get a promise resolved when queues of a certain type
  11921. // are emptied (fx is the type by default)
  11922. promise: function( type, obj ) {
  11923. var tmp,
  11924. count = 1,
  11925. defer = jQuery.Deferred(),
  11926. elements = this,
  11927. i = this.length,
  11928. resolve = function() {
  11929. if ( !( --count ) ) {
  11930. defer.resolveWith( elements, [ elements ] );
  11931. }
  11932. };
  11933. if ( typeof type !== "string" ) {
  11934. obj = type;
  11935. type = undefined;
  11936. }
  11937. type = type || "fx";
  11938. while ( i-- ) {
  11939. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  11940. if ( tmp && tmp.empty ) {
  11941. count++;
  11942. tmp.empty.add( resolve );
  11943. }
  11944. }
  11945. resolve();
  11946. return defer.promise( obj );
  11947. }
  11948. } );
  11949. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  11950. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  11951. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  11952. var documentElement = document.documentElement;
  11953. var isAttached = function( elem ) {
  11954. return jQuery.contains( elem.ownerDocument, elem );
  11955. },
  11956. composed = { composed: true };
  11957. // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
  11958. // Check attachment across shadow DOM boundaries when possible (gh-3504)
  11959. // Support: iOS 10.0-10.2 only
  11960. // Early iOS 10 versions support `attachShadow` but not `getRootNode`,
  11961. // leading to errors. We need to check for `getRootNode`.
  11962. if ( documentElement.getRootNode ) {
  11963. isAttached = function( elem ) {
  11964. return jQuery.contains( elem.ownerDocument, elem ) ||
  11965. elem.getRootNode( composed ) === elem.ownerDocument;
  11966. };
  11967. }
  11968. var isHiddenWithinTree = function( elem, el ) {
  11969. // isHiddenWithinTree might be called from jQuery#filter function;
  11970. // in that case, element will be second argument
  11971. elem = el || elem;
  11972. // Inline style trumps all
  11973. return elem.style.display === "none" ||
  11974. elem.style.display === "" &&
  11975. // Otherwise, check computed style
  11976. // Support: Firefox <=43 - 45
  11977. // Disconnected elements can have computed display: none, so first confirm that elem is
  11978. // in the document.
  11979. isAttached( elem ) &&
  11980. jQuery.css( elem, "display" ) === "none";
  11981. };
  11982. var swap = function( elem, options, callback, args ) {
  11983. var ret, name,
  11984. old = {};
  11985. // Remember the old values, and insert the new ones
  11986. for ( name in options ) {
  11987. old[ name ] = elem.style[ name ];
  11988. elem.style[ name ] = options[ name ];
  11989. }
  11990. ret = callback.apply( elem, args || [] );
  11991. // Revert the old values
  11992. for ( name in options ) {
  11993. elem.style[ name ] = old[ name ];
  11994. }
  11995. return ret;
  11996. };
  11997. function adjustCSS( elem, prop, valueParts, tween ) {
  11998. var adjusted, scale,
  11999. maxIterations = 20,
  12000. currentValue = tween ?
  12001. function() {
  12002. return tween.cur();
  12003. } :
  12004. function() {
  12005. return jQuery.css( elem, prop, "" );
  12006. },
  12007. initial = currentValue(),
  12008. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  12009. // Starting value computation is required for potential unit mismatches
  12010. initialInUnit = elem.nodeType &&
  12011. ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  12012. rcssNum.exec( jQuery.css( elem, prop ) );
  12013. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  12014. // Support: Firefox <=54
  12015. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  12016. initial = initial / 2;
  12017. // Trust units reported by jQuery.css
  12018. unit = unit || initialInUnit[ 3 ];
  12019. // Iteratively approximate from a nonzero starting point
  12020. initialInUnit = +initial || 1;
  12021. while ( maxIterations-- ) {
  12022. // Evaluate and update our best guess (doubling guesses that zero out).
  12023. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  12024. jQuery.style( elem, prop, initialInUnit + unit );
  12025. if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
  12026. maxIterations = 0;
  12027. }
  12028. initialInUnit = initialInUnit / scale;
  12029. }
  12030. initialInUnit = initialInUnit * 2;
  12031. jQuery.style( elem, prop, initialInUnit + unit );
  12032. // Make sure we update the tween properties later on
  12033. valueParts = valueParts || [];
  12034. }
  12035. if ( valueParts ) {
  12036. initialInUnit = +initialInUnit || +initial || 0;
  12037. // Apply relative offset (+=/-=) if specified
  12038. adjusted = valueParts[ 1 ] ?
  12039. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  12040. +valueParts[ 2 ];
  12041. if ( tween ) {
  12042. tween.unit = unit;
  12043. tween.start = initialInUnit;
  12044. tween.end = adjusted;
  12045. }
  12046. }
  12047. return adjusted;
  12048. }
  12049. var defaultDisplayMap = {};
  12050. function getDefaultDisplay( elem ) {
  12051. var temp,
  12052. doc = elem.ownerDocument,
  12053. nodeName = elem.nodeName,
  12054. display = defaultDisplayMap[ nodeName ];
  12055. if ( display ) {
  12056. return display;
  12057. }
  12058. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  12059. display = jQuery.css( temp, "display" );
  12060. temp.parentNode.removeChild( temp );
  12061. if ( display === "none" ) {
  12062. display = "block";
  12063. }
  12064. defaultDisplayMap[ nodeName ] = display;
  12065. return display;
  12066. }
  12067. function showHide( elements, show ) {
  12068. var display, elem,
  12069. values = [],
  12070. index = 0,
  12071. length = elements.length;
  12072. // Determine new display value for elements that need to change
  12073. for ( ; index < length; index++ ) {
  12074. elem = elements[ index ];
  12075. if ( !elem.style ) {
  12076. continue;
  12077. }
  12078. display = elem.style.display;
  12079. if ( show ) {
  12080. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  12081. // check is required in this first loop unless we have a nonempty display value (either
  12082. // inline or about-to-be-restored)
  12083. if ( display === "none" ) {
  12084. values[ index ] = dataPriv.get( elem, "display" ) || null;
  12085. if ( !values[ index ] ) {
  12086. elem.style.display = "";
  12087. }
  12088. }
  12089. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  12090. values[ index ] = getDefaultDisplay( elem );
  12091. }
  12092. } else {
  12093. if ( display !== "none" ) {
  12094. values[ index ] = "none";
  12095. // Remember what we're overwriting
  12096. dataPriv.set( elem, "display", display );
  12097. }
  12098. }
  12099. }
  12100. // Set the display of the elements in a second loop to avoid constant reflow
  12101. for ( index = 0; index < length; index++ ) {
  12102. if ( values[ index ] != null ) {
  12103. elements[ index ].style.display = values[ index ];
  12104. }
  12105. }
  12106. return elements;
  12107. }
  12108. jQuery.fn.extend( {
  12109. show: function() {
  12110. return showHide( this, true );
  12111. },
  12112. hide: function() {
  12113. return showHide( this );
  12114. },
  12115. toggle: function( state ) {
  12116. if ( typeof state === "boolean" ) {
  12117. return state ? this.show() : this.hide();
  12118. }
  12119. return this.each( function() {
  12120. if ( isHiddenWithinTree( this ) ) {
  12121. jQuery( this ).show();
  12122. } else {
  12123. jQuery( this ).hide();
  12124. }
  12125. } );
  12126. }
  12127. } );
  12128. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  12129. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );
  12130. var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
  12131. // We have to close these tags to support XHTML (#13200)
  12132. var wrapMap = {
  12133. // Support: IE <=9 only
  12134. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  12135. // XHTML parsers do not magically insert elements in the
  12136. // same way that tag soup parsers do. So we cannot shorten
  12137. // this by omitting <tbody> or other required elements.
  12138. thead: [ 1, "<table>", "</table>" ],
  12139. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  12140. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  12141. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  12142. _default: [ 0, "", "" ]
  12143. };
  12144. // Support: IE <=9 only
  12145. wrapMap.optgroup = wrapMap.option;
  12146. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  12147. wrapMap.th = wrapMap.td;
  12148. function getAll( context, tag ) {
  12149. // Support: IE <=9 - 11 only
  12150. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  12151. var ret;
  12152. if ( typeof context.getElementsByTagName !== "undefined" ) {
  12153. ret = context.getElementsByTagName( tag || "*" );
  12154. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  12155. ret = context.querySelectorAll( tag || "*" );
  12156. } else {
  12157. ret = [];
  12158. }
  12159. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  12160. return jQuery.merge( [ context ], ret );
  12161. }
  12162. return ret;
  12163. }
  12164. // Mark scripts as having already been evaluated
  12165. function setGlobalEval( elems, refElements ) {
  12166. var i = 0,
  12167. l = elems.length;
  12168. for ( ; i < l; i++ ) {
  12169. dataPriv.set(
  12170. elems[ i ],
  12171. "globalEval",
  12172. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  12173. );
  12174. }
  12175. }
  12176. var rhtml = /<|&#?\w+;/;
  12177. function buildFragment( elems, context, scripts, selection, ignored ) {
  12178. var elem, tmp, tag, wrap, attached, j,
  12179. fragment = context.createDocumentFragment(),
  12180. nodes = [],
  12181. i = 0,
  12182. l = elems.length;
  12183. for ( ; i < l; i++ ) {
  12184. elem = elems[ i ];
  12185. if ( elem || elem === 0 ) {
  12186. // Add nodes directly
  12187. if ( toType( elem ) === "object" ) {
  12188. // Support: Android <=4.0 only, PhantomJS 1 only
  12189. // push.apply(_, arraylike) throws on ancient WebKit
  12190. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  12191. // Convert non-html into a text node
  12192. } else if ( !rhtml.test( elem ) ) {
  12193. nodes.push( context.createTextNode( elem ) );
  12194. // Convert html into DOM nodes
  12195. } else {
  12196. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  12197. // Deserialize a standard representation
  12198. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  12199. wrap = wrapMap[ tag ] || wrapMap._default;
  12200. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  12201. // Descend through wrappers to the right content
  12202. j = wrap[ 0 ];
  12203. while ( j-- ) {
  12204. tmp = tmp.lastChild;
  12205. }
  12206. // Support: Android <=4.0 only, PhantomJS 1 only
  12207. // push.apply(_, arraylike) throws on ancient WebKit
  12208. jQuery.merge( nodes, tmp.childNodes );
  12209. // Remember the top-level container
  12210. tmp = fragment.firstChild;
  12211. // Ensure the created nodes are orphaned (#12392)
  12212. tmp.textContent = "";
  12213. }
  12214. }
  12215. }
  12216. // Remove wrapper from fragment
  12217. fragment.textContent = "";
  12218. i = 0;
  12219. while ( ( elem = nodes[ i++ ] ) ) {
  12220. // Skip elements already in the context collection (trac-4087)
  12221. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  12222. if ( ignored ) {
  12223. ignored.push( elem );
  12224. }
  12225. continue;
  12226. }
  12227. attached = isAttached( elem );
  12228. // Append to fragment
  12229. tmp = getAll( fragment.appendChild( elem ), "script" );
  12230. // Preserve script evaluation history
  12231. if ( attached ) {
  12232. setGlobalEval( tmp );
  12233. }
  12234. // Capture executables
  12235. if ( scripts ) {
  12236. j = 0;
  12237. while ( ( elem = tmp[ j++ ] ) ) {
  12238. if ( rscriptType.test( elem.type || "" ) ) {
  12239. scripts.push( elem );
  12240. }
  12241. }
  12242. }
  12243. }
  12244. return fragment;
  12245. }
  12246. ( function() {
  12247. var fragment = document.createDocumentFragment(),
  12248. div = fragment.appendChild( document.createElement( "div" ) ),
  12249. input = document.createElement( "input" );
  12250. // Support: Android 4.0 - 4.3 only
  12251. // Check state lost if the name is set (#11217)
  12252. // Support: Windows Web Apps (WWA)
  12253. // `name` and `type` must use .setAttribute for WWA (#14901)
  12254. input.setAttribute( "type", "radio" );
  12255. input.setAttribute( "checked", "checked" );
  12256. input.setAttribute( "name", "t" );
  12257. div.appendChild( input );
  12258. // Support: Android <=4.1 only
  12259. // Older WebKit doesn't clone checked state correctly in fragments
  12260. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  12261. // Support: IE <=11 only
  12262. // Make sure textarea (and checkbox) defaultValue is properly cloned
  12263. div.innerHTML = "<textarea>x</textarea>";
  12264. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  12265. } )();
  12266. var
  12267. rkeyEvent = /^key/,
  12268. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  12269. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  12270. function returnTrue() {
  12271. return true;
  12272. }
  12273. function returnFalse() {
  12274. return false;
  12275. }
  12276. // Support: IE <=9 - 11+
  12277. // focus() and blur() are asynchronous, except when they are no-op.
  12278. // So expect focus to be synchronous when the element is already active,
  12279. // and blur to be synchronous when the element is not already active.
  12280. // (focus and blur are always synchronous in other supported browsers,
  12281. // this just defines when we can count on it).
  12282. function expectSync( elem, type ) {
  12283. return ( elem === safeActiveElement() ) === ( type === "focus" );
  12284. }
  12285. // Support: IE <=9 only
  12286. // Accessing document.activeElement can throw unexpectedly
  12287. // https://bugs.jquery.com/ticket/13393
  12288. function safeActiveElement() {
  12289. try {
  12290. return document.activeElement;
  12291. } catch ( err ) { }
  12292. }
  12293. function on( elem, types, selector, data, fn, one ) {
  12294. var origFn, type;
  12295. // Types can be a map of types/handlers
  12296. if ( typeof types === "object" ) {
  12297. // ( types-Object, selector, data )
  12298. if ( typeof selector !== "string" ) {
  12299. // ( types-Object, data )
  12300. data = data || selector;
  12301. selector = undefined;
  12302. }
  12303. for ( type in types ) {
  12304. on( elem, type, selector, data, types[ type ], one );
  12305. }
  12306. return elem;
  12307. }
  12308. if ( data == null && fn == null ) {
  12309. // ( types, fn )
  12310. fn = selector;
  12311. data = selector = undefined;
  12312. } else if ( fn == null ) {
  12313. if ( typeof selector === "string" ) {
  12314. // ( types, selector, fn )
  12315. fn = data;
  12316. data = undefined;
  12317. } else {
  12318. // ( types, data, fn )
  12319. fn = data;
  12320. data = selector;
  12321. selector = undefined;
  12322. }
  12323. }
  12324. if ( fn === false ) {
  12325. fn = returnFalse;
  12326. } else if ( !fn ) {
  12327. return elem;
  12328. }
  12329. if ( one === 1 ) {
  12330. origFn = fn;
  12331. fn = function( event ) {
  12332. // Can use an empty set, since event contains the info
  12333. jQuery().off( event );
  12334. return origFn.apply( this, arguments );
  12335. };
  12336. // Use same guid so caller can remove using origFn
  12337. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  12338. }
  12339. return elem.each( function() {
  12340. jQuery.event.add( this, types, fn, data, selector );
  12341. } );
  12342. }
  12343. /*
  12344. * Helper functions for managing events -- not part of the public interface.
  12345. * Props to Dean Edwards' addEvent library for many of the ideas.
  12346. */
  12347. jQuery.event = {
  12348. global: {},
  12349. add: function( elem, types, handler, data, selector ) {
  12350. var handleObjIn, eventHandle, tmp,
  12351. events, t, handleObj,
  12352. special, handlers, type, namespaces, origType,
  12353. elemData = dataPriv.get( elem );
  12354. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  12355. if ( !elemData ) {
  12356. return;
  12357. }
  12358. // Caller can pass in an object of custom data in lieu of the handler
  12359. if ( handler.handler ) {
  12360. handleObjIn = handler;
  12361. handler = handleObjIn.handler;
  12362. selector = handleObjIn.selector;
  12363. }
  12364. // Ensure that invalid selectors throw exceptions at attach time
  12365. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  12366. if ( selector ) {
  12367. jQuery.find.matchesSelector( documentElement, selector );
  12368. }
  12369. // Make sure that the handler has a unique ID, used to find/remove it later
  12370. if ( !handler.guid ) {
  12371. handler.guid = jQuery.guid++;
  12372. }
  12373. // Init the element's event structure and main handler, if this is the first
  12374. if ( !( events = elemData.events ) ) {
  12375. events = elemData.events = {};
  12376. }
  12377. if ( !( eventHandle = elemData.handle ) ) {
  12378. eventHandle = elemData.handle = function( e ) {
  12379. // Discard the second event of a jQuery.event.trigger() and
  12380. // when an event is called after a page has unloaded
  12381. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  12382. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  12383. };
  12384. }
  12385. // Handle multiple events separated by a space
  12386. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  12387. t = types.length;
  12388. while ( t-- ) {
  12389. tmp = rtypenamespace.exec( types[ t ] ) || [];
  12390. type = origType = tmp[ 1 ];
  12391. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  12392. // There *must* be a type, no attaching namespace-only handlers
  12393. if ( !type ) {
  12394. continue;
  12395. }
  12396. // If event changes its type, use the special event handlers for the changed type
  12397. special = jQuery.event.special[ type ] || {};
  12398. // If selector defined, determine special event api type, otherwise given type
  12399. type = ( selector ? special.delegateType : special.bindType ) || type;
  12400. // Update special based on newly reset type
  12401. special = jQuery.event.special[ type ] || {};
  12402. // handleObj is passed to all event handlers
  12403. handleObj = jQuery.extend( {
  12404. type: type,
  12405. origType: origType,
  12406. data: data,
  12407. handler: handler,
  12408. guid: handler.guid,
  12409. selector: selector,
  12410. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  12411. namespace: namespaces.join( "." )
  12412. }, handleObjIn );
  12413. // Init the event handler queue if we're the first
  12414. if ( !( handlers = events[ type ] ) ) {
  12415. handlers = events[ type ] = [];
  12416. handlers.delegateCount = 0;
  12417. // Only use addEventListener if the special events handler returns false
  12418. if ( !special.setup ||
  12419. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  12420. if ( elem.addEventListener ) {
  12421. elem.addEventListener( type, eventHandle );
  12422. }
  12423. }
  12424. }
  12425. if ( special.add ) {
  12426. special.add.call( elem, handleObj );
  12427. if ( !handleObj.handler.guid ) {
  12428. handleObj.handler.guid = handler.guid;
  12429. }
  12430. }
  12431. // Add to the element's handler list, delegates in front
  12432. if ( selector ) {
  12433. handlers.splice( handlers.delegateCount++, 0, handleObj );
  12434. } else {
  12435. handlers.push( handleObj );
  12436. }
  12437. // Keep track of which events have ever been used, for event optimization
  12438. jQuery.event.global[ type ] = true;
  12439. }
  12440. },
  12441. // Detach an event or set of events from an element
  12442. remove: function( elem, types, handler, selector, mappedTypes ) {
  12443. var j, origCount, tmp,
  12444. events, t, handleObj,
  12445. special, handlers, type, namespaces, origType,
  12446. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  12447. if ( !elemData || !( events = elemData.events ) ) {
  12448. return;
  12449. }
  12450. // Once for each type.namespace in types; type may be omitted
  12451. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  12452. t = types.length;
  12453. while ( t-- ) {
  12454. tmp = rtypenamespace.exec( types[ t ] ) || [];
  12455. type = origType = tmp[ 1 ];
  12456. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  12457. // Unbind all events (on this namespace, if provided) for the element
  12458. if ( !type ) {
  12459. for ( type in events ) {
  12460. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  12461. }
  12462. continue;
  12463. }
  12464. special = jQuery.event.special[ type ] || {};
  12465. type = ( selector ? special.delegateType : special.bindType ) || type;
  12466. handlers = events[ type ] || [];
  12467. tmp = tmp[ 2 ] &&
  12468. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  12469. // Remove matching events
  12470. origCount = j = handlers.length;
  12471. while ( j-- ) {
  12472. handleObj = handlers[ j ];
  12473. if ( ( mappedTypes || origType === handleObj.origType ) &&
  12474. ( !handler || handler.guid === handleObj.guid ) &&
  12475. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  12476. ( !selector || selector === handleObj.selector ||
  12477. selector === "**" && handleObj.selector ) ) {
  12478. handlers.splice( j, 1 );
  12479. if ( handleObj.selector ) {
  12480. handlers.delegateCount--;
  12481. }
  12482. if ( special.remove ) {
  12483. special.remove.call( elem, handleObj );
  12484. }
  12485. }
  12486. }
  12487. // Remove generic event handler if we removed something and no more handlers exist
  12488. // (avoids potential for endless recursion during removal of special event handlers)
  12489. if ( origCount && !handlers.length ) {
  12490. if ( !special.teardown ||
  12491. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  12492. jQuery.removeEvent( elem, type, elemData.handle );
  12493. }
  12494. delete events[ type ];
  12495. }
  12496. }
  12497. // Remove data and the expando if it's no longer used
  12498. if ( jQuery.isEmptyObject( events ) ) {
  12499. dataPriv.remove( elem, "handle events" );
  12500. }
  12501. },
  12502. dispatch: function( nativeEvent ) {
  12503. // Make a writable jQuery.Event from the native event object
  12504. var event = jQuery.event.fix( nativeEvent );
  12505. var i, j, ret, matched, handleObj, handlerQueue,
  12506. args = new Array( arguments.length ),
  12507. handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
  12508. special = jQuery.event.special[ event.type ] || {};
  12509. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  12510. args[ 0 ] = event;
  12511. for ( i = 1; i < arguments.length; i++ ) {
  12512. args[ i ] = arguments[ i ];
  12513. }
  12514. event.delegateTarget = this;
  12515. // Call the preDispatch hook for the mapped type, and let it bail if desired
  12516. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  12517. return;
  12518. }
  12519. // Determine handlers
  12520. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  12521. // Run delegates first; they may want to stop propagation beneath us
  12522. i = 0;
  12523. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  12524. event.currentTarget = matched.elem;
  12525. j = 0;
  12526. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  12527. !event.isImmediatePropagationStopped() ) {
  12528. // If the event is namespaced, then each handler is only invoked if it is
  12529. // specially universal or its namespaces are a superset of the event's.
  12530. if ( !event.rnamespace || handleObj.namespace === false ||
  12531. event.rnamespace.test( handleObj.namespace ) ) {
  12532. event.handleObj = handleObj;
  12533. event.data = handleObj.data;
  12534. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  12535. handleObj.handler ).apply( matched.elem, args );
  12536. if ( ret !== undefined ) {
  12537. if ( ( event.result = ret ) === false ) {
  12538. event.preventDefault();
  12539. event.stopPropagation();
  12540. }
  12541. }
  12542. }
  12543. }
  12544. }
  12545. // Call the postDispatch hook for the mapped type
  12546. if ( special.postDispatch ) {
  12547. special.postDispatch.call( this, event );
  12548. }
  12549. return event.result;
  12550. },
  12551. handlers: function( event, handlers ) {
  12552. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  12553. handlerQueue = [],
  12554. delegateCount = handlers.delegateCount,
  12555. cur = event.target;
  12556. // Find delegate handlers
  12557. if ( delegateCount &&
  12558. // Support: IE <=9
  12559. // Black-hole SVG <use> instance trees (trac-13180)
  12560. cur.nodeType &&
  12561. // Support: Firefox <=42
  12562. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  12563. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  12564. // Support: IE 11 only
  12565. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  12566. !( event.type === "click" && event.button >= 1 ) ) {
  12567. for ( ; cur !== this; cur = cur.parentNode || this ) {
  12568. // Don't check non-elements (#13208)
  12569. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  12570. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  12571. matchedHandlers = [];
  12572. matchedSelectors = {};
  12573. for ( i = 0; i < delegateCount; i++ ) {
  12574. handleObj = handlers[ i ];
  12575. // Don't conflict with Object.prototype properties (#13203)
  12576. sel = handleObj.selector + " ";
  12577. if ( matchedSelectors[ sel ] === undefined ) {
  12578. matchedSelectors[ sel ] = handleObj.needsContext ?
  12579. jQuery( sel, this ).index( cur ) > -1 :
  12580. jQuery.find( sel, this, null, [ cur ] ).length;
  12581. }
  12582. if ( matchedSelectors[ sel ] ) {
  12583. matchedHandlers.push( handleObj );
  12584. }
  12585. }
  12586. if ( matchedHandlers.length ) {
  12587. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  12588. }
  12589. }
  12590. }
  12591. }
  12592. // Add the remaining (directly-bound) handlers
  12593. cur = this;
  12594. if ( delegateCount < handlers.length ) {
  12595. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  12596. }
  12597. return handlerQueue;
  12598. },
  12599. addProp: function( name, hook ) {
  12600. Object.defineProperty( jQuery.Event.prototype, name, {
  12601. enumerable: true,
  12602. configurable: true,
  12603. get: isFunction( hook ) ?
  12604. function() {
  12605. if ( this.originalEvent ) {
  12606. return hook( this.originalEvent );
  12607. }
  12608. } :
  12609. function() {
  12610. if ( this.originalEvent ) {
  12611. return this.originalEvent[ name ];
  12612. }
  12613. },
  12614. set: function( value ) {
  12615. Object.defineProperty( this, name, {
  12616. enumerable: true,
  12617. configurable: true,
  12618. writable: true,
  12619. value: value
  12620. } );
  12621. }
  12622. } );
  12623. },
  12624. fix: function( originalEvent ) {
  12625. return originalEvent[ jQuery.expando ] ?
  12626. originalEvent :
  12627. new jQuery.Event( originalEvent );
  12628. },
  12629. special: {
  12630. load: {
  12631. // Prevent triggered image.load events from bubbling to window.load
  12632. noBubble: true
  12633. },
  12634. click: {
  12635. // Utilize native event to ensure correct state for checkable inputs
  12636. setup: function( data ) {
  12637. // For mutual compressibility with _default, replace `this` access with a local var.
  12638. // `|| data` is dead code meant only to preserve the variable through minification.
  12639. var el = this || data;
  12640. // Claim the first handler
  12641. if ( rcheckableType.test( el.type ) &&
  12642. el.click && nodeName( el, "input" ) ) {
  12643. // dataPriv.set( el, "click", ... )
  12644. leverageNative( el, "click", returnTrue );
  12645. }
  12646. // Return false to allow normal processing in the caller
  12647. return false;
  12648. },
  12649. trigger: function( data ) {
  12650. // For mutual compressibility with _default, replace `this` access with a local var.
  12651. // `|| data` is dead code meant only to preserve the variable through minification.
  12652. var el = this || data;
  12653. // Force setup before triggering a click
  12654. if ( rcheckableType.test( el.type ) &&
  12655. el.click && nodeName( el, "input" ) ) {
  12656. leverageNative( el, "click" );
  12657. }
  12658. // Return non-false to allow normal event-path propagation
  12659. return true;
  12660. },
  12661. // For cross-browser consistency, suppress native .click() on links
  12662. // Also prevent it if we're currently inside a leveraged native-event stack
  12663. _default: function( event ) {
  12664. var target = event.target;
  12665. return rcheckableType.test( target.type ) &&
  12666. target.click && nodeName( target, "input" ) &&
  12667. dataPriv.get( target, "click" ) ||
  12668. nodeName( target, "a" );
  12669. }
  12670. },
  12671. beforeunload: {
  12672. postDispatch: function( event ) {
  12673. // Support: Firefox 20+
  12674. // Firefox doesn't alert if the returnValue field is not set.
  12675. if ( event.result !== undefined && event.originalEvent ) {
  12676. event.originalEvent.returnValue = event.result;
  12677. }
  12678. }
  12679. }
  12680. }
  12681. };
  12682. // Ensure the presence of an event listener that handles manually-triggered
  12683. // synthetic events by interrupting progress until reinvoked in response to
  12684. // *native* events that it fires directly, ensuring that state changes have
  12685. // already occurred before other listeners are invoked.
  12686. function leverageNative( el, type, expectSync ) {
  12687. // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
  12688. if ( !expectSync ) {
  12689. if ( dataPriv.get( el, type ) === undefined ) {
  12690. jQuery.event.add( el, type, returnTrue );
  12691. }
  12692. return;
  12693. }
  12694. // Register the controller as a special universal handler for all event namespaces
  12695. dataPriv.set( el, type, false );
  12696. jQuery.event.add( el, type, {
  12697. namespace: false,
  12698. handler: function( event ) {
  12699. var notAsync, result,
  12700. saved = dataPriv.get( this, type );
  12701. if ( ( event.isTrigger & 1 ) && this[ type ] ) {
  12702. // Interrupt processing of the outer synthetic .trigger()ed event
  12703. // Saved data should be false in such cases, but might be a leftover capture object
  12704. // from an async native handler (gh-4350)
  12705. if ( !saved.length ) {
  12706. // Store arguments for use when handling the inner native event
  12707. // There will always be at least one argument (an event object), so this array
  12708. // will not be confused with a leftover capture object.
  12709. saved = slice.call( arguments );
  12710. dataPriv.set( this, type, saved );
  12711. // Trigger the native event and capture its result
  12712. // Support: IE <=9 - 11+
  12713. // focus() and blur() are asynchronous
  12714. notAsync = expectSync( this, type );
  12715. this[ type ]();
  12716. result = dataPriv.get( this, type );
  12717. if ( saved !== result || notAsync ) {
  12718. dataPriv.set( this, type, false );
  12719. } else {
  12720. result = {};
  12721. }
  12722. if ( saved !== result ) {
  12723. // Cancel the outer synthetic event
  12724. event.stopImmediatePropagation();
  12725. event.preventDefault();
  12726. return result.value;
  12727. }
  12728. // If this is an inner synthetic event for an event with a bubbling surrogate
  12729. // (focus or blur), assume that the surrogate already propagated from triggering the
  12730. // native event and prevent that from happening again here.
  12731. // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
  12732. // bubbling surrogate propagates *after* the non-bubbling base), but that seems
  12733. // less bad than duplication.
  12734. } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) {
  12735. event.stopPropagation();
  12736. }
  12737. // If this is a native event triggered above, everything is now in order
  12738. // Fire an inner synthetic event with the original arguments
  12739. } else if ( saved.length ) {
  12740. // ...and capture the result
  12741. dataPriv.set( this, type, {
  12742. value: jQuery.event.trigger(
  12743. // Support: IE <=9 - 11+
  12744. // Extend with the prototype to reset the above stopImmediatePropagation()
  12745. jQuery.extend( saved[ 0 ], jQuery.Event.prototype ),
  12746. saved.slice( 1 ),
  12747. this
  12748. )
  12749. } );
  12750. // Abort handling of the native event
  12751. event.stopImmediatePropagation();
  12752. }
  12753. }
  12754. } );
  12755. }
  12756. jQuery.removeEvent = function( elem, type, handle ) {
  12757. // This "if" is needed for plain objects
  12758. if ( elem.removeEventListener ) {
  12759. elem.removeEventListener( type, handle );
  12760. }
  12761. };
  12762. jQuery.Event = function( src, props ) {
  12763. // Allow instantiation without the 'new' keyword
  12764. if ( !( this instanceof jQuery.Event ) ) {
  12765. return new jQuery.Event( src, props );
  12766. }
  12767. // Event object
  12768. if ( src && src.type ) {
  12769. this.originalEvent = src;
  12770. this.type = src.type;
  12771. // Events bubbling up the document may have been marked as prevented
  12772. // by a handler lower down the tree; reflect the correct value.
  12773. this.isDefaultPrevented = src.defaultPrevented ||
  12774. src.defaultPrevented === undefined &&
  12775. // Support: Android <=2.3 only
  12776. src.returnValue === false ?
  12777. returnTrue :
  12778. returnFalse;
  12779. // Create target properties
  12780. // Support: Safari <=6 - 7 only
  12781. // Target should not be a text node (#504, #13143)
  12782. this.target = ( src.target && src.target.nodeType === 3 ) ?
  12783. src.target.parentNode :
  12784. src.target;
  12785. this.currentTarget = src.currentTarget;
  12786. this.relatedTarget = src.relatedTarget;
  12787. // Event type
  12788. } else {
  12789. this.type = src;
  12790. }
  12791. // Put explicitly provided properties onto the event object
  12792. if ( props ) {
  12793. jQuery.extend( this, props );
  12794. }
  12795. // Create a timestamp if incoming event doesn't have one
  12796. this.timeStamp = src && src.timeStamp || Date.now();
  12797. // Mark it as fixed
  12798. this[ jQuery.expando ] = true;
  12799. };
  12800. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  12801. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  12802. jQuery.Event.prototype = {
  12803. constructor: jQuery.Event,
  12804. isDefaultPrevented: returnFalse,
  12805. isPropagationStopped: returnFalse,
  12806. isImmediatePropagationStopped: returnFalse,
  12807. isSimulated: false,
  12808. preventDefault: function() {
  12809. var e = this.originalEvent;
  12810. this.isDefaultPrevented = returnTrue;
  12811. if ( e && !this.isSimulated ) {
  12812. e.preventDefault();
  12813. }
  12814. },
  12815. stopPropagation: function() {
  12816. var e = this.originalEvent;
  12817. this.isPropagationStopped = returnTrue;
  12818. if ( e && !this.isSimulated ) {
  12819. e.stopPropagation();
  12820. }
  12821. },
  12822. stopImmediatePropagation: function() {
  12823. var e = this.originalEvent;
  12824. this.isImmediatePropagationStopped = returnTrue;
  12825. if ( e && !this.isSimulated ) {
  12826. e.stopImmediatePropagation();
  12827. }
  12828. this.stopPropagation();
  12829. }
  12830. };
  12831. // Includes all common event props including KeyEvent and MouseEvent specific props
  12832. jQuery.each( {
  12833. altKey: true,
  12834. bubbles: true,
  12835. cancelable: true,
  12836. changedTouches: true,
  12837. ctrlKey: true,
  12838. detail: true,
  12839. eventPhase: true,
  12840. metaKey: true,
  12841. pageX: true,
  12842. pageY: true,
  12843. shiftKey: true,
  12844. view: true,
  12845. "char": true,
  12846. code: true,
  12847. charCode: true,
  12848. key: true,
  12849. keyCode: true,
  12850. button: true,
  12851. buttons: true,
  12852. clientX: true,
  12853. clientY: true,
  12854. offsetX: true,
  12855. offsetY: true,
  12856. pointerId: true,
  12857. pointerType: true,
  12858. screenX: true,
  12859. screenY: true,
  12860. targetTouches: true,
  12861. toElement: true,
  12862. touches: true,
  12863. which: function( event ) {
  12864. var button = event.button;
  12865. // Add which for key events
  12866. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  12867. return event.charCode != null ? event.charCode : event.keyCode;
  12868. }
  12869. // Add which for click: 1 === left; 2 === middle; 3 === right
  12870. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  12871. if ( button & 1 ) {
  12872. return 1;
  12873. }
  12874. if ( button & 2 ) {
  12875. return 3;
  12876. }
  12877. if ( button & 4 ) {
  12878. return 2;
  12879. }
  12880. return 0;
  12881. }
  12882. return event.which;
  12883. }
  12884. }, jQuery.event.addProp );
  12885. jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
  12886. jQuery.event.special[ type ] = {
  12887. // Utilize native event if possible so blur/focus sequence is correct
  12888. setup: function() {
  12889. // Claim the first handler
  12890. // dataPriv.set( this, "focus", ... )
  12891. // dataPriv.set( this, "blur", ... )
  12892. leverageNative( this, type, expectSync );
  12893. // Return false to allow normal processing in the caller
  12894. return false;
  12895. },
  12896. trigger: function() {
  12897. // Force setup before trigger
  12898. leverageNative( this, type );
  12899. // Return non-false to allow normal event-path propagation
  12900. return true;
  12901. },
  12902. delegateType: delegateType
  12903. };
  12904. } );
  12905. // Create mouseenter/leave events using mouseover/out and event-time checks
  12906. // so that event delegation works in jQuery.
  12907. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  12908. //
  12909. // Support: Safari 7 only
  12910. // Safari sends mouseenter too often; see:
  12911. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  12912. // for the description of the bug (it existed in older Chrome versions as well).
  12913. jQuery.each( {
  12914. mouseenter: "mouseover",
  12915. mouseleave: "mouseout",
  12916. pointerenter: "pointerover",
  12917. pointerleave: "pointerout"
  12918. }, function( orig, fix ) {
  12919. jQuery.event.special[ orig ] = {
  12920. delegateType: fix,
  12921. bindType: fix,
  12922. handle: function( event ) {
  12923. var ret,
  12924. target = this,
  12925. related = event.relatedTarget,
  12926. handleObj = event.handleObj;
  12927. // For mouseenter/leave call the handler if related is outside the target.
  12928. // NB: No relatedTarget if the mouse left/entered the browser window
  12929. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  12930. event.type = handleObj.origType;
  12931. ret = handleObj.handler.apply( this, arguments );
  12932. event.type = fix;
  12933. }
  12934. return ret;
  12935. }
  12936. };
  12937. } );
  12938. jQuery.fn.extend( {
  12939. on: function( types, selector, data, fn ) {
  12940. return on( this, types, selector, data, fn );
  12941. },
  12942. one: function( types, selector, data, fn ) {
  12943. return on( this, types, selector, data, fn, 1 );
  12944. },
  12945. off: function( types, selector, fn ) {
  12946. var handleObj, type;
  12947. if ( types && types.preventDefault && types.handleObj ) {
  12948. // ( event ) dispatched jQuery.Event
  12949. handleObj = types.handleObj;
  12950. jQuery( types.delegateTarget ).off(
  12951. handleObj.namespace ?
  12952. handleObj.origType + "." + handleObj.namespace :
  12953. handleObj.origType,
  12954. handleObj.selector,
  12955. handleObj.handler
  12956. );
  12957. return this;
  12958. }
  12959. if ( typeof types === "object" ) {
  12960. // ( types-object [, selector] )
  12961. for ( type in types ) {
  12962. this.off( type, selector, types[ type ] );
  12963. }
  12964. return this;
  12965. }
  12966. if ( selector === false || typeof selector === "function" ) {
  12967. // ( types [, fn] )
  12968. fn = selector;
  12969. selector = undefined;
  12970. }
  12971. if ( fn === false ) {
  12972. fn = returnFalse;
  12973. }
  12974. return this.each( function() {
  12975. jQuery.event.remove( this, types, fn, selector );
  12976. } );
  12977. }
  12978. } );
  12979. var
  12980. /* eslint-disable max-len */
  12981. // See https://github.com/eslint/eslint/issues/3229
  12982. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  12983. /* eslint-enable */
  12984. // Support: IE <=10 - 11, Edge 12 - 13 only
  12985. // In IE/Edge using regex groups here causes severe slowdowns.
  12986. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  12987. rnoInnerhtml = /<script|<style|<link/i,
  12988. // checked="checked" or checked
  12989. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  12990. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  12991. // Prefer a tbody over its parent table for containing new rows
  12992. function manipulationTarget( elem, content ) {
  12993. if ( nodeName( elem, "table" ) &&
  12994. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  12995. return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
  12996. }
  12997. return elem;
  12998. }
  12999. // Replace/restore the type attribute of script elements for safe DOM manipulation
  13000. function disableScript( elem ) {
  13001. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  13002. return elem;
  13003. }
  13004. function restoreScript( elem ) {
  13005. if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
  13006. elem.type = elem.type.slice( 5 );
  13007. } else {
  13008. elem.removeAttribute( "type" );
  13009. }
  13010. return elem;
  13011. }
  13012. function cloneCopyEvent( src, dest ) {
  13013. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  13014. if ( dest.nodeType !== 1 ) {
  13015. return;
  13016. }
  13017. // 1. Copy private data: events, handlers, etc.
  13018. if ( dataPriv.hasData( src ) ) {
  13019. pdataOld = dataPriv.access( src );
  13020. pdataCur = dataPriv.set( dest, pdataOld );
  13021. events = pdataOld.events;
  13022. if ( events ) {
  13023. delete pdataCur.handle;
  13024. pdataCur.events = {};
  13025. for ( type in events ) {
  13026. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  13027. jQuery.event.add( dest, type, events[ type ][ i ] );
  13028. }
  13029. }
  13030. }
  13031. }
  13032. // 2. Copy user data
  13033. if ( dataUser.hasData( src ) ) {
  13034. udataOld = dataUser.access( src );
  13035. udataCur = jQuery.extend( {}, udataOld );
  13036. dataUser.set( dest, udataCur );
  13037. }
  13038. }
  13039. // Fix IE bugs, see support tests
  13040. function fixInput( src, dest ) {
  13041. var nodeName = dest.nodeName.toLowerCase();
  13042. // Fails to persist the checked state of a cloned checkbox or radio button.
  13043. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  13044. dest.checked = src.checked;
  13045. // Fails to return the selected option to the default selected state when cloning options
  13046. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  13047. dest.defaultValue = src.defaultValue;
  13048. }
  13049. }
  13050. function domManip( collection, args, callback, ignored ) {
  13051. // Flatten any nested arrays
  13052. args = concat.apply( [], args );
  13053. var fragment, first, scripts, hasScripts, node, doc,
  13054. i = 0,
  13055. l = collection.length,
  13056. iNoClone = l - 1,
  13057. value = args[ 0 ],
  13058. valueIsFunction = isFunction( value );
  13059. // We can't cloneNode fragments that contain checked, in WebKit
  13060. if ( valueIsFunction ||
  13061. ( l > 1 && typeof value === "string" &&
  13062. !support.checkClone && rchecked.test( value ) ) ) {
  13063. return collection.each( function( index ) {
  13064. var self = collection.eq( index );
  13065. if ( valueIsFunction ) {
  13066. args[ 0 ] = value.call( this, index, self.html() );
  13067. }
  13068. domManip( self, args, callback, ignored );
  13069. } );
  13070. }
  13071. if ( l ) {
  13072. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  13073. first = fragment.firstChild;
  13074. if ( fragment.childNodes.length === 1 ) {
  13075. fragment = first;
  13076. }
  13077. // Require either new content or an interest in ignored elements to invoke the callback
  13078. if ( first || ignored ) {
  13079. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  13080. hasScripts = scripts.length;
  13081. // Use the original fragment for the last item
  13082. // instead of the first because it can end up
  13083. // being emptied incorrectly in certain situations (#8070).
  13084. for ( ; i < l; i++ ) {
  13085. node = fragment;
  13086. if ( i !== iNoClone ) {
  13087. node = jQuery.clone( node, true, true );
  13088. // Keep references to cloned scripts for later restoration
  13089. if ( hasScripts ) {
  13090. // Support: Android <=4.0 only, PhantomJS 1 only
  13091. // push.apply(_, arraylike) throws on ancient WebKit
  13092. jQuery.merge( scripts, getAll( node, "script" ) );
  13093. }
  13094. }
  13095. callback.call( collection[ i ], node, i );
  13096. }
  13097. if ( hasScripts ) {
  13098. doc = scripts[ scripts.length - 1 ].ownerDocument;
  13099. // Reenable scripts
  13100. jQuery.map( scripts, restoreScript );
  13101. // Evaluate executable scripts on first document insertion
  13102. for ( i = 0; i < hasScripts; i++ ) {
  13103. node = scripts[ i ];
  13104. if ( rscriptType.test( node.type || "" ) &&
  13105. !dataPriv.access( node, "globalEval" ) &&
  13106. jQuery.contains( doc, node ) ) {
  13107. if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
  13108. // Optional AJAX dependency, but won't run scripts if not present
  13109. if ( jQuery._evalUrl && !node.noModule ) {
  13110. jQuery._evalUrl( node.src, {
  13111. nonce: node.nonce || node.getAttribute( "nonce" )
  13112. } );
  13113. }
  13114. } else {
  13115. DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc );
  13116. }
  13117. }
  13118. }
  13119. }
  13120. }
  13121. }
  13122. return collection;
  13123. }
  13124. function remove( elem, selector, keepData ) {
  13125. var node,
  13126. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  13127. i = 0;
  13128. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  13129. if ( !keepData && node.nodeType === 1 ) {
  13130. jQuery.cleanData( getAll( node ) );
  13131. }
  13132. if ( node.parentNode ) {
  13133. if ( keepData && isAttached( node ) ) {
  13134. setGlobalEval( getAll( node, "script" ) );
  13135. }
  13136. node.parentNode.removeChild( node );
  13137. }
  13138. }
  13139. return elem;
  13140. }
  13141. jQuery.extend( {
  13142. htmlPrefilter: function( html ) {
  13143. return html.replace( rxhtmlTag, "<$1></$2>" );
  13144. },
  13145. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  13146. var i, l, srcElements, destElements,
  13147. clone = elem.cloneNode( true ),
  13148. inPage = isAttached( elem );
  13149. // Fix IE cloning issues
  13150. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  13151. !jQuery.isXMLDoc( elem ) ) {
  13152. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  13153. destElements = getAll( clone );
  13154. srcElements = getAll( elem );
  13155. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  13156. fixInput( srcElements[ i ], destElements[ i ] );
  13157. }
  13158. }
  13159. // Copy the events from the original to the clone
  13160. if ( dataAndEvents ) {
  13161. if ( deepDataAndEvents ) {
  13162. srcElements = srcElements || getAll( elem );
  13163. destElements = destElements || getAll( clone );
  13164. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  13165. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  13166. }
  13167. } else {
  13168. cloneCopyEvent( elem, clone );
  13169. }
  13170. }
  13171. // Preserve script evaluation history
  13172. destElements = getAll( clone, "script" );
  13173. if ( destElements.length > 0 ) {
  13174. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  13175. }
  13176. // Return the cloned set
  13177. return clone;
  13178. },
  13179. cleanData: function( elems ) {
  13180. var data, elem, type,
  13181. special = jQuery.event.special,
  13182. i = 0;
  13183. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  13184. if ( acceptData( elem ) ) {
  13185. if ( ( data = elem[ dataPriv.expando ] ) ) {
  13186. if ( data.events ) {
  13187. for ( type in data.events ) {
  13188. if ( special[ type ] ) {
  13189. jQuery.event.remove( elem, type );
  13190. // This is a shortcut to avoid jQuery.event.remove's overhead
  13191. } else {
  13192. jQuery.removeEvent( elem, type, data.handle );
  13193. }
  13194. }
  13195. }
  13196. // Support: Chrome <=35 - 45+
  13197. // Assign undefined instead of using delete, see Data#remove
  13198. elem[ dataPriv.expando ] = undefined;
  13199. }
  13200. if ( elem[ dataUser.expando ] ) {
  13201. // Support: Chrome <=35 - 45+
  13202. // Assign undefined instead of using delete, see Data#remove
  13203. elem[ dataUser.expando ] = undefined;
  13204. }
  13205. }
  13206. }
  13207. }
  13208. } );
  13209. jQuery.fn.extend( {
  13210. detach: function( selector ) {
  13211. return remove( this, selector, true );
  13212. },
  13213. remove: function( selector ) {
  13214. return remove( this, selector );
  13215. },
  13216. text: function( value ) {
  13217. return access( this, function( value ) {
  13218. return value === undefined ?
  13219. jQuery.text( this ) :
  13220. this.empty().each( function() {
  13221. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13222. this.textContent = value;
  13223. }
  13224. } );
  13225. }, null, value, arguments.length );
  13226. },
  13227. append: function() {
  13228. return domManip( this, arguments, function( elem ) {
  13229. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13230. var target = manipulationTarget( this, elem );
  13231. target.appendChild( elem );
  13232. }
  13233. } );
  13234. },
  13235. prepend: function() {
  13236. return domManip( this, arguments, function( elem ) {
  13237. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13238. var target = manipulationTarget( this, elem );
  13239. target.insertBefore( elem, target.firstChild );
  13240. }
  13241. } );
  13242. },
  13243. before: function() {
  13244. return domManip( this, arguments, function( elem ) {
  13245. if ( this.parentNode ) {
  13246. this.parentNode.insertBefore( elem, this );
  13247. }
  13248. } );
  13249. },
  13250. after: function() {
  13251. return domManip( this, arguments, function( elem ) {
  13252. if ( this.parentNode ) {
  13253. this.parentNode.insertBefore( elem, this.nextSibling );
  13254. }
  13255. } );
  13256. },
  13257. empty: function() {
  13258. var elem,
  13259. i = 0;
  13260. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  13261. if ( elem.nodeType === 1 ) {
  13262. // Prevent memory leaks
  13263. jQuery.cleanData( getAll( elem, false ) );
  13264. // Remove any remaining nodes
  13265. elem.textContent = "";
  13266. }
  13267. }
  13268. return this;
  13269. },
  13270. clone: function( dataAndEvents, deepDataAndEvents ) {
  13271. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  13272. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  13273. return this.map( function() {
  13274. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  13275. } );
  13276. },
  13277. html: function( value ) {
  13278. return access( this, function( value ) {
  13279. var elem = this[ 0 ] || {},
  13280. i = 0,
  13281. l = this.length;
  13282. if ( value === undefined && elem.nodeType === 1 ) {
  13283. return elem.innerHTML;
  13284. }
  13285. // See if we can take a shortcut and just use innerHTML
  13286. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  13287. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  13288. value = jQuery.htmlPrefilter( value );
  13289. try {
  13290. for ( ; i < l; i++ ) {
  13291. elem = this[ i ] || {};
  13292. // Remove element nodes and prevent memory leaks
  13293. if ( elem.nodeType === 1 ) {
  13294. jQuery.cleanData( getAll( elem, false ) );
  13295. elem.innerHTML = value;
  13296. }
  13297. }
  13298. elem = 0;
  13299. // If using innerHTML throws an exception, use the fallback method
  13300. } catch ( e ) {}
  13301. }
  13302. if ( elem ) {
  13303. this.empty().append( value );
  13304. }
  13305. }, null, value, arguments.length );
  13306. },
  13307. replaceWith: function() {
  13308. var ignored = [];
  13309. // Make the changes, replacing each non-ignored context element with the new content
  13310. return domManip( this, arguments, function( elem ) {
  13311. var parent = this.parentNode;
  13312. if ( jQuery.inArray( this, ignored ) < 0 ) {
  13313. jQuery.cleanData( getAll( this ) );
  13314. if ( parent ) {
  13315. parent.replaceChild( elem, this );
  13316. }
  13317. }
  13318. // Force callback invocation
  13319. }, ignored );
  13320. }
  13321. } );
  13322. jQuery.each( {
  13323. appendTo: "append",
  13324. prependTo: "prepend",
  13325. insertBefore: "before",
  13326. insertAfter: "after",
  13327. replaceAll: "replaceWith"
  13328. }, function( name, original ) {
  13329. jQuery.fn[ name ] = function( selector ) {
  13330. var elems,
  13331. ret = [],
  13332. insert = jQuery( selector ),
  13333. last = insert.length - 1,
  13334. i = 0;
  13335. for ( ; i <= last; i++ ) {
  13336. elems = i === last ? this : this.clone( true );
  13337. jQuery( insert[ i ] )[ original ]( elems );
  13338. // Support: Android <=4.0 only, PhantomJS 1 only
  13339. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  13340. push.apply( ret, elems.get() );
  13341. }
  13342. return this.pushStack( ret );
  13343. };
  13344. } );
  13345. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  13346. var getStyles = function( elem ) {
  13347. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  13348. // IE throws on elements created in popups
  13349. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  13350. var view = elem.ownerDocument.defaultView;
  13351. if ( !view || !view.opener ) {
  13352. view = window;
  13353. }
  13354. return view.getComputedStyle( elem );
  13355. };
  13356. var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
  13357. ( function() {
  13358. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  13359. // so they're executed at the same time to save the second computation.
  13360. function computeStyleTests() {
  13361. // This is a singleton, we need to execute it only once
  13362. if ( !div ) {
  13363. return;
  13364. }
  13365. container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
  13366. "margin-top:1px;padding:0;border:0";
  13367. div.style.cssText =
  13368. "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
  13369. "margin:auto;border:1px;padding:1px;" +
  13370. "width:60%;top:1%";
  13371. documentElement.appendChild( container ).appendChild( div );
  13372. var divStyle = window.getComputedStyle( div );
  13373. pixelPositionVal = divStyle.top !== "1%";
  13374. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  13375. reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
  13376. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  13377. // Some styles come back with percentage values, even though they shouldn't
  13378. div.style.right = "60%";
  13379. pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
  13380. // Support: IE 9 - 11 only
  13381. // Detect misreporting of content dimensions for box-sizing:border-box elements
  13382. boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
  13383. // Support: IE 9 only
  13384. // Detect overflow:scroll screwiness (gh-3699)
  13385. // Support: Chrome <=64
  13386. // Don't get tricked when zoom affects offsetWidth (gh-4029)
  13387. div.style.position = "absolute";
  13388. scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12;
  13389. documentElement.removeChild( container );
  13390. // Nullify the div so it wouldn't be stored in the memory and
  13391. // it will also be a sign that checks already performed
  13392. div = null;
  13393. }
  13394. function roundPixelMeasures( measure ) {
  13395. return Math.round( parseFloat( measure ) );
  13396. }
  13397. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
  13398. reliableMarginLeftVal,
  13399. container = document.createElement( "div" ),
  13400. div = document.createElement( "div" );
  13401. // Finish early in limited (non-browser) environments
  13402. if ( !div.style ) {
  13403. return;
  13404. }
  13405. // Support: IE <=9 - 11 only
  13406. // Style of cloned element affects source element cloned (#8908)
  13407. div.style.backgroundClip = "content-box";
  13408. div.cloneNode( true ).style.backgroundClip = "";
  13409. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  13410. jQuery.extend( support, {
  13411. boxSizingReliable: function() {
  13412. computeStyleTests();
  13413. return boxSizingReliableVal;
  13414. },
  13415. pixelBoxStyles: function() {
  13416. computeStyleTests();
  13417. return pixelBoxStylesVal;
  13418. },
  13419. pixelPosition: function() {
  13420. computeStyleTests();
  13421. return pixelPositionVal;
  13422. },
  13423. reliableMarginLeft: function() {
  13424. computeStyleTests();
  13425. return reliableMarginLeftVal;
  13426. },
  13427. scrollboxSize: function() {
  13428. computeStyleTests();
  13429. return scrollboxSizeVal;
  13430. }
  13431. } );
  13432. } )();
  13433. function curCSS( elem, name, computed ) {
  13434. var width, minWidth, maxWidth, ret,
  13435. // Support: Firefox 51+
  13436. // Retrieving style before computed somehow
  13437. // fixes an issue with getting wrong values
  13438. // on detached elements
  13439. style = elem.style;
  13440. computed = computed || getStyles( elem );
  13441. // getPropertyValue is needed for:
  13442. // .css('filter') (IE 9 only, #12537)
  13443. // .css('--customProperty) (#3144)
  13444. if ( computed ) {
  13445. ret = computed.getPropertyValue( name ) || computed[ name ];
  13446. if ( ret === "" && !isAttached( elem ) ) {
  13447. ret = jQuery.style( elem, name );
  13448. }
  13449. // A tribute to the "awesome hack by Dean Edwards"
  13450. // Android Browser returns percentage for some values,
  13451. // but width seems to be reliably pixels.
  13452. // This is against the CSSOM draft spec:
  13453. // https://drafts.csswg.org/cssom/#resolved-values
  13454. if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
  13455. // Remember the original values
  13456. width = style.width;
  13457. minWidth = style.minWidth;
  13458. maxWidth = style.maxWidth;
  13459. // Put in the new values to get a computed value out
  13460. style.minWidth = style.maxWidth = style.width = ret;
  13461. ret = computed.width;
  13462. // Revert the changed values
  13463. style.width = width;
  13464. style.minWidth = minWidth;
  13465. style.maxWidth = maxWidth;
  13466. }
  13467. }
  13468. return ret !== undefined ?
  13469. // Support: IE <=9 - 11 only
  13470. // IE returns zIndex value as an integer.
  13471. ret + "" :
  13472. ret;
  13473. }
  13474. function addGetHookIf( conditionFn, hookFn ) {
  13475. // Define the hook, we'll check on the first run if it's really needed.
  13476. return {
  13477. get: function() {
  13478. if ( conditionFn() ) {
  13479. // Hook not needed (or it's not possible to use it due
  13480. // to missing dependency), remove it.
  13481. delete this.get;
  13482. return;
  13483. }
  13484. // Hook needed; redefine it so that the support test is not executed again.
  13485. return ( this.get = hookFn ).apply( this, arguments );
  13486. }
  13487. };
  13488. }
  13489. var cssPrefixes = [ "Webkit", "Moz", "ms" ],
  13490. emptyStyle = document.createElement( "div" ).style,
  13491. vendorProps = {};
  13492. // Return a vendor-prefixed property or undefined
  13493. function vendorPropName( name ) {
  13494. // Check for vendor prefixed names
  13495. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  13496. i = cssPrefixes.length;
  13497. while ( i-- ) {
  13498. name = cssPrefixes[ i ] + capName;
  13499. if ( name in emptyStyle ) {
  13500. return name;
  13501. }
  13502. }
  13503. }
  13504. // Return a potentially-mapped jQuery.cssProps or vendor prefixed property
  13505. function finalPropName( name ) {
  13506. var final = jQuery.cssProps[ name ] || vendorProps[ name ];
  13507. if ( final ) {
  13508. return final;
  13509. }
  13510. if ( name in emptyStyle ) {
  13511. return name;
  13512. }
  13513. return vendorProps[ name ] = vendorPropName( name ) || name;
  13514. }
  13515. var
  13516. // Swappable if display is none or starts with table
  13517. // except "table", "table-cell", or "table-caption"
  13518. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  13519. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  13520. rcustomProp = /^--/,
  13521. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  13522. cssNormalTransform = {
  13523. letterSpacing: "0",
  13524. fontWeight: "400"
  13525. };
  13526. function setPositiveNumber( elem, value, subtract ) {
  13527. // Any relative (+/-) values have already been
  13528. // normalized at this point
  13529. var matches = rcssNum.exec( value );
  13530. return matches ?
  13531. // Guard against undefined "subtract", e.g., when used as in cssHooks
  13532. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  13533. value;
  13534. }
  13535. function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
  13536. var i = dimension === "width" ? 1 : 0,
  13537. extra = 0,
  13538. delta = 0;
  13539. // Adjustment may not be necessary
  13540. if ( box === ( isBorderBox ? "border" : "content" ) ) {
  13541. return 0;
  13542. }
  13543. for ( ; i < 4; i += 2 ) {
  13544. // Both box models exclude margin
  13545. if ( box === "margin" ) {
  13546. delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
  13547. }
  13548. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  13549. if ( !isBorderBox ) {
  13550. // Add padding
  13551. delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  13552. // For "border" or "margin", add border
  13553. if ( box !== "padding" ) {
  13554. delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13555. // But still keep track of it otherwise
  13556. } else {
  13557. extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13558. }
  13559. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  13560. // "padding" or "margin"
  13561. } else {
  13562. // For "content", subtract padding
  13563. if ( box === "content" ) {
  13564. delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  13565. }
  13566. // For "content" or "padding", subtract border
  13567. if ( box !== "margin" ) {
  13568. delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13569. }
  13570. }
  13571. }
  13572. // Account for positive content-box scroll gutter when requested by providing computedVal
  13573. if ( !isBorderBox && computedVal >= 0 ) {
  13574. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  13575. // Assuming integer scroll gutter, subtract the rest and round down
  13576. delta += Math.max( 0, Math.ceil(
  13577. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  13578. computedVal -
  13579. delta -
  13580. extra -
  13581. 0.5
  13582. // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
  13583. // Use an explicit zero to avoid NaN (gh-3964)
  13584. ) ) || 0;
  13585. }
  13586. return delta;
  13587. }
  13588. function getWidthOrHeight( elem, dimension, extra ) {
  13589. // Start with computed style
  13590. var styles = getStyles( elem ),
  13591. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
  13592. // Fake content-box until we know it's needed to know the true value.
  13593. boxSizingNeeded = !support.boxSizingReliable() || extra,
  13594. isBorderBox = boxSizingNeeded &&
  13595. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  13596. valueIsBorderBox = isBorderBox,
  13597. val = curCSS( elem, dimension, styles ),
  13598. offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );
  13599. // Support: Firefox <=54
  13600. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  13601. if ( rnumnonpx.test( val ) ) {
  13602. if ( !extra ) {
  13603. return val;
  13604. }
  13605. val = "auto";
  13606. }
  13607. // Fall back to offsetWidth/offsetHeight when value is "auto"
  13608. // This happens for inline elements with no explicit setting (gh-3571)
  13609. // Support: Android <=4.1 - 4.3 only
  13610. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  13611. // Support: IE 9-11 only
  13612. // Also use offsetWidth/offsetHeight for when box sizing is unreliable
  13613. // We use getClientRects() to check for hidden/disconnected.
  13614. // In those cases, the computed value can be trusted to be border-box
  13615. if ( ( !support.boxSizingReliable() && isBorderBox ||
  13616. val === "auto" ||
  13617. !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&
  13618. elem.getClientRects().length ) {
  13619. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
  13620. // Where available, offsetWidth/offsetHeight approximate border box dimensions.
  13621. // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
  13622. // retrieved value as a content box dimension.
  13623. valueIsBorderBox = offsetProp in elem;
  13624. if ( valueIsBorderBox ) {
  13625. val = elem[ offsetProp ];
  13626. }
  13627. }
  13628. // Normalize "" and auto
  13629. val = parseFloat( val ) || 0;
  13630. // Adjust for the element's box model
  13631. return ( val +
  13632. boxModelAdjustment(
  13633. elem,
  13634. dimension,
  13635. extra || ( isBorderBox ? "border" : "content" ),
  13636. valueIsBorderBox,
  13637. styles,
  13638. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  13639. val
  13640. )
  13641. ) + "px";
  13642. }
  13643. jQuery.extend( {
  13644. // Add in style property hooks for overriding the default
  13645. // behavior of getting and setting a style property
  13646. cssHooks: {
  13647. opacity: {
  13648. get: function( elem, computed ) {
  13649. if ( computed ) {
  13650. // We should always get a number back from opacity
  13651. var ret = curCSS( elem, "opacity" );
  13652. return ret === "" ? "1" : ret;
  13653. }
  13654. }
  13655. }
  13656. },
  13657. // Don't automatically add "px" to these possibly-unitless properties
  13658. cssNumber: {
  13659. "animationIterationCount": true,
  13660. "columnCount": true,
  13661. "fillOpacity": true,
  13662. "flexGrow": true,
  13663. "flexShrink": true,
  13664. "fontWeight": true,
  13665. "gridArea": true,
  13666. "gridColumn": true,
  13667. "gridColumnEnd": true,
  13668. "gridColumnStart": true,
  13669. "gridRow": true,
  13670. "gridRowEnd": true,
  13671. "gridRowStart": true,
  13672. "lineHeight": true,
  13673. "opacity": true,
  13674. "order": true,
  13675. "orphans": true,
  13676. "widows": true,
  13677. "zIndex": true,
  13678. "zoom": true
  13679. },
  13680. // Add in properties whose names you wish to fix before
  13681. // setting or getting the value
  13682. cssProps: {},
  13683. // Get and set the style property on a DOM Node
  13684. style: function( elem, name, value, extra ) {
  13685. // Don't set styles on text and comment nodes
  13686. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  13687. return;
  13688. }
  13689. // Make sure that we're working with the right name
  13690. var ret, type, hooks,
  13691. origName = camelCase( name ),
  13692. isCustomProp = rcustomProp.test( name ),
  13693. style = elem.style;
  13694. // Make sure that we're working with the right name. We don't
  13695. // want to query the value if it is a CSS custom property
  13696. // since they are user-defined.
  13697. if ( !isCustomProp ) {
  13698. name = finalPropName( origName );
  13699. }
  13700. // Gets hook for the prefixed version, then unprefixed version
  13701. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  13702. // Check if we're setting a value
  13703. if ( value !== undefined ) {
  13704. type = typeof value;
  13705. // Convert "+=" or "-=" to relative numbers (#7345)
  13706. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  13707. value = adjustCSS( elem, name, ret );
  13708. // Fixes bug #9237
  13709. type = "number";
  13710. }
  13711. // Make sure that null and NaN values aren't set (#7116)
  13712. if ( value == null || value !== value ) {
  13713. return;
  13714. }
  13715. // If a number was passed in, add the unit (except for certain CSS properties)
  13716. // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append
  13717. // "px" to a few hardcoded values.
  13718. if ( type === "number" && !isCustomProp ) {
  13719. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  13720. }
  13721. // background-* props affect original clone's values
  13722. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  13723. style[ name ] = "inherit";
  13724. }
  13725. // If a hook was provided, use that value, otherwise just set the specified value
  13726. if ( !hooks || !( "set" in hooks ) ||
  13727. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  13728. if ( isCustomProp ) {
  13729. style.setProperty( name, value );
  13730. } else {
  13731. style[ name ] = value;
  13732. }
  13733. }
  13734. } else {
  13735. // If a hook was provided get the non-computed value from there
  13736. if ( hooks && "get" in hooks &&
  13737. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  13738. return ret;
  13739. }
  13740. // Otherwise just get the value from the style object
  13741. return style[ name ];
  13742. }
  13743. },
  13744. css: function( elem, name, extra, styles ) {
  13745. var val, num, hooks,
  13746. origName = camelCase( name ),
  13747. isCustomProp = rcustomProp.test( name );
  13748. // Make sure that we're working with the right name. We don't
  13749. // want to modify the value if it is a CSS custom property
  13750. // since they are user-defined.
  13751. if ( !isCustomProp ) {
  13752. name = finalPropName( origName );
  13753. }
  13754. // Try prefixed name followed by the unprefixed name
  13755. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  13756. // If a hook was provided get the computed value from there
  13757. if ( hooks && "get" in hooks ) {
  13758. val = hooks.get( elem, true, extra );
  13759. }
  13760. // Otherwise, if a way to get the computed value exists, use that
  13761. if ( val === undefined ) {
  13762. val = curCSS( elem, name, styles );
  13763. }
  13764. // Convert "normal" to computed value
  13765. if ( val === "normal" && name in cssNormalTransform ) {
  13766. val = cssNormalTransform[ name ];
  13767. }
  13768. // Make numeric if forced or a qualifier was provided and val looks numeric
  13769. if ( extra === "" || extra ) {
  13770. num = parseFloat( val );
  13771. return extra === true || isFinite( num ) ? num || 0 : val;
  13772. }
  13773. return val;
  13774. }
  13775. } );
  13776. jQuery.each( [ "height", "width" ], function( i, dimension ) {
  13777. jQuery.cssHooks[ dimension ] = {
  13778. get: function( elem, computed, extra ) {
  13779. if ( computed ) {
  13780. // Certain elements can have dimension info if we invisibly show them
  13781. // but it must have a current display style that would benefit
  13782. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  13783. // Support: Safari 8+
  13784. // Table columns in Safari have non-zero offsetWidth & zero
  13785. // getBoundingClientRect().width unless display is changed.
  13786. // Support: IE <=11 only
  13787. // Running getBoundingClientRect on a disconnected node
  13788. // in IE throws an error.
  13789. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  13790. swap( elem, cssShow, function() {
  13791. return getWidthOrHeight( elem, dimension, extra );
  13792. } ) :
  13793. getWidthOrHeight( elem, dimension, extra );
  13794. }
  13795. },
  13796. set: function( elem, value, extra ) {
  13797. var matches,
  13798. styles = getStyles( elem ),
  13799. // Only read styles.position if the test has a chance to fail
  13800. // to avoid forcing a reflow.
  13801. scrollboxSizeBuggy = !support.scrollboxSize() &&
  13802. styles.position === "absolute",
  13803. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
  13804. boxSizingNeeded = scrollboxSizeBuggy || extra,
  13805. isBorderBox = boxSizingNeeded &&
  13806. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  13807. subtract = extra ?
  13808. boxModelAdjustment(
  13809. elem,
  13810. dimension,
  13811. extra,
  13812. isBorderBox,
  13813. styles
  13814. ) :
  13815. 0;
  13816. // Account for unreliable border-box dimensions by comparing offset* to computed and
  13817. // faking a content-box to get border and padding (gh-3699)
  13818. if ( isBorderBox && scrollboxSizeBuggy ) {
  13819. subtract -= Math.ceil(
  13820. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  13821. parseFloat( styles[ dimension ] ) -
  13822. boxModelAdjustment( elem, dimension, "border", false, styles ) -
  13823. 0.5
  13824. );
  13825. }
  13826. // Convert to pixels if value adjustment is needed
  13827. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  13828. ( matches[ 3 ] || "px" ) !== "px" ) {
  13829. elem.style[ dimension ] = value;
  13830. value = jQuery.css( elem, dimension );
  13831. }
  13832. return setPositiveNumber( elem, value, subtract );
  13833. }
  13834. };
  13835. } );
  13836. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  13837. function( elem, computed ) {
  13838. if ( computed ) {
  13839. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  13840. elem.getBoundingClientRect().left -
  13841. swap( elem, { marginLeft: 0 }, function() {
  13842. return elem.getBoundingClientRect().left;
  13843. } )
  13844. ) + "px";
  13845. }
  13846. }
  13847. );
  13848. // These hooks are used by animate to expand properties
  13849. jQuery.each( {
  13850. margin: "",
  13851. padding: "",
  13852. border: "Width"
  13853. }, function( prefix, suffix ) {
  13854. jQuery.cssHooks[ prefix + suffix ] = {
  13855. expand: function( value ) {
  13856. var i = 0,
  13857. expanded = {},
  13858. // Assumes a single number if not a string
  13859. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  13860. for ( ; i < 4; i++ ) {
  13861. expanded[ prefix + cssExpand[ i ] + suffix ] =
  13862. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  13863. }
  13864. return expanded;
  13865. }
  13866. };
  13867. if ( prefix !== "margin" ) {
  13868. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  13869. }
  13870. } );
  13871. jQuery.fn.extend( {
  13872. css: function( name, value ) {
  13873. return access( this, function( elem, name, value ) {
  13874. var styles, len,
  13875. map = {},
  13876. i = 0;
  13877. if ( Array.isArray( name ) ) {
  13878. styles = getStyles( elem );
  13879. len = name.length;
  13880. for ( ; i < len; i++ ) {
  13881. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  13882. }
  13883. return map;
  13884. }
  13885. return value !== undefined ?
  13886. jQuery.style( elem, name, value ) :
  13887. jQuery.css( elem, name );
  13888. }, name, value, arguments.length > 1 );
  13889. }
  13890. } );
  13891. function Tween( elem, options, prop, end, easing ) {
  13892. return new Tween.prototype.init( elem, options, prop, end, easing );
  13893. }
  13894. jQuery.Tween = Tween;
  13895. Tween.prototype = {
  13896. constructor: Tween,
  13897. init: function( elem, options, prop, end, easing, unit ) {
  13898. this.elem = elem;
  13899. this.prop = prop;
  13900. this.easing = easing || jQuery.easing._default;
  13901. this.options = options;
  13902. this.start = this.now = this.cur();
  13903. this.end = end;
  13904. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  13905. },
  13906. cur: function() {
  13907. var hooks = Tween.propHooks[ this.prop ];
  13908. return hooks && hooks.get ?
  13909. hooks.get( this ) :
  13910. Tween.propHooks._default.get( this );
  13911. },
  13912. run: function( percent ) {
  13913. var eased,
  13914. hooks = Tween.propHooks[ this.prop ];
  13915. if ( this.options.duration ) {
  13916. this.pos = eased = jQuery.easing[ this.easing ](
  13917. percent, this.options.duration * percent, 0, 1, this.options.duration
  13918. );
  13919. } else {
  13920. this.pos = eased = percent;
  13921. }
  13922. this.now = ( this.end - this.start ) * eased + this.start;
  13923. if ( this.options.step ) {
  13924. this.options.step.call( this.elem, this.now, this );
  13925. }
  13926. if ( hooks && hooks.set ) {
  13927. hooks.set( this );
  13928. } else {
  13929. Tween.propHooks._default.set( this );
  13930. }
  13931. return this;
  13932. }
  13933. };
  13934. Tween.prototype.init.prototype = Tween.prototype;
  13935. Tween.propHooks = {
  13936. _default: {
  13937. get: function( tween ) {
  13938. var result;
  13939. // Use a property on the element directly when it is not a DOM element,
  13940. // or when there is no matching style property that exists.
  13941. if ( tween.elem.nodeType !== 1 ||
  13942. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  13943. return tween.elem[ tween.prop ];
  13944. }
  13945. // Passing an empty string as a 3rd parameter to .css will automatically
  13946. // attempt a parseFloat and fallback to a string if the parse fails.
  13947. // Simple values such as "10px" are parsed to Float;
  13948. // complex values such as "rotate(1rad)" are returned as-is.
  13949. result = jQuery.css( tween.elem, tween.prop, "" );
  13950. // Empty strings, null, undefined and "auto" are converted to 0.
  13951. return !result || result === "auto" ? 0 : result;
  13952. },
  13953. set: function( tween ) {
  13954. // Use step hook for back compat.
  13955. // Use cssHook if its there.
  13956. // Use .style if available and use plain properties where available.
  13957. if ( jQuery.fx.step[ tween.prop ] ) {
  13958. jQuery.fx.step[ tween.prop ]( tween );
  13959. } else if ( tween.elem.nodeType === 1 && (
  13960. jQuery.cssHooks[ tween.prop ] ||
  13961. tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) {
  13962. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  13963. } else {
  13964. tween.elem[ tween.prop ] = tween.now;
  13965. }
  13966. }
  13967. }
  13968. };
  13969. // Support: IE <=9 only
  13970. // Panic based approach to setting things on disconnected nodes
  13971. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  13972. set: function( tween ) {
  13973. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  13974. tween.elem[ tween.prop ] = tween.now;
  13975. }
  13976. }
  13977. };
  13978. jQuery.easing = {
  13979. linear: function( p ) {
  13980. return p;
  13981. },
  13982. swing: function( p ) {
  13983. return 0.5 - Math.cos( p * Math.PI ) / 2;
  13984. },
  13985. _default: "swing"
  13986. };
  13987. jQuery.fx = Tween.prototype.init;
  13988. // Back compat <1.8 extension point
  13989. jQuery.fx.step = {};
  13990. var
  13991. fxNow, inProgress,
  13992. rfxtypes = /^(?:toggle|show|hide)$/,
  13993. rrun = /queueHooks$/;
  13994. function schedule() {
  13995. if ( inProgress ) {
  13996. if ( document.hidden === false && window.requestAnimationFrame ) {
  13997. window.requestAnimationFrame( schedule );
  13998. } else {
  13999. window.setTimeout( schedule, jQuery.fx.interval );
  14000. }
  14001. jQuery.fx.tick();
  14002. }
  14003. }
  14004. // Animations created synchronously will run synchronously
  14005. function createFxNow() {
  14006. window.setTimeout( function() {
  14007. fxNow = undefined;
  14008. } );
  14009. return ( fxNow = Date.now() );
  14010. }
  14011. // Generate parameters to create a standard animation
  14012. function genFx( type, includeWidth ) {
  14013. var which,
  14014. i = 0,
  14015. attrs = { height: type };
  14016. // If we include width, step value is 1 to do all cssExpand values,
  14017. // otherwise step value is 2 to skip over Left and Right
  14018. includeWidth = includeWidth ? 1 : 0;
  14019. for ( ; i < 4; i += 2 - includeWidth ) {
  14020. which = cssExpand[ i ];
  14021. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  14022. }
  14023. if ( includeWidth ) {
  14024. attrs.opacity = attrs.width = type;
  14025. }
  14026. return attrs;
  14027. }
  14028. function createTween( value, prop, animation ) {
  14029. var tween,
  14030. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  14031. index = 0,
  14032. length = collection.length;
  14033. for ( ; index < length; index++ ) {
  14034. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  14035. // We're done with this property
  14036. return tween;
  14037. }
  14038. }
  14039. }
  14040. function defaultPrefilter( elem, props, opts ) {
  14041. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  14042. isBox = "width" in props || "height" in props,
  14043. anim = this,
  14044. orig = {},
  14045. style = elem.style,
  14046. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  14047. dataShow = dataPriv.get( elem, "fxshow" );
  14048. // Queue-skipping animations hijack the fx hooks
  14049. if ( !opts.queue ) {
  14050. hooks = jQuery._queueHooks( elem, "fx" );
  14051. if ( hooks.unqueued == null ) {
  14052. hooks.unqueued = 0;
  14053. oldfire = hooks.empty.fire;
  14054. hooks.empty.fire = function() {
  14055. if ( !hooks.unqueued ) {
  14056. oldfire();
  14057. }
  14058. };
  14059. }
  14060. hooks.unqueued++;
  14061. anim.always( function() {
  14062. // Ensure the complete handler is called before this completes
  14063. anim.always( function() {
  14064. hooks.unqueued--;
  14065. if ( !jQuery.queue( elem, "fx" ).length ) {
  14066. hooks.empty.fire();
  14067. }
  14068. } );
  14069. } );
  14070. }
  14071. // Detect show/hide animations
  14072. for ( prop in props ) {
  14073. value = props[ prop ];
  14074. if ( rfxtypes.test( value ) ) {
  14075. delete props[ prop ];
  14076. toggle = toggle || value === "toggle";
  14077. if ( value === ( hidden ? "hide" : "show" ) ) {
  14078. // Pretend to be hidden if this is a "show" and
  14079. // there is still data from a stopped show/hide
  14080. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  14081. hidden = true;
  14082. // Ignore all other no-op show/hide data
  14083. } else {
  14084. continue;
  14085. }
  14086. }
  14087. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  14088. }
  14089. }
  14090. // Bail out if this is a no-op like .hide().hide()
  14091. propTween = !jQuery.isEmptyObject( props );
  14092. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  14093. return;
  14094. }
  14095. // Restrict "overflow" and "display" styles during box animations
  14096. if ( isBox && elem.nodeType === 1 ) {
  14097. // Support: IE <=9 - 11, Edge 12 - 15
  14098. // Record all 3 overflow attributes because IE does not infer the shorthand
  14099. // from identically-valued overflowX and overflowY and Edge just mirrors
  14100. // the overflowX value there.
  14101. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  14102. // Identify a display type, preferring old show/hide data over the CSS cascade
  14103. restoreDisplay = dataShow && dataShow.display;
  14104. if ( restoreDisplay == null ) {
  14105. restoreDisplay = dataPriv.get( elem, "display" );
  14106. }
  14107. display = jQuery.css( elem, "display" );
  14108. if ( display === "none" ) {
  14109. if ( restoreDisplay ) {
  14110. display = restoreDisplay;
  14111. } else {
  14112. // Get nonempty value(s) by temporarily forcing visibility
  14113. showHide( [ elem ], true );
  14114. restoreDisplay = elem.style.display || restoreDisplay;
  14115. display = jQuery.css( elem, "display" );
  14116. showHide( [ elem ] );
  14117. }
  14118. }
  14119. // Animate inline elements as inline-block
  14120. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  14121. if ( jQuery.css( elem, "float" ) === "none" ) {
  14122. // Restore the original display value at the end of pure show/hide animations
  14123. if ( !propTween ) {
  14124. anim.done( function() {
  14125. style.display = restoreDisplay;
  14126. } );
  14127. if ( restoreDisplay == null ) {
  14128. display = style.display;
  14129. restoreDisplay = display === "none" ? "" : display;
  14130. }
  14131. }
  14132. style.display = "inline-block";
  14133. }
  14134. }
  14135. }
  14136. if ( opts.overflow ) {
  14137. style.overflow = "hidden";
  14138. anim.always( function() {
  14139. style.overflow = opts.overflow[ 0 ];
  14140. style.overflowX = opts.overflow[ 1 ];
  14141. style.overflowY = opts.overflow[ 2 ];
  14142. } );
  14143. }
  14144. // Implement show/hide animations
  14145. propTween = false;
  14146. for ( prop in orig ) {
  14147. // General show/hide setup for this element animation
  14148. if ( !propTween ) {
  14149. if ( dataShow ) {
  14150. if ( "hidden" in dataShow ) {
  14151. hidden = dataShow.hidden;
  14152. }
  14153. } else {
  14154. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  14155. }
  14156. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  14157. if ( toggle ) {
  14158. dataShow.hidden = !hidden;
  14159. }
  14160. // Show elements before animating them
  14161. if ( hidden ) {
  14162. showHide( [ elem ], true );
  14163. }
  14164. /* eslint-disable no-loop-func */
  14165. anim.done( function() {
  14166. /* eslint-enable no-loop-func */
  14167. // The final step of a "hide" animation is actually hiding the element
  14168. if ( !hidden ) {
  14169. showHide( [ elem ] );
  14170. }
  14171. dataPriv.remove( elem, "fxshow" );
  14172. for ( prop in orig ) {
  14173. jQuery.style( elem, prop, orig[ prop ] );
  14174. }
  14175. } );
  14176. }
  14177. // Per-property setup
  14178. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  14179. if ( !( prop in dataShow ) ) {
  14180. dataShow[ prop ] = propTween.start;
  14181. if ( hidden ) {
  14182. propTween.end = propTween.start;
  14183. propTween.start = 0;
  14184. }
  14185. }
  14186. }
  14187. }
  14188. function propFilter( props, specialEasing ) {
  14189. var index, name, easing, value, hooks;
  14190. // camelCase, specialEasing and expand cssHook pass
  14191. for ( index in props ) {
  14192. name = camelCase( index );
  14193. easing = specialEasing[ name ];
  14194. value = props[ index ];
  14195. if ( Array.isArray( value ) ) {
  14196. easing = value[ 1 ];
  14197. value = props[ index ] = value[ 0 ];
  14198. }
  14199. if ( index !== name ) {
  14200. props[ name ] = value;
  14201. delete props[ index ];
  14202. }
  14203. hooks = jQuery.cssHooks[ name ];
  14204. if ( hooks && "expand" in hooks ) {
  14205. value = hooks.expand( value );
  14206. delete props[ name ];
  14207. // Not quite $.extend, this won't overwrite existing keys.
  14208. // Reusing 'index' because we have the correct "name"
  14209. for ( index in value ) {
  14210. if ( !( index in props ) ) {
  14211. props[ index ] = value[ index ];
  14212. specialEasing[ index ] = easing;
  14213. }
  14214. }
  14215. } else {
  14216. specialEasing[ name ] = easing;
  14217. }
  14218. }
  14219. }
  14220. function Animation( elem, properties, options ) {
  14221. var result,
  14222. stopped,
  14223. index = 0,
  14224. length = Animation.prefilters.length,
  14225. deferred = jQuery.Deferred().always( function() {
  14226. // Don't match elem in the :animated selector
  14227. delete tick.elem;
  14228. } ),
  14229. tick = function() {
  14230. if ( stopped ) {
  14231. return false;
  14232. }
  14233. var currentTime = fxNow || createFxNow(),
  14234. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  14235. // Support: Android 2.3 only
  14236. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  14237. temp = remaining / animation.duration || 0,
  14238. percent = 1 - temp,
  14239. index = 0,
  14240. length = animation.tweens.length;
  14241. for ( ; index < length; index++ ) {
  14242. animation.tweens[ index ].run( percent );
  14243. }
  14244. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  14245. // If there's more to do, yield
  14246. if ( percent < 1 && length ) {
  14247. return remaining;
  14248. }
  14249. // If this was an empty animation, synthesize a final progress notification
  14250. if ( !length ) {
  14251. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  14252. }
  14253. // Resolve the animation and report its conclusion
  14254. deferred.resolveWith( elem, [ animation ] );
  14255. return false;
  14256. },
  14257. animation = deferred.promise( {
  14258. elem: elem,
  14259. props: jQuery.extend( {}, properties ),
  14260. opts: jQuery.extend( true, {
  14261. specialEasing: {},
  14262. easing: jQuery.easing._default
  14263. }, options ),
  14264. originalProperties: properties,
  14265. originalOptions: options,
  14266. startTime: fxNow || createFxNow(),
  14267. duration: options.duration,
  14268. tweens: [],
  14269. createTween: function( prop, end ) {
  14270. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  14271. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  14272. animation.tweens.push( tween );
  14273. return tween;
  14274. },
  14275. stop: function( gotoEnd ) {
  14276. var index = 0,
  14277. // If we are going to the end, we want to run all the tweens
  14278. // otherwise we skip this part
  14279. length = gotoEnd ? animation.tweens.length : 0;
  14280. if ( stopped ) {
  14281. return this;
  14282. }
  14283. stopped = true;
  14284. for ( ; index < length; index++ ) {
  14285. animation.tweens[ index ].run( 1 );
  14286. }
  14287. // Resolve when we played the last frame; otherwise, reject
  14288. if ( gotoEnd ) {
  14289. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  14290. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  14291. } else {
  14292. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  14293. }
  14294. return this;
  14295. }
  14296. } ),
  14297. props = animation.props;
  14298. propFilter( props, animation.opts.specialEasing );
  14299. for ( ; index < length; index++ ) {
  14300. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  14301. if ( result ) {
  14302. if ( isFunction( result.stop ) ) {
  14303. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  14304. result.stop.bind( result );
  14305. }
  14306. return result;
  14307. }
  14308. }
  14309. jQuery.map( props, createTween, animation );
  14310. if ( isFunction( animation.opts.start ) ) {
  14311. animation.opts.start.call( elem, animation );
  14312. }
  14313. // Attach callbacks from options
  14314. animation
  14315. .progress( animation.opts.progress )
  14316. .done( animation.opts.done, animation.opts.complete )
  14317. .fail( animation.opts.fail )
  14318. .always( animation.opts.always );
  14319. jQuery.fx.timer(
  14320. jQuery.extend( tick, {
  14321. elem: elem,
  14322. anim: animation,
  14323. queue: animation.opts.queue
  14324. } )
  14325. );
  14326. return animation;
  14327. }
  14328. jQuery.Animation = jQuery.extend( Animation, {
  14329. tweeners: {
  14330. "*": [ function( prop, value ) {
  14331. var tween = this.createTween( prop, value );
  14332. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  14333. return tween;
  14334. } ]
  14335. },
  14336. tweener: function( props, callback ) {
  14337. if ( isFunction( props ) ) {
  14338. callback = props;
  14339. props = [ "*" ];
  14340. } else {
  14341. props = props.match( rnothtmlwhite );
  14342. }
  14343. var prop,
  14344. index = 0,
  14345. length = props.length;
  14346. for ( ; index < length; index++ ) {
  14347. prop = props[ index ];
  14348. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  14349. Animation.tweeners[ prop ].unshift( callback );
  14350. }
  14351. },
  14352. prefilters: [ defaultPrefilter ],
  14353. prefilter: function( callback, prepend ) {
  14354. if ( prepend ) {
  14355. Animation.prefilters.unshift( callback );
  14356. } else {
  14357. Animation.prefilters.push( callback );
  14358. }
  14359. }
  14360. } );
  14361. jQuery.speed = function( speed, easing, fn ) {
  14362. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  14363. complete: fn || !fn && easing ||
  14364. isFunction( speed ) && speed,
  14365. duration: speed,
  14366. easing: fn && easing || easing && !isFunction( easing ) && easing
  14367. };
  14368. // Go to the end state if fx are off
  14369. if ( jQuery.fx.off ) {
  14370. opt.duration = 0;
  14371. } else {
  14372. if ( typeof opt.duration !== "number" ) {
  14373. if ( opt.duration in jQuery.fx.speeds ) {
  14374. opt.duration = jQuery.fx.speeds[ opt.duration ];
  14375. } else {
  14376. opt.duration = jQuery.fx.speeds._default;
  14377. }
  14378. }
  14379. }
  14380. // Normalize opt.queue - true/undefined/null -> "fx"
  14381. if ( opt.queue == null || opt.queue === true ) {
  14382. opt.queue = "fx";
  14383. }
  14384. // Queueing
  14385. opt.old = opt.complete;
  14386. opt.complete = function() {
  14387. if ( isFunction( opt.old ) ) {
  14388. opt.old.call( this );
  14389. }
  14390. if ( opt.queue ) {
  14391. jQuery.dequeue( this, opt.queue );
  14392. }
  14393. };
  14394. return opt;
  14395. };
  14396. jQuery.fn.extend( {
  14397. fadeTo: function( speed, to, easing, callback ) {
  14398. // Show any hidden elements after setting opacity to 0
  14399. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  14400. // Animate to the value specified
  14401. .end().animate( { opacity: to }, speed, easing, callback );
  14402. },
  14403. animate: function( prop, speed, easing, callback ) {
  14404. var empty = jQuery.isEmptyObject( prop ),
  14405. optall = jQuery.speed( speed, easing, callback ),
  14406. doAnimation = function() {
  14407. // Operate on a copy of prop so per-property easing won't be lost
  14408. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  14409. // Empty animations, or finishing resolves immediately
  14410. if ( empty || dataPriv.get( this, "finish" ) ) {
  14411. anim.stop( true );
  14412. }
  14413. };
  14414. doAnimation.finish = doAnimation;
  14415. return empty || optall.queue === false ?
  14416. this.each( doAnimation ) :
  14417. this.queue( optall.queue, doAnimation );
  14418. },
  14419. stop: function( type, clearQueue, gotoEnd ) {
  14420. var stopQueue = function( hooks ) {
  14421. var stop = hooks.stop;
  14422. delete hooks.stop;
  14423. stop( gotoEnd );
  14424. };
  14425. if ( typeof type !== "string" ) {
  14426. gotoEnd = clearQueue;
  14427. clearQueue = type;
  14428. type = undefined;
  14429. }
  14430. if ( clearQueue && type !== false ) {
  14431. this.queue( type || "fx", [] );
  14432. }
  14433. return this.each( function() {
  14434. var dequeue = true,
  14435. index = type != null && type + "queueHooks",
  14436. timers = jQuery.timers,
  14437. data = dataPriv.get( this );
  14438. if ( index ) {
  14439. if ( data[ index ] && data[ index ].stop ) {
  14440. stopQueue( data[ index ] );
  14441. }
  14442. } else {
  14443. for ( index in data ) {
  14444. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  14445. stopQueue( data[ index ] );
  14446. }
  14447. }
  14448. }
  14449. for ( index = timers.length; index--; ) {
  14450. if ( timers[ index ].elem === this &&
  14451. ( type == null || timers[ index ].queue === type ) ) {
  14452. timers[ index ].anim.stop( gotoEnd );
  14453. dequeue = false;
  14454. timers.splice( index, 1 );
  14455. }
  14456. }
  14457. // Start the next in the queue if the last step wasn't forced.
  14458. // Timers currently will call their complete callbacks, which
  14459. // will dequeue but only if they were gotoEnd.
  14460. if ( dequeue || !gotoEnd ) {
  14461. jQuery.dequeue( this, type );
  14462. }
  14463. } );
  14464. },
  14465. finish: function( type ) {
  14466. if ( type !== false ) {
  14467. type = type || "fx";
  14468. }
  14469. return this.each( function() {
  14470. var index,
  14471. data = dataPriv.get( this ),
  14472. queue = data[ type + "queue" ],
  14473. hooks = data[ type + "queueHooks" ],
  14474. timers = jQuery.timers,
  14475. length = queue ? queue.length : 0;
  14476. // Enable finishing flag on private data
  14477. data.finish = true;
  14478. // Empty the queue first
  14479. jQuery.queue( this, type, [] );
  14480. if ( hooks && hooks.stop ) {
  14481. hooks.stop.call( this, true );
  14482. }
  14483. // Look for any active animations, and finish them
  14484. for ( index = timers.length; index--; ) {
  14485. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  14486. timers[ index ].anim.stop( true );
  14487. timers.splice( index, 1 );
  14488. }
  14489. }
  14490. // Look for any animations in the old queue and finish them
  14491. for ( index = 0; index < length; index++ ) {
  14492. if ( queue[ index ] && queue[ index ].finish ) {
  14493. queue[ index ].finish.call( this );
  14494. }
  14495. }
  14496. // Turn off finishing flag
  14497. delete data.finish;
  14498. } );
  14499. }
  14500. } );
  14501. jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
  14502. var cssFn = jQuery.fn[ name ];
  14503. jQuery.fn[ name ] = function( speed, easing, callback ) {
  14504. return speed == null || typeof speed === "boolean" ?
  14505. cssFn.apply( this, arguments ) :
  14506. this.animate( genFx( name, true ), speed, easing, callback );
  14507. };
  14508. } );
  14509. // Generate shortcuts for custom animations
  14510. jQuery.each( {
  14511. slideDown: genFx( "show" ),
  14512. slideUp: genFx( "hide" ),
  14513. slideToggle: genFx( "toggle" ),
  14514. fadeIn: { opacity: "show" },
  14515. fadeOut: { opacity: "hide" },
  14516. fadeToggle: { opacity: "toggle" }
  14517. }, function( name, props ) {
  14518. jQuery.fn[ name ] = function( speed, easing, callback ) {
  14519. return this.animate( props, speed, easing, callback );
  14520. };
  14521. } );
  14522. jQuery.timers = [];
  14523. jQuery.fx.tick = function() {
  14524. var timer,
  14525. i = 0,
  14526. timers = jQuery.timers;
  14527. fxNow = Date.now();
  14528. for ( ; i < timers.length; i++ ) {
  14529. timer = timers[ i ];
  14530. // Run the timer and safely remove it when done (allowing for external removal)
  14531. if ( !timer() && timers[ i ] === timer ) {
  14532. timers.splice( i--, 1 );
  14533. }
  14534. }
  14535. if ( !timers.length ) {
  14536. jQuery.fx.stop();
  14537. }
  14538. fxNow = undefined;
  14539. };
  14540. jQuery.fx.timer = function( timer ) {
  14541. jQuery.timers.push( timer );
  14542. jQuery.fx.start();
  14543. };
  14544. jQuery.fx.interval = 13;
  14545. jQuery.fx.start = function() {
  14546. if ( inProgress ) {
  14547. return;
  14548. }
  14549. inProgress = true;
  14550. schedule();
  14551. };
  14552. jQuery.fx.stop = function() {
  14553. inProgress = null;
  14554. };
  14555. jQuery.fx.speeds = {
  14556. slow: 600,
  14557. fast: 200,
  14558. // Default speed
  14559. _default: 400
  14560. };
  14561. // Based off of the plugin by Clint Helfers, with permission.
  14562. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  14563. jQuery.fn.delay = function( time, type ) {
  14564. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  14565. type = type || "fx";
  14566. return this.queue( type, function( next, hooks ) {
  14567. var timeout = window.setTimeout( next, time );
  14568. hooks.stop = function() {
  14569. window.clearTimeout( timeout );
  14570. };
  14571. } );
  14572. };
  14573. ( function() {
  14574. var input = document.createElement( "input" ),
  14575. select = document.createElement( "select" ),
  14576. opt = select.appendChild( document.createElement( "option" ) );
  14577. input.type = "checkbox";
  14578. // Support: Android <=4.3 only
  14579. // Default value for a checkbox should be "on"
  14580. support.checkOn = input.value !== "";
  14581. // Support: IE <=11 only
  14582. // Must access selectedIndex to make default options select
  14583. support.optSelected = opt.selected;
  14584. // Support: IE <=11 only
  14585. // An input loses its value after becoming a radio
  14586. input = document.createElement( "input" );
  14587. input.value = "t";
  14588. input.type = "radio";
  14589. support.radioValue = input.value === "t";
  14590. } )();
  14591. var boolHook,
  14592. attrHandle = jQuery.expr.attrHandle;
  14593. jQuery.fn.extend( {
  14594. attr: function( name, value ) {
  14595. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  14596. },
  14597. removeAttr: function( name ) {
  14598. return this.each( function() {
  14599. jQuery.removeAttr( this, name );
  14600. } );
  14601. }
  14602. } );
  14603. jQuery.extend( {
  14604. attr: function( elem, name, value ) {
  14605. var ret, hooks,
  14606. nType = elem.nodeType;
  14607. // Don't get/set attributes on text, comment and attribute nodes
  14608. if ( nType === 3 || nType === 8 || nType === 2 ) {
  14609. return;
  14610. }
  14611. // Fallback to prop when attributes are not supported
  14612. if ( typeof elem.getAttribute === "undefined" ) {
  14613. return jQuery.prop( elem, name, value );
  14614. }
  14615. // Attribute hooks are determined by the lowercase version
  14616. // Grab necessary hook if one is defined
  14617. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  14618. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  14619. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  14620. }
  14621. if ( value !== undefined ) {
  14622. if ( value === null ) {
  14623. jQuery.removeAttr( elem, name );
  14624. return;
  14625. }
  14626. if ( hooks && "set" in hooks &&
  14627. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  14628. return ret;
  14629. }
  14630. elem.setAttribute( name, value + "" );
  14631. return value;
  14632. }
  14633. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  14634. return ret;
  14635. }
  14636. ret = jQuery.find.attr( elem, name );
  14637. // Non-existent attributes return null, we normalize to undefined
  14638. return ret == null ? undefined : ret;
  14639. },
  14640. attrHooks: {
  14641. type: {
  14642. set: function( elem, value ) {
  14643. if ( !support.radioValue && value === "radio" &&
  14644. nodeName( elem, "input" ) ) {
  14645. var val = elem.value;
  14646. elem.setAttribute( "type", value );
  14647. if ( val ) {
  14648. elem.value = val;
  14649. }
  14650. return value;
  14651. }
  14652. }
  14653. }
  14654. },
  14655. removeAttr: function( elem, value ) {
  14656. var name,
  14657. i = 0,
  14658. // Attribute names can contain non-HTML whitespace characters
  14659. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  14660. attrNames = value && value.match( rnothtmlwhite );
  14661. if ( attrNames && elem.nodeType === 1 ) {
  14662. while ( ( name = attrNames[ i++ ] ) ) {
  14663. elem.removeAttribute( name );
  14664. }
  14665. }
  14666. }
  14667. } );
  14668. // Hooks for boolean attributes
  14669. boolHook = {
  14670. set: function( elem, value, name ) {
  14671. if ( value === false ) {
  14672. // Remove boolean attributes when set to false
  14673. jQuery.removeAttr( elem, name );
  14674. } else {
  14675. elem.setAttribute( name, name );
  14676. }
  14677. return name;
  14678. }
  14679. };
  14680. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  14681. var getter = attrHandle[ name ] || jQuery.find.attr;
  14682. attrHandle[ name ] = function( elem, name, isXML ) {
  14683. var ret, handle,
  14684. lowercaseName = name.toLowerCase();
  14685. if ( !isXML ) {
  14686. // Avoid an infinite loop by temporarily removing this function from the getter
  14687. handle = attrHandle[ lowercaseName ];
  14688. attrHandle[ lowercaseName ] = ret;
  14689. ret = getter( elem, name, isXML ) != null ?
  14690. lowercaseName :
  14691. null;
  14692. attrHandle[ lowercaseName ] = handle;
  14693. }
  14694. return ret;
  14695. };
  14696. } );
  14697. var rfocusable = /^(?:input|select|textarea|button)$/i,
  14698. rclickable = /^(?:a|area)$/i;
  14699. jQuery.fn.extend( {
  14700. prop: function( name, value ) {
  14701. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  14702. },
  14703. removeProp: function( name ) {
  14704. return this.each( function() {
  14705. delete this[ jQuery.propFix[ name ] || name ];
  14706. } );
  14707. }
  14708. } );
  14709. jQuery.extend( {
  14710. prop: function( elem, name, value ) {
  14711. var ret, hooks,
  14712. nType = elem.nodeType;
  14713. // Don't get/set properties on text, comment and attribute nodes
  14714. if ( nType === 3 || nType === 8 || nType === 2 ) {
  14715. return;
  14716. }
  14717. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  14718. // Fix name and attach hooks
  14719. name = jQuery.propFix[ name ] || name;
  14720. hooks = jQuery.propHooks[ name ];
  14721. }
  14722. if ( value !== undefined ) {
  14723. if ( hooks && "set" in hooks &&
  14724. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  14725. return ret;
  14726. }
  14727. return ( elem[ name ] = value );
  14728. }
  14729. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  14730. return ret;
  14731. }
  14732. return elem[ name ];
  14733. },
  14734. propHooks: {
  14735. tabIndex: {
  14736. get: function( elem ) {
  14737. // Support: IE <=9 - 11 only
  14738. // elem.tabIndex doesn't always return the
  14739. // correct value when it hasn't been explicitly set
  14740. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  14741. // Use proper attribute retrieval(#12072)
  14742. var tabindex = jQuery.find.attr( elem, "tabindex" );
  14743. if ( tabindex ) {
  14744. return parseInt( tabindex, 10 );
  14745. }
  14746. if (
  14747. rfocusable.test( elem.nodeName ) ||
  14748. rclickable.test( elem.nodeName ) &&
  14749. elem.href
  14750. ) {
  14751. return 0;
  14752. }
  14753. return -1;
  14754. }
  14755. }
  14756. },
  14757. propFix: {
  14758. "for": "htmlFor",
  14759. "class": "className"
  14760. }
  14761. } );
  14762. // Support: IE <=11 only
  14763. // Accessing the selectedIndex property
  14764. // forces the browser to respect setting selected
  14765. // on the option
  14766. // The getter ensures a default option is selected
  14767. // when in an optgroup
  14768. // eslint rule "no-unused-expressions" is disabled for this code
  14769. // since it considers such accessions noop
  14770. if ( !support.optSelected ) {
  14771. jQuery.propHooks.selected = {
  14772. get: function( elem ) {
  14773. /* eslint no-unused-expressions: "off" */
  14774. var parent = elem.parentNode;
  14775. if ( parent && parent.parentNode ) {
  14776. parent.parentNode.selectedIndex;
  14777. }
  14778. return null;
  14779. },
  14780. set: function( elem ) {
  14781. /* eslint no-unused-expressions: "off" */
  14782. var parent = elem.parentNode;
  14783. if ( parent ) {
  14784. parent.selectedIndex;
  14785. if ( parent.parentNode ) {
  14786. parent.parentNode.selectedIndex;
  14787. }
  14788. }
  14789. }
  14790. };
  14791. }
  14792. jQuery.each( [
  14793. "tabIndex",
  14794. "readOnly",
  14795. "maxLength",
  14796. "cellSpacing",
  14797. "cellPadding",
  14798. "rowSpan",
  14799. "colSpan",
  14800. "useMap",
  14801. "frameBorder",
  14802. "contentEditable"
  14803. ], function() {
  14804. jQuery.propFix[ this.toLowerCase() ] = this;
  14805. } );
  14806. // Strip and collapse whitespace according to HTML spec
  14807. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  14808. function stripAndCollapse( value ) {
  14809. var tokens = value.match( rnothtmlwhite ) || [];
  14810. return tokens.join( " " );
  14811. }
  14812. function getClass( elem ) {
  14813. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  14814. }
  14815. function classesToArray( value ) {
  14816. if ( Array.isArray( value ) ) {
  14817. return value;
  14818. }
  14819. if ( typeof value === "string" ) {
  14820. return value.match( rnothtmlwhite ) || [];
  14821. }
  14822. return [];
  14823. }
  14824. jQuery.fn.extend( {
  14825. addClass: function( value ) {
  14826. var classes, elem, cur, curValue, clazz, j, finalValue,
  14827. i = 0;
  14828. if ( isFunction( value ) ) {
  14829. return this.each( function( j ) {
  14830. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  14831. } );
  14832. }
  14833. classes = classesToArray( value );
  14834. if ( classes.length ) {
  14835. while ( ( elem = this[ i++ ] ) ) {
  14836. curValue = getClass( elem );
  14837. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  14838. if ( cur ) {
  14839. j = 0;
  14840. while ( ( clazz = classes[ j++ ] ) ) {
  14841. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  14842. cur += clazz + " ";
  14843. }
  14844. }
  14845. // Only assign if different to avoid unneeded rendering.
  14846. finalValue = stripAndCollapse( cur );
  14847. if ( curValue !== finalValue ) {
  14848. elem.setAttribute( "class", finalValue );
  14849. }
  14850. }
  14851. }
  14852. }
  14853. return this;
  14854. },
  14855. removeClass: function( value ) {
  14856. var classes, elem, cur, curValue, clazz, j, finalValue,
  14857. i = 0;
  14858. if ( isFunction( value ) ) {
  14859. return this.each( function( j ) {
  14860. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  14861. } );
  14862. }
  14863. if ( !arguments.length ) {
  14864. return this.attr( "class", "" );
  14865. }
  14866. classes = classesToArray( value );
  14867. if ( classes.length ) {
  14868. while ( ( elem = this[ i++ ] ) ) {
  14869. curValue = getClass( elem );
  14870. // This expression is here for better compressibility (see addClass)
  14871. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  14872. if ( cur ) {
  14873. j = 0;
  14874. while ( ( clazz = classes[ j++ ] ) ) {
  14875. // Remove *all* instances
  14876. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  14877. cur = cur.replace( " " + clazz + " ", " " );
  14878. }
  14879. }
  14880. // Only assign if different to avoid unneeded rendering.
  14881. finalValue = stripAndCollapse( cur );
  14882. if ( curValue !== finalValue ) {
  14883. elem.setAttribute( "class", finalValue );
  14884. }
  14885. }
  14886. }
  14887. }
  14888. return this;
  14889. },
  14890. toggleClass: function( value, stateVal ) {
  14891. var type = typeof value,
  14892. isValidValue = type === "string" || Array.isArray( value );
  14893. if ( typeof stateVal === "boolean" && isValidValue ) {
  14894. return stateVal ? this.addClass( value ) : this.removeClass( value );
  14895. }
  14896. if ( isFunction( value ) ) {
  14897. return this.each( function( i ) {
  14898. jQuery( this ).toggleClass(
  14899. value.call( this, i, getClass( this ), stateVal ),
  14900. stateVal
  14901. );
  14902. } );
  14903. }
  14904. return this.each( function() {
  14905. var className, i, self, classNames;
  14906. if ( isValidValue ) {
  14907. // Toggle individual class names
  14908. i = 0;
  14909. self = jQuery( this );
  14910. classNames = classesToArray( value );
  14911. while ( ( className = classNames[ i++ ] ) ) {
  14912. // Check each className given, space separated list
  14913. if ( self.hasClass( className ) ) {
  14914. self.removeClass( className );
  14915. } else {
  14916. self.addClass( className );
  14917. }
  14918. }
  14919. // Toggle whole class name
  14920. } else if ( value === undefined || type === "boolean" ) {
  14921. className = getClass( this );
  14922. if ( className ) {
  14923. // Store className if set
  14924. dataPriv.set( this, "__className__", className );
  14925. }
  14926. // If the element has a class name or if we're passed `false`,
  14927. // then remove the whole classname (if there was one, the above saved it).
  14928. // Otherwise bring back whatever was previously saved (if anything),
  14929. // falling back to the empty string if nothing was stored.
  14930. if ( this.setAttribute ) {
  14931. this.setAttribute( "class",
  14932. className || value === false ?
  14933. "" :
  14934. dataPriv.get( this, "__className__" ) || ""
  14935. );
  14936. }
  14937. }
  14938. } );
  14939. },
  14940. hasClass: function( selector ) {
  14941. var className, elem,
  14942. i = 0;
  14943. className = " " + selector + " ";
  14944. while ( ( elem = this[ i++ ] ) ) {
  14945. if ( elem.nodeType === 1 &&
  14946. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  14947. return true;
  14948. }
  14949. }
  14950. return false;
  14951. }
  14952. } );
  14953. var rreturn = /\r/g;
  14954. jQuery.fn.extend( {
  14955. val: function( value ) {
  14956. var hooks, ret, valueIsFunction,
  14957. elem = this[ 0 ];
  14958. if ( !arguments.length ) {
  14959. if ( elem ) {
  14960. hooks = jQuery.valHooks[ elem.type ] ||
  14961. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  14962. if ( hooks &&
  14963. "get" in hooks &&
  14964. ( ret = hooks.get( elem, "value" ) ) !== undefined
  14965. ) {
  14966. return ret;
  14967. }
  14968. ret = elem.value;
  14969. // Handle most common string cases
  14970. if ( typeof ret === "string" ) {
  14971. return ret.replace( rreturn, "" );
  14972. }
  14973. // Handle cases where value is null/undef or number
  14974. return ret == null ? "" : ret;
  14975. }
  14976. return;
  14977. }
  14978. valueIsFunction = isFunction( value );
  14979. return this.each( function( i ) {
  14980. var val;
  14981. if ( this.nodeType !== 1 ) {
  14982. return;
  14983. }
  14984. if ( valueIsFunction ) {
  14985. val = value.call( this, i, jQuery( this ).val() );
  14986. } else {
  14987. val = value;
  14988. }
  14989. // Treat null/undefined as ""; convert numbers to string
  14990. if ( val == null ) {
  14991. val = "";
  14992. } else if ( typeof val === "number" ) {
  14993. val += "";
  14994. } else if ( Array.isArray( val ) ) {
  14995. val = jQuery.map( val, function( value ) {
  14996. return value == null ? "" : value + "";
  14997. } );
  14998. }
  14999. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  15000. // If set returns undefined, fall back to normal setting
  15001. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  15002. this.value = val;
  15003. }
  15004. } );
  15005. }
  15006. } );
  15007. jQuery.extend( {
  15008. valHooks: {
  15009. option: {
  15010. get: function( elem ) {
  15011. var val = jQuery.find.attr( elem, "value" );
  15012. return val != null ?
  15013. val :
  15014. // Support: IE <=10 - 11 only
  15015. // option.text throws exceptions (#14686, #14858)
  15016. // Strip and collapse whitespace
  15017. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  15018. stripAndCollapse( jQuery.text( elem ) );
  15019. }
  15020. },
  15021. select: {
  15022. get: function( elem ) {
  15023. var value, option, i,
  15024. options = elem.options,
  15025. index = elem.selectedIndex,
  15026. one = elem.type === "select-one",
  15027. values = one ? null : [],
  15028. max = one ? index + 1 : options.length;
  15029. if ( index < 0 ) {
  15030. i = max;
  15031. } else {
  15032. i = one ? index : 0;
  15033. }
  15034. // Loop through all the selected options
  15035. for ( ; i < max; i++ ) {
  15036. option = options[ i ];
  15037. // Support: IE <=9 only
  15038. // IE8-9 doesn't update selected after form reset (#2551)
  15039. if ( ( option.selected || i === index ) &&
  15040. // Don't return options that are disabled or in a disabled optgroup
  15041. !option.disabled &&
  15042. ( !option.parentNode.disabled ||
  15043. !nodeName( option.parentNode, "optgroup" ) ) ) {
  15044. // Get the specific value for the option
  15045. value = jQuery( option ).val();
  15046. // We don't need an array for one selects
  15047. if ( one ) {
  15048. return value;
  15049. }
  15050. // Multi-Selects return an array
  15051. values.push( value );
  15052. }
  15053. }
  15054. return values;
  15055. },
  15056. set: function( elem, value ) {
  15057. var optionSet, option,
  15058. options = elem.options,
  15059. values = jQuery.makeArray( value ),
  15060. i = options.length;
  15061. while ( i-- ) {
  15062. option = options[ i ];
  15063. /* eslint-disable no-cond-assign */
  15064. if ( option.selected =
  15065. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  15066. ) {
  15067. optionSet = true;
  15068. }
  15069. /* eslint-enable no-cond-assign */
  15070. }
  15071. // Force browsers to behave consistently when non-matching value is set
  15072. if ( !optionSet ) {
  15073. elem.selectedIndex = -1;
  15074. }
  15075. return values;
  15076. }
  15077. }
  15078. }
  15079. } );
  15080. // Radios and checkboxes getter/setter
  15081. jQuery.each( [ "radio", "checkbox" ], function() {
  15082. jQuery.valHooks[ this ] = {
  15083. set: function( elem, value ) {
  15084. if ( Array.isArray( value ) ) {
  15085. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  15086. }
  15087. }
  15088. };
  15089. if ( !support.checkOn ) {
  15090. jQuery.valHooks[ this ].get = function( elem ) {
  15091. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  15092. };
  15093. }
  15094. } );
  15095. // Return jQuery for attributes-only inclusion
  15096. support.focusin = "onfocusin" in window;
  15097. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  15098. stopPropagationCallback = function( e ) {
  15099. e.stopPropagation();
  15100. };
  15101. jQuery.extend( jQuery.event, {
  15102. trigger: function( event, data, elem, onlyHandlers ) {
  15103. var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
  15104. eventPath = [ elem || document ],
  15105. type = hasOwn.call( event, "type" ) ? event.type : event,
  15106. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  15107. cur = lastElement = tmp = elem = elem || document;
  15108. // Don't do events on text and comment nodes
  15109. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  15110. return;
  15111. }
  15112. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  15113. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  15114. return;
  15115. }
  15116. if ( type.indexOf( "." ) > -1 ) {
  15117. // Namespaced trigger; create a regexp to match event type in handle()
  15118. namespaces = type.split( "." );
  15119. type = namespaces.shift();
  15120. namespaces.sort();
  15121. }
  15122. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  15123. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  15124. event = event[ jQuery.expando ] ?
  15125. event :
  15126. new jQuery.Event( type, typeof event === "object" && event );
  15127. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  15128. event.isTrigger = onlyHandlers ? 2 : 3;
  15129. event.namespace = namespaces.join( "." );
  15130. event.rnamespace = event.namespace ?
  15131. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  15132. null;
  15133. // Clean up the event in case it is being reused
  15134. event.result = undefined;
  15135. if ( !event.target ) {
  15136. event.target = elem;
  15137. }
  15138. // Clone any incoming data and prepend the event, creating the handler arg list
  15139. data = data == null ?
  15140. [ event ] :
  15141. jQuery.makeArray( data, [ event ] );
  15142. // Allow special events to draw outside the lines
  15143. special = jQuery.event.special[ type ] || {};
  15144. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  15145. return;
  15146. }
  15147. // Determine event propagation path in advance, per W3C events spec (#9951)
  15148. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  15149. if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
  15150. bubbleType = special.delegateType || type;
  15151. if ( !rfocusMorph.test( bubbleType + type ) ) {
  15152. cur = cur.parentNode;
  15153. }
  15154. for ( ; cur; cur = cur.parentNode ) {
  15155. eventPath.push( cur );
  15156. tmp = cur;
  15157. }
  15158. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  15159. if ( tmp === ( elem.ownerDocument || document ) ) {
  15160. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  15161. }
  15162. }
  15163. // Fire handlers on the event path
  15164. i = 0;
  15165. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  15166. lastElement = cur;
  15167. event.type = i > 1 ?
  15168. bubbleType :
  15169. special.bindType || type;
  15170. // jQuery handler
  15171. handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
  15172. dataPriv.get( cur, "handle" );
  15173. if ( handle ) {
  15174. handle.apply( cur, data );
  15175. }
  15176. // Native handler
  15177. handle = ontype && cur[ ontype ];
  15178. if ( handle && handle.apply && acceptData( cur ) ) {
  15179. event.result = handle.apply( cur, data );
  15180. if ( event.result === false ) {
  15181. event.preventDefault();
  15182. }
  15183. }
  15184. }
  15185. event.type = type;
  15186. // If nobody prevented the default action, do it now
  15187. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  15188. if ( ( !special._default ||
  15189. special._default.apply( eventPath.pop(), data ) === false ) &&
  15190. acceptData( elem ) ) {
  15191. // Call a native DOM method on the target with the same name as the event.
  15192. // Don't do default actions on window, that's where global variables be (#6170)
  15193. if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
  15194. // Don't re-trigger an onFOO event when we call its FOO() method
  15195. tmp = elem[ ontype ];
  15196. if ( tmp ) {
  15197. elem[ ontype ] = null;
  15198. }
  15199. // Prevent re-triggering of the same event, since we already bubbled it above
  15200. jQuery.event.triggered = type;
  15201. if ( event.isPropagationStopped() ) {
  15202. lastElement.addEventListener( type, stopPropagationCallback );
  15203. }
  15204. elem[ type ]();
  15205. if ( event.isPropagationStopped() ) {
  15206. lastElement.removeEventListener( type, stopPropagationCallback );
  15207. }
  15208. jQuery.event.triggered = undefined;
  15209. if ( tmp ) {
  15210. elem[ ontype ] = tmp;
  15211. }
  15212. }
  15213. }
  15214. }
  15215. return event.result;
  15216. },
  15217. // Piggyback on a donor event to simulate a different one
  15218. // Used only for `focus(in | out)` events
  15219. simulate: function( type, elem, event ) {
  15220. var e = jQuery.extend(
  15221. new jQuery.Event(),
  15222. event,
  15223. {
  15224. type: type,
  15225. isSimulated: true
  15226. }
  15227. );
  15228. jQuery.event.trigger( e, null, elem );
  15229. }
  15230. } );
  15231. jQuery.fn.extend( {
  15232. trigger: function( type, data ) {
  15233. return this.each( function() {
  15234. jQuery.event.trigger( type, data, this );
  15235. } );
  15236. },
  15237. triggerHandler: function( type, data ) {
  15238. var elem = this[ 0 ];
  15239. if ( elem ) {
  15240. return jQuery.event.trigger( type, data, elem, true );
  15241. }
  15242. }
  15243. } );
  15244. // Support: Firefox <=44
  15245. // Firefox doesn't have focus(in | out) events
  15246. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  15247. //
  15248. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  15249. // focus(in | out) events fire after focus & blur events,
  15250. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  15251. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  15252. if ( !support.focusin ) {
  15253. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  15254. // Attach a single capturing handler on the document while someone wants focusin/focusout
  15255. var handler = function( event ) {
  15256. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  15257. };
  15258. jQuery.event.special[ fix ] = {
  15259. setup: function() {
  15260. var doc = this.ownerDocument || this,
  15261. attaches = dataPriv.access( doc, fix );
  15262. if ( !attaches ) {
  15263. doc.addEventListener( orig, handler, true );
  15264. }
  15265. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  15266. },
  15267. teardown: function() {
  15268. var doc = this.ownerDocument || this,
  15269. attaches = dataPriv.access( doc, fix ) - 1;
  15270. if ( !attaches ) {
  15271. doc.removeEventListener( orig, handler, true );
  15272. dataPriv.remove( doc, fix );
  15273. } else {
  15274. dataPriv.access( doc, fix, attaches );
  15275. }
  15276. }
  15277. };
  15278. } );
  15279. }
  15280. var location = window.location;
  15281. var nonce = Date.now();
  15282. var rquery = ( /\?/ );
  15283. // Cross-browser xml parsing
  15284. jQuery.parseXML = function( data ) {
  15285. var xml;
  15286. if ( !data || typeof data !== "string" ) {
  15287. return null;
  15288. }
  15289. // Support: IE 9 - 11 only
  15290. // IE throws on parseFromString with invalid input.
  15291. try {
  15292. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  15293. } catch ( e ) {
  15294. xml = undefined;
  15295. }
  15296. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  15297. jQuery.error( "Invalid XML: " + data );
  15298. }
  15299. return xml;
  15300. };
  15301. var
  15302. rbracket = /\[\]$/,
  15303. rCRLF = /\r?\n/g,
  15304. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  15305. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  15306. function buildParams( prefix, obj, traditional, add ) {
  15307. var name;
  15308. if ( Array.isArray( obj ) ) {
  15309. // Serialize array item.
  15310. jQuery.each( obj, function( i, v ) {
  15311. if ( traditional || rbracket.test( prefix ) ) {
  15312. // Treat each array item as a scalar.
  15313. add( prefix, v );
  15314. } else {
  15315. // Item is non-scalar (array or object), encode its numeric index.
  15316. buildParams(
  15317. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  15318. v,
  15319. traditional,
  15320. add
  15321. );
  15322. }
  15323. } );
  15324. } else if ( !traditional && toType( obj ) === "object" ) {
  15325. // Serialize object item.
  15326. for ( name in obj ) {
  15327. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  15328. }
  15329. } else {
  15330. // Serialize scalar item.
  15331. add( prefix, obj );
  15332. }
  15333. }
  15334. // Serialize an array of form elements or a set of
  15335. // key/values into a query string
  15336. jQuery.param = function( a, traditional ) {
  15337. var prefix,
  15338. s = [],
  15339. add = function( key, valueOrFunction ) {
  15340. // If value is a function, invoke it and use its return value
  15341. var value = isFunction( valueOrFunction ) ?
  15342. valueOrFunction() :
  15343. valueOrFunction;
  15344. s[ s.length ] = encodeURIComponent( key ) + "=" +
  15345. encodeURIComponent( value == null ? "" : value );
  15346. };
  15347. if ( a == null ) {
  15348. return "";
  15349. }
  15350. // If an array was passed in, assume that it is an array of form elements.
  15351. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  15352. // Serialize the form elements
  15353. jQuery.each( a, function() {
  15354. add( this.name, this.value );
  15355. } );
  15356. } else {
  15357. // If traditional, encode the "old" way (the way 1.3.2 or older
  15358. // did it), otherwise encode params recursively.
  15359. for ( prefix in a ) {
  15360. buildParams( prefix, a[ prefix ], traditional, add );
  15361. }
  15362. }
  15363. // Return the resulting serialization
  15364. return s.join( "&" );
  15365. };
  15366. jQuery.fn.extend( {
  15367. serialize: function() {
  15368. return jQuery.param( this.serializeArray() );
  15369. },
  15370. serializeArray: function() {
  15371. return this.map( function() {
  15372. // Can add propHook for "elements" to filter or add form elements
  15373. var elements = jQuery.prop( this, "elements" );
  15374. return elements ? jQuery.makeArray( elements ) : this;
  15375. } )
  15376. .filter( function() {
  15377. var type = this.type;
  15378. // Use .is( ":disabled" ) so that fieldset[disabled] works
  15379. return this.name && !jQuery( this ).is( ":disabled" ) &&
  15380. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  15381. ( this.checked || !rcheckableType.test( type ) );
  15382. } )
  15383. .map( function( i, elem ) {
  15384. var val = jQuery( this ).val();
  15385. if ( val == null ) {
  15386. return null;
  15387. }
  15388. if ( Array.isArray( val ) ) {
  15389. return jQuery.map( val, function( val ) {
  15390. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  15391. } );
  15392. }
  15393. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  15394. } ).get();
  15395. }
  15396. } );
  15397. var
  15398. r20 = /%20/g,
  15399. rhash = /#.*$/,
  15400. rantiCache = /([?&])_=[^&]*/,
  15401. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  15402. // #7653, #8125, #8152: local protocol detection
  15403. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  15404. rnoContent = /^(?:GET|HEAD)$/,
  15405. rprotocol = /^\/\//,
  15406. /* Prefilters
  15407. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  15408. * 2) These are called:
  15409. * - BEFORE asking for a transport
  15410. * - AFTER param serialization (s.data is a string if s.processData is true)
  15411. * 3) key is the dataType
  15412. * 4) the catchall symbol "*" can be used
  15413. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  15414. */
  15415. prefilters = {},
  15416. /* Transports bindings
  15417. * 1) key is the dataType
  15418. * 2) the catchall symbol "*" can be used
  15419. * 3) selection will start with transport dataType and THEN go to "*" if needed
  15420. */
  15421. transports = {},
  15422. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  15423. allTypes = "*/".concat( "*" ),
  15424. // Anchor tag for parsing the document origin
  15425. originAnchor = document.createElement( "a" );
  15426. originAnchor.href = location.href;
  15427. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  15428. function addToPrefiltersOrTransports( structure ) {
  15429. // dataTypeExpression is optional and defaults to "*"
  15430. return function( dataTypeExpression, func ) {
  15431. if ( typeof dataTypeExpression !== "string" ) {
  15432. func = dataTypeExpression;
  15433. dataTypeExpression = "*";
  15434. }
  15435. var dataType,
  15436. i = 0,
  15437. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  15438. if ( isFunction( func ) ) {
  15439. // For each dataType in the dataTypeExpression
  15440. while ( ( dataType = dataTypes[ i++ ] ) ) {
  15441. // Prepend if requested
  15442. if ( dataType[ 0 ] === "+" ) {
  15443. dataType = dataType.slice( 1 ) || "*";
  15444. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  15445. // Otherwise append
  15446. } else {
  15447. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  15448. }
  15449. }
  15450. }
  15451. };
  15452. }
  15453. // Base inspection function for prefilters and transports
  15454. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  15455. var inspected = {},
  15456. seekingTransport = ( structure === transports );
  15457. function inspect( dataType ) {
  15458. var selected;
  15459. inspected[ dataType ] = true;
  15460. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  15461. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  15462. if ( typeof dataTypeOrTransport === "string" &&
  15463. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  15464. options.dataTypes.unshift( dataTypeOrTransport );
  15465. inspect( dataTypeOrTransport );
  15466. return false;
  15467. } else if ( seekingTransport ) {
  15468. return !( selected = dataTypeOrTransport );
  15469. }
  15470. } );
  15471. return selected;
  15472. }
  15473. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  15474. }
  15475. // A special extend for ajax options
  15476. // that takes "flat" options (not to be deep extended)
  15477. // Fixes #9887
  15478. function ajaxExtend( target, src ) {
  15479. var key, deep,
  15480. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  15481. for ( key in src ) {
  15482. if ( src[ key ] !== undefined ) {
  15483. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  15484. }
  15485. }
  15486. if ( deep ) {
  15487. jQuery.extend( true, target, deep );
  15488. }
  15489. return target;
  15490. }
  15491. /* Handles responses to an ajax request:
  15492. * - finds the right dataType (mediates between content-type and expected dataType)
  15493. * - returns the corresponding response
  15494. */
  15495. function ajaxHandleResponses( s, jqXHR, responses ) {
  15496. var ct, type, finalDataType, firstDataType,
  15497. contents = s.contents,
  15498. dataTypes = s.dataTypes;
  15499. // Remove auto dataType and get content-type in the process
  15500. while ( dataTypes[ 0 ] === "*" ) {
  15501. dataTypes.shift();
  15502. if ( ct === undefined ) {
  15503. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  15504. }
  15505. }
  15506. // Check if we're dealing with a known content-type
  15507. if ( ct ) {
  15508. for ( type in contents ) {
  15509. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  15510. dataTypes.unshift( type );
  15511. break;
  15512. }
  15513. }
  15514. }
  15515. // Check to see if we have a response for the expected dataType
  15516. if ( dataTypes[ 0 ] in responses ) {
  15517. finalDataType = dataTypes[ 0 ];
  15518. } else {
  15519. // Try convertible dataTypes
  15520. for ( type in responses ) {
  15521. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  15522. finalDataType = type;
  15523. break;
  15524. }
  15525. if ( !firstDataType ) {
  15526. firstDataType = type;
  15527. }
  15528. }
  15529. // Or just use first one
  15530. finalDataType = finalDataType || firstDataType;
  15531. }
  15532. // If we found a dataType
  15533. // We add the dataType to the list if needed
  15534. // and return the corresponding response
  15535. if ( finalDataType ) {
  15536. if ( finalDataType !== dataTypes[ 0 ] ) {
  15537. dataTypes.unshift( finalDataType );
  15538. }
  15539. return responses[ finalDataType ];
  15540. }
  15541. }
  15542. /* Chain conversions given the request and the original response
  15543. * Also sets the responseXXX fields on the jqXHR instance
  15544. */
  15545. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  15546. var conv2, current, conv, tmp, prev,
  15547. converters = {},
  15548. // Work with a copy of dataTypes in case we need to modify it for conversion
  15549. dataTypes = s.dataTypes.slice();
  15550. // Create converters map with lowercased keys
  15551. if ( dataTypes[ 1 ] ) {
  15552. for ( conv in s.converters ) {
  15553. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  15554. }
  15555. }
  15556. current = dataTypes.shift();
  15557. // Convert to each sequential dataType
  15558. while ( current ) {
  15559. if ( s.responseFields[ current ] ) {
  15560. jqXHR[ s.responseFields[ current ] ] = response;
  15561. }
  15562. // Apply the dataFilter if provided
  15563. if ( !prev && isSuccess && s.dataFilter ) {
  15564. response = s.dataFilter( response, s.dataType );
  15565. }
  15566. prev = current;
  15567. current = dataTypes.shift();
  15568. if ( current ) {
  15569. // There's only work to do if current dataType is non-auto
  15570. if ( current === "*" ) {
  15571. current = prev;
  15572. // Convert response if prev dataType is non-auto and differs from current
  15573. } else if ( prev !== "*" && prev !== current ) {
  15574. // Seek a direct converter
  15575. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  15576. // If none found, seek a pair
  15577. if ( !conv ) {
  15578. for ( conv2 in converters ) {
  15579. // If conv2 outputs current
  15580. tmp = conv2.split( " " );
  15581. if ( tmp[ 1 ] === current ) {
  15582. // If prev can be converted to accepted input
  15583. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  15584. converters[ "* " + tmp[ 0 ] ];
  15585. if ( conv ) {
  15586. // Condense equivalence converters
  15587. if ( conv === true ) {
  15588. conv = converters[ conv2 ];
  15589. // Otherwise, insert the intermediate dataType
  15590. } else if ( converters[ conv2 ] !== true ) {
  15591. current = tmp[ 0 ];
  15592. dataTypes.unshift( tmp[ 1 ] );
  15593. }
  15594. break;
  15595. }
  15596. }
  15597. }
  15598. }
  15599. // Apply converter (if not an equivalence)
  15600. if ( conv !== true ) {
  15601. // Unless errors are allowed to bubble, catch and return them
  15602. if ( conv && s.throws ) {
  15603. response = conv( response );
  15604. } else {
  15605. try {
  15606. response = conv( response );
  15607. } catch ( e ) {
  15608. return {
  15609. state: "parsererror",
  15610. error: conv ? e : "No conversion from " + prev + " to " + current
  15611. };
  15612. }
  15613. }
  15614. }
  15615. }
  15616. }
  15617. }
  15618. return { state: "success", data: response };
  15619. }
  15620. jQuery.extend( {
  15621. // Counter for holding the number of active queries
  15622. active: 0,
  15623. // Last-Modified header cache for next request
  15624. lastModified: {},
  15625. etag: {},
  15626. ajaxSettings: {
  15627. url: location.href,
  15628. type: "GET",
  15629. isLocal: rlocalProtocol.test( location.protocol ),
  15630. global: true,
  15631. processData: true,
  15632. async: true,
  15633. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  15634. /*
  15635. timeout: 0,
  15636. data: null,
  15637. dataType: null,
  15638. username: null,
  15639. password: null,
  15640. cache: null,
  15641. throws: false,
  15642. traditional: false,
  15643. headers: {},
  15644. */
  15645. accepts: {
  15646. "*": allTypes,
  15647. text: "text/plain",
  15648. html: "text/html",
  15649. xml: "application/xml, text/xml",
  15650. json: "application/json, text/javascript"
  15651. },
  15652. contents: {
  15653. xml: /\bxml\b/,
  15654. html: /\bhtml/,
  15655. json: /\bjson\b/
  15656. },
  15657. responseFields: {
  15658. xml: "responseXML",
  15659. text: "responseText",
  15660. json: "responseJSON"
  15661. },
  15662. // Data converters
  15663. // Keys separate source (or catchall "*") and destination types with a single space
  15664. converters: {
  15665. // Convert anything to text
  15666. "* text": String,
  15667. // Text to html (true = no transformation)
  15668. "text html": true,
  15669. // Evaluate text as a json expression
  15670. "text json": JSON.parse,
  15671. // Parse text as xml
  15672. "text xml": jQuery.parseXML
  15673. },
  15674. // For options that shouldn't be deep extended:
  15675. // you can add your own custom options here if
  15676. // and when you create one that shouldn't be
  15677. // deep extended (see ajaxExtend)
  15678. flatOptions: {
  15679. url: true,
  15680. context: true
  15681. }
  15682. },
  15683. // Creates a full fledged settings object into target
  15684. // with both ajaxSettings and settings fields.
  15685. // If target is omitted, writes into ajaxSettings.
  15686. ajaxSetup: function( target, settings ) {
  15687. return settings ?
  15688. // Building a settings object
  15689. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  15690. // Extending ajaxSettings
  15691. ajaxExtend( jQuery.ajaxSettings, target );
  15692. },
  15693. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  15694. ajaxTransport: addToPrefiltersOrTransports( transports ),
  15695. // Main method
  15696. ajax: function( url, options ) {
  15697. // If url is an object, simulate pre-1.5 signature
  15698. if ( typeof url === "object" ) {
  15699. options = url;
  15700. url = undefined;
  15701. }
  15702. // Force options to be an object
  15703. options = options || {};
  15704. var transport,
  15705. // URL without anti-cache param
  15706. cacheURL,
  15707. // Response headers
  15708. responseHeadersString,
  15709. responseHeaders,
  15710. // timeout handle
  15711. timeoutTimer,
  15712. // Url cleanup var
  15713. urlAnchor,
  15714. // Request state (becomes false upon send and true upon completion)
  15715. completed,
  15716. // To know if global events are to be dispatched
  15717. fireGlobals,
  15718. // Loop variable
  15719. i,
  15720. // uncached part of the url
  15721. uncached,
  15722. // Create the final options object
  15723. s = jQuery.ajaxSetup( {}, options ),
  15724. // Callbacks context
  15725. callbackContext = s.context || s,
  15726. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  15727. globalEventContext = s.context &&
  15728. ( callbackContext.nodeType || callbackContext.jquery ) ?
  15729. jQuery( callbackContext ) :
  15730. jQuery.event,
  15731. // Deferreds
  15732. deferred = jQuery.Deferred(),
  15733. completeDeferred = jQuery.Callbacks( "once memory" ),
  15734. // Status-dependent callbacks
  15735. statusCode = s.statusCode || {},
  15736. // Headers (they are sent all at once)
  15737. requestHeaders = {},
  15738. requestHeadersNames = {},
  15739. // Default abort message
  15740. strAbort = "canceled",
  15741. // Fake xhr
  15742. jqXHR = {
  15743. readyState: 0,
  15744. // Builds headers hashtable if needed
  15745. getResponseHeader: function( key ) {
  15746. var match;
  15747. if ( completed ) {
  15748. if ( !responseHeaders ) {
  15749. responseHeaders = {};
  15750. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  15751. responseHeaders[ match[ 1 ].toLowerCase() + " " ] =
  15752. ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] )
  15753. .concat( match[ 2 ] );
  15754. }
  15755. }
  15756. match = responseHeaders[ key.toLowerCase() + " " ];
  15757. }
  15758. return match == null ? null : match.join( ", " );
  15759. },
  15760. // Raw string
  15761. getAllResponseHeaders: function() {
  15762. return completed ? responseHeadersString : null;
  15763. },
  15764. // Caches the header
  15765. setRequestHeader: function( name, value ) {
  15766. if ( completed == null ) {
  15767. name = requestHeadersNames[ name.toLowerCase() ] =
  15768. requestHeadersNames[ name.toLowerCase() ] || name;
  15769. requestHeaders[ name ] = value;
  15770. }
  15771. return this;
  15772. },
  15773. // Overrides response content-type header
  15774. overrideMimeType: function( type ) {
  15775. if ( completed == null ) {
  15776. s.mimeType = type;
  15777. }
  15778. return this;
  15779. },
  15780. // Status-dependent callbacks
  15781. statusCode: function( map ) {
  15782. var code;
  15783. if ( map ) {
  15784. if ( completed ) {
  15785. // Execute the appropriate callbacks
  15786. jqXHR.always( map[ jqXHR.status ] );
  15787. } else {
  15788. // Lazy-add the new callbacks in a way that preserves old ones
  15789. for ( code in map ) {
  15790. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  15791. }
  15792. }
  15793. }
  15794. return this;
  15795. },
  15796. // Cancel the request
  15797. abort: function( statusText ) {
  15798. var finalText = statusText || strAbort;
  15799. if ( transport ) {
  15800. transport.abort( finalText );
  15801. }
  15802. done( 0, finalText );
  15803. return this;
  15804. }
  15805. };
  15806. // Attach deferreds
  15807. deferred.promise( jqXHR );
  15808. // Add protocol if not provided (prefilters might expect it)
  15809. // Handle falsy url in the settings object (#10093: consistency with old signature)
  15810. // We also use the url parameter if available
  15811. s.url = ( ( url || s.url || location.href ) + "" )
  15812. .replace( rprotocol, location.protocol + "//" );
  15813. // Alias method option to type as per ticket #12004
  15814. s.type = options.method || options.type || s.method || s.type;
  15815. // Extract dataTypes list
  15816. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  15817. // A cross-domain request is in order when the origin doesn't match the current origin.
  15818. if ( s.crossDomain == null ) {
  15819. urlAnchor = document.createElement( "a" );
  15820. // Support: IE <=8 - 11, Edge 12 - 15
  15821. // IE throws exception on accessing the href property if url is malformed,
  15822. // e.g. http://example.com:80x/
  15823. try {
  15824. urlAnchor.href = s.url;
  15825. // Support: IE <=8 - 11 only
  15826. // Anchor's host property isn't correctly set when s.url is relative
  15827. urlAnchor.href = urlAnchor.href;
  15828. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  15829. urlAnchor.protocol + "//" + urlAnchor.host;
  15830. } catch ( e ) {
  15831. // If there is an error parsing the URL, assume it is crossDomain,
  15832. // it can be rejected by the transport if it is invalid
  15833. s.crossDomain = true;
  15834. }
  15835. }
  15836. // Convert data if not already a string
  15837. if ( s.data && s.processData && typeof s.data !== "string" ) {
  15838. s.data = jQuery.param( s.data, s.traditional );
  15839. }
  15840. // Apply prefilters
  15841. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  15842. // If request was aborted inside a prefilter, stop there
  15843. if ( completed ) {
  15844. return jqXHR;
  15845. }
  15846. // We can fire global events as of now if asked to
  15847. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  15848. fireGlobals = jQuery.event && s.global;
  15849. // Watch for a new set of requests
  15850. if ( fireGlobals && jQuery.active++ === 0 ) {
  15851. jQuery.event.trigger( "ajaxStart" );
  15852. }
  15853. // Uppercase the type
  15854. s.type = s.type.toUpperCase();
  15855. // Determine if request has content
  15856. s.hasContent = !rnoContent.test( s.type );
  15857. // Save the URL in case we're toying with the If-Modified-Since
  15858. // and/or If-None-Match header later on
  15859. // Remove hash to simplify url manipulation
  15860. cacheURL = s.url.replace( rhash, "" );
  15861. // More options handling for requests with no content
  15862. if ( !s.hasContent ) {
  15863. // Remember the hash so we can put it back
  15864. uncached = s.url.slice( cacheURL.length );
  15865. // If data is available and should be processed, append data to url
  15866. if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
  15867. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  15868. // #9682: remove data so that it's not used in an eventual retry
  15869. delete s.data;
  15870. }
  15871. // Add or update anti-cache param if needed
  15872. if ( s.cache === false ) {
  15873. cacheURL = cacheURL.replace( rantiCache, "$1" );
  15874. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
  15875. }
  15876. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  15877. s.url = cacheURL + uncached;
  15878. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  15879. } else if ( s.data && s.processData &&
  15880. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  15881. s.data = s.data.replace( r20, "+" );
  15882. }
  15883. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  15884. if ( s.ifModified ) {
  15885. if ( jQuery.lastModified[ cacheURL ] ) {
  15886. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  15887. }
  15888. if ( jQuery.etag[ cacheURL ] ) {
  15889. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  15890. }
  15891. }
  15892. // Set the correct header, if data is being sent
  15893. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  15894. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  15895. }
  15896. // Set the Accepts header for the server, depending on the dataType
  15897. jqXHR.setRequestHeader(
  15898. "Accept",
  15899. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  15900. s.accepts[ s.dataTypes[ 0 ] ] +
  15901. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  15902. s.accepts[ "*" ]
  15903. );
  15904. // Check for headers option
  15905. for ( i in s.headers ) {
  15906. jqXHR.setRequestHeader( i, s.headers[ i ] );
  15907. }
  15908. // Allow custom headers/mimetypes and early abort
  15909. if ( s.beforeSend &&
  15910. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  15911. // Abort if not done already and return
  15912. return jqXHR.abort();
  15913. }
  15914. // Aborting is no longer a cancellation
  15915. strAbort = "abort";
  15916. // Install callbacks on deferreds
  15917. completeDeferred.add( s.complete );
  15918. jqXHR.done( s.success );
  15919. jqXHR.fail( s.error );
  15920. // Get transport
  15921. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  15922. // If no transport, we auto-abort
  15923. if ( !transport ) {
  15924. done( -1, "No Transport" );
  15925. } else {
  15926. jqXHR.readyState = 1;
  15927. // Send global event
  15928. if ( fireGlobals ) {
  15929. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  15930. }
  15931. // If request was aborted inside ajaxSend, stop there
  15932. if ( completed ) {
  15933. return jqXHR;
  15934. }
  15935. // Timeout
  15936. if ( s.async && s.timeout > 0 ) {
  15937. timeoutTimer = window.setTimeout( function() {
  15938. jqXHR.abort( "timeout" );
  15939. }, s.timeout );
  15940. }
  15941. try {
  15942. completed = false;
  15943. transport.send( requestHeaders, done );
  15944. } catch ( e ) {
  15945. // Rethrow post-completion exceptions
  15946. if ( completed ) {
  15947. throw e;
  15948. }
  15949. // Propagate others as results
  15950. done( -1, e );
  15951. }
  15952. }
  15953. // Callback for when everything is done
  15954. function done( status, nativeStatusText, responses, headers ) {
  15955. var isSuccess, success, error, response, modified,
  15956. statusText = nativeStatusText;
  15957. // Ignore repeat invocations
  15958. if ( completed ) {
  15959. return;
  15960. }
  15961. completed = true;
  15962. // Clear timeout if it exists
  15963. if ( timeoutTimer ) {
  15964. window.clearTimeout( timeoutTimer );
  15965. }
  15966. // Dereference transport for early garbage collection
  15967. // (no matter how long the jqXHR object will be used)
  15968. transport = undefined;
  15969. // Cache response headers
  15970. responseHeadersString = headers || "";
  15971. // Set readyState
  15972. jqXHR.readyState = status > 0 ? 4 : 0;
  15973. // Determine if successful
  15974. isSuccess = status >= 200 && status < 300 || status === 304;
  15975. // Get response data
  15976. if ( responses ) {
  15977. response = ajaxHandleResponses( s, jqXHR, responses );
  15978. }
  15979. // Convert no matter what (that way responseXXX fields are always set)
  15980. response = ajaxConvert( s, response, jqXHR, isSuccess );
  15981. // If successful, handle type chaining
  15982. if ( isSuccess ) {
  15983. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  15984. if ( s.ifModified ) {
  15985. modified = jqXHR.getResponseHeader( "Last-Modified" );
  15986. if ( modified ) {
  15987. jQuery.lastModified[ cacheURL ] = modified;
  15988. }
  15989. modified = jqXHR.getResponseHeader( "etag" );
  15990. if ( modified ) {
  15991. jQuery.etag[ cacheURL ] = modified;
  15992. }
  15993. }
  15994. // if no content
  15995. if ( status === 204 || s.type === "HEAD" ) {
  15996. statusText = "nocontent";
  15997. // if not modified
  15998. } else if ( status === 304 ) {
  15999. statusText = "notmodified";
  16000. // If we have data, let's convert it
  16001. } else {
  16002. statusText = response.state;
  16003. success = response.data;
  16004. error = response.error;
  16005. isSuccess = !error;
  16006. }
  16007. } else {
  16008. // Extract error from statusText and normalize for non-aborts
  16009. error = statusText;
  16010. if ( status || !statusText ) {
  16011. statusText = "error";
  16012. if ( status < 0 ) {
  16013. status = 0;
  16014. }
  16015. }
  16016. }
  16017. // Set data for the fake xhr object
  16018. jqXHR.status = status;
  16019. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  16020. // Success/Error
  16021. if ( isSuccess ) {
  16022. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  16023. } else {
  16024. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  16025. }
  16026. // Status-dependent callbacks
  16027. jqXHR.statusCode( statusCode );
  16028. statusCode = undefined;
  16029. if ( fireGlobals ) {
  16030. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  16031. [ jqXHR, s, isSuccess ? success : error ] );
  16032. }
  16033. // Complete
  16034. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  16035. if ( fireGlobals ) {
  16036. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  16037. // Handle the global AJAX counter
  16038. if ( !( --jQuery.active ) ) {
  16039. jQuery.event.trigger( "ajaxStop" );
  16040. }
  16041. }
  16042. }
  16043. return jqXHR;
  16044. },
  16045. getJSON: function( url, data, callback ) {
  16046. return jQuery.get( url, data, callback, "json" );
  16047. },
  16048. getScript: function( url, callback ) {
  16049. return jQuery.get( url, undefined, callback, "script" );
  16050. }
  16051. } );
  16052. jQuery.each( [ "get", "post" ], function( i, method ) {
  16053. jQuery[ method ] = function( url, data, callback, type ) {
  16054. // Shift arguments if data argument was omitted
  16055. if ( isFunction( data ) ) {
  16056. type = type || callback;
  16057. callback = data;
  16058. data = undefined;
  16059. }
  16060. // The url can be an options object (which then must have .url)
  16061. return jQuery.ajax( jQuery.extend( {
  16062. url: url,
  16063. type: method,
  16064. dataType: type,
  16065. data: data,
  16066. success: callback
  16067. }, jQuery.isPlainObject( url ) && url ) );
  16068. };
  16069. } );
  16070. jQuery._evalUrl = function( url, options ) {
  16071. return jQuery.ajax( {
  16072. url: url,
  16073. // Make this explicit, since user can override this through ajaxSetup (#11264)
  16074. type: "GET",
  16075. dataType: "script",
  16076. cache: true,
  16077. async: false,
  16078. global: false,
  16079. // Only evaluate the response if it is successful (gh-4126)
  16080. // dataFilter is not invoked for failure responses, so using it instead
  16081. // of the default converter is kludgy but it works.
  16082. converters: {
  16083. "text script": function() {}
  16084. },
  16085. dataFilter: function( response ) {
  16086. jQuery.globalEval( response, options );
  16087. }
  16088. } );
  16089. };
  16090. jQuery.fn.extend( {
  16091. wrapAll: function( html ) {
  16092. var wrap;
  16093. if ( this[ 0 ] ) {
  16094. if ( isFunction( html ) ) {
  16095. html = html.call( this[ 0 ] );
  16096. }
  16097. // The elements to wrap the target around
  16098. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  16099. if ( this[ 0 ].parentNode ) {
  16100. wrap.insertBefore( this[ 0 ] );
  16101. }
  16102. wrap.map( function() {
  16103. var elem = this;
  16104. while ( elem.firstElementChild ) {
  16105. elem = elem.firstElementChild;
  16106. }
  16107. return elem;
  16108. } ).append( this );
  16109. }
  16110. return this;
  16111. },
  16112. wrapInner: function( html ) {
  16113. if ( isFunction( html ) ) {
  16114. return this.each( function( i ) {
  16115. jQuery( this ).wrapInner( html.call( this, i ) );
  16116. } );
  16117. }
  16118. return this.each( function() {
  16119. var self = jQuery( this ),
  16120. contents = self.contents();
  16121. if ( contents.length ) {
  16122. contents.wrapAll( html );
  16123. } else {
  16124. self.append( html );
  16125. }
  16126. } );
  16127. },
  16128. wrap: function( html ) {
  16129. var htmlIsFunction = isFunction( html );
  16130. return this.each( function( i ) {
  16131. jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
  16132. } );
  16133. },
  16134. unwrap: function( selector ) {
  16135. this.parent( selector ).not( "body" ).each( function() {
  16136. jQuery( this ).replaceWith( this.childNodes );
  16137. } );
  16138. return this;
  16139. }
  16140. } );
  16141. jQuery.expr.pseudos.hidden = function( elem ) {
  16142. return !jQuery.expr.pseudos.visible( elem );
  16143. };
  16144. jQuery.expr.pseudos.visible = function( elem ) {
  16145. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  16146. };
  16147. jQuery.ajaxSettings.xhr = function() {
  16148. try {
  16149. return new window.XMLHttpRequest();
  16150. } catch ( e ) {}
  16151. };
  16152. var xhrSuccessStatus = {
  16153. // File protocol always yields status code 0, assume 200
  16154. 0: 200,
  16155. // Support: IE <=9 only
  16156. // #1450: sometimes IE returns 1223 when it should be 204
  16157. 1223: 204
  16158. },
  16159. xhrSupported = jQuery.ajaxSettings.xhr();
  16160. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  16161. support.ajax = xhrSupported = !!xhrSupported;
  16162. jQuery.ajaxTransport( function( options ) {
  16163. var callback, errorCallback;
  16164. // Cross domain only allowed if supported through XMLHttpRequest
  16165. if ( support.cors || xhrSupported && !options.crossDomain ) {
  16166. return {
  16167. send: function( headers, complete ) {
  16168. var i,
  16169. xhr = options.xhr();
  16170. xhr.open(
  16171. options.type,
  16172. options.url,
  16173. options.async,
  16174. options.username,
  16175. options.password
  16176. );
  16177. // Apply custom fields if provided
  16178. if ( options.xhrFields ) {
  16179. for ( i in options.xhrFields ) {
  16180. xhr[ i ] = options.xhrFields[ i ];
  16181. }
  16182. }
  16183. // Override mime type if needed
  16184. if ( options.mimeType && xhr.overrideMimeType ) {
  16185. xhr.overrideMimeType( options.mimeType );
  16186. }
  16187. // X-Requested-With header
  16188. // For cross-domain requests, seeing as conditions for a preflight are
  16189. // akin to a jigsaw puzzle, we simply never set it to be sure.
  16190. // (it can always be set on a per-request basis or even using ajaxSetup)
  16191. // For same-domain requests, won't change header if already provided.
  16192. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  16193. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  16194. }
  16195. // Set headers
  16196. for ( i in headers ) {
  16197. xhr.setRequestHeader( i, headers[ i ] );
  16198. }
  16199. // Callback
  16200. callback = function( type ) {
  16201. return function() {
  16202. if ( callback ) {
  16203. callback = errorCallback = xhr.onload =
  16204. xhr.onerror = xhr.onabort = xhr.ontimeout =
  16205. xhr.onreadystatechange = null;
  16206. if ( type === "abort" ) {
  16207. xhr.abort();
  16208. } else if ( type === "error" ) {
  16209. // Support: IE <=9 only
  16210. // On a manual native abort, IE9 throws
  16211. // errors on any property access that is not readyState
  16212. if ( typeof xhr.status !== "number" ) {
  16213. complete( 0, "error" );
  16214. } else {
  16215. complete(
  16216. // File: protocol always yields status 0; see #8605, #14207
  16217. xhr.status,
  16218. xhr.statusText
  16219. );
  16220. }
  16221. } else {
  16222. complete(
  16223. xhrSuccessStatus[ xhr.status ] || xhr.status,
  16224. xhr.statusText,
  16225. // Support: IE <=9 only
  16226. // IE9 has no XHR2 but throws on binary (trac-11426)
  16227. // For XHR2 non-text, let the caller handle it (gh-2498)
  16228. ( xhr.responseType || "text" ) !== "text" ||
  16229. typeof xhr.responseText !== "string" ?
  16230. { binary: xhr.response } :
  16231. { text: xhr.responseText },
  16232. xhr.getAllResponseHeaders()
  16233. );
  16234. }
  16235. }
  16236. };
  16237. };
  16238. // Listen to events
  16239. xhr.onload = callback();
  16240. errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
  16241. // Support: IE 9 only
  16242. // Use onreadystatechange to replace onabort
  16243. // to handle uncaught aborts
  16244. if ( xhr.onabort !== undefined ) {
  16245. xhr.onabort = errorCallback;
  16246. } else {
  16247. xhr.onreadystatechange = function() {
  16248. // Check readyState before timeout as it changes
  16249. if ( xhr.readyState === 4 ) {
  16250. // Allow onerror to be called first,
  16251. // but that will not handle a native abort
  16252. // Also, save errorCallback to a variable
  16253. // as xhr.onerror cannot be accessed
  16254. window.setTimeout( function() {
  16255. if ( callback ) {
  16256. errorCallback();
  16257. }
  16258. } );
  16259. }
  16260. };
  16261. }
  16262. // Create the abort callback
  16263. callback = callback( "abort" );
  16264. try {
  16265. // Do send the request (this may raise an exception)
  16266. xhr.send( options.hasContent && options.data || null );
  16267. } catch ( e ) {
  16268. // #14683: Only rethrow if this hasn't been notified as an error yet
  16269. if ( callback ) {
  16270. throw e;
  16271. }
  16272. }
  16273. },
  16274. abort: function() {
  16275. if ( callback ) {
  16276. callback();
  16277. }
  16278. }
  16279. };
  16280. }
  16281. } );
  16282. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  16283. jQuery.ajaxPrefilter( function( s ) {
  16284. if ( s.crossDomain ) {
  16285. s.contents.script = false;
  16286. }
  16287. } );
  16288. // Install script dataType
  16289. jQuery.ajaxSetup( {
  16290. accepts: {
  16291. script: "text/javascript, application/javascript, " +
  16292. "application/ecmascript, application/x-ecmascript"
  16293. },
  16294. contents: {
  16295. script: /\b(?:java|ecma)script\b/
  16296. },
  16297. converters: {
  16298. "text script": function( text ) {
  16299. jQuery.globalEval( text );
  16300. return text;
  16301. }
  16302. }
  16303. } );
  16304. // Handle cache's special case and crossDomain
  16305. jQuery.ajaxPrefilter( "script", function( s ) {
  16306. if ( s.cache === undefined ) {
  16307. s.cache = false;
  16308. }
  16309. if ( s.crossDomain ) {
  16310. s.type = "GET";
  16311. }
  16312. } );
  16313. // Bind script tag hack transport
  16314. jQuery.ajaxTransport( "script", function( s ) {
  16315. // This transport only deals with cross domain or forced-by-attrs requests
  16316. if ( s.crossDomain || s.scriptAttrs ) {
  16317. var script, callback;
  16318. return {
  16319. send: function( _, complete ) {
  16320. script = jQuery( "<script>" )
  16321. .attr( s.scriptAttrs || {} )
  16322. .prop( { charset: s.scriptCharset, src: s.url } )
  16323. .on( "load error", callback = function( evt ) {
  16324. script.remove();
  16325. callback = null;
  16326. if ( evt ) {
  16327. complete( evt.type === "error" ? 404 : 200, evt.type );
  16328. }
  16329. } );
  16330. // Use native DOM manipulation to avoid our domManip AJAX trickery
  16331. document.head.appendChild( script[ 0 ] );
  16332. },
  16333. abort: function() {
  16334. if ( callback ) {
  16335. callback();
  16336. }
  16337. }
  16338. };
  16339. }
  16340. } );
  16341. var oldCallbacks = [],
  16342. rjsonp = /(=)\?(?=&|$)|\?\?/;
  16343. // Default jsonp settings
  16344. jQuery.ajaxSetup( {
  16345. jsonp: "callback",
  16346. jsonpCallback: function() {
  16347. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  16348. this[ callback ] = true;
  16349. return callback;
  16350. }
  16351. } );
  16352. // Detect, normalize options and install callbacks for jsonp requests
  16353. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  16354. var callbackName, overwritten, responseContainer,
  16355. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  16356. "url" :
  16357. typeof s.data === "string" &&
  16358. ( s.contentType || "" )
  16359. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  16360. rjsonp.test( s.data ) && "data"
  16361. );
  16362. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  16363. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  16364. // Get callback name, remembering preexisting value associated with it
  16365. callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
  16366. s.jsonpCallback() :
  16367. s.jsonpCallback;
  16368. // Insert callback into url or form data
  16369. if ( jsonProp ) {
  16370. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  16371. } else if ( s.jsonp !== false ) {
  16372. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  16373. }
  16374. // Use data converter to retrieve json after script execution
  16375. s.converters[ "script json" ] = function() {
  16376. if ( !responseContainer ) {
  16377. jQuery.error( callbackName + " was not called" );
  16378. }
  16379. return responseContainer[ 0 ];
  16380. };
  16381. // Force json dataType
  16382. s.dataTypes[ 0 ] = "json";
  16383. // Install callback
  16384. overwritten = window[ callbackName ];
  16385. window[ callbackName ] = function() {
  16386. responseContainer = arguments;
  16387. };
  16388. // Clean-up function (fires after converters)
  16389. jqXHR.always( function() {
  16390. // If previous value didn't exist - remove it
  16391. if ( overwritten === undefined ) {
  16392. jQuery( window ).removeProp( callbackName );
  16393. // Otherwise restore preexisting value
  16394. } else {
  16395. window[ callbackName ] = overwritten;
  16396. }
  16397. // Save back as free
  16398. if ( s[ callbackName ] ) {
  16399. // Make sure that re-using the options doesn't screw things around
  16400. s.jsonpCallback = originalSettings.jsonpCallback;
  16401. // Save the callback name for future use
  16402. oldCallbacks.push( callbackName );
  16403. }
  16404. // Call if it was a function and we have a response
  16405. if ( responseContainer && isFunction( overwritten ) ) {
  16406. overwritten( responseContainer[ 0 ] );
  16407. }
  16408. responseContainer = overwritten = undefined;
  16409. } );
  16410. // Delegate to script
  16411. return "script";
  16412. }
  16413. } );
  16414. // Support: Safari 8 only
  16415. // In Safari 8 documents created via document.implementation.createHTMLDocument
  16416. // collapse sibling forms: the second one becomes a child of the first one.
  16417. // Because of that, this security measure has to be disabled in Safari 8.
  16418. // https://bugs.webkit.org/show_bug.cgi?id=137337
  16419. support.createHTMLDocument = ( function() {
  16420. var body = document.implementation.createHTMLDocument( "" ).body;
  16421. body.innerHTML = "<form></form><form></form>";
  16422. return body.childNodes.length === 2;
  16423. } )();
  16424. // Argument "data" should be string of html
  16425. // context (optional): If specified, the fragment will be created in this context,
  16426. // defaults to document
  16427. // keepScripts (optional): If true, will include scripts passed in the html string
  16428. jQuery.parseHTML = function( data, context, keepScripts ) {
  16429. if ( typeof data !== "string" ) {
  16430. return [];
  16431. }
  16432. if ( typeof context === "boolean" ) {
  16433. keepScripts = context;
  16434. context = false;
  16435. }
  16436. var base, parsed, scripts;
  16437. if ( !context ) {
  16438. // Stop scripts or inline event handlers from being executed immediately
  16439. // by using document.implementation
  16440. if ( support.createHTMLDocument ) {
  16441. context = document.implementation.createHTMLDocument( "" );
  16442. // Set the base href for the created document
  16443. // so any parsed elements with URLs
  16444. // are based on the document's URL (gh-2965)
  16445. base = context.createElement( "base" );
  16446. base.href = document.location.href;
  16447. context.head.appendChild( base );
  16448. } else {
  16449. context = document;
  16450. }
  16451. }
  16452. parsed = rsingleTag.exec( data );
  16453. scripts = !keepScripts && [];
  16454. // Single tag
  16455. if ( parsed ) {
  16456. return [ context.createElement( parsed[ 1 ] ) ];
  16457. }
  16458. parsed = buildFragment( [ data ], context, scripts );
  16459. if ( scripts && scripts.length ) {
  16460. jQuery( scripts ).remove();
  16461. }
  16462. return jQuery.merge( [], parsed.childNodes );
  16463. };
  16464. /**
  16465. * Load a url into a page
  16466. */
  16467. jQuery.fn.load = function( url, params, callback ) {
  16468. var selector, type, response,
  16469. self = this,
  16470. off = url.indexOf( " " );
  16471. if ( off > -1 ) {
  16472. selector = stripAndCollapse( url.slice( off ) );
  16473. url = url.slice( 0, off );
  16474. }
  16475. // If it's a function
  16476. if ( isFunction( params ) ) {
  16477. // We assume that it's the callback
  16478. callback = params;
  16479. params = undefined;
  16480. // Otherwise, build a param string
  16481. } else if ( params && typeof params === "object" ) {
  16482. type = "POST";
  16483. }
  16484. // If we have elements to modify, make the request
  16485. if ( self.length > 0 ) {
  16486. jQuery.ajax( {
  16487. url: url,
  16488. // If "type" variable is undefined, then "GET" method will be used.
  16489. // Make value of this field explicit since
  16490. // user can override it through ajaxSetup method
  16491. type: type || "GET",
  16492. dataType: "html",
  16493. data: params
  16494. } ).done( function( responseText ) {
  16495. // Save response for use in complete callback
  16496. response = arguments;
  16497. self.html( selector ?
  16498. // If a selector was specified, locate the right elements in a dummy div
  16499. // Exclude scripts to avoid IE 'Permission Denied' errors
  16500. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  16501. // Otherwise use the full result
  16502. responseText );
  16503. // If the request succeeds, this function gets "data", "status", "jqXHR"
  16504. // but they are ignored because response was set above.
  16505. // If it fails, this function gets "jqXHR", "status", "error"
  16506. } ).always( callback && function( jqXHR, status ) {
  16507. self.each( function() {
  16508. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  16509. } );
  16510. } );
  16511. }
  16512. return this;
  16513. };
  16514. // Attach a bunch of functions for handling common AJAX events
  16515. jQuery.each( [
  16516. "ajaxStart",
  16517. "ajaxStop",
  16518. "ajaxComplete",
  16519. "ajaxError",
  16520. "ajaxSuccess",
  16521. "ajaxSend"
  16522. ], function( i, type ) {
  16523. jQuery.fn[ type ] = function( fn ) {
  16524. return this.on( type, fn );
  16525. };
  16526. } );
  16527. jQuery.expr.pseudos.animated = function( elem ) {
  16528. return jQuery.grep( jQuery.timers, function( fn ) {
  16529. return elem === fn.elem;
  16530. } ).length;
  16531. };
  16532. jQuery.offset = {
  16533. setOffset: function( elem, options, i ) {
  16534. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  16535. position = jQuery.css( elem, "position" ),
  16536. curElem = jQuery( elem ),
  16537. props = {};
  16538. // Set position first, in-case top/left are set even on static elem
  16539. if ( position === "static" ) {
  16540. elem.style.position = "relative";
  16541. }
  16542. curOffset = curElem.offset();
  16543. curCSSTop = jQuery.css( elem, "top" );
  16544. curCSSLeft = jQuery.css( elem, "left" );
  16545. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  16546. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  16547. // Need to be able to calculate position if either
  16548. // top or left is auto and position is either absolute or fixed
  16549. if ( calculatePosition ) {
  16550. curPosition = curElem.position();
  16551. curTop = curPosition.top;
  16552. curLeft = curPosition.left;
  16553. } else {
  16554. curTop = parseFloat( curCSSTop ) || 0;
  16555. curLeft = parseFloat( curCSSLeft ) || 0;
  16556. }
  16557. if ( isFunction( options ) ) {
  16558. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  16559. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  16560. }
  16561. if ( options.top != null ) {
  16562. props.top = ( options.top - curOffset.top ) + curTop;
  16563. }
  16564. if ( options.left != null ) {
  16565. props.left = ( options.left - curOffset.left ) + curLeft;
  16566. }
  16567. if ( "using" in options ) {
  16568. options.using.call( elem, props );
  16569. } else {
  16570. curElem.css( props );
  16571. }
  16572. }
  16573. };
  16574. jQuery.fn.extend( {
  16575. // offset() relates an element's border box to the document origin
  16576. offset: function( options ) {
  16577. // Preserve chaining for setter
  16578. if ( arguments.length ) {
  16579. return options === undefined ?
  16580. this :
  16581. this.each( function( i ) {
  16582. jQuery.offset.setOffset( this, options, i );
  16583. } );
  16584. }
  16585. var rect, win,
  16586. elem = this[ 0 ];
  16587. if ( !elem ) {
  16588. return;
  16589. }
  16590. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  16591. // Support: IE <=11 only
  16592. // Running getBoundingClientRect on a
  16593. // disconnected node in IE throws an error
  16594. if ( !elem.getClientRects().length ) {
  16595. return { top: 0, left: 0 };
  16596. }
  16597. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  16598. rect = elem.getBoundingClientRect();
  16599. win = elem.ownerDocument.defaultView;
  16600. return {
  16601. top: rect.top + win.pageYOffset,
  16602. left: rect.left + win.pageXOffset
  16603. };
  16604. },
  16605. // position() relates an element's margin box to its offset parent's padding box
  16606. // This corresponds to the behavior of CSS absolute positioning
  16607. position: function() {
  16608. if ( !this[ 0 ] ) {
  16609. return;
  16610. }
  16611. var offsetParent, offset, doc,
  16612. elem = this[ 0 ],
  16613. parentOffset = { top: 0, left: 0 };
  16614. // position:fixed elements are offset from the viewport, which itself always has zero offset
  16615. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  16616. // Assume position:fixed implies availability of getBoundingClientRect
  16617. offset = elem.getBoundingClientRect();
  16618. } else {
  16619. offset = this.offset();
  16620. // Account for the *real* offset parent, which can be the document or its root element
  16621. // when a statically positioned element is identified
  16622. doc = elem.ownerDocument;
  16623. offsetParent = elem.offsetParent || doc.documentElement;
  16624. while ( offsetParent &&
  16625. ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
  16626. jQuery.css( offsetParent, "position" ) === "static" ) {
  16627. offsetParent = offsetParent.parentNode;
  16628. }
  16629. if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
  16630. // Incorporate borders into its offset, since they are outside its content origin
  16631. parentOffset = jQuery( offsetParent ).offset();
  16632. parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
  16633. parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
  16634. }
  16635. }
  16636. // Subtract parent offsets and element margins
  16637. return {
  16638. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  16639. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  16640. };
  16641. },
  16642. // This method will return documentElement in the following cases:
  16643. // 1) For the element inside the iframe without offsetParent, this method will return
  16644. // documentElement of the parent window
  16645. // 2) For the hidden or detached element
  16646. // 3) For body or html element, i.e. in case of the html node - it will return itself
  16647. //
  16648. // but those exceptions were never presented as a real life use-cases
  16649. // and might be considered as more preferable results.
  16650. //
  16651. // This logic, however, is not guaranteed and can change at any point in the future
  16652. offsetParent: function() {
  16653. return this.map( function() {
  16654. var offsetParent = this.offsetParent;
  16655. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  16656. offsetParent = offsetParent.offsetParent;
  16657. }
  16658. return offsetParent || documentElement;
  16659. } );
  16660. }
  16661. } );
  16662. // Create scrollLeft and scrollTop methods
  16663. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  16664. var top = "pageYOffset" === prop;
  16665. jQuery.fn[ method ] = function( val ) {
  16666. return access( this, function( elem, method, val ) {
  16667. // Coalesce documents and windows
  16668. var win;
  16669. if ( isWindow( elem ) ) {
  16670. win = elem;
  16671. } else if ( elem.nodeType === 9 ) {
  16672. win = elem.defaultView;
  16673. }
  16674. if ( val === undefined ) {
  16675. return win ? win[ prop ] : elem[ method ];
  16676. }
  16677. if ( win ) {
  16678. win.scrollTo(
  16679. !top ? val : win.pageXOffset,
  16680. top ? val : win.pageYOffset
  16681. );
  16682. } else {
  16683. elem[ method ] = val;
  16684. }
  16685. }, method, val, arguments.length );
  16686. };
  16687. } );
  16688. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  16689. // Add the top/left cssHooks using jQuery.fn.position
  16690. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  16691. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  16692. // getComputedStyle returns percent when specified for top/left/bottom/right;
  16693. // rather than make the css module depend on the offset module, just check for it here
  16694. jQuery.each( [ "top", "left" ], function( i, prop ) {
  16695. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  16696. function( elem, computed ) {
  16697. if ( computed ) {
  16698. computed = curCSS( elem, prop );
  16699. // If curCSS returns percentage, fallback to offset
  16700. return rnumnonpx.test( computed ) ?
  16701. jQuery( elem ).position()[ prop ] + "px" :
  16702. computed;
  16703. }
  16704. }
  16705. );
  16706. } );
  16707. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  16708. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  16709. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  16710. function( defaultExtra, funcName ) {
  16711. // Margin is only for outerHeight, outerWidth
  16712. jQuery.fn[ funcName ] = function( margin, value ) {
  16713. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  16714. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  16715. return access( this, function( elem, type, value ) {
  16716. var doc;
  16717. if ( isWindow( elem ) ) {
  16718. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  16719. return funcName.indexOf( "outer" ) === 0 ?
  16720. elem[ "inner" + name ] :
  16721. elem.document.documentElement[ "client" + name ];
  16722. }
  16723. // Get document width or height
  16724. if ( elem.nodeType === 9 ) {
  16725. doc = elem.documentElement;
  16726. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  16727. // whichever is greatest
  16728. return Math.max(
  16729. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  16730. elem.body[ "offset" + name ], doc[ "offset" + name ],
  16731. doc[ "client" + name ]
  16732. );
  16733. }
  16734. return value === undefined ?
  16735. // Get width or height on the element, requesting but not forcing parseFloat
  16736. jQuery.css( elem, type, extra ) :
  16737. // Set width or height on the element
  16738. jQuery.style( elem, type, value, extra );
  16739. }, type, chainable ? margin : undefined, chainable );
  16740. };
  16741. } );
  16742. } );
  16743. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  16744. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  16745. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  16746. function( i, name ) {
  16747. // Handle event binding
  16748. jQuery.fn[ name ] = function( data, fn ) {
  16749. return arguments.length > 0 ?
  16750. this.on( name, null, data, fn ) :
  16751. this.trigger( name );
  16752. };
  16753. } );
  16754. jQuery.fn.extend( {
  16755. hover: function( fnOver, fnOut ) {
  16756. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  16757. }
  16758. } );
  16759. jQuery.fn.extend( {
  16760. bind: function( types, data, fn ) {
  16761. return this.on( types, null, data, fn );
  16762. },
  16763. unbind: function( types, fn ) {
  16764. return this.off( types, null, fn );
  16765. },
  16766. delegate: function( selector, types, data, fn ) {
  16767. return this.on( types, selector, data, fn );
  16768. },
  16769. undelegate: function( selector, types, fn ) {
  16770. // ( namespace ) or ( selector, types [, fn] )
  16771. return arguments.length === 1 ?
  16772. this.off( selector, "**" ) :
  16773. this.off( types, selector || "**", fn );
  16774. }
  16775. } );
  16776. // Bind a function to a context, optionally partially applying any
  16777. // arguments.
  16778. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  16779. // However, it is not slated for removal any time soon
  16780. jQuery.proxy = function( fn, context ) {
  16781. var tmp, args, proxy;
  16782. if ( typeof context === "string" ) {
  16783. tmp = fn[ context ];
  16784. context = fn;
  16785. fn = tmp;
  16786. }
  16787. // Quick check to determine if target is callable, in the spec
  16788. // this throws a TypeError, but we will just return undefined.
  16789. if ( !isFunction( fn ) ) {
  16790. return undefined;
  16791. }
  16792. // Simulated bind
  16793. args = slice.call( arguments, 2 );
  16794. proxy = function() {
  16795. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  16796. };
  16797. // Set the guid of unique handler to the same of original handler, so it can be removed
  16798. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  16799. return proxy;
  16800. };
  16801. jQuery.holdReady = function( hold ) {
  16802. if ( hold ) {
  16803. jQuery.readyWait++;
  16804. } else {
  16805. jQuery.ready( true );
  16806. }
  16807. };
  16808. jQuery.isArray = Array.isArray;
  16809. jQuery.parseJSON = JSON.parse;
  16810. jQuery.nodeName = nodeName;
  16811. jQuery.isFunction = isFunction;
  16812. jQuery.isWindow = isWindow;
  16813. jQuery.camelCase = camelCase;
  16814. jQuery.type = toType;
  16815. jQuery.now = Date.now;
  16816. jQuery.isNumeric = function( obj ) {
  16817. // As of jQuery 3.0, isNumeric is limited to
  16818. // strings and numbers (primitives or objects)
  16819. // that can be coerced to finite numbers (gh-2662)
  16820. var type = jQuery.type( obj );
  16821. return ( type === "number" || type === "string" ) &&
  16822. // parseFloat NaNs numeric-cast false positives ("")
  16823. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  16824. // subtraction forces infinities to NaN
  16825. !isNaN( obj - parseFloat( obj ) );
  16826. };
  16827. // Register as a named AMD module, since jQuery can be concatenated with other
  16828. // files that may use define, but not via a proper concatenation script that
  16829. // understands anonymous AMD modules. A named AMD is safest and most robust
  16830. // way to register. Lowercase jquery is used because AMD module names are
  16831. // derived from file names, and jQuery is normally delivered in a lowercase
  16832. // file name. Do this after creating the global so that if an AMD module wants
  16833. // to call noConflict to hide this version of jQuery, it will work.
  16834. // Note that for maximum portability, libraries that are not jQuery should
  16835. // declare themselves as anonymous modules, and avoid setting a global if an
  16836. // AMD loader is present. jQuery is a special case. For more information, see
  16837. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  16838. if ( true ) {
  16839. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  16840. return jQuery;
  16841. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  16842. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  16843. }
  16844. var
  16845. // Map over jQuery in case of overwrite
  16846. _jQuery = window.jQuery,
  16847. // Map over the $ in case of overwrite
  16848. _$ = window.$;
  16849. jQuery.noConflict = function( deep ) {
  16850. if ( window.$ === jQuery ) {
  16851. window.$ = _$;
  16852. }
  16853. if ( deep && window.jQuery === jQuery ) {
  16854. window.jQuery = _jQuery;
  16855. }
  16856. return jQuery;
  16857. };
  16858. // Expose jQuery and $ identifiers, even in AMD
  16859. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  16860. // and CommonJS for browser emulators (#13566)
  16861. if ( !noGlobal ) {
  16862. window.jQuery = window.$ = jQuery;
  16863. }
  16864. return jQuery;
  16865. } );
  16866. /***/ }),
  16867. /***/ "./node_modules/laravel-echo/dist/echo.js":
  16868. /*!************************************************!*\
  16869. !*** ./node_modules/laravel-echo/dist/echo.js ***!
  16870. \************************************************/
  16871. /*! exports provided: default */
  16872. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  16873. "use strict";
  16874. __webpack_require__.r(__webpack_exports__);
  16875. var classCallCheck = function (instance, Constructor) {
  16876. if (!(instance instanceof Constructor)) {
  16877. throw new TypeError("Cannot call a class as a function");
  16878. }
  16879. };
  16880. var createClass = function () {
  16881. function defineProperties(target, props) {
  16882. for (var i = 0; i < props.length; i++) {
  16883. var descriptor = props[i];
  16884. descriptor.enumerable = descriptor.enumerable || false;
  16885. descriptor.configurable = true;
  16886. if ("value" in descriptor) descriptor.writable = true;
  16887. Object.defineProperty(target, descriptor.key, descriptor);
  16888. }
  16889. }
  16890. return function (Constructor, protoProps, staticProps) {
  16891. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  16892. if (staticProps) defineProperties(Constructor, staticProps);
  16893. return Constructor;
  16894. };
  16895. }();
  16896. var _extends = Object.assign || function (target) {
  16897. for (var i = 1; i < arguments.length; i++) {
  16898. var source = arguments[i];
  16899. for (var key in source) {
  16900. if (Object.prototype.hasOwnProperty.call(source, key)) {
  16901. target[key] = source[key];
  16902. }
  16903. }
  16904. }
  16905. return target;
  16906. };
  16907. var inherits = function (subClass, superClass) {
  16908. if (typeof superClass !== "function" && superClass !== null) {
  16909. throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  16910. }
  16911. subClass.prototype = Object.create(superClass && superClass.prototype, {
  16912. constructor: {
  16913. value: subClass,
  16914. enumerable: false,
  16915. writable: true,
  16916. configurable: true
  16917. }
  16918. });
  16919. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  16920. };
  16921. var possibleConstructorReturn = function (self, call) {
  16922. if (!self) {
  16923. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  16924. }
  16925. return call && (typeof call === "object" || typeof call === "function") ? call : self;
  16926. };
  16927. var Connector = function () {
  16928. /**
  16929. * Create a new class instance.
  16930. */
  16931. function Connector(options) {
  16932. classCallCheck(this, Connector);
  16933. /**
  16934. * Default connector options.
  16935. */
  16936. this._defaultOptions = {
  16937. auth: {
  16938. headers: {}
  16939. },
  16940. authEndpoint: '/broadcasting/auth',
  16941. broadcaster: 'pusher',
  16942. csrfToken: null,
  16943. host: null,
  16944. key: null,
  16945. namespace: 'App.Events'
  16946. };
  16947. this.setOptions(options);
  16948. this.connect();
  16949. }
  16950. /**
  16951. * Merge the custom options with the defaults.
  16952. */
  16953. createClass(Connector, [{
  16954. key: 'setOptions',
  16955. value: function setOptions(options) {
  16956. this.options = _extends(this._defaultOptions, options);
  16957. if (this.csrfToken()) {
  16958. this.options.auth.headers['X-CSRF-TOKEN'] = this.csrfToken();
  16959. }
  16960. return options;
  16961. }
  16962. /**
  16963. * Extract the CSRF token from the page.
  16964. */
  16965. }, {
  16966. key: 'csrfToken',
  16967. value: function csrfToken() {
  16968. var selector = void 0;
  16969. if (typeof window !== 'undefined' && window['Laravel'] && window['Laravel'].csrfToken) {
  16970. return window['Laravel'].csrfToken;
  16971. } else if (this.options.csrfToken) {
  16972. return this.options.csrfToken;
  16973. } else if (typeof document !== 'undefined' && typeof document.querySelector === 'function' && (selector = document.querySelector('meta[name="csrf-token"]'))) {
  16974. return selector.getAttribute('content');
  16975. }
  16976. return null;
  16977. }
  16978. }]);
  16979. return Connector;
  16980. }();
  16981. /**
  16982. * This class represents a basic channel.
  16983. */
  16984. var Channel = function () {
  16985. function Channel() {
  16986. classCallCheck(this, Channel);
  16987. }
  16988. createClass(Channel, [{
  16989. key: 'listenForWhisper',
  16990. /**
  16991. * Listen for a whisper event on the channel instance.
  16992. */
  16993. value: function listenForWhisper(event, callback) {
  16994. return this.listen('.client-' + event, callback);
  16995. }
  16996. /**
  16997. * Listen for an event on the channel instance.
  16998. */
  16999. }, {
  17000. key: 'notification',
  17001. value: function notification(callback) {
  17002. return this.listen('.Illuminate\\Notifications\\Events\\BroadcastNotificationCreated', callback);
  17003. }
  17004. /**
  17005. * Stop listening for a whispser event on the channel instance.
  17006. */
  17007. }, {
  17008. key: 'stopListeningForWhisper',
  17009. value: function stopListeningForWhisper(event) {
  17010. return this.stopListening('.client-' + event);
  17011. }
  17012. }]);
  17013. return Channel;
  17014. }();
  17015. /**
  17016. * Event name formatter
  17017. */
  17018. var EventFormatter = function () {
  17019. /**
  17020. * Create a new class instance.
  17021. */
  17022. function EventFormatter(namespace) {
  17023. classCallCheck(this, EventFormatter);
  17024. this.setNamespace(namespace);
  17025. }
  17026. /**
  17027. * Format the given event name.
  17028. */
  17029. createClass(EventFormatter, [{
  17030. key: 'format',
  17031. value: function format(event) {
  17032. if (event.charAt(0) === '.' || event.charAt(0) === '\\') {
  17033. return event.substr(1);
  17034. } else if (this.namespace) {
  17035. event = this.namespace + '.' + event;
  17036. }
  17037. return event.replace(/\./g, '\\');
  17038. }
  17039. /**
  17040. * Set the event namespace.
  17041. */
  17042. }, {
  17043. key: 'setNamespace',
  17044. value: function setNamespace(value) {
  17045. this.namespace = value;
  17046. }
  17047. }]);
  17048. return EventFormatter;
  17049. }();
  17050. /**
  17051. * This class represents a Pusher channel.
  17052. */
  17053. var PusherChannel = function (_Channel) {
  17054. inherits(PusherChannel, _Channel);
  17055. /**
  17056. * Create a new class instance.
  17057. */
  17058. function PusherChannel(pusher, name, options) {
  17059. classCallCheck(this, PusherChannel);
  17060. var _this = possibleConstructorReturn(this, (PusherChannel.__proto__ || Object.getPrototypeOf(PusherChannel)).call(this));
  17061. _this.name = name;
  17062. _this.pusher = pusher;
  17063. _this.options = options;
  17064. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  17065. _this.subscribe();
  17066. return _this;
  17067. }
  17068. /**
  17069. * Subscribe to a Pusher channel.
  17070. */
  17071. createClass(PusherChannel, [{
  17072. key: 'subscribe',
  17073. value: function subscribe() {
  17074. this.subscription = this.pusher.subscribe(this.name);
  17075. }
  17076. /**
  17077. * Unsubscribe from a Pusher channel.
  17078. */
  17079. }, {
  17080. key: 'unsubscribe',
  17081. value: function unsubscribe() {
  17082. this.pusher.unsubscribe(this.name);
  17083. }
  17084. /**
  17085. * Listen for an event on the channel instance.
  17086. */
  17087. }, {
  17088. key: 'listen',
  17089. value: function listen(event, callback) {
  17090. this.on(this.eventFormatter.format(event), callback);
  17091. return this;
  17092. }
  17093. /**
  17094. * Stop listening for an event on the channel instance.
  17095. */
  17096. }, {
  17097. key: 'stopListening',
  17098. value: function stopListening(event) {
  17099. this.subscription.unbind(this.eventFormatter.format(event));
  17100. return this;
  17101. }
  17102. /**
  17103. * Bind a channel to an event.
  17104. */
  17105. }, {
  17106. key: 'on',
  17107. value: function on(event, callback) {
  17108. this.subscription.bind(event, callback);
  17109. return this;
  17110. }
  17111. }]);
  17112. return PusherChannel;
  17113. }(Channel);
  17114. /**
  17115. * This class represents a Pusher private channel.
  17116. */
  17117. var PusherPrivateChannel = function (_PusherChannel) {
  17118. inherits(PusherPrivateChannel, _PusherChannel);
  17119. function PusherPrivateChannel() {
  17120. classCallCheck(this, PusherPrivateChannel);
  17121. return possibleConstructorReturn(this, (PusherPrivateChannel.__proto__ || Object.getPrototypeOf(PusherPrivateChannel)).apply(this, arguments));
  17122. }
  17123. createClass(PusherPrivateChannel, [{
  17124. key: 'whisper',
  17125. /**
  17126. * Trigger client event on the channel.
  17127. */
  17128. value: function whisper(eventName, data) {
  17129. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  17130. return this;
  17131. }
  17132. }]);
  17133. return PusherPrivateChannel;
  17134. }(PusherChannel);
  17135. /**
  17136. * This class represents a Pusher presence channel.
  17137. */
  17138. var PusherPresenceChannel = function (_PusherChannel) {
  17139. inherits(PusherPresenceChannel, _PusherChannel);
  17140. function PusherPresenceChannel() {
  17141. classCallCheck(this, PusherPresenceChannel);
  17142. return possibleConstructorReturn(this, (PusherPresenceChannel.__proto__ || Object.getPrototypeOf(PusherPresenceChannel)).apply(this, arguments));
  17143. }
  17144. createClass(PusherPresenceChannel, [{
  17145. key: 'here',
  17146. /**
  17147. * Register a callback to be called anytime the member list changes.
  17148. */
  17149. value: function here(callback) {
  17150. this.on('pusher:subscription_succeeded', function (data) {
  17151. callback(Object.keys(data.members).map(function (k) {
  17152. return data.members[k];
  17153. }));
  17154. });
  17155. return this;
  17156. }
  17157. /**
  17158. * Listen for someone joining the channel.
  17159. */
  17160. }, {
  17161. key: 'joining',
  17162. value: function joining(callback) {
  17163. this.on('pusher:member_added', function (member) {
  17164. callback(member.info);
  17165. });
  17166. return this;
  17167. }
  17168. /**
  17169. * Listen for someone leaving the channel.
  17170. */
  17171. }, {
  17172. key: 'leaving',
  17173. value: function leaving(callback) {
  17174. this.on('pusher:member_removed', function (member) {
  17175. callback(member.info);
  17176. });
  17177. return this;
  17178. }
  17179. /**
  17180. * Trigger client event on the channel.
  17181. */
  17182. }, {
  17183. key: 'whisper',
  17184. value: function whisper(eventName, data) {
  17185. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  17186. return this;
  17187. }
  17188. }]);
  17189. return PusherPresenceChannel;
  17190. }(PusherChannel);
  17191. /**
  17192. * This class represents a Socket.io channel.
  17193. */
  17194. var SocketIoChannel = function (_Channel) {
  17195. inherits(SocketIoChannel, _Channel);
  17196. /**
  17197. * Create a new class instance.
  17198. */
  17199. function SocketIoChannel(socket, name, options) {
  17200. classCallCheck(this, SocketIoChannel);
  17201. /**
  17202. * The event callbacks applied to the channel.
  17203. */
  17204. var _this = possibleConstructorReturn(this, (SocketIoChannel.__proto__ || Object.getPrototypeOf(SocketIoChannel)).call(this));
  17205. _this.events = {};
  17206. _this.name = name;
  17207. _this.socket = socket;
  17208. _this.options = options;
  17209. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  17210. _this.subscribe();
  17211. _this.configureReconnector();
  17212. return _this;
  17213. }
  17214. /**
  17215. * Subscribe to a Socket.io channel.
  17216. */
  17217. createClass(SocketIoChannel, [{
  17218. key: 'subscribe',
  17219. value: function subscribe() {
  17220. this.socket.emit('subscribe', {
  17221. channel: this.name,
  17222. auth: this.options.auth || {}
  17223. });
  17224. }
  17225. /**
  17226. * Unsubscribe from channel and ubind event callbacks.
  17227. */
  17228. }, {
  17229. key: 'unsubscribe',
  17230. value: function unsubscribe() {
  17231. this.unbind();
  17232. this.socket.emit('unsubscribe', {
  17233. channel: this.name,
  17234. auth: this.options.auth || {}
  17235. });
  17236. }
  17237. /**
  17238. * Listen for an event on the channel instance.
  17239. */
  17240. }, {
  17241. key: 'listen',
  17242. value: function listen(event, callback) {
  17243. this.on(this.eventFormatter.format(event), callback);
  17244. return this;
  17245. }
  17246. /**
  17247. * Stop listening for an event on the channel instance.
  17248. */
  17249. }, {
  17250. key: 'stopListening',
  17251. value: function stopListening(event) {
  17252. var name = this.eventFormatter.format(event);
  17253. this.socket.removeListener(name);
  17254. delete this.events[name];
  17255. return this;
  17256. }
  17257. /**
  17258. * Bind the channel's socket to an event and store the callback.
  17259. */
  17260. }, {
  17261. key: 'on',
  17262. value: function on(event, callback) {
  17263. var _this2 = this;
  17264. var listener = function listener(channel, data) {
  17265. if (_this2.name == channel) {
  17266. callback(data);
  17267. }
  17268. };
  17269. this.socket.on(event, listener);
  17270. this.bind(event, listener);
  17271. }
  17272. /**
  17273. * Attach a 'reconnect' listener and bind the event.
  17274. */
  17275. }, {
  17276. key: 'configureReconnector',
  17277. value: function configureReconnector() {
  17278. var _this3 = this;
  17279. var listener = function listener() {
  17280. _this3.subscribe();
  17281. };
  17282. this.socket.on('reconnect', listener);
  17283. this.bind('reconnect', listener);
  17284. }
  17285. /**
  17286. * Bind the channel's socket to an event and store the callback.
  17287. */
  17288. }, {
  17289. key: 'bind',
  17290. value: function bind(event, callback) {
  17291. this.events[event] = this.events[event] || [];
  17292. this.events[event].push(callback);
  17293. }
  17294. /**
  17295. * Unbind the channel's socket from all stored event callbacks.
  17296. */
  17297. }, {
  17298. key: 'unbind',
  17299. value: function unbind() {
  17300. var _this4 = this;
  17301. Object.keys(this.events).forEach(function (event) {
  17302. _this4.events[event].forEach(function (callback) {
  17303. _this4.socket.removeListener(event, callback);
  17304. });
  17305. delete _this4.events[event];
  17306. });
  17307. }
  17308. }]);
  17309. return SocketIoChannel;
  17310. }(Channel);
  17311. /**
  17312. * This class represents a Socket.io presence channel.
  17313. */
  17314. var SocketIoPrivateChannel = function (_SocketIoChannel) {
  17315. inherits(SocketIoPrivateChannel, _SocketIoChannel);
  17316. function SocketIoPrivateChannel() {
  17317. classCallCheck(this, SocketIoPrivateChannel);
  17318. return possibleConstructorReturn(this, (SocketIoPrivateChannel.__proto__ || Object.getPrototypeOf(SocketIoPrivateChannel)).apply(this, arguments));
  17319. }
  17320. createClass(SocketIoPrivateChannel, [{
  17321. key: 'whisper',
  17322. /**
  17323. * Trigger client event on the channel.
  17324. */
  17325. value: function whisper(eventName, data) {
  17326. this.socket.emit('client event', {
  17327. channel: this.name,
  17328. event: 'client-' + eventName,
  17329. data: data
  17330. });
  17331. return this;
  17332. }
  17333. }]);
  17334. return SocketIoPrivateChannel;
  17335. }(SocketIoChannel);
  17336. /**
  17337. * This class represents a Socket.io presence channel.
  17338. */
  17339. var SocketIoPresenceChannel = function (_SocketIoPrivateChann) {
  17340. inherits(SocketIoPresenceChannel, _SocketIoPrivateChann);
  17341. function SocketIoPresenceChannel() {
  17342. classCallCheck(this, SocketIoPresenceChannel);
  17343. return possibleConstructorReturn(this, (SocketIoPresenceChannel.__proto__ || Object.getPrototypeOf(SocketIoPresenceChannel)).apply(this, arguments));
  17344. }
  17345. createClass(SocketIoPresenceChannel, [{
  17346. key: 'here',
  17347. /**
  17348. * Register a callback to be called anytime the member list changes.
  17349. */
  17350. value: function here(callback) {
  17351. this.on('presence:subscribed', function (members) {
  17352. callback(members.map(function (m) {
  17353. return m.user_info;
  17354. }));
  17355. });
  17356. return this;
  17357. }
  17358. /**
  17359. * Listen for someone joining the channel.
  17360. */
  17361. }, {
  17362. key: 'joining',
  17363. value: function joining(callback) {
  17364. this.on('presence:joining', function (member) {
  17365. return callback(member.user_info);
  17366. });
  17367. return this;
  17368. }
  17369. /**
  17370. * Listen for someone leaving the channel.
  17371. */
  17372. }, {
  17373. key: 'leaving',
  17374. value: function leaving(callback) {
  17375. this.on('presence:leaving', function (member) {
  17376. return callback(member.user_info);
  17377. });
  17378. return this;
  17379. }
  17380. }]);
  17381. return SocketIoPresenceChannel;
  17382. }(SocketIoPrivateChannel);
  17383. /**
  17384. * This class represents a null channel.
  17385. */
  17386. var NullChannel = function (_Channel) {
  17387. inherits(NullChannel, _Channel);
  17388. function NullChannel() {
  17389. classCallCheck(this, NullChannel);
  17390. return possibleConstructorReturn(this, (NullChannel.__proto__ || Object.getPrototypeOf(NullChannel)).apply(this, arguments));
  17391. }
  17392. createClass(NullChannel, [{
  17393. key: 'subscribe',
  17394. /**
  17395. * Subscribe to a channel.
  17396. */
  17397. value: function subscribe() {}
  17398. //
  17399. /**
  17400. * Unsubscribe from a channel.
  17401. */
  17402. }, {
  17403. key: 'unsubscribe',
  17404. value: function unsubscribe() {}
  17405. //
  17406. /**
  17407. * Listen for an event on the channel instance.
  17408. */
  17409. }, {
  17410. key: 'listen',
  17411. value: function listen(event, callback) {
  17412. return this;
  17413. }
  17414. /**
  17415. * Stop listening for an event on the channel instance.
  17416. */
  17417. }, {
  17418. key: 'stopListening',
  17419. value: function stopListening(event) {
  17420. return this;
  17421. }
  17422. /**
  17423. * Bind a channel to an event.
  17424. */
  17425. }, {
  17426. key: 'on',
  17427. value: function on(event, callback) {
  17428. return this;
  17429. }
  17430. }]);
  17431. return NullChannel;
  17432. }(Channel);
  17433. /**
  17434. * This class represents a null private channel.
  17435. */
  17436. var NullPrivateChannel = function (_NullChannel) {
  17437. inherits(NullPrivateChannel, _NullChannel);
  17438. function NullPrivateChannel() {
  17439. classCallCheck(this, NullPrivateChannel);
  17440. return possibleConstructorReturn(this, (NullPrivateChannel.__proto__ || Object.getPrototypeOf(NullPrivateChannel)).apply(this, arguments));
  17441. }
  17442. createClass(NullPrivateChannel, [{
  17443. key: 'whisper',
  17444. /**
  17445. * Trigger client event on the channel.
  17446. */
  17447. value: function whisper(eventName, data) {
  17448. return this;
  17449. }
  17450. }]);
  17451. return NullPrivateChannel;
  17452. }(NullChannel);
  17453. /**
  17454. * This class represents a null presence channel.
  17455. */
  17456. var NullPresenceChannel = function (_NullChannel) {
  17457. inherits(NullPresenceChannel, _NullChannel);
  17458. function NullPresenceChannel() {
  17459. classCallCheck(this, NullPresenceChannel);
  17460. return possibleConstructorReturn(this, (NullPresenceChannel.__proto__ || Object.getPrototypeOf(NullPresenceChannel)).apply(this, arguments));
  17461. }
  17462. createClass(NullPresenceChannel, [{
  17463. key: 'here',
  17464. /**
  17465. * Register a callback to be called anytime the member list changes.
  17466. */
  17467. value: function here(callback) {
  17468. return this;
  17469. }
  17470. /**
  17471. * Listen for someone joining the channel.
  17472. */
  17473. }, {
  17474. key: 'joining',
  17475. value: function joining(callback) {
  17476. return this;
  17477. }
  17478. /**
  17479. * Listen for someone leaving the channel.
  17480. */
  17481. }, {
  17482. key: 'leaving',
  17483. value: function leaving(callback) {
  17484. return this;
  17485. }
  17486. /**
  17487. * Trigger client event on the channel.
  17488. */
  17489. }, {
  17490. key: 'whisper',
  17491. value: function whisper(eventName, data) {
  17492. return this;
  17493. }
  17494. }]);
  17495. return NullPresenceChannel;
  17496. }(NullChannel);
  17497. /**
  17498. * This class creates a connector to Pusher.
  17499. */
  17500. var PusherConnector = function (_Connector) {
  17501. inherits(PusherConnector, _Connector);
  17502. function PusherConnector() {
  17503. classCallCheck(this, PusherConnector);
  17504. /**
  17505. * All of the subscribed channel names.
  17506. */
  17507. var _this = possibleConstructorReturn(this, (PusherConnector.__proto__ || Object.getPrototypeOf(PusherConnector)).apply(this, arguments));
  17508. _this.channels = {};
  17509. return _this;
  17510. }
  17511. /**
  17512. * Create a fresh Pusher connection.
  17513. */
  17514. createClass(PusherConnector, [{
  17515. key: 'connect',
  17516. value: function connect() {
  17517. if (typeof this.options.client !== 'undefined') {
  17518. this.pusher = this.options.client;
  17519. } else {
  17520. this.pusher = new Pusher(this.options.key, this.options);
  17521. }
  17522. }
  17523. /**
  17524. * Listen for an event on a channel instance.
  17525. */
  17526. }, {
  17527. key: 'listen',
  17528. value: function listen(name, event, callback) {
  17529. return this.channel(name).listen(event, callback);
  17530. }
  17531. /**
  17532. * Get a channel instance by name.
  17533. */
  17534. }, {
  17535. key: 'channel',
  17536. value: function channel(name) {
  17537. if (!this.channels[name]) {
  17538. this.channels[name] = new PusherChannel(this.pusher, name, this.options);
  17539. }
  17540. return this.channels[name];
  17541. }
  17542. /**
  17543. * Get a private channel instance by name.
  17544. */
  17545. }, {
  17546. key: 'privateChannel',
  17547. value: function privateChannel(name) {
  17548. if (!this.channels['private-' + name]) {
  17549. this.channels['private-' + name] = new PusherPrivateChannel(this.pusher, 'private-' + name, this.options);
  17550. }
  17551. return this.channels['private-' + name];
  17552. }
  17553. /**
  17554. * Get a presence channel instance by name.
  17555. */
  17556. }, {
  17557. key: 'presenceChannel',
  17558. value: function presenceChannel(name) {
  17559. if (!this.channels['presence-' + name]) {
  17560. this.channels['presence-' + name] = new PusherPresenceChannel(this.pusher, 'presence-' + name, this.options);
  17561. }
  17562. return this.channels['presence-' + name];
  17563. }
  17564. /**
  17565. * Leave the given channel, as well as its private and presence variants.
  17566. */
  17567. }, {
  17568. key: 'leave',
  17569. value: function leave(name) {
  17570. var _this2 = this;
  17571. var channels = [name, 'private-' + name, 'presence-' + name];
  17572. channels.forEach(function (name, index) {
  17573. _this2.leaveChannel(name);
  17574. });
  17575. }
  17576. /**
  17577. * Leave the given channel.
  17578. */
  17579. }, {
  17580. key: 'leaveChannel',
  17581. value: function leaveChannel(name) {
  17582. if (this.channels[name]) {
  17583. this.channels[name].unsubscribe();
  17584. delete this.channels[name];
  17585. }
  17586. }
  17587. /**
  17588. * Get the socket ID for the connection.
  17589. */
  17590. }, {
  17591. key: 'socketId',
  17592. value: function socketId() {
  17593. return this.pusher.connection.socket_id;
  17594. }
  17595. /**
  17596. * Disconnect Pusher connection.
  17597. */
  17598. }, {
  17599. key: 'disconnect',
  17600. value: function disconnect() {
  17601. this.pusher.disconnect();
  17602. }
  17603. }]);
  17604. return PusherConnector;
  17605. }(Connector);
  17606. /**
  17607. * This class creates a connnector to a Socket.io server.
  17608. */
  17609. var SocketIoConnector = function (_Connector) {
  17610. inherits(SocketIoConnector, _Connector);
  17611. function SocketIoConnector() {
  17612. classCallCheck(this, SocketIoConnector);
  17613. /**
  17614. * All of the subscribed channel names.
  17615. */
  17616. var _this = possibleConstructorReturn(this, (SocketIoConnector.__proto__ || Object.getPrototypeOf(SocketIoConnector)).apply(this, arguments));
  17617. _this.channels = {};
  17618. return _this;
  17619. }
  17620. /**
  17621. * Create a fresh Socket.io connection.
  17622. */
  17623. createClass(SocketIoConnector, [{
  17624. key: 'connect',
  17625. value: function connect() {
  17626. var io = this.getSocketIO();
  17627. this.socket = io(this.options.host, this.options);
  17628. return this.socket;
  17629. }
  17630. /**
  17631. * Get socket.io module from global scope or options.
  17632. */
  17633. }, {
  17634. key: 'getSocketIO',
  17635. value: function getSocketIO() {
  17636. if (typeof this.options.client !== 'undefined') {
  17637. return this.options.client;
  17638. }
  17639. if (typeof io !== 'undefined') {
  17640. return io;
  17641. }
  17642. throw new Error('Socket.io client not found. Should be globally available or passed via options.client');
  17643. }
  17644. /**
  17645. * Listen for an event on a channel instance.
  17646. */
  17647. }, {
  17648. key: 'listen',
  17649. value: function listen(name, event, callback) {
  17650. return this.channel(name).listen(event, callback);
  17651. }
  17652. /**
  17653. * Get a channel instance by name.
  17654. */
  17655. }, {
  17656. key: 'channel',
  17657. value: function channel(name) {
  17658. if (!this.channels[name]) {
  17659. this.channels[name] = new SocketIoChannel(this.socket, name, this.options);
  17660. }
  17661. return this.channels[name];
  17662. }
  17663. /**
  17664. * Get a private channel instance by name.
  17665. */
  17666. }, {
  17667. key: 'privateChannel',
  17668. value: function privateChannel(name) {
  17669. if (!this.channels['private-' + name]) {
  17670. this.channels['private-' + name] = new SocketIoPrivateChannel(this.socket, 'private-' + name, this.options);
  17671. }
  17672. return this.channels['private-' + name];
  17673. }
  17674. /**
  17675. * Get a presence channel instance by name.
  17676. */
  17677. }, {
  17678. key: 'presenceChannel',
  17679. value: function presenceChannel(name) {
  17680. if (!this.channels['presence-' + name]) {
  17681. this.channels['presence-' + name] = new SocketIoPresenceChannel(this.socket, 'presence-' + name, this.options);
  17682. }
  17683. return this.channels['presence-' + name];
  17684. }
  17685. /**
  17686. * Leave the given channel, as well as its private and presence variants.
  17687. */
  17688. }, {
  17689. key: 'leave',
  17690. value: function leave(name) {
  17691. var _this2 = this;
  17692. var channels = [name, 'private-' + name, 'presence-' + name];
  17693. channels.forEach(function (name) {
  17694. _this2.leaveChannel(name);
  17695. });
  17696. }
  17697. /**
  17698. * Leave the given channel.
  17699. */
  17700. }, {
  17701. key: 'leaveChannel',
  17702. value: function leaveChannel(name) {
  17703. if (this.channels[name]) {
  17704. this.channels[name].unsubscribe();
  17705. delete this.channels[name];
  17706. }
  17707. }
  17708. /**
  17709. * Get the socket ID for the connection.
  17710. */
  17711. }, {
  17712. key: 'socketId',
  17713. value: function socketId() {
  17714. return this.socket.id;
  17715. }
  17716. /**
  17717. * Disconnect Socketio connection.
  17718. */
  17719. }, {
  17720. key: 'disconnect',
  17721. value: function disconnect() {
  17722. this.socket.disconnect();
  17723. }
  17724. }]);
  17725. return SocketIoConnector;
  17726. }(Connector);
  17727. /**
  17728. * This class creates a null connector.
  17729. */
  17730. var NullConnector = function (_Connector) {
  17731. inherits(NullConnector, _Connector);
  17732. function NullConnector() {
  17733. classCallCheck(this, NullConnector);
  17734. /**
  17735. * All of the subscribed channel names.
  17736. */
  17737. var _this = possibleConstructorReturn(this, (NullConnector.__proto__ || Object.getPrototypeOf(NullConnector)).apply(this, arguments));
  17738. _this.channels = {};
  17739. return _this;
  17740. }
  17741. /**
  17742. * Create a fresh connection.
  17743. */
  17744. createClass(NullConnector, [{
  17745. key: 'connect',
  17746. value: function connect() {}
  17747. //
  17748. /**
  17749. * Listen for an event on a channel instance.
  17750. */
  17751. }, {
  17752. key: 'listen',
  17753. value: function listen(name, event, callback) {
  17754. return new NullChannel();
  17755. }
  17756. /**
  17757. * Get a channel instance by name.
  17758. */
  17759. }, {
  17760. key: 'channel',
  17761. value: function channel(name) {
  17762. return new NullChannel();
  17763. }
  17764. /**
  17765. * Get a private channel instance by name.
  17766. */
  17767. }, {
  17768. key: 'privateChannel',
  17769. value: function privateChannel(name) {
  17770. return new NullPrivateChannel();
  17771. }
  17772. /**
  17773. * Get a presence channel instance by name.
  17774. */
  17775. }, {
  17776. key: 'presenceChannel',
  17777. value: function presenceChannel(name) {
  17778. return new NullPresenceChannel();
  17779. }
  17780. /**
  17781. * Leave the given channel, as well as its private and presence variants.
  17782. */
  17783. }, {
  17784. key: 'leave',
  17785. value: function leave(name) {}
  17786. //
  17787. /**
  17788. * Leave the given channel.
  17789. */
  17790. }, {
  17791. key: 'leaveChannel',
  17792. value: function leaveChannel(name) {}
  17793. //
  17794. /**
  17795. * Get the socket ID for the connection.
  17796. */
  17797. }, {
  17798. key: 'socketId',
  17799. value: function socketId() {
  17800. return 'fake-socket-id';
  17801. }
  17802. /**
  17803. * Disconnect the connection.
  17804. */
  17805. }, {
  17806. key: 'disconnect',
  17807. value: function disconnect() {
  17808. //
  17809. }
  17810. }]);
  17811. return NullConnector;
  17812. }(Connector);
  17813. /**
  17814. * This class is the primary API for interacting with broadcasting.
  17815. */
  17816. var Echo = function () {
  17817. /**
  17818. * Create a new class instance.
  17819. */
  17820. function Echo(options) {
  17821. classCallCheck(this, Echo);
  17822. this.options = options;
  17823. this.connect();
  17824. if (!this.options.withoutInterceptors) {
  17825. this.registerInterceptors();
  17826. }
  17827. }
  17828. /**
  17829. * Get a channel instance by name.
  17830. */
  17831. createClass(Echo, [{
  17832. key: 'channel',
  17833. value: function channel(_channel) {
  17834. return this.connector.channel(_channel);
  17835. }
  17836. /**
  17837. * Create a new connection.
  17838. */
  17839. }, {
  17840. key: 'connect',
  17841. value: function connect() {
  17842. if (this.options.broadcaster == 'pusher') {
  17843. this.connector = new PusherConnector(this.options);
  17844. } else if (this.options.broadcaster == 'socket.io') {
  17845. this.connector = new SocketIoConnector(this.options);
  17846. } else if (this.options.broadcaster == 'null') {
  17847. this.connector = new NullConnector(this.options);
  17848. } else if (typeof this.options.broadcaster == 'function') {
  17849. this.connector = new this.options.broadcaster(this.options);
  17850. }
  17851. }
  17852. /**
  17853. * Disconnect from the Echo server.
  17854. */
  17855. }, {
  17856. key: 'disconnect',
  17857. value: function disconnect() {
  17858. this.connector.disconnect();
  17859. }
  17860. /**
  17861. * Get a presence channel instance by name.
  17862. */
  17863. }, {
  17864. key: 'join',
  17865. value: function join(channel) {
  17866. return this.connector.presenceChannel(channel);
  17867. }
  17868. /**
  17869. * Leave the given channel, as well as its private and presence variants.
  17870. */
  17871. }, {
  17872. key: 'leave',
  17873. value: function leave(channel) {
  17874. this.connector.leave(channel);
  17875. }
  17876. /**
  17877. * Leave the given channel.
  17878. */
  17879. }, {
  17880. key: 'leaveChannel',
  17881. value: function leaveChannel(channel) {
  17882. this.connector.leaveChannel(channel);
  17883. }
  17884. /**
  17885. * Listen for an event on a channel instance.
  17886. */
  17887. }, {
  17888. key: 'listen',
  17889. value: function listen(channel, event, callback) {
  17890. return this.connector.listen(channel, event, callback);
  17891. }
  17892. /**
  17893. * Get a private channel instance by name.
  17894. */
  17895. }, {
  17896. key: 'private',
  17897. value: function _private(channel) {
  17898. return this.connector.privateChannel(channel);
  17899. }
  17900. /**
  17901. * Get the Socket ID for the connection.
  17902. */
  17903. }, {
  17904. key: 'socketId',
  17905. value: function socketId() {
  17906. return this.connector.socketId();
  17907. }
  17908. /**
  17909. * Register 3rd party request interceptiors. These are used to automatically
  17910. * send a connections socket id to a Laravel app with a X-Socket-Id header.
  17911. */
  17912. }, {
  17913. key: 'registerInterceptors',
  17914. value: function registerInterceptors() {
  17915. if (typeof Vue === 'function' && Vue.http) {
  17916. this.registerVueRequestInterceptor();
  17917. }
  17918. if (typeof axios === 'function') {
  17919. this.registerAxiosRequestInterceptor();
  17920. }
  17921. if (typeof jQuery === 'function') {
  17922. this.registerjQueryAjaxSetup();
  17923. }
  17924. }
  17925. /**
  17926. * Register a Vue HTTP interceptor to add the X-Socket-ID header.
  17927. */
  17928. }, {
  17929. key: 'registerVueRequestInterceptor',
  17930. value: function registerVueRequestInterceptor() {
  17931. var _this = this;
  17932. Vue.http.interceptors.push(function (request, next) {
  17933. if (_this.socketId()) {
  17934. request.headers.set('X-Socket-ID', _this.socketId());
  17935. }
  17936. next();
  17937. });
  17938. }
  17939. /**
  17940. * Register an Axios HTTP interceptor to add the X-Socket-ID header.
  17941. */
  17942. }, {
  17943. key: 'registerAxiosRequestInterceptor',
  17944. value: function registerAxiosRequestInterceptor() {
  17945. var _this2 = this;
  17946. axios.interceptors.request.use(function (config) {
  17947. if (_this2.socketId()) {
  17948. config.headers['X-Socket-Id'] = _this2.socketId();
  17949. }
  17950. return config;
  17951. });
  17952. }
  17953. /**
  17954. * Register jQuery AjaxPrefilter to add the X-Socket-ID header.
  17955. */
  17956. }, {
  17957. key: 'registerjQueryAjaxSetup',
  17958. value: function registerjQueryAjaxSetup() {
  17959. var _this3 = this;
  17960. if (typeof jQuery.ajax != 'undefined') {
  17961. jQuery.ajaxPrefilter(function (options, originalOptions, xhr) {
  17962. if (_this3.socketId()) {
  17963. xhr.setRequestHeader('X-Socket-Id', _this3.socketId());
  17964. }
  17965. });
  17966. }
  17967. }
  17968. }]);
  17969. return Echo;
  17970. }();
  17971. /* harmony default export */ __webpack_exports__["default"] = (Echo);
  17972. /***/ }),
  17973. /***/ "./node_modules/lodash/lodash.js":
  17974. /*!***************************************!*\
  17975. !*** ./node_modules/lodash/lodash.js ***!
  17976. \***************************************/
  17977. /*! no static exports found */
  17978. /***/ (function(module, exports, __webpack_require__) {
  17979. /* WEBPACK VAR INJECTION */(function(global, module) {var __WEBPACK_AMD_DEFINE_RESULT__;/**
  17980. * @license
  17981. * Lodash <https://lodash.com/>
  17982. * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
  17983. * Released under MIT license <https://lodash.com/license>
  17984. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  17985. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  17986. */
  17987. ;(function() {
  17988. /** Used as a safe reference for `undefined` in pre-ES5 environments. */
  17989. var undefined;
  17990. /** Used as the semantic version number. */
  17991. var VERSION = '4.17.15';
  17992. /** Used as the size to enable large array optimizations. */
  17993. var LARGE_ARRAY_SIZE = 200;
  17994. /** Error message constants. */
  17995. var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
  17996. FUNC_ERROR_TEXT = 'Expected a function';
  17997. /** Used to stand-in for `undefined` hash values. */
  17998. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  17999. /** Used as the maximum memoize cache size. */
  18000. var MAX_MEMOIZE_SIZE = 500;
  18001. /** Used as the internal argument placeholder. */
  18002. var PLACEHOLDER = '__lodash_placeholder__';
  18003. /** Used to compose bitmasks for cloning. */
  18004. var CLONE_DEEP_FLAG = 1,
  18005. CLONE_FLAT_FLAG = 2,
  18006. CLONE_SYMBOLS_FLAG = 4;
  18007. /** Used to compose bitmasks for value comparisons. */
  18008. var COMPARE_PARTIAL_FLAG = 1,
  18009. COMPARE_UNORDERED_FLAG = 2;
  18010. /** Used to compose bitmasks for function metadata. */
  18011. var WRAP_BIND_FLAG = 1,
  18012. WRAP_BIND_KEY_FLAG = 2,
  18013. WRAP_CURRY_BOUND_FLAG = 4,
  18014. WRAP_CURRY_FLAG = 8,
  18015. WRAP_CURRY_RIGHT_FLAG = 16,
  18016. WRAP_PARTIAL_FLAG = 32,
  18017. WRAP_PARTIAL_RIGHT_FLAG = 64,
  18018. WRAP_ARY_FLAG = 128,
  18019. WRAP_REARG_FLAG = 256,
  18020. WRAP_FLIP_FLAG = 512;
  18021. /** Used as default options for `_.truncate`. */
  18022. var DEFAULT_TRUNC_LENGTH = 30,
  18023. DEFAULT_TRUNC_OMISSION = '...';
  18024. /** Used to detect hot functions by number of calls within a span of milliseconds. */
  18025. var HOT_COUNT = 800,
  18026. HOT_SPAN = 16;
  18027. /** Used to indicate the type of lazy iteratees. */
  18028. var LAZY_FILTER_FLAG = 1,
  18029. LAZY_MAP_FLAG = 2,
  18030. LAZY_WHILE_FLAG = 3;
  18031. /** Used as references for various `Number` constants. */
  18032. var INFINITY = 1 / 0,
  18033. MAX_SAFE_INTEGER = 9007199254740991,
  18034. MAX_INTEGER = 1.7976931348623157e+308,
  18035. NAN = 0 / 0;
  18036. /** Used as references for the maximum length and index of an array. */
  18037. var MAX_ARRAY_LENGTH = 4294967295,
  18038. MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
  18039. HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
  18040. /** Used to associate wrap methods with their bit flags. */
  18041. var wrapFlags = [
  18042. ['ary', WRAP_ARY_FLAG],
  18043. ['bind', WRAP_BIND_FLAG],
  18044. ['bindKey', WRAP_BIND_KEY_FLAG],
  18045. ['curry', WRAP_CURRY_FLAG],
  18046. ['curryRight', WRAP_CURRY_RIGHT_FLAG],
  18047. ['flip', WRAP_FLIP_FLAG],
  18048. ['partial', WRAP_PARTIAL_FLAG],
  18049. ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
  18050. ['rearg', WRAP_REARG_FLAG]
  18051. ];
  18052. /** `Object#toString` result references. */
  18053. var argsTag = '[object Arguments]',
  18054. arrayTag = '[object Array]',
  18055. asyncTag = '[object AsyncFunction]',
  18056. boolTag = '[object Boolean]',
  18057. dateTag = '[object Date]',
  18058. domExcTag = '[object DOMException]',
  18059. errorTag = '[object Error]',
  18060. funcTag = '[object Function]',
  18061. genTag = '[object GeneratorFunction]',
  18062. mapTag = '[object Map]',
  18063. numberTag = '[object Number]',
  18064. nullTag = '[object Null]',
  18065. objectTag = '[object Object]',
  18066. promiseTag = '[object Promise]',
  18067. proxyTag = '[object Proxy]',
  18068. regexpTag = '[object RegExp]',
  18069. setTag = '[object Set]',
  18070. stringTag = '[object String]',
  18071. symbolTag = '[object Symbol]',
  18072. undefinedTag = '[object Undefined]',
  18073. weakMapTag = '[object WeakMap]',
  18074. weakSetTag = '[object WeakSet]';
  18075. var arrayBufferTag = '[object ArrayBuffer]',
  18076. dataViewTag = '[object DataView]',
  18077. float32Tag = '[object Float32Array]',
  18078. float64Tag = '[object Float64Array]',
  18079. int8Tag = '[object Int8Array]',
  18080. int16Tag = '[object Int16Array]',
  18081. int32Tag = '[object Int32Array]',
  18082. uint8Tag = '[object Uint8Array]',
  18083. uint8ClampedTag = '[object Uint8ClampedArray]',
  18084. uint16Tag = '[object Uint16Array]',
  18085. uint32Tag = '[object Uint32Array]';
  18086. /** Used to match empty string literals in compiled template source. */
  18087. var reEmptyStringLeading = /\b__p \+= '';/g,
  18088. reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
  18089. reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  18090. /** Used to match HTML entities and HTML characters. */
  18091. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
  18092. reUnescapedHtml = /[&<>"']/g,
  18093. reHasEscapedHtml = RegExp(reEscapedHtml.source),
  18094. reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  18095. /** Used to match template delimiters. */
  18096. var reEscape = /<%-([\s\S]+?)%>/g,
  18097. reEvaluate = /<%([\s\S]+?)%>/g,
  18098. reInterpolate = /<%=([\s\S]+?)%>/g;
  18099. /** Used to match property names within property paths. */
  18100. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  18101. reIsPlainProp = /^\w*$/,
  18102. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  18103. /**
  18104. * Used to match `RegExp`
  18105. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  18106. */
  18107. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
  18108. reHasRegExpChar = RegExp(reRegExpChar.source);
  18109. /** Used to match leading and trailing whitespace. */
  18110. var reTrim = /^\s+|\s+$/g,
  18111. reTrimStart = /^\s+/,
  18112. reTrimEnd = /\s+$/;
  18113. /** Used to match wrap detail comments. */
  18114. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
  18115. reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
  18116. reSplitDetails = /,? & /;
  18117. /** Used to match words composed of alphanumeric characters. */
  18118. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  18119. /** Used to match backslashes in property paths. */
  18120. var reEscapeChar = /\\(\\)?/g;
  18121. /**
  18122. * Used to match
  18123. * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
  18124. */
  18125. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  18126. /** Used to match `RegExp` flags from their coerced string values. */
  18127. var reFlags = /\w*$/;
  18128. /** Used to detect bad signed hexadecimal string values. */
  18129. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  18130. /** Used to detect binary string values. */
  18131. var reIsBinary = /^0b[01]+$/i;
  18132. /** Used to detect host constructors (Safari). */
  18133. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  18134. /** Used to detect octal string values. */
  18135. var reIsOctal = /^0o[0-7]+$/i;
  18136. /** Used to detect unsigned integer values. */
  18137. var reIsUint = /^(?:0|[1-9]\d*)$/;
  18138. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  18139. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  18140. /** Used to ensure capturing order of template delimiters. */
  18141. var reNoMatch = /($^)/;
  18142. /** Used to match unescaped characters in compiled string literals. */
  18143. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  18144. /** Used to compose unicode character classes. */
  18145. var rsAstralRange = '\\ud800-\\udfff',
  18146. rsComboMarksRange = '\\u0300-\\u036f',
  18147. reComboHalfMarksRange = '\\ufe20-\\ufe2f',
  18148. rsComboSymbolsRange = '\\u20d0-\\u20ff',
  18149. rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
  18150. rsDingbatRange = '\\u2700-\\u27bf',
  18151. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  18152. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  18153. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  18154. rsPunctuationRange = '\\u2000-\\u206f',
  18155. 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',
  18156. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  18157. rsVarRange = '\\ufe0e\\ufe0f',
  18158. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  18159. /** Used to compose unicode capture groups. */
  18160. var rsApos = "['\u2019]",
  18161. rsAstral = '[' + rsAstralRange + ']',
  18162. rsBreak = '[' + rsBreakRange + ']',
  18163. rsCombo = '[' + rsComboRange + ']',
  18164. rsDigits = '\\d+',
  18165. rsDingbat = '[' + rsDingbatRange + ']',
  18166. rsLower = '[' + rsLowerRange + ']',
  18167. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  18168. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  18169. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  18170. rsNonAstral = '[^' + rsAstralRange + ']',
  18171. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  18172. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  18173. rsUpper = '[' + rsUpperRange + ']',
  18174. rsZWJ = '\\u200d';
  18175. /** Used to compose unicode regexes. */
  18176. var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
  18177. rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
  18178. rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  18179. rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  18180. reOptMod = rsModifier + '?',
  18181. rsOptVar = '[' + rsVarRange + ']?',
  18182. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  18183. rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
  18184. rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
  18185. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  18186. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  18187. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  18188. /** Used to match apostrophes. */
  18189. var reApos = RegExp(rsApos, 'g');
  18190. /**
  18191. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  18192. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  18193. */
  18194. var reComboMark = RegExp(rsCombo, 'g');
  18195. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  18196. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  18197. /** Used to match complex or compound words. */
  18198. var reUnicodeWord = RegExp([
  18199. rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  18200. rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
  18201. rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
  18202. rsUpper + '+' + rsOptContrUpper,
  18203. rsOrdUpper,
  18204. rsOrdLower,
  18205. rsDigits,
  18206. rsEmoji
  18207. ].join('|'), 'g');
  18208. /** 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/). */
  18209. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
  18210. /** Used to detect strings that need a more robust regexp to match words. */
  18211. 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 ]/;
  18212. /** Used to assign default `context` object properties. */
  18213. var contextProps = [
  18214. 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
  18215. 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
  18216. 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
  18217. 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
  18218. '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
  18219. ];
  18220. /** Used to make template sourceURLs easier to identify. */
  18221. var templateCounter = -1;
  18222. /** Used to identify `toStringTag` values of typed arrays. */
  18223. var typedArrayTags = {};
  18224. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  18225. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  18226. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  18227. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  18228. typedArrayTags[uint32Tag] = true;
  18229. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  18230. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  18231. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  18232. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  18233. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  18234. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  18235. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  18236. typedArrayTags[weakMapTag] = false;
  18237. /** Used to identify `toStringTag` values supported by `_.clone`. */
  18238. var cloneableTags = {};
  18239. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  18240. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  18241. cloneableTags[boolTag] = cloneableTags[dateTag] =
  18242. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  18243. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  18244. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  18245. cloneableTags[numberTag] = cloneableTags[objectTag] =
  18246. cloneableTags[regexpTag] = cloneableTags[setTag] =
  18247. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  18248. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  18249. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  18250. cloneableTags[errorTag] = cloneableTags[funcTag] =
  18251. cloneableTags[weakMapTag] = false;
  18252. /** Used to map Latin Unicode letters to basic Latin letters. */
  18253. var deburredLetters = {
  18254. // Latin-1 Supplement block.
  18255. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  18256. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  18257. '\xc7': 'C', '\xe7': 'c',
  18258. '\xd0': 'D', '\xf0': 'd',
  18259. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  18260. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  18261. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  18262. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  18263. '\xd1': 'N', '\xf1': 'n',
  18264. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  18265. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  18266. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  18267. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  18268. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  18269. '\xc6': 'Ae', '\xe6': 'ae',
  18270. '\xde': 'Th', '\xfe': 'th',
  18271. '\xdf': 'ss',
  18272. // Latin Extended-A block.
  18273. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  18274. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  18275. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  18276. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  18277. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  18278. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  18279. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  18280. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  18281. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  18282. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  18283. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  18284. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  18285. '\u0134': 'J', '\u0135': 'j',
  18286. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  18287. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  18288. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  18289. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  18290. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  18291. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  18292. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  18293. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  18294. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  18295. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  18296. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  18297. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  18298. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  18299. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  18300. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  18301. '\u0174': 'W', '\u0175': 'w',
  18302. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  18303. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  18304. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  18305. '\u0132': 'IJ', '\u0133': 'ij',
  18306. '\u0152': 'Oe', '\u0153': 'oe',
  18307. '\u0149': "'n", '\u017f': 's'
  18308. };
  18309. /** Used to map characters to HTML entities. */
  18310. var htmlEscapes = {
  18311. '&': '&amp;',
  18312. '<': '&lt;',
  18313. '>': '&gt;',
  18314. '"': '&quot;',
  18315. "'": '&#39;'
  18316. };
  18317. /** Used to map HTML entities to characters. */
  18318. var htmlUnescapes = {
  18319. '&amp;': '&',
  18320. '&lt;': '<',
  18321. '&gt;': '>',
  18322. '&quot;': '"',
  18323. '&#39;': "'"
  18324. };
  18325. /** Used to escape characters for inclusion in compiled string literals. */
  18326. var stringEscapes = {
  18327. '\\': '\\',
  18328. "'": "'",
  18329. '\n': 'n',
  18330. '\r': 'r',
  18331. '\u2028': 'u2028',
  18332. '\u2029': 'u2029'
  18333. };
  18334. /** Built-in method references without a dependency on `root`. */
  18335. var freeParseFloat = parseFloat,
  18336. freeParseInt = parseInt;
  18337. /** Detect free variable `global` from Node.js. */
  18338. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  18339. /** Detect free variable `self`. */
  18340. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  18341. /** Used as a reference to the global object. */
  18342. var root = freeGlobal || freeSelf || Function('return this')();
  18343. /** Detect free variable `exports`. */
  18344. var freeExports = true && exports && !exports.nodeType && exports;
  18345. /** Detect free variable `module`. */
  18346. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  18347. /** Detect the popular CommonJS extension `module.exports`. */
  18348. var moduleExports = freeModule && freeModule.exports === freeExports;
  18349. /** Detect free variable `process` from Node.js. */
  18350. var freeProcess = moduleExports && freeGlobal.process;
  18351. /** Used to access faster Node.js helpers. */
  18352. var nodeUtil = (function() {
  18353. try {
  18354. // Use `util.types` for Node.js 10+.
  18355. var types = freeModule && freeModule.require && freeModule.require('util').types;
  18356. if (types) {
  18357. return types;
  18358. }
  18359. // Legacy `process.binding('util')` for Node.js < 10.
  18360. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  18361. } catch (e) {}
  18362. }());
  18363. /* Node.js helper references. */
  18364. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
  18365. nodeIsDate = nodeUtil && nodeUtil.isDate,
  18366. nodeIsMap = nodeUtil && nodeUtil.isMap,
  18367. nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
  18368. nodeIsSet = nodeUtil && nodeUtil.isSet,
  18369. nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  18370. /*--------------------------------------------------------------------------*/
  18371. /**
  18372. * A faster alternative to `Function#apply`, this function invokes `func`
  18373. * with the `this` binding of `thisArg` and the arguments of `args`.
  18374. *
  18375. * @private
  18376. * @param {Function} func The function to invoke.
  18377. * @param {*} thisArg The `this` binding of `func`.
  18378. * @param {Array} args The arguments to invoke `func` with.
  18379. * @returns {*} Returns the result of `func`.
  18380. */
  18381. function apply(func, thisArg, args) {
  18382. switch (args.length) {
  18383. case 0: return func.call(thisArg);
  18384. case 1: return func.call(thisArg, args[0]);
  18385. case 2: return func.call(thisArg, args[0], args[1]);
  18386. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  18387. }
  18388. return func.apply(thisArg, args);
  18389. }
  18390. /**
  18391. * A specialized version of `baseAggregator` for arrays.
  18392. *
  18393. * @private
  18394. * @param {Array} [array] The array to iterate over.
  18395. * @param {Function} setter The function to set `accumulator` values.
  18396. * @param {Function} iteratee The iteratee to transform keys.
  18397. * @param {Object} accumulator The initial aggregated object.
  18398. * @returns {Function} Returns `accumulator`.
  18399. */
  18400. function arrayAggregator(array, setter, iteratee, accumulator) {
  18401. var index = -1,
  18402. length = array == null ? 0 : array.length;
  18403. while (++index < length) {
  18404. var value = array[index];
  18405. setter(accumulator, value, iteratee(value), array);
  18406. }
  18407. return accumulator;
  18408. }
  18409. /**
  18410. * A specialized version of `_.forEach` for arrays without support for
  18411. * iteratee shorthands.
  18412. *
  18413. * @private
  18414. * @param {Array} [array] The array to iterate over.
  18415. * @param {Function} iteratee The function invoked per iteration.
  18416. * @returns {Array} Returns `array`.
  18417. */
  18418. function arrayEach(array, iteratee) {
  18419. var index = -1,
  18420. length = array == null ? 0 : array.length;
  18421. while (++index < length) {
  18422. if (iteratee(array[index], index, array) === false) {
  18423. break;
  18424. }
  18425. }
  18426. return array;
  18427. }
  18428. /**
  18429. * A specialized version of `_.forEachRight` for arrays without support for
  18430. * iteratee shorthands.
  18431. *
  18432. * @private
  18433. * @param {Array} [array] The array to iterate over.
  18434. * @param {Function} iteratee The function invoked per iteration.
  18435. * @returns {Array} Returns `array`.
  18436. */
  18437. function arrayEachRight(array, iteratee) {
  18438. var length = array == null ? 0 : array.length;
  18439. while (length--) {
  18440. if (iteratee(array[length], length, array) === false) {
  18441. break;
  18442. }
  18443. }
  18444. return array;
  18445. }
  18446. /**
  18447. * A specialized version of `_.every` for arrays without support for
  18448. * iteratee shorthands.
  18449. *
  18450. * @private
  18451. * @param {Array} [array] The array to iterate over.
  18452. * @param {Function} predicate The function invoked per iteration.
  18453. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  18454. * else `false`.
  18455. */
  18456. function arrayEvery(array, predicate) {
  18457. var index = -1,
  18458. length = array == null ? 0 : array.length;
  18459. while (++index < length) {
  18460. if (!predicate(array[index], index, array)) {
  18461. return false;
  18462. }
  18463. }
  18464. return true;
  18465. }
  18466. /**
  18467. * A specialized version of `_.filter` for arrays without support for
  18468. * iteratee shorthands.
  18469. *
  18470. * @private
  18471. * @param {Array} [array] The array to iterate over.
  18472. * @param {Function} predicate The function invoked per iteration.
  18473. * @returns {Array} Returns the new filtered array.
  18474. */
  18475. function arrayFilter(array, predicate) {
  18476. var index = -1,
  18477. length = array == null ? 0 : array.length,
  18478. resIndex = 0,
  18479. result = [];
  18480. while (++index < length) {
  18481. var value = array[index];
  18482. if (predicate(value, index, array)) {
  18483. result[resIndex++] = value;
  18484. }
  18485. }
  18486. return result;
  18487. }
  18488. /**
  18489. * A specialized version of `_.includes` for arrays without support for
  18490. * specifying an index to search from.
  18491. *
  18492. * @private
  18493. * @param {Array} [array] The array to inspect.
  18494. * @param {*} target The value to search for.
  18495. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  18496. */
  18497. function arrayIncludes(array, value) {
  18498. var length = array == null ? 0 : array.length;
  18499. return !!length && baseIndexOf(array, value, 0) > -1;
  18500. }
  18501. /**
  18502. * This function is like `arrayIncludes` except that it accepts a comparator.
  18503. *
  18504. * @private
  18505. * @param {Array} [array] The array to inspect.
  18506. * @param {*} target The value to search for.
  18507. * @param {Function} comparator The comparator invoked per element.
  18508. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  18509. */
  18510. function arrayIncludesWith(array, value, comparator) {
  18511. var index = -1,
  18512. length = array == null ? 0 : array.length;
  18513. while (++index < length) {
  18514. if (comparator(value, array[index])) {
  18515. return true;
  18516. }
  18517. }
  18518. return false;
  18519. }
  18520. /**
  18521. * A specialized version of `_.map` for arrays without support for iteratee
  18522. * shorthands.
  18523. *
  18524. * @private
  18525. * @param {Array} [array] The array to iterate over.
  18526. * @param {Function} iteratee The function invoked per iteration.
  18527. * @returns {Array} Returns the new mapped array.
  18528. */
  18529. function arrayMap(array, iteratee) {
  18530. var index = -1,
  18531. length = array == null ? 0 : array.length,
  18532. result = Array(length);
  18533. while (++index < length) {
  18534. result[index] = iteratee(array[index], index, array);
  18535. }
  18536. return result;
  18537. }
  18538. /**
  18539. * Appends the elements of `values` to `array`.
  18540. *
  18541. * @private
  18542. * @param {Array} array The array to modify.
  18543. * @param {Array} values The values to append.
  18544. * @returns {Array} Returns `array`.
  18545. */
  18546. function arrayPush(array, values) {
  18547. var index = -1,
  18548. length = values.length,
  18549. offset = array.length;
  18550. while (++index < length) {
  18551. array[offset + index] = values[index];
  18552. }
  18553. return array;
  18554. }
  18555. /**
  18556. * A specialized version of `_.reduce` for arrays without support for
  18557. * iteratee shorthands.
  18558. *
  18559. * @private
  18560. * @param {Array} [array] The array to iterate over.
  18561. * @param {Function} iteratee The function invoked per iteration.
  18562. * @param {*} [accumulator] The initial value.
  18563. * @param {boolean} [initAccum] Specify using the first element of `array` as
  18564. * the initial value.
  18565. * @returns {*} Returns the accumulated value.
  18566. */
  18567. function arrayReduce(array, iteratee, accumulator, initAccum) {
  18568. var index = -1,
  18569. length = array == null ? 0 : array.length;
  18570. if (initAccum && length) {
  18571. accumulator = array[++index];
  18572. }
  18573. while (++index < length) {
  18574. accumulator = iteratee(accumulator, array[index], index, array);
  18575. }
  18576. return accumulator;
  18577. }
  18578. /**
  18579. * A specialized version of `_.reduceRight` for arrays without support for
  18580. * iteratee shorthands.
  18581. *
  18582. * @private
  18583. * @param {Array} [array] The array to iterate over.
  18584. * @param {Function} iteratee The function invoked per iteration.
  18585. * @param {*} [accumulator] The initial value.
  18586. * @param {boolean} [initAccum] Specify using the last element of `array` as
  18587. * the initial value.
  18588. * @returns {*} Returns the accumulated value.
  18589. */
  18590. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  18591. var length = array == null ? 0 : array.length;
  18592. if (initAccum && length) {
  18593. accumulator = array[--length];
  18594. }
  18595. while (length--) {
  18596. accumulator = iteratee(accumulator, array[length], length, array);
  18597. }
  18598. return accumulator;
  18599. }
  18600. /**
  18601. * A specialized version of `_.some` for arrays without support for iteratee
  18602. * shorthands.
  18603. *
  18604. * @private
  18605. * @param {Array} [array] The array to iterate over.
  18606. * @param {Function} predicate The function invoked per iteration.
  18607. * @returns {boolean} Returns `true` if any element passes the predicate check,
  18608. * else `false`.
  18609. */
  18610. function arraySome(array, predicate) {
  18611. var index = -1,
  18612. length = array == null ? 0 : array.length;
  18613. while (++index < length) {
  18614. if (predicate(array[index], index, array)) {
  18615. return true;
  18616. }
  18617. }
  18618. return false;
  18619. }
  18620. /**
  18621. * Gets the size of an ASCII `string`.
  18622. *
  18623. * @private
  18624. * @param {string} string The string inspect.
  18625. * @returns {number} Returns the string size.
  18626. */
  18627. var asciiSize = baseProperty('length');
  18628. /**
  18629. * Converts an ASCII `string` to an array.
  18630. *
  18631. * @private
  18632. * @param {string} string The string to convert.
  18633. * @returns {Array} Returns the converted array.
  18634. */
  18635. function asciiToArray(string) {
  18636. return string.split('');
  18637. }
  18638. /**
  18639. * Splits an ASCII `string` into an array of its words.
  18640. *
  18641. * @private
  18642. * @param {string} The string to inspect.
  18643. * @returns {Array} Returns the words of `string`.
  18644. */
  18645. function asciiWords(string) {
  18646. return string.match(reAsciiWord) || [];
  18647. }
  18648. /**
  18649. * The base implementation of methods like `_.findKey` and `_.findLastKey`,
  18650. * without support for iteratee shorthands, which iterates over `collection`
  18651. * using `eachFunc`.
  18652. *
  18653. * @private
  18654. * @param {Array|Object} collection The collection to inspect.
  18655. * @param {Function} predicate The function invoked per iteration.
  18656. * @param {Function} eachFunc The function to iterate over `collection`.
  18657. * @returns {*} Returns the found element or its key, else `undefined`.
  18658. */
  18659. function baseFindKey(collection, predicate, eachFunc) {
  18660. var result;
  18661. eachFunc(collection, function(value, key, collection) {
  18662. if (predicate(value, key, collection)) {
  18663. result = key;
  18664. return false;
  18665. }
  18666. });
  18667. return result;
  18668. }
  18669. /**
  18670. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  18671. * support for iteratee shorthands.
  18672. *
  18673. * @private
  18674. * @param {Array} array The array to inspect.
  18675. * @param {Function} predicate The function invoked per iteration.
  18676. * @param {number} fromIndex The index to search from.
  18677. * @param {boolean} [fromRight] Specify iterating from right to left.
  18678. * @returns {number} Returns the index of the matched value, else `-1`.
  18679. */
  18680. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  18681. var length = array.length,
  18682. index = fromIndex + (fromRight ? 1 : -1);
  18683. while ((fromRight ? index-- : ++index < length)) {
  18684. if (predicate(array[index], index, array)) {
  18685. return index;
  18686. }
  18687. }
  18688. return -1;
  18689. }
  18690. /**
  18691. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  18692. *
  18693. * @private
  18694. * @param {Array} array The array to inspect.
  18695. * @param {*} value The value to search for.
  18696. * @param {number} fromIndex The index to search from.
  18697. * @returns {number} Returns the index of the matched value, else `-1`.
  18698. */
  18699. function baseIndexOf(array, value, fromIndex) {
  18700. return value === value
  18701. ? strictIndexOf(array, value, fromIndex)
  18702. : baseFindIndex(array, baseIsNaN, fromIndex);
  18703. }
  18704. /**
  18705. * This function is like `baseIndexOf` except that it accepts a comparator.
  18706. *
  18707. * @private
  18708. * @param {Array} array The array to inspect.
  18709. * @param {*} value The value to search for.
  18710. * @param {number} fromIndex The index to search from.
  18711. * @param {Function} comparator The comparator invoked per element.
  18712. * @returns {number} Returns the index of the matched value, else `-1`.
  18713. */
  18714. function baseIndexOfWith(array, value, fromIndex, comparator) {
  18715. var index = fromIndex - 1,
  18716. length = array.length;
  18717. while (++index < length) {
  18718. if (comparator(array[index], value)) {
  18719. return index;
  18720. }
  18721. }
  18722. return -1;
  18723. }
  18724. /**
  18725. * The base implementation of `_.isNaN` without support for number objects.
  18726. *
  18727. * @private
  18728. * @param {*} value The value to check.
  18729. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  18730. */
  18731. function baseIsNaN(value) {
  18732. return value !== value;
  18733. }
  18734. /**
  18735. * The base implementation of `_.mean` and `_.meanBy` without support for
  18736. * iteratee shorthands.
  18737. *
  18738. * @private
  18739. * @param {Array} array The array to iterate over.
  18740. * @param {Function} iteratee The function invoked per iteration.
  18741. * @returns {number} Returns the mean.
  18742. */
  18743. function baseMean(array, iteratee) {
  18744. var length = array == null ? 0 : array.length;
  18745. return length ? (baseSum(array, iteratee) / length) : NAN;
  18746. }
  18747. /**
  18748. * The base implementation of `_.property` without support for deep paths.
  18749. *
  18750. * @private
  18751. * @param {string} key The key of the property to get.
  18752. * @returns {Function} Returns the new accessor function.
  18753. */
  18754. function baseProperty(key) {
  18755. return function(object) {
  18756. return object == null ? undefined : object[key];
  18757. };
  18758. }
  18759. /**
  18760. * The base implementation of `_.propertyOf` without support for deep paths.
  18761. *
  18762. * @private
  18763. * @param {Object} object The object to query.
  18764. * @returns {Function} Returns the new accessor function.
  18765. */
  18766. function basePropertyOf(object) {
  18767. return function(key) {
  18768. return object == null ? undefined : object[key];
  18769. };
  18770. }
  18771. /**
  18772. * The base implementation of `_.reduce` and `_.reduceRight`, without support
  18773. * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
  18774. *
  18775. * @private
  18776. * @param {Array|Object} collection The collection to iterate over.
  18777. * @param {Function} iteratee The function invoked per iteration.
  18778. * @param {*} accumulator The initial value.
  18779. * @param {boolean} initAccum Specify using the first or last element of
  18780. * `collection` as the initial value.
  18781. * @param {Function} eachFunc The function to iterate over `collection`.
  18782. * @returns {*} Returns the accumulated value.
  18783. */
  18784. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  18785. eachFunc(collection, function(value, index, collection) {
  18786. accumulator = initAccum
  18787. ? (initAccum = false, value)
  18788. : iteratee(accumulator, value, index, collection);
  18789. });
  18790. return accumulator;
  18791. }
  18792. /**
  18793. * The base implementation of `_.sortBy` which uses `comparer` to define the
  18794. * sort order of `array` and replaces criteria objects with their corresponding
  18795. * values.
  18796. *
  18797. * @private
  18798. * @param {Array} array The array to sort.
  18799. * @param {Function} comparer The function to define sort order.
  18800. * @returns {Array} Returns `array`.
  18801. */
  18802. function baseSortBy(array, comparer) {
  18803. var length = array.length;
  18804. array.sort(comparer);
  18805. while (length--) {
  18806. array[length] = array[length].value;
  18807. }
  18808. return array;
  18809. }
  18810. /**
  18811. * The base implementation of `_.sum` and `_.sumBy` without support for
  18812. * iteratee shorthands.
  18813. *
  18814. * @private
  18815. * @param {Array} array The array to iterate over.
  18816. * @param {Function} iteratee The function invoked per iteration.
  18817. * @returns {number} Returns the sum.
  18818. */
  18819. function baseSum(array, iteratee) {
  18820. var result,
  18821. index = -1,
  18822. length = array.length;
  18823. while (++index < length) {
  18824. var current = iteratee(array[index]);
  18825. if (current !== undefined) {
  18826. result = result === undefined ? current : (result + current);
  18827. }
  18828. }
  18829. return result;
  18830. }
  18831. /**
  18832. * The base implementation of `_.times` without support for iteratee shorthands
  18833. * or max array length checks.
  18834. *
  18835. * @private
  18836. * @param {number} n The number of times to invoke `iteratee`.
  18837. * @param {Function} iteratee The function invoked per iteration.
  18838. * @returns {Array} Returns the array of results.
  18839. */
  18840. function baseTimes(n, iteratee) {
  18841. var index = -1,
  18842. result = Array(n);
  18843. while (++index < n) {
  18844. result[index] = iteratee(index);
  18845. }
  18846. return result;
  18847. }
  18848. /**
  18849. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  18850. * of key-value pairs for `object` corresponding to the property names of `props`.
  18851. *
  18852. * @private
  18853. * @param {Object} object The object to query.
  18854. * @param {Array} props The property names to get values for.
  18855. * @returns {Object} Returns the key-value pairs.
  18856. */
  18857. function baseToPairs(object, props) {
  18858. return arrayMap(props, function(key) {
  18859. return [key, object[key]];
  18860. });
  18861. }
  18862. /**
  18863. * The base implementation of `_.unary` without support for storing metadata.
  18864. *
  18865. * @private
  18866. * @param {Function} func The function to cap arguments for.
  18867. * @returns {Function} Returns the new capped function.
  18868. */
  18869. function baseUnary(func) {
  18870. return function(value) {
  18871. return func(value);
  18872. };
  18873. }
  18874. /**
  18875. * The base implementation of `_.values` and `_.valuesIn` which creates an
  18876. * array of `object` property values corresponding to the property names
  18877. * of `props`.
  18878. *
  18879. * @private
  18880. * @param {Object} object The object to query.
  18881. * @param {Array} props The property names to get values for.
  18882. * @returns {Object} Returns the array of property values.
  18883. */
  18884. function baseValues(object, props) {
  18885. return arrayMap(props, function(key) {
  18886. return object[key];
  18887. });
  18888. }
  18889. /**
  18890. * Checks if a `cache` value for `key` exists.
  18891. *
  18892. * @private
  18893. * @param {Object} cache The cache to query.
  18894. * @param {string} key The key of the entry to check.
  18895. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  18896. */
  18897. function cacheHas(cache, key) {
  18898. return cache.has(key);
  18899. }
  18900. /**
  18901. * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
  18902. * that is not found in the character symbols.
  18903. *
  18904. * @private
  18905. * @param {Array} strSymbols The string symbols to inspect.
  18906. * @param {Array} chrSymbols The character symbols to find.
  18907. * @returns {number} Returns the index of the first unmatched string symbol.
  18908. */
  18909. function charsStartIndex(strSymbols, chrSymbols) {
  18910. var index = -1,
  18911. length = strSymbols.length;
  18912. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  18913. return index;
  18914. }
  18915. /**
  18916. * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
  18917. * that is not found in the character symbols.
  18918. *
  18919. * @private
  18920. * @param {Array} strSymbols The string symbols to inspect.
  18921. * @param {Array} chrSymbols The character symbols to find.
  18922. * @returns {number} Returns the index of the last unmatched string symbol.
  18923. */
  18924. function charsEndIndex(strSymbols, chrSymbols) {
  18925. var index = strSymbols.length;
  18926. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  18927. return index;
  18928. }
  18929. /**
  18930. * Gets the number of `placeholder` occurrences in `array`.
  18931. *
  18932. * @private
  18933. * @param {Array} array The array to inspect.
  18934. * @param {*} placeholder The placeholder to search for.
  18935. * @returns {number} Returns the placeholder count.
  18936. */
  18937. function countHolders(array, placeholder) {
  18938. var length = array.length,
  18939. result = 0;
  18940. while (length--) {
  18941. if (array[length] === placeholder) {
  18942. ++result;
  18943. }
  18944. }
  18945. return result;
  18946. }
  18947. /**
  18948. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  18949. * letters to basic Latin letters.
  18950. *
  18951. * @private
  18952. * @param {string} letter The matched letter to deburr.
  18953. * @returns {string} Returns the deburred letter.
  18954. */
  18955. var deburrLetter = basePropertyOf(deburredLetters);
  18956. /**
  18957. * Used by `_.escape` to convert characters to HTML entities.
  18958. *
  18959. * @private
  18960. * @param {string} chr The matched character to escape.
  18961. * @returns {string} Returns the escaped character.
  18962. */
  18963. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  18964. /**
  18965. * Used by `_.template` to escape characters for inclusion in compiled string literals.
  18966. *
  18967. * @private
  18968. * @param {string} chr The matched character to escape.
  18969. * @returns {string} Returns the escaped character.
  18970. */
  18971. function escapeStringChar(chr) {
  18972. return '\\' + stringEscapes[chr];
  18973. }
  18974. /**
  18975. * Gets the value at `key` of `object`.
  18976. *
  18977. * @private
  18978. * @param {Object} [object] The object to query.
  18979. * @param {string} key The key of the property to get.
  18980. * @returns {*} Returns the property value.
  18981. */
  18982. function getValue(object, key) {
  18983. return object == null ? undefined : object[key];
  18984. }
  18985. /**
  18986. * Checks if `string` contains Unicode symbols.
  18987. *
  18988. * @private
  18989. * @param {string} string The string to inspect.
  18990. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  18991. */
  18992. function hasUnicode(string) {
  18993. return reHasUnicode.test(string);
  18994. }
  18995. /**
  18996. * Checks if `string` contains a word composed of Unicode symbols.
  18997. *
  18998. * @private
  18999. * @param {string} string The string to inspect.
  19000. * @returns {boolean} Returns `true` if a word is found, else `false`.
  19001. */
  19002. function hasUnicodeWord(string) {
  19003. return reHasUnicodeWord.test(string);
  19004. }
  19005. /**
  19006. * Converts `iterator` to an array.
  19007. *
  19008. * @private
  19009. * @param {Object} iterator The iterator to convert.
  19010. * @returns {Array} Returns the converted array.
  19011. */
  19012. function iteratorToArray(iterator) {
  19013. var data,
  19014. result = [];
  19015. while (!(data = iterator.next()).done) {
  19016. result.push(data.value);
  19017. }
  19018. return result;
  19019. }
  19020. /**
  19021. * Converts `map` to its key-value pairs.
  19022. *
  19023. * @private
  19024. * @param {Object} map The map to convert.
  19025. * @returns {Array} Returns the key-value pairs.
  19026. */
  19027. function mapToArray(map) {
  19028. var index = -1,
  19029. result = Array(map.size);
  19030. map.forEach(function(value, key) {
  19031. result[++index] = [key, value];
  19032. });
  19033. return result;
  19034. }
  19035. /**
  19036. * Creates a unary function that invokes `func` with its argument transformed.
  19037. *
  19038. * @private
  19039. * @param {Function} func The function to wrap.
  19040. * @param {Function} transform The argument transform.
  19041. * @returns {Function} Returns the new function.
  19042. */
  19043. function overArg(func, transform) {
  19044. return function(arg) {
  19045. return func(transform(arg));
  19046. };
  19047. }
  19048. /**
  19049. * Replaces all `placeholder` elements in `array` with an internal placeholder
  19050. * and returns an array of their indexes.
  19051. *
  19052. * @private
  19053. * @param {Array} array The array to modify.
  19054. * @param {*} placeholder The placeholder to replace.
  19055. * @returns {Array} Returns the new array of placeholder indexes.
  19056. */
  19057. function replaceHolders(array, placeholder) {
  19058. var index = -1,
  19059. length = array.length,
  19060. resIndex = 0,
  19061. result = [];
  19062. while (++index < length) {
  19063. var value = array[index];
  19064. if (value === placeholder || value === PLACEHOLDER) {
  19065. array[index] = PLACEHOLDER;
  19066. result[resIndex++] = index;
  19067. }
  19068. }
  19069. return result;
  19070. }
  19071. /**
  19072. * Converts `set` to an array of its values.
  19073. *
  19074. * @private
  19075. * @param {Object} set The set to convert.
  19076. * @returns {Array} Returns the values.
  19077. */
  19078. function setToArray(set) {
  19079. var index = -1,
  19080. result = Array(set.size);
  19081. set.forEach(function(value) {
  19082. result[++index] = value;
  19083. });
  19084. return result;
  19085. }
  19086. /**
  19087. * Converts `set` to its value-value pairs.
  19088. *
  19089. * @private
  19090. * @param {Object} set The set to convert.
  19091. * @returns {Array} Returns the value-value pairs.
  19092. */
  19093. function setToPairs(set) {
  19094. var index = -1,
  19095. result = Array(set.size);
  19096. set.forEach(function(value) {
  19097. result[++index] = [value, value];
  19098. });
  19099. return result;
  19100. }
  19101. /**
  19102. * A specialized version of `_.indexOf` which performs strict equality
  19103. * comparisons of values, i.e. `===`.
  19104. *
  19105. * @private
  19106. * @param {Array} array The array to inspect.
  19107. * @param {*} value The value to search for.
  19108. * @param {number} fromIndex The index to search from.
  19109. * @returns {number} Returns the index of the matched value, else `-1`.
  19110. */
  19111. function strictIndexOf(array, value, fromIndex) {
  19112. var index = fromIndex - 1,
  19113. length = array.length;
  19114. while (++index < length) {
  19115. if (array[index] === value) {
  19116. return index;
  19117. }
  19118. }
  19119. return -1;
  19120. }
  19121. /**
  19122. * A specialized version of `_.lastIndexOf` which performs strict equality
  19123. * comparisons of values, i.e. `===`.
  19124. *
  19125. * @private
  19126. * @param {Array} array The array to inspect.
  19127. * @param {*} value The value to search for.
  19128. * @param {number} fromIndex The index to search from.
  19129. * @returns {number} Returns the index of the matched value, else `-1`.
  19130. */
  19131. function strictLastIndexOf(array, value, fromIndex) {
  19132. var index = fromIndex + 1;
  19133. while (index--) {
  19134. if (array[index] === value) {
  19135. return index;
  19136. }
  19137. }
  19138. return index;
  19139. }
  19140. /**
  19141. * Gets the number of symbols in `string`.
  19142. *
  19143. * @private
  19144. * @param {string} string The string to inspect.
  19145. * @returns {number} Returns the string size.
  19146. */
  19147. function stringSize(string) {
  19148. return hasUnicode(string)
  19149. ? unicodeSize(string)
  19150. : asciiSize(string);
  19151. }
  19152. /**
  19153. * Converts `string` to an array.
  19154. *
  19155. * @private
  19156. * @param {string} string The string to convert.
  19157. * @returns {Array} Returns the converted array.
  19158. */
  19159. function stringToArray(string) {
  19160. return hasUnicode(string)
  19161. ? unicodeToArray(string)
  19162. : asciiToArray(string);
  19163. }
  19164. /**
  19165. * Used by `_.unescape` to convert HTML entities to characters.
  19166. *
  19167. * @private
  19168. * @param {string} chr The matched character to unescape.
  19169. * @returns {string} Returns the unescaped character.
  19170. */
  19171. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  19172. /**
  19173. * Gets the size of a Unicode `string`.
  19174. *
  19175. * @private
  19176. * @param {string} string The string inspect.
  19177. * @returns {number} Returns the string size.
  19178. */
  19179. function unicodeSize(string) {
  19180. var result = reUnicode.lastIndex = 0;
  19181. while (reUnicode.test(string)) {
  19182. ++result;
  19183. }
  19184. return result;
  19185. }
  19186. /**
  19187. * Converts a Unicode `string` to an array.
  19188. *
  19189. * @private
  19190. * @param {string} string The string to convert.
  19191. * @returns {Array} Returns the converted array.
  19192. */
  19193. function unicodeToArray(string) {
  19194. return string.match(reUnicode) || [];
  19195. }
  19196. /**
  19197. * Splits a Unicode `string` into an array of its words.
  19198. *
  19199. * @private
  19200. * @param {string} The string to inspect.
  19201. * @returns {Array} Returns the words of `string`.
  19202. */
  19203. function unicodeWords(string) {
  19204. return string.match(reUnicodeWord) || [];
  19205. }
  19206. /*--------------------------------------------------------------------------*/
  19207. /**
  19208. * Create a new pristine `lodash` function using the `context` object.
  19209. *
  19210. * @static
  19211. * @memberOf _
  19212. * @since 1.1.0
  19213. * @category Util
  19214. * @param {Object} [context=root] The context object.
  19215. * @returns {Function} Returns a new `lodash` function.
  19216. * @example
  19217. *
  19218. * _.mixin({ 'foo': _.constant('foo') });
  19219. *
  19220. * var lodash = _.runInContext();
  19221. * lodash.mixin({ 'bar': lodash.constant('bar') });
  19222. *
  19223. * _.isFunction(_.foo);
  19224. * // => true
  19225. * _.isFunction(_.bar);
  19226. * // => false
  19227. *
  19228. * lodash.isFunction(lodash.foo);
  19229. * // => false
  19230. * lodash.isFunction(lodash.bar);
  19231. * // => true
  19232. *
  19233. * // Create a suped-up `defer` in Node.js.
  19234. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
  19235. */
  19236. var runInContext = (function runInContext(context) {
  19237. context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
  19238. /** Built-in constructor references. */
  19239. var Array = context.Array,
  19240. Date = context.Date,
  19241. Error = context.Error,
  19242. Function = context.Function,
  19243. Math = context.Math,
  19244. Object = context.Object,
  19245. RegExp = context.RegExp,
  19246. String = context.String,
  19247. TypeError = context.TypeError;
  19248. /** Used for built-in method references. */
  19249. var arrayProto = Array.prototype,
  19250. funcProto = Function.prototype,
  19251. objectProto = Object.prototype;
  19252. /** Used to detect overreaching core-js shims. */
  19253. var coreJsData = context['__core-js_shared__'];
  19254. /** Used to resolve the decompiled source of functions. */
  19255. var funcToString = funcProto.toString;
  19256. /** Used to check objects for own properties. */
  19257. var hasOwnProperty = objectProto.hasOwnProperty;
  19258. /** Used to generate unique IDs. */
  19259. var idCounter = 0;
  19260. /** Used to detect methods masquerading as native. */
  19261. var maskSrcKey = (function() {
  19262. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  19263. return uid ? ('Symbol(src)_1.' + uid) : '';
  19264. }());
  19265. /**
  19266. * Used to resolve the
  19267. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  19268. * of values.
  19269. */
  19270. var nativeObjectToString = objectProto.toString;
  19271. /** Used to infer the `Object` constructor. */
  19272. var objectCtorString = funcToString.call(Object);
  19273. /** Used to restore the original `_` reference in `_.noConflict`. */
  19274. var oldDash = root._;
  19275. /** Used to detect if a method is native. */
  19276. var reIsNative = RegExp('^' +
  19277. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  19278. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  19279. );
  19280. /** Built-in value references. */
  19281. var Buffer = moduleExports ? context.Buffer : undefined,
  19282. Symbol = context.Symbol,
  19283. Uint8Array = context.Uint8Array,
  19284. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
  19285. getPrototype = overArg(Object.getPrototypeOf, Object),
  19286. objectCreate = Object.create,
  19287. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  19288. splice = arrayProto.splice,
  19289. spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
  19290. symIterator = Symbol ? Symbol.iterator : undefined,
  19291. symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  19292. var defineProperty = (function() {
  19293. try {
  19294. var func = getNative(Object, 'defineProperty');
  19295. func({}, '', {});
  19296. return func;
  19297. } catch (e) {}
  19298. }());
  19299. /** Mocked built-ins. */
  19300. var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
  19301. ctxNow = Date && Date.now !== root.Date.now && Date.now,
  19302. ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
  19303. /* Built-in method references for those with the same name as other `lodash` methods. */
  19304. var nativeCeil = Math.ceil,
  19305. nativeFloor = Math.floor,
  19306. nativeGetSymbols = Object.getOwnPropertySymbols,
  19307. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  19308. nativeIsFinite = context.isFinite,
  19309. nativeJoin = arrayProto.join,
  19310. nativeKeys = overArg(Object.keys, Object),
  19311. nativeMax = Math.max,
  19312. nativeMin = Math.min,
  19313. nativeNow = Date.now,
  19314. nativeParseInt = context.parseInt,
  19315. nativeRandom = Math.random,
  19316. nativeReverse = arrayProto.reverse;
  19317. /* Built-in method references that are verified to be native. */
  19318. var DataView = getNative(context, 'DataView'),
  19319. Map = getNative(context, 'Map'),
  19320. Promise = getNative(context, 'Promise'),
  19321. Set = getNative(context, 'Set'),
  19322. WeakMap = getNative(context, 'WeakMap'),
  19323. nativeCreate = getNative(Object, 'create');
  19324. /** Used to store function metadata. */
  19325. var metaMap = WeakMap && new WeakMap;
  19326. /** Used to lookup unminified function names. */
  19327. var realNames = {};
  19328. /** Used to detect maps, sets, and weakmaps. */
  19329. var dataViewCtorString = toSource(DataView),
  19330. mapCtorString = toSource(Map),
  19331. promiseCtorString = toSource(Promise),
  19332. setCtorString = toSource(Set),
  19333. weakMapCtorString = toSource(WeakMap);
  19334. /** Used to convert symbols to primitives and strings. */
  19335. var symbolProto = Symbol ? Symbol.prototype : undefined,
  19336. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  19337. symbolToString = symbolProto ? symbolProto.toString : undefined;
  19338. /*------------------------------------------------------------------------*/
  19339. /**
  19340. * Creates a `lodash` object which wraps `value` to enable implicit method
  19341. * chain sequences. Methods that operate on and return arrays, collections,
  19342. * and functions can be chained together. Methods that retrieve a single value
  19343. * or may return a primitive value will automatically end the chain sequence
  19344. * and return the unwrapped value. Otherwise, the value must be unwrapped
  19345. * with `_#value`.
  19346. *
  19347. * Explicit chain sequences, which must be unwrapped with `_#value`, may be
  19348. * enabled using `_.chain`.
  19349. *
  19350. * The execution of chained methods is lazy, that is, it's deferred until
  19351. * `_#value` is implicitly or explicitly called.
  19352. *
  19353. * Lazy evaluation allows several methods to support shortcut fusion.
  19354. * Shortcut fusion is an optimization to merge iteratee calls; this avoids
  19355. * the creation of intermediate arrays and can greatly reduce the number of
  19356. * iteratee executions. Sections of a chain sequence qualify for shortcut
  19357. * fusion if the section is applied to an array and iteratees accept only
  19358. * one argument. The heuristic for whether a section qualifies for shortcut
  19359. * fusion is subject to change.
  19360. *
  19361. * Chaining is supported in custom builds as long as the `_#value` method is
  19362. * directly or indirectly included in the build.
  19363. *
  19364. * In addition to lodash methods, wrappers have `Array` and `String` methods.
  19365. *
  19366. * The wrapper `Array` methods are:
  19367. * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
  19368. *
  19369. * The wrapper `String` methods are:
  19370. * `replace` and `split`
  19371. *
  19372. * The wrapper methods that support shortcut fusion are:
  19373. * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
  19374. * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
  19375. * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
  19376. *
  19377. * The chainable wrapper methods are:
  19378. * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
  19379. * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
  19380. * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
  19381. * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
  19382. * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
  19383. * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
  19384. * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
  19385. * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
  19386. * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
  19387. * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
  19388. * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
  19389. * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
  19390. * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
  19391. * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
  19392. * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
  19393. * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
  19394. * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
  19395. * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
  19396. * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
  19397. * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
  19398. * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
  19399. * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
  19400. * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
  19401. * `zipObject`, `zipObjectDeep`, and `zipWith`
  19402. *
  19403. * The wrapper methods that are **not** chainable by default are:
  19404. * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
  19405. * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
  19406. * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
  19407. * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
  19408. * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
  19409. * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
  19410. * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
  19411. * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
  19412. * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
  19413. * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
  19414. * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
  19415. * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
  19416. * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
  19417. * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
  19418. * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
  19419. * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
  19420. * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
  19421. * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
  19422. * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
  19423. * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
  19424. * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
  19425. * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
  19426. * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
  19427. * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
  19428. * `upperFirst`, `value`, and `words`
  19429. *
  19430. * @name _
  19431. * @constructor
  19432. * @category Seq
  19433. * @param {*} value The value to wrap in a `lodash` instance.
  19434. * @returns {Object} Returns the new `lodash` wrapper instance.
  19435. * @example
  19436. *
  19437. * function square(n) {
  19438. * return n * n;
  19439. * }
  19440. *
  19441. * var wrapped = _([1, 2, 3]);
  19442. *
  19443. * // Returns an unwrapped value.
  19444. * wrapped.reduce(_.add);
  19445. * // => 6
  19446. *
  19447. * // Returns a wrapped value.
  19448. * var squares = wrapped.map(square);
  19449. *
  19450. * _.isArray(squares);
  19451. * // => false
  19452. *
  19453. * _.isArray(squares.value());
  19454. * // => true
  19455. */
  19456. function lodash(value) {
  19457. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  19458. if (value instanceof LodashWrapper) {
  19459. return value;
  19460. }
  19461. if (hasOwnProperty.call(value, '__wrapped__')) {
  19462. return wrapperClone(value);
  19463. }
  19464. }
  19465. return new LodashWrapper(value);
  19466. }
  19467. /**
  19468. * The base implementation of `_.create` without support for assigning
  19469. * properties to the created object.
  19470. *
  19471. * @private
  19472. * @param {Object} proto The object to inherit from.
  19473. * @returns {Object} Returns the new object.
  19474. */
  19475. var baseCreate = (function() {
  19476. function object() {}
  19477. return function(proto) {
  19478. if (!isObject(proto)) {
  19479. return {};
  19480. }
  19481. if (objectCreate) {
  19482. return objectCreate(proto);
  19483. }
  19484. object.prototype = proto;
  19485. var result = new object;
  19486. object.prototype = undefined;
  19487. return result;
  19488. };
  19489. }());
  19490. /**
  19491. * The function whose prototype chain sequence wrappers inherit from.
  19492. *
  19493. * @private
  19494. */
  19495. function baseLodash() {
  19496. // No operation performed.
  19497. }
  19498. /**
  19499. * The base constructor for creating `lodash` wrapper objects.
  19500. *
  19501. * @private
  19502. * @param {*} value The value to wrap.
  19503. * @param {boolean} [chainAll] Enable explicit method chain sequences.
  19504. */
  19505. function LodashWrapper(value, chainAll) {
  19506. this.__wrapped__ = value;
  19507. this.__actions__ = [];
  19508. this.__chain__ = !!chainAll;
  19509. this.__index__ = 0;
  19510. this.__values__ = undefined;
  19511. }
  19512. /**
  19513. * By default, the template delimiters used by lodash are like those in
  19514. * embedded Ruby (ERB) as well as ES2015 template strings. Change the
  19515. * following template settings to use alternative delimiters.
  19516. *
  19517. * @static
  19518. * @memberOf _
  19519. * @type {Object}
  19520. */
  19521. lodash.templateSettings = {
  19522. /**
  19523. * Used to detect `data` property values to be HTML-escaped.
  19524. *
  19525. * @memberOf _.templateSettings
  19526. * @type {RegExp}
  19527. */
  19528. 'escape': reEscape,
  19529. /**
  19530. * Used to detect code to be evaluated.
  19531. *
  19532. * @memberOf _.templateSettings
  19533. * @type {RegExp}
  19534. */
  19535. 'evaluate': reEvaluate,
  19536. /**
  19537. * Used to detect `data` property values to inject.
  19538. *
  19539. * @memberOf _.templateSettings
  19540. * @type {RegExp}
  19541. */
  19542. 'interpolate': reInterpolate,
  19543. /**
  19544. * Used to reference the data object in the template text.
  19545. *
  19546. * @memberOf _.templateSettings
  19547. * @type {string}
  19548. */
  19549. 'variable': '',
  19550. /**
  19551. * Used to import variables into the compiled template.
  19552. *
  19553. * @memberOf _.templateSettings
  19554. * @type {Object}
  19555. */
  19556. 'imports': {
  19557. /**
  19558. * A reference to the `lodash` function.
  19559. *
  19560. * @memberOf _.templateSettings.imports
  19561. * @type {Function}
  19562. */
  19563. '_': lodash
  19564. }
  19565. };
  19566. // Ensure wrappers are instances of `baseLodash`.
  19567. lodash.prototype = baseLodash.prototype;
  19568. lodash.prototype.constructor = lodash;
  19569. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  19570. LodashWrapper.prototype.constructor = LodashWrapper;
  19571. /*------------------------------------------------------------------------*/
  19572. /**
  19573. * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
  19574. *
  19575. * @private
  19576. * @constructor
  19577. * @param {*} value The value to wrap.
  19578. */
  19579. function LazyWrapper(value) {
  19580. this.__wrapped__ = value;
  19581. this.__actions__ = [];
  19582. this.__dir__ = 1;
  19583. this.__filtered__ = false;
  19584. this.__iteratees__ = [];
  19585. this.__takeCount__ = MAX_ARRAY_LENGTH;
  19586. this.__views__ = [];
  19587. }
  19588. /**
  19589. * Creates a clone of the lazy wrapper object.
  19590. *
  19591. * @private
  19592. * @name clone
  19593. * @memberOf LazyWrapper
  19594. * @returns {Object} Returns the cloned `LazyWrapper` object.
  19595. */
  19596. function lazyClone() {
  19597. var result = new LazyWrapper(this.__wrapped__);
  19598. result.__actions__ = copyArray(this.__actions__);
  19599. result.__dir__ = this.__dir__;
  19600. result.__filtered__ = this.__filtered__;
  19601. result.__iteratees__ = copyArray(this.__iteratees__);
  19602. result.__takeCount__ = this.__takeCount__;
  19603. result.__views__ = copyArray(this.__views__);
  19604. return result;
  19605. }
  19606. /**
  19607. * Reverses the direction of lazy iteration.
  19608. *
  19609. * @private
  19610. * @name reverse
  19611. * @memberOf LazyWrapper
  19612. * @returns {Object} Returns the new reversed `LazyWrapper` object.
  19613. */
  19614. function lazyReverse() {
  19615. if (this.__filtered__) {
  19616. var result = new LazyWrapper(this);
  19617. result.__dir__ = -1;
  19618. result.__filtered__ = true;
  19619. } else {
  19620. result = this.clone();
  19621. result.__dir__ *= -1;
  19622. }
  19623. return result;
  19624. }
  19625. /**
  19626. * Extracts the unwrapped value from its lazy wrapper.
  19627. *
  19628. * @private
  19629. * @name value
  19630. * @memberOf LazyWrapper
  19631. * @returns {*} Returns the unwrapped value.
  19632. */
  19633. function lazyValue() {
  19634. var array = this.__wrapped__.value(),
  19635. dir = this.__dir__,
  19636. isArr = isArray(array),
  19637. isRight = dir < 0,
  19638. arrLength = isArr ? array.length : 0,
  19639. view = getView(0, arrLength, this.__views__),
  19640. start = view.start,
  19641. end = view.end,
  19642. length = end - start,
  19643. index = isRight ? end : (start - 1),
  19644. iteratees = this.__iteratees__,
  19645. iterLength = iteratees.length,
  19646. resIndex = 0,
  19647. takeCount = nativeMin(length, this.__takeCount__);
  19648. if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
  19649. return baseWrapperValue(array, this.__actions__);
  19650. }
  19651. var result = [];
  19652. outer:
  19653. while (length-- && resIndex < takeCount) {
  19654. index += dir;
  19655. var iterIndex = -1,
  19656. value = array[index];
  19657. while (++iterIndex < iterLength) {
  19658. var data = iteratees[iterIndex],
  19659. iteratee = data.iteratee,
  19660. type = data.type,
  19661. computed = iteratee(value);
  19662. if (type == LAZY_MAP_FLAG) {
  19663. value = computed;
  19664. } else if (!computed) {
  19665. if (type == LAZY_FILTER_FLAG) {
  19666. continue outer;
  19667. } else {
  19668. break outer;
  19669. }
  19670. }
  19671. }
  19672. result[resIndex++] = value;
  19673. }
  19674. return result;
  19675. }
  19676. // Ensure `LazyWrapper` is an instance of `baseLodash`.
  19677. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  19678. LazyWrapper.prototype.constructor = LazyWrapper;
  19679. /*------------------------------------------------------------------------*/
  19680. /**
  19681. * Creates a hash object.
  19682. *
  19683. * @private
  19684. * @constructor
  19685. * @param {Array} [entries] The key-value pairs to cache.
  19686. */
  19687. function Hash(entries) {
  19688. var index = -1,
  19689. length = entries == null ? 0 : entries.length;
  19690. this.clear();
  19691. while (++index < length) {
  19692. var entry = entries[index];
  19693. this.set(entry[0], entry[1]);
  19694. }
  19695. }
  19696. /**
  19697. * Removes all key-value entries from the hash.
  19698. *
  19699. * @private
  19700. * @name clear
  19701. * @memberOf Hash
  19702. */
  19703. function hashClear() {
  19704. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  19705. this.size = 0;
  19706. }
  19707. /**
  19708. * Removes `key` and its value from the hash.
  19709. *
  19710. * @private
  19711. * @name delete
  19712. * @memberOf Hash
  19713. * @param {Object} hash The hash to modify.
  19714. * @param {string} key The key of the value to remove.
  19715. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  19716. */
  19717. function hashDelete(key) {
  19718. var result = this.has(key) && delete this.__data__[key];
  19719. this.size -= result ? 1 : 0;
  19720. return result;
  19721. }
  19722. /**
  19723. * Gets the hash value for `key`.
  19724. *
  19725. * @private
  19726. * @name get
  19727. * @memberOf Hash
  19728. * @param {string} key The key of the value to get.
  19729. * @returns {*} Returns the entry value.
  19730. */
  19731. function hashGet(key) {
  19732. var data = this.__data__;
  19733. if (nativeCreate) {
  19734. var result = data[key];
  19735. return result === HASH_UNDEFINED ? undefined : result;
  19736. }
  19737. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  19738. }
  19739. /**
  19740. * Checks if a hash value for `key` exists.
  19741. *
  19742. * @private
  19743. * @name has
  19744. * @memberOf Hash
  19745. * @param {string} key The key of the entry to check.
  19746. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  19747. */
  19748. function hashHas(key) {
  19749. var data = this.__data__;
  19750. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  19751. }
  19752. /**
  19753. * Sets the hash `key` to `value`.
  19754. *
  19755. * @private
  19756. * @name set
  19757. * @memberOf Hash
  19758. * @param {string} key The key of the value to set.
  19759. * @param {*} value The value to set.
  19760. * @returns {Object} Returns the hash instance.
  19761. */
  19762. function hashSet(key, value) {
  19763. var data = this.__data__;
  19764. this.size += this.has(key) ? 0 : 1;
  19765. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  19766. return this;
  19767. }
  19768. // Add methods to `Hash`.
  19769. Hash.prototype.clear = hashClear;
  19770. Hash.prototype['delete'] = hashDelete;
  19771. Hash.prototype.get = hashGet;
  19772. Hash.prototype.has = hashHas;
  19773. Hash.prototype.set = hashSet;
  19774. /*------------------------------------------------------------------------*/
  19775. /**
  19776. * Creates an list cache object.
  19777. *
  19778. * @private
  19779. * @constructor
  19780. * @param {Array} [entries] The key-value pairs to cache.
  19781. */
  19782. function ListCache(entries) {
  19783. var index = -1,
  19784. length = entries == null ? 0 : entries.length;
  19785. this.clear();
  19786. while (++index < length) {
  19787. var entry = entries[index];
  19788. this.set(entry[0], entry[1]);
  19789. }
  19790. }
  19791. /**
  19792. * Removes all key-value entries from the list cache.
  19793. *
  19794. * @private
  19795. * @name clear
  19796. * @memberOf ListCache
  19797. */
  19798. function listCacheClear() {
  19799. this.__data__ = [];
  19800. this.size = 0;
  19801. }
  19802. /**
  19803. * Removes `key` and its value from the list cache.
  19804. *
  19805. * @private
  19806. * @name delete
  19807. * @memberOf ListCache
  19808. * @param {string} key The key of the value to remove.
  19809. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  19810. */
  19811. function listCacheDelete(key) {
  19812. var data = this.__data__,
  19813. index = assocIndexOf(data, key);
  19814. if (index < 0) {
  19815. return false;
  19816. }
  19817. var lastIndex = data.length - 1;
  19818. if (index == lastIndex) {
  19819. data.pop();
  19820. } else {
  19821. splice.call(data, index, 1);
  19822. }
  19823. --this.size;
  19824. return true;
  19825. }
  19826. /**
  19827. * Gets the list cache value for `key`.
  19828. *
  19829. * @private
  19830. * @name get
  19831. * @memberOf ListCache
  19832. * @param {string} key The key of the value to get.
  19833. * @returns {*} Returns the entry value.
  19834. */
  19835. function listCacheGet(key) {
  19836. var data = this.__data__,
  19837. index = assocIndexOf(data, key);
  19838. return index < 0 ? undefined : data[index][1];
  19839. }
  19840. /**
  19841. * Checks if a list cache value for `key` exists.
  19842. *
  19843. * @private
  19844. * @name has
  19845. * @memberOf ListCache
  19846. * @param {string} key The key of the entry to check.
  19847. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  19848. */
  19849. function listCacheHas(key) {
  19850. return assocIndexOf(this.__data__, key) > -1;
  19851. }
  19852. /**
  19853. * Sets the list cache `key` to `value`.
  19854. *
  19855. * @private
  19856. * @name set
  19857. * @memberOf ListCache
  19858. * @param {string} key The key of the value to set.
  19859. * @param {*} value The value to set.
  19860. * @returns {Object} Returns the list cache instance.
  19861. */
  19862. function listCacheSet(key, value) {
  19863. var data = this.__data__,
  19864. index = assocIndexOf(data, key);
  19865. if (index < 0) {
  19866. ++this.size;
  19867. data.push([key, value]);
  19868. } else {
  19869. data[index][1] = value;
  19870. }
  19871. return this;
  19872. }
  19873. // Add methods to `ListCache`.
  19874. ListCache.prototype.clear = listCacheClear;
  19875. ListCache.prototype['delete'] = listCacheDelete;
  19876. ListCache.prototype.get = listCacheGet;
  19877. ListCache.prototype.has = listCacheHas;
  19878. ListCache.prototype.set = listCacheSet;
  19879. /*------------------------------------------------------------------------*/
  19880. /**
  19881. * Creates a map cache object to store key-value pairs.
  19882. *
  19883. * @private
  19884. * @constructor
  19885. * @param {Array} [entries] The key-value pairs to cache.
  19886. */
  19887. function MapCache(entries) {
  19888. var index = -1,
  19889. length = entries == null ? 0 : entries.length;
  19890. this.clear();
  19891. while (++index < length) {
  19892. var entry = entries[index];
  19893. this.set(entry[0], entry[1]);
  19894. }
  19895. }
  19896. /**
  19897. * Removes all key-value entries from the map.
  19898. *
  19899. * @private
  19900. * @name clear
  19901. * @memberOf MapCache
  19902. */
  19903. function mapCacheClear() {
  19904. this.size = 0;
  19905. this.__data__ = {
  19906. 'hash': new Hash,
  19907. 'map': new (Map || ListCache),
  19908. 'string': new Hash
  19909. };
  19910. }
  19911. /**
  19912. * Removes `key` and its value from the map.
  19913. *
  19914. * @private
  19915. * @name delete
  19916. * @memberOf MapCache
  19917. * @param {string} key The key of the value to remove.
  19918. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  19919. */
  19920. function mapCacheDelete(key) {
  19921. var result = getMapData(this, key)['delete'](key);
  19922. this.size -= result ? 1 : 0;
  19923. return result;
  19924. }
  19925. /**
  19926. * Gets the map value for `key`.
  19927. *
  19928. * @private
  19929. * @name get
  19930. * @memberOf MapCache
  19931. * @param {string} key The key of the value to get.
  19932. * @returns {*} Returns the entry value.
  19933. */
  19934. function mapCacheGet(key) {
  19935. return getMapData(this, key).get(key);
  19936. }
  19937. /**
  19938. * Checks if a map value for `key` exists.
  19939. *
  19940. * @private
  19941. * @name has
  19942. * @memberOf MapCache
  19943. * @param {string} key The key of the entry to check.
  19944. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  19945. */
  19946. function mapCacheHas(key) {
  19947. return getMapData(this, key).has(key);
  19948. }
  19949. /**
  19950. * Sets the map `key` to `value`.
  19951. *
  19952. * @private
  19953. * @name set
  19954. * @memberOf MapCache
  19955. * @param {string} key The key of the value to set.
  19956. * @param {*} value The value to set.
  19957. * @returns {Object} Returns the map cache instance.
  19958. */
  19959. function mapCacheSet(key, value) {
  19960. var data = getMapData(this, key),
  19961. size = data.size;
  19962. data.set(key, value);
  19963. this.size += data.size == size ? 0 : 1;
  19964. return this;
  19965. }
  19966. // Add methods to `MapCache`.
  19967. MapCache.prototype.clear = mapCacheClear;
  19968. MapCache.prototype['delete'] = mapCacheDelete;
  19969. MapCache.prototype.get = mapCacheGet;
  19970. MapCache.prototype.has = mapCacheHas;
  19971. MapCache.prototype.set = mapCacheSet;
  19972. /*------------------------------------------------------------------------*/
  19973. /**
  19974. *
  19975. * Creates an array cache object to store unique values.
  19976. *
  19977. * @private
  19978. * @constructor
  19979. * @param {Array} [values] The values to cache.
  19980. */
  19981. function SetCache(values) {
  19982. var index = -1,
  19983. length = values == null ? 0 : values.length;
  19984. this.__data__ = new MapCache;
  19985. while (++index < length) {
  19986. this.add(values[index]);
  19987. }
  19988. }
  19989. /**
  19990. * Adds `value` to the array cache.
  19991. *
  19992. * @private
  19993. * @name add
  19994. * @memberOf SetCache
  19995. * @alias push
  19996. * @param {*} value The value to cache.
  19997. * @returns {Object} Returns the cache instance.
  19998. */
  19999. function setCacheAdd(value) {
  20000. this.__data__.set(value, HASH_UNDEFINED);
  20001. return this;
  20002. }
  20003. /**
  20004. * Checks if `value` is in the array cache.
  20005. *
  20006. * @private
  20007. * @name has
  20008. * @memberOf SetCache
  20009. * @param {*} value The value to search for.
  20010. * @returns {number} Returns `true` if `value` is found, else `false`.
  20011. */
  20012. function setCacheHas(value) {
  20013. return this.__data__.has(value);
  20014. }
  20015. // Add methods to `SetCache`.
  20016. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  20017. SetCache.prototype.has = setCacheHas;
  20018. /*------------------------------------------------------------------------*/
  20019. /**
  20020. * Creates a stack cache object to store key-value pairs.
  20021. *
  20022. * @private
  20023. * @constructor
  20024. * @param {Array} [entries] The key-value pairs to cache.
  20025. */
  20026. function Stack(entries) {
  20027. var data = this.__data__ = new ListCache(entries);
  20028. this.size = data.size;
  20029. }
  20030. /**
  20031. * Removes all key-value entries from the stack.
  20032. *
  20033. * @private
  20034. * @name clear
  20035. * @memberOf Stack
  20036. */
  20037. function stackClear() {
  20038. this.__data__ = new ListCache;
  20039. this.size = 0;
  20040. }
  20041. /**
  20042. * Removes `key` and its value from the stack.
  20043. *
  20044. * @private
  20045. * @name delete
  20046. * @memberOf Stack
  20047. * @param {string} key The key of the value to remove.
  20048. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20049. */
  20050. function stackDelete(key) {
  20051. var data = this.__data__,
  20052. result = data['delete'](key);
  20053. this.size = data.size;
  20054. return result;
  20055. }
  20056. /**
  20057. * Gets the stack value for `key`.
  20058. *
  20059. * @private
  20060. * @name get
  20061. * @memberOf Stack
  20062. * @param {string} key The key of the value to get.
  20063. * @returns {*} Returns the entry value.
  20064. */
  20065. function stackGet(key) {
  20066. return this.__data__.get(key);
  20067. }
  20068. /**
  20069. * Checks if a stack value for `key` exists.
  20070. *
  20071. * @private
  20072. * @name has
  20073. * @memberOf Stack
  20074. * @param {string} key The key of the entry to check.
  20075. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20076. */
  20077. function stackHas(key) {
  20078. return this.__data__.has(key);
  20079. }
  20080. /**
  20081. * Sets the stack `key` to `value`.
  20082. *
  20083. * @private
  20084. * @name set
  20085. * @memberOf Stack
  20086. * @param {string} key The key of the value to set.
  20087. * @param {*} value The value to set.
  20088. * @returns {Object} Returns the stack cache instance.
  20089. */
  20090. function stackSet(key, value) {
  20091. var data = this.__data__;
  20092. if (data instanceof ListCache) {
  20093. var pairs = data.__data__;
  20094. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  20095. pairs.push([key, value]);
  20096. this.size = ++data.size;
  20097. return this;
  20098. }
  20099. data = this.__data__ = new MapCache(pairs);
  20100. }
  20101. data.set(key, value);
  20102. this.size = data.size;
  20103. return this;
  20104. }
  20105. // Add methods to `Stack`.
  20106. Stack.prototype.clear = stackClear;
  20107. Stack.prototype['delete'] = stackDelete;
  20108. Stack.prototype.get = stackGet;
  20109. Stack.prototype.has = stackHas;
  20110. Stack.prototype.set = stackSet;
  20111. /*------------------------------------------------------------------------*/
  20112. /**
  20113. * Creates an array of the enumerable property names of the array-like `value`.
  20114. *
  20115. * @private
  20116. * @param {*} value The value to query.
  20117. * @param {boolean} inherited Specify returning inherited property names.
  20118. * @returns {Array} Returns the array of property names.
  20119. */
  20120. function arrayLikeKeys(value, inherited) {
  20121. var isArr = isArray(value),
  20122. isArg = !isArr && isArguments(value),
  20123. isBuff = !isArr && !isArg && isBuffer(value),
  20124. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  20125. skipIndexes = isArr || isArg || isBuff || isType,
  20126. result = skipIndexes ? baseTimes(value.length, String) : [],
  20127. length = result.length;
  20128. for (var key in value) {
  20129. if ((inherited || hasOwnProperty.call(value, key)) &&
  20130. !(skipIndexes && (
  20131. // Safari 9 has enumerable `arguments.length` in strict mode.
  20132. key == 'length' ||
  20133. // Node.js 0.10 has enumerable non-index properties on buffers.
  20134. (isBuff && (key == 'offset' || key == 'parent')) ||
  20135. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  20136. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  20137. // Skip index properties.
  20138. isIndex(key, length)
  20139. ))) {
  20140. result.push(key);
  20141. }
  20142. }
  20143. return result;
  20144. }
  20145. /**
  20146. * A specialized version of `_.sample` for arrays.
  20147. *
  20148. * @private
  20149. * @param {Array} array The array to sample.
  20150. * @returns {*} Returns the random element.
  20151. */
  20152. function arraySample(array) {
  20153. var length = array.length;
  20154. return length ? array[baseRandom(0, length - 1)] : undefined;
  20155. }
  20156. /**
  20157. * A specialized version of `_.sampleSize` for arrays.
  20158. *
  20159. * @private
  20160. * @param {Array} array The array to sample.
  20161. * @param {number} n The number of elements to sample.
  20162. * @returns {Array} Returns the random elements.
  20163. */
  20164. function arraySampleSize(array, n) {
  20165. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  20166. }
  20167. /**
  20168. * A specialized version of `_.shuffle` for arrays.
  20169. *
  20170. * @private
  20171. * @param {Array} array The array to shuffle.
  20172. * @returns {Array} Returns the new shuffled array.
  20173. */
  20174. function arrayShuffle(array) {
  20175. return shuffleSelf(copyArray(array));
  20176. }
  20177. /**
  20178. * This function is like `assignValue` except that it doesn't assign
  20179. * `undefined` values.
  20180. *
  20181. * @private
  20182. * @param {Object} object The object to modify.
  20183. * @param {string} key The key of the property to assign.
  20184. * @param {*} value The value to assign.
  20185. */
  20186. function assignMergeValue(object, key, value) {
  20187. if ((value !== undefined && !eq(object[key], value)) ||
  20188. (value === undefined && !(key in object))) {
  20189. baseAssignValue(object, key, value);
  20190. }
  20191. }
  20192. /**
  20193. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  20194. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  20195. * for equality comparisons.
  20196. *
  20197. * @private
  20198. * @param {Object} object The object to modify.
  20199. * @param {string} key The key of the property to assign.
  20200. * @param {*} value The value to assign.
  20201. */
  20202. function assignValue(object, key, value) {
  20203. var objValue = object[key];
  20204. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  20205. (value === undefined && !(key in object))) {
  20206. baseAssignValue(object, key, value);
  20207. }
  20208. }
  20209. /**
  20210. * Gets the index at which the `key` is found in `array` of key-value pairs.
  20211. *
  20212. * @private
  20213. * @param {Array} array The array to inspect.
  20214. * @param {*} key The key to search for.
  20215. * @returns {number} Returns the index of the matched value, else `-1`.
  20216. */
  20217. function assocIndexOf(array, key) {
  20218. var length = array.length;
  20219. while (length--) {
  20220. if (eq(array[length][0], key)) {
  20221. return length;
  20222. }
  20223. }
  20224. return -1;
  20225. }
  20226. /**
  20227. * Aggregates elements of `collection` on `accumulator` with keys transformed
  20228. * by `iteratee` and values set by `setter`.
  20229. *
  20230. * @private
  20231. * @param {Array|Object} collection The collection to iterate over.
  20232. * @param {Function} setter The function to set `accumulator` values.
  20233. * @param {Function} iteratee The iteratee to transform keys.
  20234. * @param {Object} accumulator The initial aggregated object.
  20235. * @returns {Function} Returns `accumulator`.
  20236. */
  20237. function baseAggregator(collection, setter, iteratee, accumulator) {
  20238. baseEach(collection, function(value, key, collection) {
  20239. setter(accumulator, value, iteratee(value), collection);
  20240. });
  20241. return accumulator;
  20242. }
  20243. /**
  20244. * The base implementation of `_.assign` without support for multiple sources
  20245. * or `customizer` functions.
  20246. *
  20247. * @private
  20248. * @param {Object} object The destination object.
  20249. * @param {Object} source The source object.
  20250. * @returns {Object} Returns `object`.
  20251. */
  20252. function baseAssign(object, source) {
  20253. return object && copyObject(source, keys(source), object);
  20254. }
  20255. /**
  20256. * The base implementation of `_.assignIn` without support for multiple sources
  20257. * or `customizer` functions.
  20258. *
  20259. * @private
  20260. * @param {Object} object The destination object.
  20261. * @param {Object} source The source object.
  20262. * @returns {Object} Returns `object`.
  20263. */
  20264. function baseAssignIn(object, source) {
  20265. return object && copyObject(source, keysIn(source), object);
  20266. }
  20267. /**
  20268. * The base implementation of `assignValue` and `assignMergeValue` without
  20269. * value checks.
  20270. *
  20271. * @private
  20272. * @param {Object} object The object to modify.
  20273. * @param {string} key The key of the property to assign.
  20274. * @param {*} value The value to assign.
  20275. */
  20276. function baseAssignValue(object, key, value) {
  20277. if (key == '__proto__' && defineProperty) {
  20278. defineProperty(object, key, {
  20279. 'configurable': true,
  20280. 'enumerable': true,
  20281. 'value': value,
  20282. 'writable': true
  20283. });
  20284. } else {
  20285. object[key] = value;
  20286. }
  20287. }
  20288. /**
  20289. * The base implementation of `_.at` without support for individual paths.
  20290. *
  20291. * @private
  20292. * @param {Object} object The object to iterate over.
  20293. * @param {string[]} paths The property paths to pick.
  20294. * @returns {Array} Returns the picked elements.
  20295. */
  20296. function baseAt(object, paths) {
  20297. var index = -1,
  20298. length = paths.length,
  20299. result = Array(length),
  20300. skip = object == null;
  20301. while (++index < length) {
  20302. result[index] = skip ? undefined : get(object, paths[index]);
  20303. }
  20304. return result;
  20305. }
  20306. /**
  20307. * The base implementation of `_.clamp` which doesn't coerce arguments.
  20308. *
  20309. * @private
  20310. * @param {number} number The number to clamp.
  20311. * @param {number} [lower] The lower bound.
  20312. * @param {number} upper The upper bound.
  20313. * @returns {number} Returns the clamped number.
  20314. */
  20315. function baseClamp(number, lower, upper) {
  20316. if (number === number) {
  20317. if (upper !== undefined) {
  20318. number = number <= upper ? number : upper;
  20319. }
  20320. if (lower !== undefined) {
  20321. number = number >= lower ? number : lower;
  20322. }
  20323. }
  20324. return number;
  20325. }
  20326. /**
  20327. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  20328. * traversed objects.
  20329. *
  20330. * @private
  20331. * @param {*} value The value to clone.
  20332. * @param {boolean} bitmask The bitmask flags.
  20333. * 1 - Deep clone
  20334. * 2 - Flatten inherited properties
  20335. * 4 - Clone symbols
  20336. * @param {Function} [customizer] The function to customize cloning.
  20337. * @param {string} [key] The key of `value`.
  20338. * @param {Object} [object] The parent object of `value`.
  20339. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  20340. * @returns {*} Returns the cloned value.
  20341. */
  20342. function baseClone(value, bitmask, customizer, key, object, stack) {
  20343. var result,
  20344. isDeep = bitmask & CLONE_DEEP_FLAG,
  20345. isFlat = bitmask & CLONE_FLAT_FLAG,
  20346. isFull = bitmask & CLONE_SYMBOLS_FLAG;
  20347. if (customizer) {
  20348. result = object ? customizer(value, key, object, stack) : customizer(value);
  20349. }
  20350. if (result !== undefined) {
  20351. return result;
  20352. }
  20353. if (!isObject(value)) {
  20354. return value;
  20355. }
  20356. var isArr = isArray(value);
  20357. if (isArr) {
  20358. result = initCloneArray(value);
  20359. if (!isDeep) {
  20360. return copyArray(value, result);
  20361. }
  20362. } else {
  20363. var tag = getTag(value),
  20364. isFunc = tag == funcTag || tag == genTag;
  20365. if (isBuffer(value)) {
  20366. return cloneBuffer(value, isDeep);
  20367. }
  20368. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  20369. result = (isFlat || isFunc) ? {} : initCloneObject(value);
  20370. if (!isDeep) {
  20371. return isFlat
  20372. ? copySymbolsIn(value, baseAssignIn(result, value))
  20373. : copySymbols(value, baseAssign(result, value));
  20374. }
  20375. } else {
  20376. if (!cloneableTags[tag]) {
  20377. return object ? value : {};
  20378. }
  20379. result = initCloneByTag(value, tag, isDeep);
  20380. }
  20381. }
  20382. // Check for circular references and return its corresponding clone.
  20383. stack || (stack = new Stack);
  20384. var stacked = stack.get(value);
  20385. if (stacked) {
  20386. return stacked;
  20387. }
  20388. stack.set(value, result);
  20389. if (isSet(value)) {
  20390. value.forEach(function(subValue) {
  20391. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  20392. });
  20393. } else if (isMap(value)) {
  20394. value.forEach(function(subValue, key) {
  20395. result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
  20396. });
  20397. }
  20398. var keysFunc = isFull
  20399. ? (isFlat ? getAllKeysIn : getAllKeys)
  20400. : (isFlat ? keysIn : keys);
  20401. var props = isArr ? undefined : keysFunc(value);
  20402. arrayEach(props || value, function(subValue, key) {
  20403. if (props) {
  20404. key = subValue;
  20405. subValue = value[key];
  20406. }
  20407. // Recursively populate clone (susceptible to call stack limits).
  20408. assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  20409. });
  20410. return result;
  20411. }
  20412. /**
  20413. * The base implementation of `_.conforms` which doesn't clone `source`.
  20414. *
  20415. * @private
  20416. * @param {Object} source The object of property predicates to conform to.
  20417. * @returns {Function} Returns the new spec function.
  20418. */
  20419. function baseConforms(source) {
  20420. var props = keys(source);
  20421. return function(object) {
  20422. return baseConformsTo(object, source, props);
  20423. };
  20424. }
  20425. /**
  20426. * The base implementation of `_.conformsTo` which accepts `props` to check.
  20427. *
  20428. * @private
  20429. * @param {Object} object The object to inspect.
  20430. * @param {Object} source The object of property predicates to conform to.
  20431. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  20432. */
  20433. function baseConformsTo(object, source, props) {
  20434. var length = props.length;
  20435. if (object == null) {
  20436. return !length;
  20437. }
  20438. object = Object(object);
  20439. while (length--) {
  20440. var key = props[length],
  20441. predicate = source[key],
  20442. value = object[key];
  20443. if ((value === undefined && !(key in object)) || !predicate(value)) {
  20444. return false;
  20445. }
  20446. }
  20447. return true;
  20448. }
  20449. /**
  20450. * The base implementation of `_.delay` and `_.defer` which accepts `args`
  20451. * to provide to `func`.
  20452. *
  20453. * @private
  20454. * @param {Function} func The function to delay.
  20455. * @param {number} wait The number of milliseconds to delay invocation.
  20456. * @param {Array} args The arguments to provide to `func`.
  20457. * @returns {number|Object} Returns the timer id or timeout object.
  20458. */
  20459. function baseDelay(func, wait, args) {
  20460. if (typeof func != 'function') {
  20461. throw new TypeError(FUNC_ERROR_TEXT);
  20462. }
  20463. return setTimeout(function() { func.apply(undefined, args); }, wait);
  20464. }
  20465. /**
  20466. * The base implementation of methods like `_.difference` without support
  20467. * for excluding multiple arrays or iteratee shorthands.
  20468. *
  20469. * @private
  20470. * @param {Array} array The array to inspect.
  20471. * @param {Array} values The values to exclude.
  20472. * @param {Function} [iteratee] The iteratee invoked per element.
  20473. * @param {Function} [comparator] The comparator invoked per element.
  20474. * @returns {Array} Returns the new array of filtered values.
  20475. */
  20476. function baseDifference(array, values, iteratee, comparator) {
  20477. var index = -1,
  20478. includes = arrayIncludes,
  20479. isCommon = true,
  20480. length = array.length,
  20481. result = [],
  20482. valuesLength = values.length;
  20483. if (!length) {
  20484. return result;
  20485. }
  20486. if (iteratee) {
  20487. values = arrayMap(values, baseUnary(iteratee));
  20488. }
  20489. if (comparator) {
  20490. includes = arrayIncludesWith;
  20491. isCommon = false;
  20492. }
  20493. else if (values.length >= LARGE_ARRAY_SIZE) {
  20494. includes = cacheHas;
  20495. isCommon = false;
  20496. values = new SetCache(values);
  20497. }
  20498. outer:
  20499. while (++index < length) {
  20500. var value = array[index],
  20501. computed = iteratee == null ? value : iteratee(value);
  20502. value = (comparator || value !== 0) ? value : 0;
  20503. if (isCommon && computed === computed) {
  20504. var valuesIndex = valuesLength;
  20505. while (valuesIndex--) {
  20506. if (values[valuesIndex] === computed) {
  20507. continue outer;
  20508. }
  20509. }
  20510. result.push(value);
  20511. }
  20512. else if (!includes(values, computed, comparator)) {
  20513. result.push(value);
  20514. }
  20515. }
  20516. return result;
  20517. }
  20518. /**
  20519. * The base implementation of `_.forEach` without support for iteratee shorthands.
  20520. *
  20521. * @private
  20522. * @param {Array|Object} collection The collection to iterate over.
  20523. * @param {Function} iteratee The function invoked per iteration.
  20524. * @returns {Array|Object} Returns `collection`.
  20525. */
  20526. var baseEach = createBaseEach(baseForOwn);
  20527. /**
  20528. * The base implementation of `_.forEachRight` without support for iteratee shorthands.
  20529. *
  20530. * @private
  20531. * @param {Array|Object} collection The collection to iterate over.
  20532. * @param {Function} iteratee The function invoked per iteration.
  20533. * @returns {Array|Object} Returns `collection`.
  20534. */
  20535. var baseEachRight = createBaseEach(baseForOwnRight, true);
  20536. /**
  20537. * The base implementation of `_.every` without support for iteratee shorthands.
  20538. *
  20539. * @private
  20540. * @param {Array|Object} collection The collection to iterate over.
  20541. * @param {Function} predicate The function invoked per iteration.
  20542. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  20543. * else `false`
  20544. */
  20545. function baseEvery(collection, predicate) {
  20546. var result = true;
  20547. baseEach(collection, function(value, index, collection) {
  20548. result = !!predicate(value, index, collection);
  20549. return result;
  20550. });
  20551. return result;
  20552. }
  20553. /**
  20554. * The base implementation of methods like `_.max` and `_.min` which accepts a
  20555. * `comparator` to determine the extremum value.
  20556. *
  20557. * @private
  20558. * @param {Array} array The array to iterate over.
  20559. * @param {Function} iteratee The iteratee invoked per iteration.
  20560. * @param {Function} comparator The comparator used to compare values.
  20561. * @returns {*} Returns the extremum value.
  20562. */
  20563. function baseExtremum(array, iteratee, comparator) {
  20564. var index = -1,
  20565. length = array.length;
  20566. while (++index < length) {
  20567. var value = array[index],
  20568. current = iteratee(value);
  20569. if (current != null && (computed === undefined
  20570. ? (current === current && !isSymbol(current))
  20571. : comparator(current, computed)
  20572. )) {
  20573. var computed = current,
  20574. result = value;
  20575. }
  20576. }
  20577. return result;
  20578. }
  20579. /**
  20580. * The base implementation of `_.fill` without an iteratee call guard.
  20581. *
  20582. * @private
  20583. * @param {Array} array The array to fill.
  20584. * @param {*} value The value to fill `array` with.
  20585. * @param {number} [start=0] The start position.
  20586. * @param {number} [end=array.length] The end position.
  20587. * @returns {Array} Returns `array`.
  20588. */
  20589. function baseFill(array, value, start, end) {
  20590. var length = array.length;
  20591. start = toInteger(start);
  20592. if (start < 0) {
  20593. start = -start > length ? 0 : (length + start);
  20594. }
  20595. end = (end === undefined || end > length) ? length : toInteger(end);
  20596. if (end < 0) {
  20597. end += length;
  20598. }
  20599. end = start > end ? 0 : toLength(end);
  20600. while (start < end) {
  20601. array[start++] = value;
  20602. }
  20603. return array;
  20604. }
  20605. /**
  20606. * The base implementation of `_.filter` without support for iteratee shorthands.
  20607. *
  20608. * @private
  20609. * @param {Array|Object} collection The collection to iterate over.
  20610. * @param {Function} predicate The function invoked per iteration.
  20611. * @returns {Array} Returns the new filtered array.
  20612. */
  20613. function baseFilter(collection, predicate) {
  20614. var result = [];
  20615. baseEach(collection, function(value, index, collection) {
  20616. if (predicate(value, index, collection)) {
  20617. result.push(value);
  20618. }
  20619. });
  20620. return result;
  20621. }
  20622. /**
  20623. * The base implementation of `_.flatten` with support for restricting flattening.
  20624. *
  20625. * @private
  20626. * @param {Array} array The array to flatten.
  20627. * @param {number} depth The maximum recursion depth.
  20628. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  20629. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  20630. * @param {Array} [result=[]] The initial result value.
  20631. * @returns {Array} Returns the new flattened array.
  20632. */
  20633. function baseFlatten(array, depth, predicate, isStrict, result) {
  20634. var index = -1,
  20635. length = array.length;
  20636. predicate || (predicate = isFlattenable);
  20637. result || (result = []);
  20638. while (++index < length) {
  20639. var value = array[index];
  20640. if (depth > 0 && predicate(value)) {
  20641. if (depth > 1) {
  20642. // Recursively flatten arrays (susceptible to call stack limits).
  20643. baseFlatten(value, depth - 1, predicate, isStrict, result);
  20644. } else {
  20645. arrayPush(result, value);
  20646. }
  20647. } else if (!isStrict) {
  20648. result[result.length] = value;
  20649. }
  20650. }
  20651. return result;
  20652. }
  20653. /**
  20654. * The base implementation of `baseForOwn` which iterates over `object`
  20655. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  20656. * Iteratee functions may exit iteration early by explicitly returning `false`.
  20657. *
  20658. * @private
  20659. * @param {Object} object The object to iterate over.
  20660. * @param {Function} iteratee The function invoked per iteration.
  20661. * @param {Function} keysFunc The function to get the keys of `object`.
  20662. * @returns {Object} Returns `object`.
  20663. */
  20664. var baseFor = createBaseFor();
  20665. /**
  20666. * This function is like `baseFor` except that it iterates over properties
  20667. * in the opposite order.
  20668. *
  20669. * @private
  20670. * @param {Object} object The object to iterate over.
  20671. * @param {Function} iteratee The function invoked per iteration.
  20672. * @param {Function} keysFunc The function to get the keys of `object`.
  20673. * @returns {Object} Returns `object`.
  20674. */
  20675. var baseForRight = createBaseFor(true);
  20676. /**
  20677. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  20678. *
  20679. * @private
  20680. * @param {Object} object The object to iterate over.
  20681. * @param {Function} iteratee The function invoked per iteration.
  20682. * @returns {Object} Returns `object`.
  20683. */
  20684. function baseForOwn(object, iteratee) {
  20685. return object && baseFor(object, iteratee, keys);
  20686. }
  20687. /**
  20688. * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
  20689. *
  20690. * @private
  20691. * @param {Object} object The object to iterate over.
  20692. * @param {Function} iteratee The function invoked per iteration.
  20693. * @returns {Object} Returns `object`.
  20694. */
  20695. function baseForOwnRight(object, iteratee) {
  20696. return object && baseForRight(object, iteratee, keys);
  20697. }
  20698. /**
  20699. * The base implementation of `_.functions` which creates an array of
  20700. * `object` function property names filtered from `props`.
  20701. *
  20702. * @private
  20703. * @param {Object} object The object to inspect.
  20704. * @param {Array} props The property names to filter.
  20705. * @returns {Array} Returns the function names.
  20706. */
  20707. function baseFunctions(object, props) {
  20708. return arrayFilter(props, function(key) {
  20709. return isFunction(object[key]);
  20710. });
  20711. }
  20712. /**
  20713. * The base implementation of `_.get` without support for default values.
  20714. *
  20715. * @private
  20716. * @param {Object} object The object to query.
  20717. * @param {Array|string} path The path of the property to get.
  20718. * @returns {*} Returns the resolved value.
  20719. */
  20720. function baseGet(object, path) {
  20721. path = castPath(path, object);
  20722. var index = 0,
  20723. length = path.length;
  20724. while (object != null && index < length) {
  20725. object = object[toKey(path[index++])];
  20726. }
  20727. return (index && index == length) ? object : undefined;
  20728. }
  20729. /**
  20730. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  20731. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  20732. * symbols of `object`.
  20733. *
  20734. * @private
  20735. * @param {Object} object The object to query.
  20736. * @param {Function} keysFunc The function to get the keys of `object`.
  20737. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  20738. * @returns {Array} Returns the array of property names and symbols.
  20739. */
  20740. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  20741. var result = keysFunc(object);
  20742. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  20743. }
  20744. /**
  20745. * The base implementation of `getTag` without fallbacks for buggy environments.
  20746. *
  20747. * @private
  20748. * @param {*} value The value to query.
  20749. * @returns {string} Returns the `toStringTag`.
  20750. */
  20751. function baseGetTag(value) {
  20752. if (value == null) {
  20753. return value === undefined ? undefinedTag : nullTag;
  20754. }
  20755. return (symToStringTag && symToStringTag in Object(value))
  20756. ? getRawTag(value)
  20757. : objectToString(value);
  20758. }
  20759. /**
  20760. * The base implementation of `_.gt` which doesn't coerce arguments.
  20761. *
  20762. * @private
  20763. * @param {*} value The value to compare.
  20764. * @param {*} other The other value to compare.
  20765. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  20766. * else `false`.
  20767. */
  20768. function baseGt(value, other) {
  20769. return value > other;
  20770. }
  20771. /**
  20772. * The base implementation of `_.has` without support for deep paths.
  20773. *
  20774. * @private
  20775. * @param {Object} [object] The object to query.
  20776. * @param {Array|string} key The key to check.
  20777. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  20778. */
  20779. function baseHas(object, key) {
  20780. return object != null && hasOwnProperty.call(object, key);
  20781. }
  20782. /**
  20783. * The base implementation of `_.hasIn` without support for deep paths.
  20784. *
  20785. * @private
  20786. * @param {Object} [object] The object to query.
  20787. * @param {Array|string} key The key to check.
  20788. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  20789. */
  20790. function baseHasIn(object, key) {
  20791. return object != null && key in Object(object);
  20792. }
  20793. /**
  20794. * The base implementation of `_.inRange` which doesn't coerce arguments.
  20795. *
  20796. * @private
  20797. * @param {number} number The number to check.
  20798. * @param {number} start The start of the range.
  20799. * @param {number} end The end of the range.
  20800. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  20801. */
  20802. function baseInRange(number, start, end) {
  20803. return number >= nativeMin(start, end) && number < nativeMax(start, end);
  20804. }
  20805. /**
  20806. * The base implementation of methods like `_.intersection`, without support
  20807. * for iteratee shorthands, that accepts an array of arrays to inspect.
  20808. *
  20809. * @private
  20810. * @param {Array} arrays The arrays to inspect.
  20811. * @param {Function} [iteratee] The iteratee invoked per element.
  20812. * @param {Function} [comparator] The comparator invoked per element.
  20813. * @returns {Array} Returns the new array of shared values.
  20814. */
  20815. function baseIntersection(arrays, iteratee, comparator) {
  20816. var includes = comparator ? arrayIncludesWith : arrayIncludes,
  20817. length = arrays[0].length,
  20818. othLength = arrays.length,
  20819. othIndex = othLength,
  20820. caches = Array(othLength),
  20821. maxLength = Infinity,
  20822. result = [];
  20823. while (othIndex--) {
  20824. var array = arrays[othIndex];
  20825. if (othIndex && iteratee) {
  20826. array = arrayMap(array, baseUnary(iteratee));
  20827. }
  20828. maxLength = nativeMin(array.length, maxLength);
  20829. caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
  20830. ? new SetCache(othIndex && array)
  20831. : undefined;
  20832. }
  20833. array = arrays[0];
  20834. var index = -1,
  20835. seen = caches[0];
  20836. outer:
  20837. while (++index < length && result.length < maxLength) {
  20838. var value = array[index],
  20839. computed = iteratee ? iteratee(value) : value;
  20840. value = (comparator || value !== 0) ? value : 0;
  20841. if (!(seen
  20842. ? cacheHas(seen, computed)
  20843. : includes(result, computed, comparator)
  20844. )) {
  20845. othIndex = othLength;
  20846. while (--othIndex) {
  20847. var cache = caches[othIndex];
  20848. if (!(cache
  20849. ? cacheHas(cache, computed)
  20850. : includes(arrays[othIndex], computed, comparator))
  20851. ) {
  20852. continue outer;
  20853. }
  20854. }
  20855. if (seen) {
  20856. seen.push(computed);
  20857. }
  20858. result.push(value);
  20859. }
  20860. }
  20861. return result;
  20862. }
  20863. /**
  20864. * The base implementation of `_.invert` and `_.invertBy` which inverts
  20865. * `object` with values transformed by `iteratee` and set by `setter`.
  20866. *
  20867. * @private
  20868. * @param {Object} object The object to iterate over.
  20869. * @param {Function} setter The function to set `accumulator` values.
  20870. * @param {Function} iteratee The iteratee to transform values.
  20871. * @param {Object} accumulator The initial inverted object.
  20872. * @returns {Function} Returns `accumulator`.
  20873. */
  20874. function baseInverter(object, setter, iteratee, accumulator) {
  20875. baseForOwn(object, function(value, key, object) {
  20876. setter(accumulator, iteratee(value), key, object);
  20877. });
  20878. return accumulator;
  20879. }
  20880. /**
  20881. * The base implementation of `_.invoke` without support for individual
  20882. * method arguments.
  20883. *
  20884. * @private
  20885. * @param {Object} object The object to query.
  20886. * @param {Array|string} path The path of the method to invoke.
  20887. * @param {Array} args The arguments to invoke the method with.
  20888. * @returns {*} Returns the result of the invoked method.
  20889. */
  20890. function baseInvoke(object, path, args) {
  20891. path = castPath(path, object);
  20892. object = parent(object, path);
  20893. var func = object == null ? object : object[toKey(last(path))];
  20894. return func == null ? undefined : apply(func, object, args);
  20895. }
  20896. /**
  20897. * The base implementation of `_.isArguments`.
  20898. *
  20899. * @private
  20900. * @param {*} value The value to check.
  20901. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  20902. */
  20903. function baseIsArguments(value) {
  20904. return isObjectLike(value) && baseGetTag(value) == argsTag;
  20905. }
  20906. /**
  20907. * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
  20908. *
  20909. * @private
  20910. * @param {*} value The value to check.
  20911. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  20912. */
  20913. function baseIsArrayBuffer(value) {
  20914. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  20915. }
  20916. /**
  20917. * The base implementation of `_.isDate` without Node.js optimizations.
  20918. *
  20919. * @private
  20920. * @param {*} value The value to check.
  20921. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  20922. */
  20923. function baseIsDate(value) {
  20924. return isObjectLike(value) && baseGetTag(value) == dateTag;
  20925. }
  20926. /**
  20927. * The base implementation of `_.isEqual` which supports partial comparisons
  20928. * and tracks traversed objects.
  20929. *
  20930. * @private
  20931. * @param {*} value The value to compare.
  20932. * @param {*} other The other value to compare.
  20933. * @param {boolean} bitmask The bitmask flags.
  20934. * 1 - Unordered comparison
  20935. * 2 - Partial comparison
  20936. * @param {Function} [customizer] The function to customize comparisons.
  20937. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  20938. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  20939. */
  20940. function baseIsEqual(value, other, bitmask, customizer, stack) {
  20941. if (value === other) {
  20942. return true;
  20943. }
  20944. if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
  20945. return value !== value && other !== other;
  20946. }
  20947. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  20948. }
  20949. /**
  20950. * A specialized version of `baseIsEqual` for arrays and objects which performs
  20951. * deep comparisons and tracks traversed objects enabling objects with circular
  20952. * references to be compared.
  20953. *
  20954. * @private
  20955. * @param {Object} object The object to compare.
  20956. * @param {Object} other The other object to compare.
  20957. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  20958. * @param {Function} customizer The function to customize comparisons.
  20959. * @param {Function} equalFunc The function to determine equivalents of values.
  20960. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  20961. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  20962. */
  20963. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  20964. var objIsArr = isArray(object),
  20965. othIsArr = isArray(other),
  20966. objTag = objIsArr ? arrayTag : getTag(object),
  20967. othTag = othIsArr ? arrayTag : getTag(other);
  20968. objTag = objTag == argsTag ? objectTag : objTag;
  20969. othTag = othTag == argsTag ? objectTag : othTag;
  20970. var objIsObj = objTag == objectTag,
  20971. othIsObj = othTag == objectTag,
  20972. isSameTag = objTag == othTag;
  20973. if (isSameTag && isBuffer(object)) {
  20974. if (!isBuffer(other)) {
  20975. return false;
  20976. }
  20977. objIsArr = true;
  20978. objIsObj = false;
  20979. }
  20980. if (isSameTag && !objIsObj) {
  20981. stack || (stack = new Stack);
  20982. return (objIsArr || isTypedArray(object))
  20983. ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
  20984. : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  20985. }
  20986. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  20987. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  20988. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  20989. if (objIsWrapped || othIsWrapped) {
  20990. var objUnwrapped = objIsWrapped ? object.value() : object,
  20991. othUnwrapped = othIsWrapped ? other.value() : other;
  20992. stack || (stack = new Stack);
  20993. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  20994. }
  20995. }
  20996. if (!isSameTag) {
  20997. return false;
  20998. }
  20999. stack || (stack = new Stack);
  21000. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  21001. }
  21002. /**
  21003. * The base implementation of `_.isMap` without Node.js optimizations.
  21004. *
  21005. * @private
  21006. * @param {*} value The value to check.
  21007. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  21008. */
  21009. function baseIsMap(value) {
  21010. return isObjectLike(value) && getTag(value) == mapTag;
  21011. }
  21012. /**
  21013. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  21014. *
  21015. * @private
  21016. * @param {Object} object The object to inspect.
  21017. * @param {Object} source The object of property values to match.
  21018. * @param {Array} matchData The property names, values, and compare flags to match.
  21019. * @param {Function} [customizer] The function to customize comparisons.
  21020. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  21021. */
  21022. function baseIsMatch(object, source, matchData, customizer) {
  21023. var index = matchData.length,
  21024. length = index,
  21025. noCustomizer = !customizer;
  21026. if (object == null) {
  21027. return !length;
  21028. }
  21029. object = Object(object);
  21030. while (index--) {
  21031. var data = matchData[index];
  21032. if ((noCustomizer && data[2])
  21033. ? data[1] !== object[data[0]]
  21034. : !(data[0] in object)
  21035. ) {
  21036. return false;
  21037. }
  21038. }
  21039. while (++index < length) {
  21040. data = matchData[index];
  21041. var key = data[0],
  21042. objValue = object[key],
  21043. srcValue = data[1];
  21044. if (noCustomizer && data[2]) {
  21045. if (objValue === undefined && !(key in object)) {
  21046. return false;
  21047. }
  21048. } else {
  21049. var stack = new Stack;
  21050. if (customizer) {
  21051. var result = customizer(objValue, srcValue, key, object, source, stack);
  21052. }
  21053. if (!(result === undefined
  21054. ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
  21055. : result
  21056. )) {
  21057. return false;
  21058. }
  21059. }
  21060. }
  21061. return true;
  21062. }
  21063. /**
  21064. * The base implementation of `_.isNative` without bad shim checks.
  21065. *
  21066. * @private
  21067. * @param {*} value The value to check.
  21068. * @returns {boolean} Returns `true` if `value` is a native function,
  21069. * else `false`.
  21070. */
  21071. function baseIsNative(value) {
  21072. if (!isObject(value) || isMasked(value)) {
  21073. return false;
  21074. }
  21075. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  21076. return pattern.test(toSource(value));
  21077. }
  21078. /**
  21079. * The base implementation of `_.isRegExp` without Node.js optimizations.
  21080. *
  21081. * @private
  21082. * @param {*} value The value to check.
  21083. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  21084. */
  21085. function baseIsRegExp(value) {
  21086. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  21087. }
  21088. /**
  21089. * The base implementation of `_.isSet` without Node.js optimizations.
  21090. *
  21091. * @private
  21092. * @param {*} value The value to check.
  21093. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  21094. */
  21095. function baseIsSet(value) {
  21096. return isObjectLike(value) && getTag(value) == setTag;
  21097. }
  21098. /**
  21099. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  21100. *
  21101. * @private
  21102. * @param {*} value The value to check.
  21103. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  21104. */
  21105. function baseIsTypedArray(value) {
  21106. return isObjectLike(value) &&
  21107. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  21108. }
  21109. /**
  21110. * The base implementation of `_.iteratee`.
  21111. *
  21112. * @private
  21113. * @param {*} [value=_.identity] The value to convert to an iteratee.
  21114. * @returns {Function} Returns the iteratee.
  21115. */
  21116. function baseIteratee(value) {
  21117. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  21118. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  21119. if (typeof value == 'function') {
  21120. return value;
  21121. }
  21122. if (value == null) {
  21123. return identity;
  21124. }
  21125. if (typeof value == 'object') {
  21126. return isArray(value)
  21127. ? baseMatchesProperty(value[0], value[1])
  21128. : baseMatches(value);
  21129. }
  21130. return property(value);
  21131. }
  21132. /**
  21133. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  21134. *
  21135. * @private
  21136. * @param {Object} object The object to query.
  21137. * @returns {Array} Returns the array of property names.
  21138. */
  21139. function baseKeys(object) {
  21140. if (!isPrototype(object)) {
  21141. return nativeKeys(object);
  21142. }
  21143. var result = [];
  21144. for (var key in Object(object)) {
  21145. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  21146. result.push(key);
  21147. }
  21148. }
  21149. return result;
  21150. }
  21151. /**
  21152. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  21153. *
  21154. * @private
  21155. * @param {Object} object The object to query.
  21156. * @returns {Array} Returns the array of property names.
  21157. */
  21158. function baseKeysIn(object) {
  21159. if (!isObject(object)) {
  21160. return nativeKeysIn(object);
  21161. }
  21162. var isProto = isPrototype(object),
  21163. result = [];
  21164. for (var key in object) {
  21165. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  21166. result.push(key);
  21167. }
  21168. }
  21169. return result;
  21170. }
  21171. /**
  21172. * The base implementation of `_.lt` which doesn't coerce arguments.
  21173. *
  21174. * @private
  21175. * @param {*} value The value to compare.
  21176. * @param {*} other The other value to compare.
  21177. * @returns {boolean} Returns `true` if `value` is less than `other`,
  21178. * else `false`.
  21179. */
  21180. function baseLt(value, other) {
  21181. return value < other;
  21182. }
  21183. /**
  21184. * The base implementation of `_.map` without support for iteratee shorthands.
  21185. *
  21186. * @private
  21187. * @param {Array|Object} collection The collection to iterate over.
  21188. * @param {Function} iteratee The function invoked per iteration.
  21189. * @returns {Array} Returns the new mapped array.
  21190. */
  21191. function baseMap(collection, iteratee) {
  21192. var index = -1,
  21193. result = isArrayLike(collection) ? Array(collection.length) : [];
  21194. baseEach(collection, function(value, key, collection) {
  21195. result[++index] = iteratee(value, key, collection);
  21196. });
  21197. return result;
  21198. }
  21199. /**
  21200. * The base implementation of `_.matches` which doesn't clone `source`.
  21201. *
  21202. * @private
  21203. * @param {Object} source The object of property values to match.
  21204. * @returns {Function} Returns the new spec function.
  21205. */
  21206. function baseMatches(source) {
  21207. var matchData = getMatchData(source);
  21208. if (matchData.length == 1 && matchData[0][2]) {
  21209. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  21210. }
  21211. return function(object) {
  21212. return object === source || baseIsMatch(object, source, matchData);
  21213. };
  21214. }
  21215. /**
  21216. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  21217. *
  21218. * @private
  21219. * @param {string} path The path of the property to get.
  21220. * @param {*} srcValue The value to match.
  21221. * @returns {Function} Returns the new spec function.
  21222. */
  21223. function baseMatchesProperty(path, srcValue) {
  21224. if (isKey(path) && isStrictComparable(srcValue)) {
  21225. return matchesStrictComparable(toKey(path), srcValue);
  21226. }
  21227. return function(object) {
  21228. var objValue = get(object, path);
  21229. return (objValue === undefined && objValue === srcValue)
  21230. ? hasIn(object, path)
  21231. : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  21232. };
  21233. }
  21234. /**
  21235. * The base implementation of `_.merge` without support for multiple sources.
  21236. *
  21237. * @private
  21238. * @param {Object} object The destination object.
  21239. * @param {Object} source The source object.
  21240. * @param {number} srcIndex The index of `source`.
  21241. * @param {Function} [customizer] The function to customize merged values.
  21242. * @param {Object} [stack] Tracks traversed source values and their merged
  21243. * counterparts.
  21244. */
  21245. function baseMerge(object, source, srcIndex, customizer, stack) {
  21246. if (object === source) {
  21247. return;
  21248. }
  21249. baseFor(source, function(srcValue, key) {
  21250. stack || (stack = new Stack);
  21251. if (isObject(srcValue)) {
  21252. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  21253. }
  21254. else {
  21255. var newValue = customizer
  21256. ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
  21257. : undefined;
  21258. if (newValue === undefined) {
  21259. newValue = srcValue;
  21260. }
  21261. assignMergeValue(object, key, newValue);
  21262. }
  21263. }, keysIn);
  21264. }
  21265. /**
  21266. * A specialized version of `baseMerge` for arrays and objects which performs
  21267. * deep merges and tracks traversed objects enabling objects with circular
  21268. * references to be merged.
  21269. *
  21270. * @private
  21271. * @param {Object} object The destination object.
  21272. * @param {Object} source The source object.
  21273. * @param {string} key The key of the value to merge.
  21274. * @param {number} srcIndex The index of `source`.
  21275. * @param {Function} mergeFunc The function to merge values.
  21276. * @param {Function} [customizer] The function to customize assigned values.
  21277. * @param {Object} [stack] Tracks traversed source values and their merged
  21278. * counterparts.
  21279. */
  21280. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  21281. var objValue = safeGet(object, key),
  21282. srcValue = safeGet(source, key),
  21283. stacked = stack.get(srcValue);
  21284. if (stacked) {
  21285. assignMergeValue(object, key, stacked);
  21286. return;
  21287. }
  21288. var newValue = customizer
  21289. ? customizer(objValue, srcValue, (key + ''), object, source, stack)
  21290. : undefined;
  21291. var isCommon = newValue === undefined;
  21292. if (isCommon) {
  21293. var isArr = isArray(srcValue),
  21294. isBuff = !isArr && isBuffer(srcValue),
  21295. isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  21296. newValue = srcValue;
  21297. if (isArr || isBuff || isTyped) {
  21298. if (isArray(objValue)) {
  21299. newValue = objValue;
  21300. }
  21301. else if (isArrayLikeObject(objValue)) {
  21302. newValue = copyArray(objValue);
  21303. }
  21304. else if (isBuff) {
  21305. isCommon = false;
  21306. newValue = cloneBuffer(srcValue, true);
  21307. }
  21308. else if (isTyped) {
  21309. isCommon = false;
  21310. newValue = cloneTypedArray(srcValue, true);
  21311. }
  21312. else {
  21313. newValue = [];
  21314. }
  21315. }
  21316. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  21317. newValue = objValue;
  21318. if (isArguments(objValue)) {
  21319. newValue = toPlainObject(objValue);
  21320. }
  21321. else if (!isObject(objValue) || isFunction(objValue)) {
  21322. newValue = initCloneObject(srcValue);
  21323. }
  21324. }
  21325. else {
  21326. isCommon = false;
  21327. }
  21328. }
  21329. if (isCommon) {
  21330. // Recursively merge objects and arrays (susceptible to call stack limits).
  21331. stack.set(srcValue, newValue);
  21332. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  21333. stack['delete'](srcValue);
  21334. }
  21335. assignMergeValue(object, key, newValue);
  21336. }
  21337. /**
  21338. * The base implementation of `_.nth` which doesn't coerce arguments.
  21339. *
  21340. * @private
  21341. * @param {Array} array The array to query.
  21342. * @param {number} n The index of the element to return.
  21343. * @returns {*} Returns the nth element of `array`.
  21344. */
  21345. function baseNth(array, n) {
  21346. var length = array.length;
  21347. if (!length) {
  21348. return;
  21349. }
  21350. n += n < 0 ? length : 0;
  21351. return isIndex(n, length) ? array[n] : undefined;
  21352. }
  21353. /**
  21354. * The base implementation of `_.orderBy` without param guards.
  21355. *
  21356. * @private
  21357. * @param {Array|Object} collection The collection to iterate over.
  21358. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
  21359. * @param {string[]} orders The sort orders of `iteratees`.
  21360. * @returns {Array} Returns the new sorted array.
  21361. */
  21362. function baseOrderBy(collection, iteratees, orders) {
  21363. var index = -1;
  21364. iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee()));
  21365. var result = baseMap(collection, function(value, key, collection) {
  21366. var criteria = arrayMap(iteratees, function(iteratee) {
  21367. return iteratee(value);
  21368. });
  21369. return { 'criteria': criteria, 'index': ++index, 'value': value };
  21370. });
  21371. return baseSortBy(result, function(object, other) {
  21372. return compareMultiple(object, other, orders);
  21373. });
  21374. }
  21375. /**
  21376. * The base implementation of `_.pick` without support for individual
  21377. * property identifiers.
  21378. *
  21379. * @private
  21380. * @param {Object} object The source object.
  21381. * @param {string[]} paths The property paths to pick.
  21382. * @returns {Object} Returns the new object.
  21383. */
  21384. function basePick(object, paths) {
  21385. return basePickBy(object, paths, function(value, path) {
  21386. return hasIn(object, path);
  21387. });
  21388. }
  21389. /**
  21390. * The base implementation of `_.pickBy` without support for iteratee shorthands.
  21391. *
  21392. * @private
  21393. * @param {Object} object The source object.
  21394. * @param {string[]} paths The property paths to pick.
  21395. * @param {Function} predicate The function invoked per property.
  21396. * @returns {Object} Returns the new object.
  21397. */
  21398. function basePickBy(object, paths, predicate) {
  21399. var index = -1,
  21400. length = paths.length,
  21401. result = {};
  21402. while (++index < length) {
  21403. var path = paths[index],
  21404. value = baseGet(object, path);
  21405. if (predicate(value, path)) {
  21406. baseSet(result, castPath(path, object), value);
  21407. }
  21408. }
  21409. return result;
  21410. }
  21411. /**
  21412. * A specialized version of `baseProperty` which supports deep paths.
  21413. *
  21414. * @private
  21415. * @param {Array|string} path The path of the property to get.
  21416. * @returns {Function} Returns the new accessor function.
  21417. */
  21418. function basePropertyDeep(path) {
  21419. return function(object) {
  21420. return baseGet(object, path);
  21421. };
  21422. }
  21423. /**
  21424. * The base implementation of `_.pullAllBy` without support for iteratee
  21425. * shorthands.
  21426. *
  21427. * @private
  21428. * @param {Array} array The array to modify.
  21429. * @param {Array} values The values to remove.
  21430. * @param {Function} [iteratee] The iteratee invoked per element.
  21431. * @param {Function} [comparator] The comparator invoked per element.
  21432. * @returns {Array} Returns `array`.
  21433. */
  21434. function basePullAll(array, values, iteratee, comparator) {
  21435. var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
  21436. index = -1,
  21437. length = values.length,
  21438. seen = array;
  21439. if (array === values) {
  21440. values = copyArray(values);
  21441. }
  21442. if (iteratee) {
  21443. seen = arrayMap(array, baseUnary(iteratee));
  21444. }
  21445. while (++index < length) {
  21446. var fromIndex = 0,
  21447. value = values[index],
  21448. computed = iteratee ? iteratee(value) : value;
  21449. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  21450. if (seen !== array) {
  21451. splice.call(seen, fromIndex, 1);
  21452. }
  21453. splice.call(array, fromIndex, 1);
  21454. }
  21455. }
  21456. return array;
  21457. }
  21458. /**
  21459. * The base implementation of `_.pullAt` without support for individual
  21460. * indexes or capturing the removed elements.
  21461. *
  21462. * @private
  21463. * @param {Array} array The array to modify.
  21464. * @param {number[]} indexes The indexes of elements to remove.
  21465. * @returns {Array} Returns `array`.
  21466. */
  21467. function basePullAt(array, indexes) {
  21468. var length = array ? indexes.length : 0,
  21469. lastIndex = length - 1;
  21470. while (length--) {
  21471. var index = indexes[length];
  21472. if (length == lastIndex || index !== previous) {
  21473. var previous = index;
  21474. if (isIndex(index)) {
  21475. splice.call(array, index, 1);
  21476. } else {
  21477. baseUnset(array, index);
  21478. }
  21479. }
  21480. }
  21481. return array;
  21482. }
  21483. /**
  21484. * The base implementation of `_.random` without support for returning
  21485. * floating-point numbers.
  21486. *
  21487. * @private
  21488. * @param {number} lower The lower bound.
  21489. * @param {number} upper The upper bound.
  21490. * @returns {number} Returns the random number.
  21491. */
  21492. function baseRandom(lower, upper) {
  21493. return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
  21494. }
  21495. /**
  21496. * The base implementation of `_.range` and `_.rangeRight` which doesn't
  21497. * coerce arguments.
  21498. *
  21499. * @private
  21500. * @param {number} start The start of the range.
  21501. * @param {number} end The end of the range.
  21502. * @param {number} step The value to increment or decrement by.
  21503. * @param {boolean} [fromRight] Specify iterating from right to left.
  21504. * @returns {Array} Returns the range of numbers.
  21505. */
  21506. function baseRange(start, end, step, fromRight) {
  21507. var index = -1,
  21508. length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
  21509. result = Array(length);
  21510. while (length--) {
  21511. result[fromRight ? length : ++index] = start;
  21512. start += step;
  21513. }
  21514. return result;
  21515. }
  21516. /**
  21517. * The base implementation of `_.repeat` which doesn't coerce arguments.
  21518. *
  21519. * @private
  21520. * @param {string} string The string to repeat.
  21521. * @param {number} n The number of times to repeat the string.
  21522. * @returns {string} Returns the repeated string.
  21523. */
  21524. function baseRepeat(string, n) {
  21525. var result = '';
  21526. if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
  21527. return result;
  21528. }
  21529. // Leverage the exponentiation by squaring algorithm for a faster repeat.
  21530. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
  21531. do {
  21532. if (n % 2) {
  21533. result += string;
  21534. }
  21535. n = nativeFloor(n / 2);
  21536. if (n) {
  21537. string += string;
  21538. }
  21539. } while (n);
  21540. return result;
  21541. }
  21542. /**
  21543. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  21544. *
  21545. * @private
  21546. * @param {Function} func The function to apply a rest parameter to.
  21547. * @param {number} [start=func.length-1] The start position of the rest parameter.
  21548. * @returns {Function} Returns the new function.
  21549. */
  21550. function baseRest(func, start) {
  21551. return setToString(overRest(func, start, identity), func + '');
  21552. }
  21553. /**
  21554. * The base implementation of `_.sample`.
  21555. *
  21556. * @private
  21557. * @param {Array|Object} collection The collection to sample.
  21558. * @returns {*} Returns the random element.
  21559. */
  21560. function baseSample(collection) {
  21561. return arraySample(values(collection));
  21562. }
  21563. /**
  21564. * The base implementation of `_.sampleSize` without param guards.
  21565. *
  21566. * @private
  21567. * @param {Array|Object} collection The collection to sample.
  21568. * @param {number} n The number of elements to sample.
  21569. * @returns {Array} Returns the random elements.
  21570. */
  21571. function baseSampleSize(collection, n) {
  21572. var array = values(collection);
  21573. return shuffleSelf(array, baseClamp(n, 0, array.length));
  21574. }
  21575. /**
  21576. * The base implementation of `_.set`.
  21577. *
  21578. * @private
  21579. * @param {Object} object The object to modify.
  21580. * @param {Array|string} path The path of the property to set.
  21581. * @param {*} value The value to set.
  21582. * @param {Function} [customizer] The function to customize path creation.
  21583. * @returns {Object} Returns `object`.
  21584. */
  21585. function baseSet(object, path, value, customizer) {
  21586. if (!isObject(object)) {
  21587. return object;
  21588. }
  21589. path = castPath(path, object);
  21590. var index = -1,
  21591. length = path.length,
  21592. lastIndex = length - 1,
  21593. nested = object;
  21594. while (nested != null && ++index < length) {
  21595. var key = toKey(path[index]),
  21596. newValue = value;
  21597. if (index != lastIndex) {
  21598. var objValue = nested[key];
  21599. newValue = customizer ? customizer(objValue, key, nested) : undefined;
  21600. if (newValue === undefined) {
  21601. newValue = isObject(objValue)
  21602. ? objValue
  21603. : (isIndex(path[index + 1]) ? [] : {});
  21604. }
  21605. }
  21606. assignValue(nested, key, newValue);
  21607. nested = nested[key];
  21608. }
  21609. return object;
  21610. }
  21611. /**
  21612. * The base implementation of `setData` without support for hot loop shorting.
  21613. *
  21614. * @private
  21615. * @param {Function} func The function to associate metadata with.
  21616. * @param {*} data The metadata.
  21617. * @returns {Function} Returns `func`.
  21618. */
  21619. var baseSetData = !metaMap ? identity : function(func, data) {
  21620. metaMap.set(func, data);
  21621. return func;
  21622. };
  21623. /**
  21624. * The base implementation of `setToString` without support for hot loop shorting.
  21625. *
  21626. * @private
  21627. * @param {Function} func The function to modify.
  21628. * @param {Function} string The `toString` result.
  21629. * @returns {Function} Returns `func`.
  21630. */
  21631. var baseSetToString = !defineProperty ? identity : function(func, string) {
  21632. return defineProperty(func, 'toString', {
  21633. 'configurable': true,
  21634. 'enumerable': false,
  21635. 'value': constant(string),
  21636. 'writable': true
  21637. });
  21638. };
  21639. /**
  21640. * The base implementation of `_.shuffle`.
  21641. *
  21642. * @private
  21643. * @param {Array|Object} collection The collection to shuffle.
  21644. * @returns {Array} Returns the new shuffled array.
  21645. */
  21646. function baseShuffle(collection) {
  21647. return shuffleSelf(values(collection));
  21648. }
  21649. /**
  21650. * The base implementation of `_.slice` without an iteratee call guard.
  21651. *
  21652. * @private
  21653. * @param {Array} array The array to slice.
  21654. * @param {number} [start=0] The start position.
  21655. * @param {number} [end=array.length] The end position.
  21656. * @returns {Array} Returns the slice of `array`.
  21657. */
  21658. function baseSlice(array, start, end) {
  21659. var index = -1,
  21660. length = array.length;
  21661. if (start < 0) {
  21662. start = -start > length ? 0 : (length + start);
  21663. }
  21664. end = end > length ? length : end;
  21665. if (end < 0) {
  21666. end += length;
  21667. }
  21668. length = start > end ? 0 : ((end - start) >>> 0);
  21669. start >>>= 0;
  21670. var result = Array(length);
  21671. while (++index < length) {
  21672. result[index] = array[index + start];
  21673. }
  21674. return result;
  21675. }
  21676. /**
  21677. * The base implementation of `_.some` without support for iteratee shorthands.
  21678. *
  21679. * @private
  21680. * @param {Array|Object} collection The collection to iterate over.
  21681. * @param {Function} predicate The function invoked per iteration.
  21682. * @returns {boolean} Returns `true` if any element passes the predicate check,
  21683. * else `false`.
  21684. */
  21685. function baseSome(collection, predicate) {
  21686. var result;
  21687. baseEach(collection, function(value, index, collection) {
  21688. result = predicate(value, index, collection);
  21689. return !result;
  21690. });
  21691. return !!result;
  21692. }
  21693. /**
  21694. * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
  21695. * performs a binary search of `array` to determine the index at which `value`
  21696. * should be inserted into `array` in order to maintain its sort order.
  21697. *
  21698. * @private
  21699. * @param {Array} array The sorted array to inspect.
  21700. * @param {*} value The value to evaluate.
  21701. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  21702. * @returns {number} Returns the index at which `value` should be inserted
  21703. * into `array`.
  21704. */
  21705. function baseSortedIndex(array, value, retHighest) {
  21706. var low = 0,
  21707. high = array == null ? low : array.length;
  21708. if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  21709. while (low < high) {
  21710. var mid = (low + high) >>> 1,
  21711. computed = array[mid];
  21712. if (computed !== null && !isSymbol(computed) &&
  21713. (retHighest ? (computed <= value) : (computed < value))) {
  21714. low = mid + 1;
  21715. } else {
  21716. high = mid;
  21717. }
  21718. }
  21719. return high;
  21720. }
  21721. return baseSortedIndexBy(array, value, identity, retHighest);
  21722. }
  21723. /**
  21724. * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
  21725. * which invokes `iteratee` for `value` and each element of `array` to compute
  21726. * their sort ranking. The iteratee is invoked with one argument; (value).
  21727. *
  21728. * @private
  21729. * @param {Array} array The sorted array to inspect.
  21730. * @param {*} value The value to evaluate.
  21731. * @param {Function} iteratee The iteratee invoked per element.
  21732. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  21733. * @returns {number} Returns the index at which `value` should be inserted
  21734. * into `array`.
  21735. */
  21736. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  21737. value = iteratee(value);
  21738. var low = 0,
  21739. high = array == null ? 0 : array.length,
  21740. valIsNaN = value !== value,
  21741. valIsNull = value === null,
  21742. valIsSymbol = isSymbol(value),
  21743. valIsUndefined = value === undefined;
  21744. while (low < high) {
  21745. var mid = nativeFloor((low + high) / 2),
  21746. computed = iteratee(array[mid]),
  21747. othIsDefined = computed !== undefined,
  21748. othIsNull = computed === null,
  21749. othIsReflexive = computed === computed,
  21750. othIsSymbol = isSymbol(computed);
  21751. if (valIsNaN) {
  21752. var setLow = retHighest || othIsReflexive;
  21753. } else if (valIsUndefined) {
  21754. setLow = othIsReflexive && (retHighest || othIsDefined);
  21755. } else if (valIsNull) {
  21756. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  21757. } else if (valIsSymbol) {
  21758. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  21759. } else if (othIsNull || othIsSymbol) {
  21760. setLow = false;
  21761. } else {
  21762. setLow = retHighest ? (computed <= value) : (computed < value);
  21763. }
  21764. if (setLow) {
  21765. low = mid + 1;
  21766. } else {
  21767. high = mid;
  21768. }
  21769. }
  21770. return nativeMin(high, MAX_ARRAY_INDEX);
  21771. }
  21772. /**
  21773. * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
  21774. * support for iteratee shorthands.
  21775. *
  21776. * @private
  21777. * @param {Array} array The array to inspect.
  21778. * @param {Function} [iteratee] The iteratee invoked per element.
  21779. * @returns {Array} Returns the new duplicate free array.
  21780. */
  21781. function baseSortedUniq(array, iteratee) {
  21782. var index = -1,
  21783. length = array.length,
  21784. resIndex = 0,
  21785. result = [];
  21786. while (++index < length) {
  21787. var value = array[index],
  21788. computed = iteratee ? iteratee(value) : value;
  21789. if (!index || !eq(computed, seen)) {
  21790. var seen = computed;
  21791. result[resIndex++] = value === 0 ? 0 : value;
  21792. }
  21793. }
  21794. return result;
  21795. }
  21796. /**
  21797. * The base implementation of `_.toNumber` which doesn't ensure correct
  21798. * conversions of binary, hexadecimal, or octal string values.
  21799. *
  21800. * @private
  21801. * @param {*} value The value to process.
  21802. * @returns {number} Returns the number.
  21803. */
  21804. function baseToNumber(value) {
  21805. if (typeof value == 'number') {
  21806. return value;
  21807. }
  21808. if (isSymbol(value)) {
  21809. return NAN;
  21810. }
  21811. return +value;
  21812. }
  21813. /**
  21814. * The base implementation of `_.toString` which doesn't convert nullish
  21815. * values to empty strings.
  21816. *
  21817. * @private
  21818. * @param {*} value The value to process.
  21819. * @returns {string} Returns the string.
  21820. */
  21821. function baseToString(value) {
  21822. // Exit early for strings to avoid a performance hit in some environments.
  21823. if (typeof value == 'string') {
  21824. return value;
  21825. }
  21826. if (isArray(value)) {
  21827. // Recursively convert values (susceptible to call stack limits).
  21828. return arrayMap(value, baseToString) + '';
  21829. }
  21830. if (isSymbol(value)) {
  21831. return symbolToString ? symbolToString.call(value) : '';
  21832. }
  21833. var result = (value + '');
  21834. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  21835. }
  21836. /**
  21837. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  21838. *
  21839. * @private
  21840. * @param {Array} array The array to inspect.
  21841. * @param {Function} [iteratee] The iteratee invoked per element.
  21842. * @param {Function} [comparator] The comparator invoked per element.
  21843. * @returns {Array} Returns the new duplicate free array.
  21844. */
  21845. function baseUniq(array, iteratee, comparator) {
  21846. var index = -1,
  21847. includes = arrayIncludes,
  21848. length = array.length,
  21849. isCommon = true,
  21850. result = [],
  21851. seen = result;
  21852. if (comparator) {
  21853. isCommon = false;
  21854. includes = arrayIncludesWith;
  21855. }
  21856. else if (length >= LARGE_ARRAY_SIZE) {
  21857. var set = iteratee ? null : createSet(array);
  21858. if (set) {
  21859. return setToArray(set);
  21860. }
  21861. isCommon = false;
  21862. includes = cacheHas;
  21863. seen = new SetCache;
  21864. }
  21865. else {
  21866. seen = iteratee ? [] : result;
  21867. }
  21868. outer:
  21869. while (++index < length) {
  21870. var value = array[index],
  21871. computed = iteratee ? iteratee(value) : value;
  21872. value = (comparator || value !== 0) ? value : 0;
  21873. if (isCommon && computed === computed) {
  21874. var seenIndex = seen.length;
  21875. while (seenIndex--) {
  21876. if (seen[seenIndex] === computed) {
  21877. continue outer;
  21878. }
  21879. }
  21880. if (iteratee) {
  21881. seen.push(computed);
  21882. }
  21883. result.push(value);
  21884. }
  21885. else if (!includes(seen, computed, comparator)) {
  21886. if (seen !== result) {
  21887. seen.push(computed);
  21888. }
  21889. result.push(value);
  21890. }
  21891. }
  21892. return result;
  21893. }
  21894. /**
  21895. * The base implementation of `_.unset`.
  21896. *
  21897. * @private
  21898. * @param {Object} object The object to modify.
  21899. * @param {Array|string} path The property path to unset.
  21900. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  21901. */
  21902. function baseUnset(object, path) {
  21903. path = castPath(path, object);
  21904. object = parent(object, path);
  21905. return object == null || delete object[toKey(last(path))];
  21906. }
  21907. /**
  21908. * The base implementation of `_.update`.
  21909. *
  21910. * @private
  21911. * @param {Object} object The object to modify.
  21912. * @param {Array|string} path The path of the property to update.
  21913. * @param {Function} updater The function to produce the updated value.
  21914. * @param {Function} [customizer] The function to customize path creation.
  21915. * @returns {Object} Returns `object`.
  21916. */
  21917. function baseUpdate(object, path, updater, customizer) {
  21918. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  21919. }
  21920. /**
  21921. * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
  21922. * without support for iteratee shorthands.
  21923. *
  21924. * @private
  21925. * @param {Array} array The array to query.
  21926. * @param {Function} predicate The function invoked per iteration.
  21927. * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
  21928. * @param {boolean} [fromRight] Specify iterating from right to left.
  21929. * @returns {Array} Returns the slice of `array`.
  21930. */
  21931. function baseWhile(array, predicate, isDrop, fromRight) {
  21932. var length = array.length,
  21933. index = fromRight ? length : -1;
  21934. while ((fromRight ? index-- : ++index < length) &&
  21935. predicate(array[index], index, array)) {}
  21936. return isDrop
  21937. ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
  21938. : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
  21939. }
  21940. /**
  21941. * The base implementation of `wrapperValue` which returns the result of
  21942. * performing a sequence of actions on the unwrapped `value`, where each
  21943. * successive action is supplied the return value of the previous.
  21944. *
  21945. * @private
  21946. * @param {*} value The unwrapped value.
  21947. * @param {Array} actions Actions to perform to resolve the unwrapped value.
  21948. * @returns {*} Returns the resolved value.
  21949. */
  21950. function baseWrapperValue(value, actions) {
  21951. var result = value;
  21952. if (result instanceof LazyWrapper) {
  21953. result = result.value();
  21954. }
  21955. return arrayReduce(actions, function(result, action) {
  21956. return action.func.apply(action.thisArg, arrayPush([result], action.args));
  21957. }, result);
  21958. }
  21959. /**
  21960. * The base implementation of methods like `_.xor`, without support for
  21961. * iteratee shorthands, that accepts an array of arrays to inspect.
  21962. *
  21963. * @private
  21964. * @param {Array} arrays The arrays to inspect.
  21965. * @param {Function} [iteratee] The iteratee invoked per element.
  21966. * @param {Function} [comparator] The comparator invoked per element.
  21967. * @returns {Array} Returns the new array of values.
  21968. */
  21969. function baseXor(arrays, iteratee, comparator) {
  21970. var length = arrays.length;
  21971. if (length < 2) {
  21972. return length ? baseUniq(arrays[0]) : [];
  21973. }
  21974. var index = -1,
  21975. result = Array(length);
  21976. while (++index < length) {
  21977. var array = arrays[index],
  21978. othIndex = -1;
  21979. while (++othIndex < length) {
  21980. if (othIndex != index) {
  21981. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  21982. }
  21983. }
  21984. }
  21985. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  21986. }
  21987. /**
  21988. * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
  21989. *
  21990. * @private
  21991. * @param {Array} props The property identifiers.
  21992. * @param {Array} values The property values.
  21993. * @param {Function} assignFunc The function to assign values.
  21994. * @returns {Object} Returns the new object.
  21995. */
  21996. function baseZipObject(props, values, assignFunc) {
  21997. var index = -1,
  21998. length = props.length,
  21999. valsLength = values.length,
  22000. result = {};
  22001. while (++index < length) {
  22002. var value = index < valsLength ? values[index] : undefined;
  22003. assignFunc(result, props[index], value);
  22004. }
  22005. return result;
  22006. }
  22007. /**
  22008. * Casts `value` to an empty array if it's not an array like object.
  22009. *
  22010. * @private
  22011. * @param {*} value The value to inspect.
  22012. * @returns {Array|Object} Returns the cast array-like object.
  22013. */
  22014. function castArrayLikeObject(value) {
  22015. return isArrayLikeObject(value) ? value : [];
  22016. }
  22017. /**
  22018. * Casts `value` to `identity` if it's not a function.
  22019. *
  22020. * @private
  22021. * @param {*} value The value to inspect.
  22022. * @returns {Function} Returns cast function.
  22023. */
  22024. function castFunction(value) {
  22025. return typeof value == 'function' ? value : identity;
  22026. }
  22027. /**
  22028. * Casts `value` to a path array if it's not one.
  22029. *
  22030. * @private
  22031. * @param {*} value The value to inspect.
  22032. * @param {Object} [object] The object to query keys on.
  22033. * @returns {Array} Returns the cast property path array.
  22034. */
  22035. function castPath(value, object) {
  22036. if (isArray(value)) {
  22037. return value;
  22038. }
  22039. return isKey(value, object) ? [value] : stringToPath(toString(value));
  22040. }
  22041. /**
  22042. * A `baseRest` alias which can be replaced with `identity` by module
  22043. * replacement plugins.
  22044. *
  22045. * @private
  22046. * @type {Function}
  22047. * @param {Function} func The function to apply a rest parameter to.
  22048. * @returns {Function} Returns the new function.
  22049. */
  22050. var castRest = baseRest;
  22051. /**
  22052. * Casts `array` to a slice if it's needed.
  22053. *
  22054. * @private
  22055. * @param {Array} array The array to inspect.
  22056. * @param {number} start The start position.
  22057. * @param {number} [end=array.length] The end position.
  22058. * @returns {Array} Returns the cast slice.
  22059. */
  22060. function castSlice(array, start, end) {
  22061. var length = array.length;
  22062. end = end === undefined ? length : end;
  22063. return (!start && end >= length) ? array : baseSlice(array, start, end);
  22064. }
  22065. /**
  22066. * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
  22067. *
  22068. * @private
  22069. * @param {number|Object} id The timer id or timeout object of the timer to clear.
  22070. */
  22071. var clearTimeout = ctxClearTimeout || function(id) {
  22072. return root.clearTimeout(id);
  22073. };
  22074. /**
  22075. * Creates a clone of `buffer`.
  22076. *
  22077. * @private
  22078. * @param {Buffer} buffer The buffer to clone.
  22079. * @param {boolean} [isDeep] Specify a deep clone.
  22080. * @returns {Buffer} Returns the cloned buffer.
  22081. */
  22082. function cloneBuffer(buffer, isDeep) {
  22083. if (isDeep) {
  22084. return buffer.slice();
  22085. }
  22086. var length = buffer.length,
  22087. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  22088. buffer.copy(result);
  22089. return result;
  22090. }
  22091. /**
  22092. * Creates a clone of `arrayBuffer`.
  22093. *
  22094. * @private
  22095. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  22096. * @returns {ArrayBuffer} Returns the cloned array buffer.
  22097. */
  22098. function cloneArrayBuffer(arrayBuffer) {
  22099. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  22100. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  22101. return result;
  22102. }
  22103. /**
  22104. * Creates a clone of `dataView`.
  22105. *
  22106. * @private
  22107. * @param {Object} dataView The data view to clone.
  22108. * @param {boolean} [isDeep] Specify a deep clone.
  22109. * @returns {Object} Returns the cloned data view.
  22110. */
  22111. function cloneDataView(dataView, isDeep) {
  22112. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  22113. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  22114. }
  22115. /**
  22116. * Creates a clone of `regexp`.
  22117. *
  22118. * @private
  22119. * @param {Object} regexp The regexp to clone.
  22120. * @returns {Object} Returns the cloned regexp.
  22121. */
  22122. function cloneRegExp(regexp) {
  22123. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  22124. result.lastIndex = regexp.lastIndex;
  22125. return result;
  22126. }
  22127. /**
  22128. * Creates a clone of the `symbol` object.
  22129. *
  22130. * @private
  22131. * @param {Object} symbol The symbol object to clone.
  22132. * @returns {Object} Returns the cloned symbol object.
  22133. */
  22134. function cloneSymbol(symbol) {
  22135. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  22136. }
  22137. /**
  22138. * Creates a clone of `typedArray`.
  22139. *
  22140. * @private
  22141. * @param {Object} typedArray The typed array to clone.
  22142. * @param {boolean} [isDeep] Specify a deep clone.
  22143. * @returns {Object} Returns the cloned typed array.
  22144. */
  22145. function cloneTypedArray(typedArray, isDeep) {
  22146. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  22147. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  22148. }
  22149. /**
  22150. * Compares values to sort them in ascending order.
  22151. *
  22152. * @private
  22153. * @param {*} value The value to compare.
  22154. * @param {*} other The other value to compare.
  22155. * @returns {number} Returns the sort order indicator for `value`.
  22156. */
  22157. function compareAscending(value, other) {
  22158. if (value !== other) {
  22159. var valIsDefined = value !== undefined,
  22160. valIsNull = value === null,
  22161. valIsReflexive = value === value,
  22162. valIsSymbol = isSymbol(value);
  22163. var othIsDefined = other !== undefined,
  22164. othIsNull = other === null,
  22165. othIsReflexive = other === other,
  22166. othIsSymbol = isSymbol(other);
  22167. if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
  22168. (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
  22169. (valIsNull && othIsDefined && othIsReflexive) ||
  22170. (!valIsDefined && othIsReflexive) ||
  22171. !valIsReflexive) {
  22172. return 1;
  22173. }
  22174. if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
  22175. (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
  22176. (othIsNull && valIsDefined && valIsReflexive) ||
  22177. (!othIsDefined && valIsReflexive) ||
  22178. !othIsReflexive) {
  22179. return -1;
  22180. }
  22181. }
  22182. return 0;
  22183. }
  22184. /**
  22185. * Used by `_.orderBy` to compare multiple properties of a value to another
  22186. * and stable sort them.
  22187. *
  22188. * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
  22189. * specify an order of "desc" for descending or "asc" for ascending sort order
  22190. * of corresponding values.
  22191. *
  22192. * @private
  22193. * @param {Object} object The object to compare.
  22194. * @param {Object} other The other object to compare.
  22195. * @param {boolean[]|string[]} orders The order to sort by for each property.
  22196. * @returns {number} Returns the sort order indicator for `object`.
  22197. */
  22198. function compareMultiple(object, other, orders) {
  22199. var index = -1,
  22200. objCriteria = object.criteria,
  22201. othCriteria = other.criteria,
  22202. length = objCriteria.length,
  22203. ordersLength = orders.length;
  22204. while (++index < length) {
  22205. var result = compareAscending(objCriteria[index], othCriteria[index]);
  22206. if (result) {
  22207. if (index >= ordersLength) {
  22208. return result;
  22209. }
  22210. var order = orders[index];
  22211. return result * (order == 'desc' ? -1 : 1);
  22212. }
  22213. }
  22214. // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
  22215. // that causes it, under certain circumstances, to provide the same value for
  22216. // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
  22217. // for more details.
  22218. //
  22219. // This also ensures a stable sort in V8 and other engines.
  22220. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
  22221. return object.index - other.index;
  22222. }
  22223. /**
  22224. * Creates an array that is the composition of partially applied arguments,
  22225. * placeholders, and provided arguments into a single array of arguments.
  22226. *
  22227. * @private
  22228. * @param {Array} args The provided arguments.
  22229. * @param {Array} partials The arguments to prepend to those provided.
  22230. * @param {Array} holders The `partials` placeholder indexes.
  22231. * @params {boolean} [isCurried] Specify composing for a curried function.
  22232. * @returns {Array} Returns the new array of composed arguments.
  22233. */
  22234. function composeArgs(args, partials, holders, isCurried) {
  22235. var argsIndex = -1,
  22236. argsLength = args.length,
  22237. holdersLength = holders.length,
  22238. leftIndex = -1,
  22239. leftLength = partials.length,
  22240. rangeLength = nativeMax(argsLength - holdersLength, 0),
  22241. result = Array(leftLength + rangeLength),
  22242. isUncurried = !isCurried;
  22243. while (++leftIndex < leftLength) {
  22244. result[leftIndex] = partials[leftIndex];
  22245. }
  22246. while (++argsIndex < holdersLength) {
  22247. if (isUncurried || argsIndex < argsLength) {
  22248. result[holders[argsIndex]] = args[argsIndex];
  22249. }
  22250. }
  22251. while (rangeLength--) {
  22252. result[leftIndex++] = args[argsIndex++];
  22253. }
  22254. return result;
  22255. }
  22256. /**
  22257. * This function is like `composeArgs` except that the arguments composition
  22258. * is tailored for `_.partialRight`.
  22259. *
  22260. * @private
  22261. * @param {Array} args The provided arguments.
  22262. * @param {Array} partials The arguments to append to those provided.
  22263. * @param {Array} holders The `partials` placeholder indexes.
  22264. * @params {boolean} [isCurried] Specify composing for a curried function.
  22265. * @returns {Array} Returns the new array of composed arguments.
  22266. */
  22267. function composeArgsRight(args, partials, holders, isCurried) {
  22268. var argsIndex = -1,
  22269. argsLength = args.length,
  22270. holdersIndex = -1,
  22271. holdersLength = holders.length,
  22272. rightIndex = -1,
  22273. rightLength = partials.length,
  22274. rangeLength = nativeMax(argsLength - holdersLength, 0),
  22275. result = Array(rangeLength + rightLength),
  22276. isUncurried = !isCurried;
  22277. while (++argsIndex < rangeLength) {
  22278. result[argsIndex] = args[argsIndex];
  22279. }
  22280. var offset = argsIndex;
  22281. while (++rightIndex < rightLength) {
  22282. result[offset + rightIndex] = partials[rightIndex];
  22283. }
  22284. while (++holdersIndex < holdersLength) {
  22285. if (isUncurried || argsIndex < argsLength) {
  22286. result[offset + holders[holdersIndex]] = args[argsIndex++];
  22287. }
  22288. }
  22289. return result;
  22290. }
  22291. /**
  22292. * Copies the values of `source` to `array`.
  22293. *
  22294. * @private
  22295. * @param {Array} source The array to copy values from.
  22296. * @param {Array} [array=[]] The array to copy values to.
  22297. * @returns {Array} Returns `array`.
  22298. */
  22299. function copyArray(source, array) {
  22300. var index = -1,
  22301. length = source.length;
  22302. array || (array = Array(length));
  22303. while (++index < length) {
  22304. array[index] = source[index];
  22305. }
  22306. return array;
  22307. }
  22308. /**
  22309. * Copies properties of `source` to `object`.
  22310. *
  22311. * @private
  22312. * @param {Object} source The object to copy properties from.
  22313. * @param {Array} props The property identifiers to copy.
  22314. * @param {Object} [object={}] The object to copy properties to.
  22315. * @param {Function} [customizer] The function to customize copied values.
  22316. * @returns {Object} Returns `object`.
  22317. */
  22318. function copyObject(source, props, object, customizer) {
  22319. var isNew = !object;
  22320. object || (object = {});
  22321. var index = -1,
  22322. length = props.length;
  22323. while (++index < length) {
  22324. var key = props[index];
  22325. var newValue = customizer
  22326. ? customizer(object[key], source[key], key, object, source)
  22327. : undefined;
  22328. if (newValue === undefined) {
  22329. newValue = source[key];
  22330. }
  22331. if (isNew) {
  22332. baseAssignValue(object, key, newValue);
  22333. } else {
  22334. assignValue(object, key, newValue);
  22335. }
  22336. }
  22337. return object;
  22338. }
  22339. /**
  22340. * Copies own symbols of `source` to `object`.
  22341. *
  22342. * @private
  22343. * @param {Object} source The object to copy symbols from.
  22344. * @param {Object} [object={}] The object to copy symbols to.
  22345. * @returns {Object} Returns `object`.
  22346. */
  22347. function copySymbols(source, object) {
  22348. return copyObject(source, getSymbols(source), object);
  22349. }
  22350. /**
  22351. * Copies own and inherited symbols of `source` to `object`.
  22352. *
  22353. * @private
  22354. * @param {Object} source The object to copy symbols from.
  22355. * @param {Object} [object={}] The object to copy symbols to.
  22356. * @returns {Object} Returns `object`.
  22357. */
  22358. function copySymbolsIn(source, object) {
  22359. return copyObject(source, getSymbolsIn(source), object);
  22360. }
  22361. /**
  22362. * Creates a function like `_.groupBy`.
  22363. *
  22364. * @private
  22365. * @param {Function} setter The function to set accumulator values.
  22366. * @param {Function} [initializer] The accumulator object initializer.
  22367. * @returns {Function} Returns the new aggregator function.
  22368. */
  22369. function createAggregator(setter, initializer) {
  22370. return function(collection, iteratee) {
  22371. var func = isArray(collection) ? arrayAggregator : baseAggregator,
  22372. accumulator = initializer ? initializer() : {};
  22373. return func(collection, setter, getIteratee(iteratee, 2), accumulator);
  22374. };
  22375. }
  22376. /**
  22377. * Creates a function like `_.assign`.
  22378. *
  22379. * @private
  22380. * @param {Function} assigner The function to assign values.
  22381. * @returns {Function} Returns the new assigner function.
  22382. */
  22383. function createAssigner(assigner) {
  22384. return baseRest(function(object, sources) {
  22385. var index = -1,
  22386. length = sources.length,
  22387. customizer = length > 1 ? sources[length - 1] : undefined,
  22388. guard = length > 2 ? sources[2] : undefined;
  22389. customizer = (assigner.length > 3 && typeof customizer == 'function')
  22390. ? (length--, customizer)
  22391. : undefined;
  22392. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  22393. customizer = length < 3 ? undefined : customizer;
  22394. length = 1;
  22395. }
  22396. object = Object(object);
  22397. while (++index < length) {
  22398. var source = sources[index];
  22399. if (source) {
  22400. assigner(object, source, index, customizer);
  22401. }
  22402. }
  22403. return object;
  22404. });
  22405. }
  22406. /**
  22407. * Creates a `baseEach` or `baseEachRight` function.
  22408. *
  22409. * @private
  22410. * @param {Function} eachFunc The function to iterate over a collection.
  22411. * @param {boolean} [fromRight] Specify iterating from right to left.
  22412. * @returns {Function} Returns the new base function.
  22413. */
  22414. function createBaseEach(eachFunc, fromRight) {
  22415. return function(collection, iteratee) {
  22416. if (collection == null) {
  22417. return collection;
  22418. }
  22419. if (!isArrayLike(collection)) {
  22420. return eachFunc(collection, iteratee);
  22421. }
  22422. var length = collection.length,
  22423. index = fromRight ? length : -1,
  22424. iterable = Object(collection);
  22425. while ((fromRight ? index-- : ++index < length)) {
  22426. if (iteratee(iterable[index], index, iterable) === false) {
  22427. break;
  22428. }
  22429. }
  22430. return collection;
  22431. };
  22432. }
  22433. /**
  22434. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  22435. *
  22436. * @private
  22437. * @param {boolean} [fromRight] Specify iterating from right to left.
  22438. * @returns {Function} Returns the new base function.
  22439. */
  22440. function createBaseFor(fromRight) {
  22441. return function(object, iteratee, keysFunc) {
  22442. var index = -1,
  22443. iterable = Object(object),
  22444. props = keysFunc(object),
  22445. length = props.length;
  22446. while (length--) {
  22447. var key = props[fromRight ? length : ++index];
  22448. if (iteratee(iterable[key], key, iterable) === false) {
  22449. break;
  22450. }
  22451. }
  22452. return object;
  22453. };
  22454. }
  22455. /**
  22456. * Creates a function that wraps `func` to invoke it with the optional `this`
  22457. * binding of `thisArg`.
  22458. *
  22459. * @private
  22460. * @param {Function} func The function to wrap.
  22461. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22462. * @param {*} [thisArg] The `this` binding of `func`.
  22463. * @returns {Function} Returns the new wrapped function.
  22464. */
  22465. function createBind(func, bitmask, thisArg) {
  22466. var isBind = bitmask & WRAP_BIND_FLAG,
  22467. Ctor = createCtor(func);
  22468. function wrapper() {
  22469. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  22470. return fn.apply(isBind ? thisArg : this, arguments);
  22471. }
  22472. return wrapper;
  22473. }
  22474. /**
  22475. * Creates a function like `_.lowerFirst`.
  22476. *
  22477. * @private
  22478. * @param {string} methodName The name of the `String` case method to use.
  22479. * @returns {Function} Returns the new case function.
  22480. */
  22481. function createCaseFirst(methodName) {
  22482. return function(string) {
  22483. string = toString(string);
  22484. var strSymbols = hasUnicode(string)
  22485. ? stringToArray(string)
  22486. : undefined;
  22487. var chr = strSymbols
  22488. ? strSymbols[0]
  22489. : string.charAt(0);
  22490. var trailing = strSymbols
  22491. ? castSlice(strSymbols, 1).join('')
  22492. : string.slice(1);
  22493. return chr[methodName]() + trailing;
  22494. };
  22495. }
  22496. /**
  22497. * Creates a function like `_.camelCase`.
  22498. *
  22499. * @private
  22500. * @param {Function} callback The function to combine each word.
  22501. * @returns {Function} Returns the new compounder function.
  22502. */
  22503. function createCompounder(callback) {
  22504. return function(string) {
  22505. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  22506. };
  22507. }
  22508. /**
  22509. * Creates a function that produces an instance of `Ctor` regardless of
  22510. * whether it was invoked as part of a `new` expression or by `call` or `apply`.
  22511. *
  22512. * @private
  22513. * @param {Function} Ctor The constructor to wrap.
  22514. * @returns {Function} Returns the new wrapped function.
  22515. */
  22516. function createCtor(Ctor) {
  22517. return function() {
  22518. // Use a `switch` statement to work with class constructors. See
  22519. // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
  22520. // for more details.
  22521. var args = arguments;
  22522. switch (args.length) {
  22523. case 0: return new Ctor;
  22524. case 1: return new Ctor(args[0]);
  22525. case 2: return new Ctor(args[0], args[1]);
  22526. case 3: return new Ctor(args[0], args[1], args[2]);
  22527. case 4: return new Ctor(args[0], args[1], args[2], args[3]);
  22528. case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  22529. case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  22530. case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  22531. }
  22532. var thisBinding = baseCreate(Ctor.prototype),
  22533. result = Ctor.apply(thisBinding, args);
  22534. // Mimic the constructor's `return` behavior.
  22535. // See https://es5.github.io/#x13.2.2 for more details.
  22536. return isObject(result) ? result : thisBinding;
  22537. };
  22538. }
  22539. /**
  22540. * Creates a function that wraps `func` to enable currying.
  22541. *
  22542. * @private
  22543. * @param {Function} func The function to wrap.
  22544. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22545. * @param {number} arity The arity of `func`.
  22546. * @returns {Function} Returns the new wrapped function.
  22547. */
  22548. function createCurry(func, bitmask, arity) {
  22549. var Ctor = createCtor(func);
  22550. function wrapper() {
  22551. var length = arguments.length,
  22552. args = Array(length),
  22553. index = length,
  22554. placeholder = getHolder(wrapper);
  22555. while (index--) {
  22556. args[index] = arguments[index];
  22557. }
  22558. var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
  22559. ? []
  22560. : replaceHolders(args, placeholder);
  22561. length -= holders.length;
  22562. if (length < arity) {
  22563. return createRecurry(
  22564. func, bitmask, createHybrid, wrapper.placeholder, undefined,
  22565. args, holders, undefined, undefined, arity - length);
  22566. }
  22567. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  22568. return apply(fn, this, args);
  22569. }
  22570. return wrapper;
  22571. }
  22572. /**
  22573. * Creates a `_.find` or `_.findLast` function.
  22574. *
  22575. * @private
  22576. * @param {Function} findIndexFunc The function to find the collection index.
  22577. * @returns {Function} Returns the new find function.
  22578. */
  22579. function createFind(findIndexFunc) {
  22580. return function(collection, predicate, fromIndex) {
  22581. var iterable = Object(collection);
  22582. if (!isArrayLike(collection)) {
  22583. var iteratee = getIteratee(predicate, 3);
  22584. collection = keys(collection);
  22585. predicate = function(key) { return iteratee(iterable[key], key, iterable); };
  22586. }
  22587. var index = findIndexFunc(collection, predicate, fromIndex);
  22588. return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
  22589. };
  22590. }
  22591. /**
  22592. * Creates a `_.flow` or `_.flowRight` function.
  22593. *
  22594. * @private
  22595. * @param {boolean} [fromRight] Specify iterating from right to left.
  22596. * @returns {Function} Returns the new flow function.
  22597. */
  22598. function createFlow(fromRight) {
  22599. return flatRest(function(funcs) {
  22600. var length = funcs.length,
  22601. index = length,
  22602. prereq = LodashWrapper.prototype.thru;
  22603. if (fromRight) {
  22604. funcs.reverse();
  22605. }
  22606. while (index--) {
  22607. var func = funcs[index];
  22608. if (typeof func != 'function') {
  22609. throw new TypeError(FUNC_ERROR_TEXT);
  22610. }
  22611. if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
  22612. var wrapper = new LodashWrapper([], true);
  22613. }
  22614. }
  22615. index = wrapper ? index : length;
  22616. while (++index < length) {
  22617. func = funcs[index];
  22618. var funcName = getFuncName(func),
  22619. data = funcName == 'wrapper' ? getData(func) : undefined;
  22620. if (data && isLaziable(data[0]) &&
  22621. data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
  22622. !data[4].length && data[9] == 1
  22623. ) {
  22624. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  22625. } else {
  22626. wrapper = (func.length == 1 && isLaziable(func))
  22627. ? wrapper[funcName]()
  22628. : wrapper.thru(func);
  22629. }
  22630. }
  22631. return function() {
  22632. var args = arguments,
  22633. value = args[0];
  22634. if (wrapper && args.length == 1 && isArray(value)) {
  22635. return wrapper.plant(value).value();
  22636. }
  22637. var index = 0,
  22638. result = length ? funcs[index].apply(this, args) : value;
  22639. while (++index < length) {
  22640. result = funcs[index].call(this, result);
  22641. }
  22642. return result;
  22643. };
  22644. });
  22645. }
  22646. /**
  22647. * Creates a function that wraps `func` to invoke it with optional `this`
  22648. * binding of `thisArg`, partial application, and currying.
  22649. *
  22650. * @private
  22651. * @param {Function|string} func The function or method name to wrap.
  22652. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22653. * @param {*} [thisArg] The `this` binding of `func`.
  22654. * @param {Array} [partials] The arguments to prepend to those provided to
  22655. * the new function.
  22656. * @param {Array} [holders] The `partials` placeholder indexes.
  22657. * @param {Array} [partialsRight] The arguments to append to those provided
  22658. * to the new function.
  22659. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
  22660. * @param {Array} [argPos] The argument positions of the new function.
  22661. * @param {number} [ary] The arity cap of `func`.
  22662. * @param {number} [arity] The arity of `func`.
  22663. * @returns {Function} Returns the new wrapped function.
  22664. */
  22665. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  22666. var isAry = bitmask & WRAP_ARY_FLAG,
  22667. isBind = bitmask & WRAP_BIND_FLAG,
  22668. isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
  22669. isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
  22670. isFlip = bitmask & WRAP_FLIP_FLAG,
  22671. Ctor = isBindKey ? undefined : createCtor(func);
  22672. function wrapper() {
  22673. var length = arguments.length,
  22674. args = Array(length),
  22675. index = length;
  22676. while (index--) {
  22677. args[index] = arguments[index];
  22678. }
  22679. if (isCurried) {
  22680. var placeholder = getHolder(wrapper),
  22681. holdersCount = countHolders(args, placeholder);
  22682. }
  22683. if (partials) {
  22684. args = composeArgs(args, partials, holders, isCurried);
  22685. }
  22686. if (partialsRight) {
  22687. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  22688. }
  22689. length -= holdersCount;
  22690. if (isCurried && length < arity) {
  22691. var newHolders = replaceHolders(args, placeholder);
  22692. return createRecurry(
  22693. func, bitmask, createHybrid, wrapper.placeholder, thisArg,
  22694. args, newHolders, argPos, ary, arity - length
  22695. );
  22696. }
  22697. var thisBinding = isBind ? thisArg : this,
  22698. fn = isBindKey ? thisBinding[func] : func;
  22699. length = args.length;
  22700. if (argPos) {
  22701. args = reorder(args, argPos);
  22702. } else if (isFlip && length > 1) {
  22703. args.reverse();
  22704. }
  22705. if (isAry && ary < length) {
  22706. args.length = ary;
  22707. }
  22708. if (this && this !== root && this instanceof wrapper) {
  22709. fn = Ctor || createCtor(fn);
  22710. }
  22711. return fn.apply(thisBinding, args);
  22712. }
  22713. return wrapper;
  22714. }
  22715. /**
  22716. * Creates a function like `_.invertBy`.
  22717. *
  22718. * @private
  22719. * @param {Function} setter The function to set accumulator values.
  22720. * @param {Function} toIteratee The function to resolve iteratees.
  22721. * @returns {Function} Returns the new inverter function.
  22722. */
  22723. function createInverter(setter, toIteratee) {
  22724. return function(object, iteratee) {
  22725. return baseInverter(object, setter, toIteratee(iteratee), {});
  22726. };
  22727. }
  22728. /**
  22729. * Creates a function that performs a mathematical operation on two values.
  22730. *
  22731. * @private
  22732. * @param {Function} operator The function to perform the operation.
  22733. * @param {number} [defaultValue] The value used for `undefined` arguments.
  22734. * @returns {Function} Returns the new mathematical operation function.
  22735. */
  22736. function createMathOperation(operator, defaultValue) {
  22737. return function(value, other) {
  22738. var result;
  22739. if (value === undefined && other === undefined) {
  22740. return defaultValue;
  22741. }
  22742. if (value !== undefined) {
  22743. result = value;
  22744. }
  22745. if (other !== undefined) {
  22746. if (result === undefined) {
  22747. return other;
  22748. }
  22749. if (typeof value == 'string' || typeof other == 'string') {
  22750. value = baseToString(value);
  22751. other = baseToString(other);
  22752. } else {
  22753. value = baseToNumber(value);
  22754. other = baseToNumber(other);
  22755. }
  22756. result = operator(value, other);
  22757. }
  22758. return result;
  22759. };
  22760. }
  22761. /**
  22762. * Creates a function like `_.over`.
  22763. *
  22764. * @private
  22765. * @param {Function} arrayFunc The function to iterate over iteratees.
  22766. * @returns {Function} Returns the new over function.
  22767. */
  22768. function createOver(arrayFunc) {
  22769. return flatRest(function(iteratees) {
  22770. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  22771. return baseRest(function(args) {
  22772. var thisArg = this;
  22773. return arrayFunc(iteratees, function(iteratee) {
  22774. return apply(iteratee, thisArg, args);
  22775. });
  22776. });
  22777. });
  22778. }
  22779. /**
  22780. * Creates the padding for `string` based on `length`. The `chars` string
  22781. * is truncated if the number of characters exceeds `length`.
  22782. *
  22783. * @private
  22784. * @param {number} length The padding length.
  22785. * @param {string} [chars=' '] The string used as padding.
  22786. * @returns {string} Returns the padding for `string`.
  22787. */
  22788. function createPadding(length, chars) {
  22789. chars = chars === undefined ? ' ' : baseToString(chars);
  22790. var charsLength = chars.length;
  22791. if (charsLength < 2) {
  22792. return charsLength ? baseRepeat(chars, length) : chars;
  22793. }
  22794. var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
  22795. return hasUnicode(chars)
  22796. ? castSlice(stringToArray(result), 0, length).join('')
  22797. : result.slice(0, length);
  22798. }
  22799. /**
  22800. * Creates a function that wraps `func` to invoke it with the `this` binding
  22801. * of `thisArg` and `partials` prepended to the arguments it receives.
  22802. *
  22803. * @private
  22804. * @param {Function} func The function to wrap.
  22805. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22806. * @param {*} thisArg The `this` binding of `func`.
  22807. * @param {Array} partials The arguments to prepend to those provided to
  22808. * the new function.
  22809. * @returns {Function} Returns the new wrapped function.
  22810. */
  22811. function createPartial(func, bitmask, thisArg, partials) {
  22812. var isBind = bitmask & WRAP_BIND_FLAG,
  22813. Ctor = createCtor(func);
  22814. function wrapper() {
  22815. var argsIndex = -1,
  22816. argsLength = arguments.length,
  22817. leftIndex = -1,
  22818. leftLength = partials.length,
  22819. args = Array(leftLength + argsLength),
  22820. fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  22821. while (++leftIndex < leftLength) {
  22822. args[leftIndex] = partials[leftIndex];
  22823. }
  22824. while (argsLength--) {
  22825. args[leftIndex++] = arguments[++argsIndex];
  22826. }
  22827. return apply(fn, isBind ? thisArg : this, args);
  22828. }
  22829. return wrapper;
  22830. }
  22831. /**
  22832. * Creates a `_.range` or `_.rangeRight` function.
  22833. *
  22834. * @private
  22835. * @param {boolean} [fromRight] Specify iterating from right to left.
  22836. * @returns {Function} Returns the new range function.
  22837. */
  22838. function createRange(fromRight) {
  22839. return function(start, end, step) {
  22840. if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
  22841. end = step = undefined;
  22842. }
  22843. // Ensure the sign of `-0` is preserved.
  22844. start = toFinite(start);
  22845. if (end === undefined) {
  22846. end = start;
  22847. start = 0;
  22848. } else {
  22849. end = toFinite(end);
  22850. }
  22851. step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
  22852. return baseRange(start, end, step, fromRight);
  22853. };
  22854. }
  22855. /**
  22856. * Creates a function that performs a relational operation on two values.
  22857. *
  22858. * @private
  22859. * @param {Function} operator The function to perform the operation.
  22860. * @returns {Function} Returns the new relational operation function.
  22861. */
  22862. function createRelationalOperation(operator) {
  22863. return function(value, other) {
  22864. if (!(typeof value == 'string' && typeof other == 'string')) {
  22865. value = toNumber(value);
  22866. other = toNumber(other);
  22867. }
  22868. return operator(value, other);
  22869. };
  22870. }
  22871. /**
  22872. * Creates a function that wraps `func` to continue currying.
  22873. *
  22874. * @private
  22875. * @param {Function} func The function to wrap.
  22876. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22877. * @param {Function} wrapFunc The function to create the `func` wrapper.
  22878. * @param {*} placeholder The placeholder value.
  22879. * @param {*} [thisArg] The `this` binding of `func`.
  22880. * @param {Array} [partials] The arguments to prepend to those provided to
  22881. * the new function.
  22882. * @param {Array} [holders] The `partials` placeholder indexes.
  22883. * @param {Array} [argPos] The argument positions of the new function.
  22884. * @param {number} [ary] The arity cap of `func`.
  22885. * @param {number} [arity] The arity of `func`.
  22886. * @returns {Function} Returns the new wrapped function.
  22887. */
  22888. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  22889. var isCurry = bitmask & WRAP_CURRY_FLAG,
  22890. newHolders = isCurry ? holders : undefined,
  22891. newHoldersRight = isCurry ? undefined : holders,
  22892. newPartials = isCurry ? partials : undefined,
  22893. newPartialsRight = isCurry ? undefined : partials;
  22894. bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
  22895. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
  22896. if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
  22897. bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
  22898. }
  22899. var newData = [
  22900. func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
  22901. newHoldersRight, argPos, ary, arity
  22902. ];
  22903. var result = wrapFunc.apply(undefined, newData);
  22904. if (isLaziable(func)) {
  22905. setData(result, newData);
  22906. }
  22907. result.placeholder = placeholder;
  22908. return setWrapToString(result, func, bitmask);
  22909. }
  22910. /**
  22911. * Creates a function like `_.round`.
  22912. *
  22913. * @private
  22914. * @param {string} methodName The name of the `Math` method to use when rounding.
  22915. * @returns {Function} Returns the new round function.
  22916. */
  22917. function createRound(methodName) {
  22918. var func = Math[methodName];
  22919. return function(number, precision) {
  22920. number = toNumber(number);
  22921. precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
  22922. if (precision && nativeIsFinite(number)) {
  22923. // Shift with exponential notation to avoid floating-point issues.
  22924. // See [MDN](https://mdn.io/round#Examples) for more details.
  22925. var pair = (toString(number) + 'e').split('e'),
  22926. value = func(pair[0] + 'e' + (+pair[1] + precision));
  22927. pair = (toString(value) + 'e').split('e');
  22928. return +(pair[0] + 'e' + (+pair[1] - precision));
  22929. }
  22930. return func(number);
  22931. };
  22932. }
  22933. /**
  22934. * Creates a set object of `values`.
  22935. *
  22936. * @private
  22937. * @param {Array} values The values to add to the set.
  22938. * @returns {Object} Returns the new set.
  22939. */
  22940. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  22941. return new Set(values);
  22942. };
  22943. /**
  22944. * Creates a `_.toPairs` or `_.toPairsIn` function.
  22945. *
  22946. * @private
  22947. * @param {Function} keysFunc The function to get the keys of a given object.
  22948. * @returns {Function} Returns the new pairs function.
  22949. */
  22950. function createToPairs(keysFunc) {
  22951. return function(object) {
  22952. var tag = getTag(object);
  22953. if (tag == mapTag) {
  22954. return mapToArray(object);
  22955. }
  22956. if (tag == setTag) {
  22957. return setToPairs(object);
  22958. }
  22959. return baseToPairs(object, keysFunc(object));
  22960. };
  22961. }
  22962. /**
  22963. * Creates a function that either curries or invokes `func` with optional
  22964. * `this` binding and partially applied arguments.
  22965. *
  22966. * @private
  22967. * @param {Function|string} func The function or method name to wrap.
  22968. * @param {number} bitmask The bitmask flags.
  22969. * 1 - `_.bind`
  22970. * 2 - `_.bindKey`
  22971. * 4 - `_.curry` or `_.curryRight` of a bound function
  22972. * 8 - `_.curry`
  22973. * 16 - `_.curryRight`
  22974. * 32 - `_.partial`
  22975. * 64 - `_.partialRight`
  22976. * 128 - `_.rearg`
  22977. * 256 - `_.ary`
  22978. * 512 - `_.flip`
  22979. * @param {*} [thisArg] The `this` binding of `func`.
  22980. * @param {Array} [partials] The arguments to be partially applied.
  22981. * @param {Array} [holders] The `partials` placeholder indexes.
  22982. * @param {Array} [argPos] The argument positions of the new function.
  22983. * @param {number} [ary] The arity cap of `func`.
  22984. * @param {number} [arity] The arity of `func`.
  22985. * @returns {Function} Returns the new wrapped function.
  22986. */
  22987. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  22988. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
  22989. if (!isBindKey && typeof func != 'function') {
  22990. throw new TypeError(FUNC_ERROR_TEXT);
  22991. }
  22992. var length = partials ? partials.length : 0;
  22993. if (!length) {
  22994. bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
  22995. partials = holders = undefined;
  22996. }
  22997. ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
  22998. arity = arity === undefined ? arity : toInteger(arity);
  22999. length -= holders ? holders.length : 0;
  23000. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
  23001. var partialsRight = partials,
  23002. holdersRight = holders;
  23003. partials = holders = undefined;
  23004. }
  23005. var data = isBindKey ? undefined : getData(func);
  23006. var newData = [
  23007. func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
  23008. argPos, ary, arity
  23009. ];
  23010. if (data) {
  23011. mergeData(newData, data);
  23012. }
  23013. func = newData[0];
  23014. bitmask = newData[1];
  23015. thisArg = newData[2];
  23016. partials = newData[3];
  23017. holders = newData[4];
  23018. arity = newData[9] = newData[9] === undefined
  23019. ? (isBindKey ? 0 : func.length)
  23020. : nativeMax(newData[9] - length, 0);
  23021. if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
  23022. bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
  23023. }
  23024. if (!bitmask || bitmask == WRAP_BIND_FLAG) {
  23025. var result = createBind(func, bitmask, thisArg);
  23026. } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
  23027. result = createCurry(func, bitmask, arity);
  23028. } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
  23029. result = createPartial(func, bitmask, thisArg, partials);
  23030. } else {
  23031. result = createHybrid.apply(undefined, newData);
  23032. }
  23033. var setter = data ? baseSetData : setData;
  23034. return setWrapToString(setter(result, newData), func, bitmask);
  23035. }
  23036. /**
  23037. * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
  23038. * of source objects to the destination object for all destination properties
  23039. * that resolve to `undefined`.
  23040. *
  23041. * @private
  23042. * @param {*} objValue The destination value.
  23043. * @param {*} srcValue The source value.
  23044. * @param {string} key The key of the property to assign.
  23045. * @param {Object} object The parent object of `objValue`.
  23046. * @returns {*} Returns the value to assign.
  23047. */
  23048. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  23049. if (objValue === undefined ||
  23050. (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  23051. return srcValue;
  23052. }
  23053. return objValue;
  23054. }
  23055. /**
  23056. * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
  23057. * objects into destination objects that are passed thru.
  23058. *
  23059. * @private
  23060. * @param {*} objValue The destination value.
  23061. * @param {*} srcValue The source value.
  23062. * @param {string} key The key of the property to merge.
  23063. * @param {Object} object The parent object of `objValue`.
  23064. * @param {Object} source The parent object of `srcValue`.
  23065. * @param {Object} [stack] Tracks traversed source values and their merged
  23066. * counterparts.
  23067. * @returns {*} Returns the value to assign.
  23068. */
  23069. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  23070. if (isObject(objValue) && isObject(srcValue)) {
  23071. // Recursively merge objects and arrays (susceptible to call stack limits).
  23072. stack.set(srcValue, objValue);
  23073. baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
  23074. stack['delete'](srcValue);
  23075. }
  23076. return objValue;
  23077. }
  23078. /**
  23079. * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
  23080. * objects.
  23081. *
  23082. * @private
  23083. * @param {*} value The value to inspect.
  23084. * @param {string} key The key of the property to inspect.
  23085. * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
  23086. */
  23087. function customOmitClone(value) {
  23088. return isPlainObject(value) ? undefined : value;
  23089. }
  23090. /**
  23091. * A specialized version of `baseIsEqualDeep` for arrays with support for
  23092. * partial deep comparisons.
  23093. *
  23094. * @private
  23095. * @param {Array} array The array to compare.
  23096. * @param {Array} other The other array to compare.
  23097. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23098. * @param {Function} customizer The function to customize comparisons.
  23099. * @param {Function} equalFunc The function to determine equivalents of values.
  23100. * @param {Object} stack Tracks traversed `array` and `other` objects.
  23101. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  23102. */
  23103. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  23104. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  23105. arrLength = array.length,
  23106. othLength = other.length;
  23107. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  23108. return false;
  23109. }
  23110. // Assume cyclic values are equal.
  23111. var stacked = stack.get(array);
  23112. if (stacked && stack.get(other)) {
  23113. return stacked == other;
  23114. }
  23115. var index = -1,
  23116. result = true,
  23117. seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
  23118. stack.set(array, other);
  23119. stack.set(other, array);
  23120. // Ignore non-index properties.
  23121. while (++index < arrLength) {
  23122. var arrValue = array[index],
  23123. othValue = other[index];
  23124. if (customizer) {
  23125. var compared = isPartial
  23126. ? customizer(othValue, arrValue, index, other, array, stack)
  23127. : customizer(arrValue, othValue, index, array, other, stack);
  23128. }
  23129. if (compared !== undefined) {
  23130. if (compared) {
  23131. continue;
  23132. }
  23133. result = false;
  23134. break;
  23135. }
  23136. // Recursively compare arrays (susceptible to call stack limits).
  23137. if (seen) {
  23138. if (!arraySome(other, function(othValue, othIndex) {
  23139. if (!cacheHas(seen, othIndex) &&
  23140. (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  23141. return seen.push(othIndex);
  23142. }
  23143. })) {
  23144. result = false;
  23145. break;
  23146. }
  23147. } else if (!(
  23148. arrValue === othValue ||
  23149. equalFunc(arrValue, othValue, bitmask, customizer, stack)
  23150. )) {
  23151. result = false;
  23152. break;
  23153. }
  23154. }
  23155. stack['delete'](array);
  23156. stack['delete'](other);
  23157. return result;
  23158. }
  23159. /**
  23160. * A specialized version of `baseIsEqualDeep` for comparing objects of
  23161. * the same `toStringTag`.
  23162. *
  23163. * **Note:** This function only supports comparing values with tags of
  23164. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  23165. *
  23166. * @private
  23167. * @param {Object} object The object to compare.
  23168. * @param {Object} other The other object to compare.
  23169. * @param {string} tag The `toStringTag` of the objects to compare.
  23170. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23171. * @param {Function} customizer The function to customize comparisons.
  23172. * @param {Function} equalFunc The function to determine equivalents of values.
  23173. * @param {Object} stack Tracks traversed `object` and `other` objects.
  23174. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  23175. */
  23176. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  23177. switch (tag) {
  23178. case dataViewTag:
  23179. if ((object.byteLength != other.byteLength) ||
  23180. (object.byteOffset != other.byteOffset)) {
  23181. return false;
  23182. }
  23183. object = object.buffer;
  23184. other = other.buffer;
  23185. case arrayBufferTag:
  23186. if ((object.byteLength != other.byteLength) ||
  23187. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  23188. return false;
  23189. }
  23190. return true;
  23191. case boolTag:
  23192. case dateTag:
  23193. case numberTag:
  23194. // Coerce booleans to `1` or `0` and dates to milliseconds.
  23195. // Invalid dates are coerced to `NaN`.
  23196. return eq(+object, +other);
  23197. case errorTag:
  23198. return object.name == other.name && object.message == other.message;
  23199. case regexpTag:
  23200. case stringTag:
  23201. // Coerce regexes to strings and treat strings, primitives and objects,
  23202. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  23203. // for more details.
  23204. return object == (other + '');
  23205. case mapTag:
  23206. var convert = mapToArray;
  23207. case setTag:
  23208. var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
  23209. convert || (convert = setToArray);
  23210. if (object.size != other.size && !isPartial) {
  23211. return false;
  23212. }
  23213. // Assume cyclic values are equal.
  23214. var stacked = stack.get(object);
  23215. if (stacked) {
  23216. return stacked == other;
  23217. }
  23218. bitmask |= COMPARE_UNORDERED_FLAG;
  23219. // Recursively compare objects (susceptible to call stack limits).
  23220. stack.set(object, other);
  23221. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  23222. stack['delete'](object);
  23223. return result;
  23224. case symbolTag:
  23225. if (symbolValueOf) {
  23226. return symbolValueOf.call(object) == symbolValueOf.call(other);
  23227. }
  23228. }
  23229. return false;
  23230. }
  23231. /**
  23232. * A specialized version of `baseIsEqualDeep` for objects with support for
  23233. * partial deep comparisons.
  23234. *
  23235. * @private
  23236. * @param {Object} object The object to compare.
  23237. * @param {Object} other The other object to compare.
  23238. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23239. * @param {Function} customizer The function to customize comparisons.
  23240. * @param {Function} equalFunc The function to determine equivalents of values.
  23241. * @param {Object} stack Tracks traversed `object` and `other` objects.
  23242. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  23243. */
  23244. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  23245. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  23246. objProps = getAllKeys(object),
  23247. objLength = objProps.length,
  23248. othProps = getAllKeys(other),
  23249. othLength = othProps.length;
  23250. if (objLength != othLength && !isPartial) {
  23251. return false;
  23252. }
  23253. var index = objLength;
  23254. while (index--) {
  23255. var key = objProps[index];
  23256. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  23257. return false;
  23258. }
  23259. }
  23260. // Assume cyclic values are equal.
  23261. var stacked = stack.get(object);
  23262. if (stacked && stack.get(other)) {
  23263. return stacked == other;
  23264. }
  23265. var result = true;
  23266. stack.set(object, other);
  23267. stack.set(other, object);
  23268. var skipCtor = isPartial;
  23269. while (++index < objLength) {
  23270. key = objProps[index];
  23271. var objValue = object[key],
  23272. othValue = other[key];
  23273. if (customizer) {
  23274. var compared = isPartial
  23275. ? customizer(othValue, objValue, key, other, object, stack)
  23276. : customizer(objValue, othValue, key, object, other, stack);
  23277. }
  23278. // Recursively compare objects (susceptible to call stack limits).
  23279. if (!(compared === undefined
  23280. ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
  23281. : compared
  23282. )) {
  23283. result = false;
  23284. break;
  23285. }
  23286. skipCtor || (skipCtor = key == 'constructor');
  23287. }
  23288. if (result && !skipCtor) {
  23289. var objCtor = object.constructor,
  23290. othCtor = other.constructor;
  23291. // Non `Object` object instances with different constructors are not equal.
  23292. if (objCtor != othCtor &&
  23293. ('constructor' in object && 'constructor' in other) &&
  23294. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  23295. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  23296. result = false;
  23297. }
  23298. }
  23299. stack['delete'](object);
  23300. stack['delete'](other);
  23301. return result;
  23302. }
  23303. /**
  23304. * A specialized version of `baseRest` which flattens the rest array.
  23305. *
  23306. * @private
  23307. * @param {Function} func The function to apply a rest parameter to.
  23308. * @returns {Function} Returns the new function.
  23309. */
  23310. function flatRest(func) {
  23311. return setToString(overRest(func, undefined, flatten), func + '');
  23312. }
  23313. /**
  23314. * Creates an array of own enumerable property names and symbols of `object`.
  23315. *
  23316. * @private
  23317. * @param {Object} object The object to query.
  23318. * @returns {Array} Returns the array of property names and symbols.
  23319. */
  23320. function getAllKeys(object) {
  23321. return baseGetAllKeys(object, keys, getSymbols);
  23322. }
  23323. /**
  23324. * Creates an array of own and inherited enumerable property names and
  23325. * symbols of `object`.
  23326. *
  23327. * @private
  23328. * @param {Object} object The object to query.
  23329. * @returns {Array} Returns the array of property names and symbols.
  23330. */
  23331. function getAllKeysIn(object) {
  23332. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  23333. }
  23334. /**
  23335. * Gets metadata for `func`.
  23336. *
  23337. * @private
  23338. * @param {Function} func The function to query.
  23339. * @returns {*} Returns the metadata for `func`.
  23340. */
  23341. var getData = !metaMap ? noop : function(func) {
  23342. return metaMap.get(func);
  23343. };
  23344. /**
  23345. * Gets the name of `func`.
  23346. *
  23347. * @private
  23348. * @param {Function} func The function to query.
  23349. * @returns {string} Returns the function name.
  23350. */
  23351. function getFuncName(func) {
  23352. var result = (func.name + ''),
  23353. array = realNames[result],
  23354. length = hasOwnProperty.call(realNames, result) ? array.length : 0;
  23355. while (length--) {
  23356. var data = array[length],
  23357. otherFunc = data.func;
  23358. if (otherFunc == null || otherFunc == func) {
  23359. return data.name;
  23360. }
  23361. }
  23362. return result;
  23363. }
  23364. /**
  23365. * Gets the argument placeholder value for `func`.
  23366. *
  23367. * @private
  23368. * @param {Function} func The function to inspect.
  23369. * @returns {*} Returns the placeholder value.
  23370. */
  23371. function getHolder(func) {
  23372. var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
  23373. return object.placeholder;
  23374. }
  23375. /**
  23376. * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
  23377. * this function returns the custom method, otherwise it returns `baseIteratee`.
  23378. * If arguments are provided, the chosen function is invoked with them and
  23379. * its result is returned.
  23380. *
  23381. * @private
  23382. * @param {*} [value] The value to convert to an iteratee.
  23383. * @param {number} [arity] The arity of the created iteratee.
  23384. * @returns {Function} Returns the chosen function or its result.
  23385. */
  23386. function getIteratee() {
  23387. var result = lodash.iteratee || iteratee;
  23388. result = result === iteratee ? baseIteratee : result;
  23389. return arguments.length ? result(arguments[0], arguments[1]) : result;
  23390. }
  23391. /**
  23392. * Gets the data for `map`.
  23393. *
  23394. * @private
  23395. * @param {Object} map The map to query.
  23396. * @param {string} key The reference key.
  23397. * @returns {*} Returns the map data.
  23398. */
  23399. function getMapData(map, key) {
  23400. var data = map.__data__;
  23401. return isKeyable(key)
  23402. ? data[typeof key == 'string' ? 'string' : 'hash']
  23403. : data.map;
  23404. }
  23405. /**
  23406. * Gets the property names, values, and compare flags of `object`.
  23407. *
  23408. * @private
  23409. * @param {Object} object The object to query.
  23410. * @returns {Array} Returns the match data of `object`.
  23411. */
  23412. function getMatchData(object) {
  23413. var result = keys(object),
  23414. length = result.length;
  23415. while (length--) {
  23416. var key = result[length],
  23417. value = object[key];
  23418. result[length] = [key, value, isStrictComparable(value)];
  23419. }
  23420. return result;
  23421. }
  23422. /**
  23423. * Gets the native function at `key` of `object`.
  23424. *
  23425. * @private
  23426. * @param {Object} object The object to query.
  23427. * @param {string} key The key of the method to get.
  23428. * @returns {*} Returns the function if it's native, else `undefined`.
  23429. */
  23430. function getNative(object, key) {
  23431. var value = getValue(object, key);
  23432. return baseIsNative(value) ? value : undefined;
  23433. }
  23434. /**
  23435. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  23436. *
  23437. * @private
  23438. * @param {*} value The value to query.
  23439. * @returns {string} Returns the raw `toStringTag`.
  23440. */
  23441. function getRawTag(value) {
  23442. var isOwn = hasOwnProperty.call(value, symToStringTag),
  23443. tag = value[symToStringTag];
  23444. try {
  23445. value[symToStringTag] = undefined;
  23446. var unmasked = true;
  23447. } catch (e) {}
  23448. var result = nativeObjectToString.call(value);
  23449. if (unmasked) {
  23450. if (isOwn) {
  23451. value[symToStringTag] = tag;
  23452. } else {
  23453. delete value[symToStringTag];
  23454. }
  23455. }
  23456. return result;
  23457. }
  23458. /**
  23459. * Creates an array of the own enumerable symbols of `object`.
  23460. *
  23461. * @private
  23462. * @param {Object} object The object to query.
  23463. * @returns {Array} Returns the array of symbols.
  23464. */
  23465. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  23466. if (object == null) {
  23467. return [];
  23468. }
  23469. object = Object(object);
  23470. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  23471. return propertyIsEnumerable.call(object, symbol);
  23472. });
  23473. };
  23474. /**
  23475. * Creates an array of the own and inherited enumerable symbols of `object`.
  23476. *
  23477. * @private
  23478. * @param {Object} object The object to query.
  23479. * @returns {Array} Returns the array of symbols.
  23480. */
  23481. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  23482. var result = [];
  23483. while (object) {
  23484. arrayPush(result, getSymbols(object));
  23485. object = getPrototype(object);
  23486. }
  23487. return result;
  23488. };
  23489. /**
  23490. * Gets the `toStringTag` of `value`.
  23491. *
  23492. * @private
  23493. * @param {*} value The value to query.
  23494. * @returns {string} Returns the `toStringTag`.
  23495. */
  23496. var getTag = baseGetTag;
  23497. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  23498. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  23499. (Map && getTag(new Map) != mapTag) ||
  23500. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  23501. (Set && getTag(new Set) != setTag) ||
  23502. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  23503. getTag = function(value) {
  23504. var result = baseGetTag(value),
  23505. Ctor = result == objectTag ? value.constructor : undefined,
  23506. ctorString = Ctor ? toSource(Ctor) : '';
  23507. if (ctorString) {
  23508. switch (ctorString) {
  23509. case dataViewCtorString: return dataViewTag;
  23510. case mapCtorString: return mapTag;
  23511. case promiseCtorString: return promiseTag;
  23512. case setCtorString: return setTag;
  23513. case weakMapCtorString: return weakMapTag;
  23514. }
  23515. }
  23516. return result;
  23517. };
  23518. }
  23519. /**
  23520. * Gets the view, applying any `transforms` to the `start` and `end` positions.
  23521. *
  23522. * @private
  23523. * @param {number} start The start of the view.
  23524. * @param {number} end The end of the view.
  23525. * @param {Array} transforms The transformations to apply to the view.
  23526. * @returns {Object} Returns an object containing the `start` and `end`
  23527. * positions of the view.
  23528. */
  23529. function getView(start, end, transforms) {
  23530. var index = -1,
  23531. length = transforms.length;
  23532. while (++index < length) {
  23533. var data = transforms[index],
  23534. size = data.size;
  23535. switch (data.type) {
  23536. case 'drop': start += size; break;
  23537. case 'dropRight': end -= size; break;
  23538. case 'take': end = nativeMin(end, start + size); break;
  23539. case 'takeRight': start = nativeMax(start, end - size); break;
  23540. }
  23541. }
  23542. return { 'start': start, 'end': end };
  23543. }
  23544. /**
  23545. * Extracts wrapper details from the `source` body comment.
  23546. *
  23547. * @private
  23548. * @param {string} source The source to inspect.
  23549. * @returns {Array} Returns the wrapper details.
  23550. */
  23551. function getWrapDetails(source) {
  23552. var match = source.match(reWrapDetails);
  23553. return match ? match[1].split(reSplitDetails) : [];
  23554. }
  23555. /**
  23556. * Checks if `path` exists on `object`.
  23557. *
  23558. * @private
  23559. * @param {Object} object The object to query.
  23560. * @param {Array|string} path The path to check.
  23561. * @param {Function} hasFunc The function to check properties.
  23562. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  23563. */
  23564. function hasPath(object, path, hasFunc) {
  23565. path = castPath(path, object);
  23566. var index = -1,
  23567. length = path.length,
  23568. result = false;
  23569. while (++index < length) {
  23570. var key = toKey(path[index]);
  23571. if (!(result = object != null && hasFunc(object, key))) {
  23572. break;
  23573. }
  23574. object = object[key];
  23575. }
  23576. if (result || ++index != length) {
  23577. return result;
  23578. }
  23579. length = object == null ? 0 : object.length;
  23580. return !!length && isLength(length) && isIndex(key, length) &&
  23581. (isArray(object) || isArguments(object));
  23582. }
  23583. /**
  23584. * Initializes an array clone.
  23585. *
  23586. * @private
  23587. * @param {Array} array The array to clone.
  23588. * @returns {Array} Returns the initialized clone.
  23589. */
  23590. function initCloneArray(array) {
  23591. var length = array.length,
  23592. result = new array.constructor(length);
  23593. // Add properties assigned by `RegExp#exec`.
  23594. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  23595. result.index = array.index;
  23596. result.input = array.input;
  23597. }
  23598. return result;
  23599. }
  23600. /**
  23601. * Initializes an object clone.
  23602. *
  23603. * @private
  23604. * @param {Object} object The object to clone.
  23605. * @returns {Object} Returns the initialized clone.
  23606. */
  23607. function initCloneObject(object) {
  23608. return (typeof object.constructor == 'function' && !isPrototype(object))
  23609. ? baseCreate(getPrototype(object))
  23610. : {};
  23611. }
  23612. /**
  23613. * Initializes an object clone based on its `toStringTag`.
  23614. *
  23615. * **Note:** This function only supports cloning values with tags of
  23616. * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
  23617. *
  23618. * @private
  23619. * @param {Object} object The object to clone.
  23620. * @param {string} tag The `toStringTag` of the object to clone.
  23621. * @param {boolean} [isDeep] Specify a deep clone.
  23622. * @returns {Object} Returns the initialized clone.
  23623. */
  23624. function initCloneByTag(object, tag, isDeep) {
  23625. var Ctor = object.constructor;
  23626. switch (tag) {
  23627. case arrayBufferTag:
  23628. return cloneArrayBuffer(object);
  23629. case boolTag:
  23630. case dateTag:
  23631. return new Ctor(+object);
  23632. case dataViewTag:
  23633. return cloneDataView(object, isDeep);
  23634. case float32Tag: case float64Tag:
  23635. case int8Tag: case int16Tag: case int32Tag:
  23636. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  23637. return cloneTypedArray(object, isDeep);
  23638. case mapTag:
  23639. return new Ctor;
  23640. case numberTag:
  23641. case stringTag:
  23642. return new Ctor(object);
  23643. case regexpTag:
  23644. return cloneRegExp(object);
  23645. case setTag:
  23646. return new Ctor;
  23647. case symbolTag:
  23648. return cloneSymbol(object);
  23649. }
  23650. }
  23651. /**
  23652. * Inserts wrapper `details` in a comment at the top of the `source` body.
  23653. *
  23654. * @private
  23655. * @param {string} source The source to modify.
  23656. * @returns {Array} details The details to insert.
  23657. * @returns {string} Returns the modified source.
  23658. */
  23659. function insertWrapDetails(source, details) {
  23660. var length = details.length;
  23661. if (!length) {
  23662. return source;
  23663. }
  23664. var lastIndex = length - 1;
  23665. details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
  23666. details = details.join(length > 2 ? ', ' : ' ');
  23667. return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
  23668. }
  23669. /**
  23670. * Checks if `value` is a flattenable `arguments` object or array.
  23671. *
  23672. * @private
  23673. * @param {*} value The value to check.
  23674. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  23675. */
  23676. function isFlattenable(value) {
  23677. return isArray(value) || isArguments(value) ||
  23678. !!(spreadableSymbol && value && value[spreadableSymbol]);
  23679. }
  23680. /**
  23681. * Checks if `value` is a valid array-like index.
  23682. *
  23683. * @private
  23684. * @param {*} value The value to check.
  23685. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  23686. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  23687. */
  23688. function isIndex(value, length) {
  23689. var type = typeof value;
  23690. length = length == null ? MAX_SAFE_INTEGER : length;
  23691. return !!length &&
  23692. (type == 'number' ||
  23693. (type != 'symbol' && reIsUint.test(value))) &&
  23694. (value > -1 && value % 1 == 0 && value < length);
  23695. }
  23696. /**
  23697. * Checks if the given arguments are from an iteratee call.
  23698. *
  23699. * @private
  23700. * @param {*} value The potential iteratee value argument.
  23701. * @param {*} index The potential iteratee index or key argument.
  23702. * @param {*} object The potential iteratee object argument.
  23703. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  23704. * else `false`.
  23705. */
  23706. function isIterateeCall(value, index, object) {
  23707. if (!isObject(object)) {
  23708. return false;
  23709. }
  23710. var type = typeof index;
  23711. if (type == 'number'
  23712. ? (isArrayLike(object) && isIndex(index, object.length))
  23713. : (type == 'string' && index in object)
  23714. ) {
  23715. return eq(object[index], value);
  23716. }
  23717. return false;
  23718. }
  23719. /**
  23720. * Checks if `value` is a property name and not a property path.
  23721. *
  23722. * @private
  23723. * @param {*} value The value to check.
  23724. * @param {Object} [object] The object to query keys on.
  23725. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  23726. */
  23727. function isKey(value, object) {
  23728. if (isArray(value)) {
  23729. return false;
  23730. }
  23731. var type = typeof value;
  23732. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  23733. value == null || isSymbol(value)) {
  23734. return true;
  23735. }
  23736. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  23737. (object != null && value in Object(object));
  23738. }
  23739. /**
  23740. * Checks if `value` is suitable for use as unique object key.
  23741. *
  23742. * @private
  23743. * @param {*} value The value to check.
  23744. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  23745. */
  23746. function isKeyable(value) {
  23747. var type = typeof value;
  23748. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  23749. ? (value !== '__proto__')
  23750. : (value === null);
  23751. }
  23752. /**
  23753. * Checks if `func` has a lazy counterpart.
  23754. *
  23755. * @private
  23756. * @param {Function} func The function to check.
  23757. * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
  23758. * else `false`.
  23759. */
  23760. function isLaziable(func) {
  23761. var funcName = getFuncName(func),
  23762. other = lodash[funcName];
  23763. if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
  23764. return false;
  23765. }
  23766. if (func === other) {
  23767. return true;
  23768. }
  23769. var data = getData(other);
  23770. return !!data && func === data[0];
  23771. }
  23772. /**
  23773. * Checks if `func` has its source masked.
  23774. *
  23775. * @private
  23776. * @param {Function} func The function to check.
  23777. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  23778. */
  23779. function isMasked(func) {
  23780. return !!maskSrcKey && (maskSrcKey in func);
  23781. }
  23782. /**
  23783. * Checks if `func` is capable of being masked.
  23784. *
  23785. * @private
  23786. * @param {*} value The value to check.
  23787. * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
  23788. */
  23789. var isMaskable = coreJsData ? isFunction : stubFalse;
  23790. /**
  23791. * Checks if `value` is likely a prototype object.
  23792. *
  23793. * @private
  23794. * @param {*} value The value to check.
  23795. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  23796. */
  23797. function isPrototype(value) {
  23798. var Ctor = value && value.constructor,
  23799. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  23800. return value === proto;
  23801. }
  23802. /**
  23803. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  23804. *
  23805. * @private
  23806. * @param {*} value The value to check.
  23807. * @returns {boolean} Returns `true` if `value` if suitable for strict
  23808. * equality comparisons, else `false`.
  23809. */
  23810. function isStrictComparable(value) {
  23811. return value === value && !isObject(value);
  23812. }
  23813. /**
  23814. * A specialized version of `matchesProperty` for source values suitable
  23815. * for strict equality comparisons, i.e. `===`.
  23816. *
  23817. * @private
  23818. * @param {string} key The key of the property to get.
  23819. * @param {*} srcValue The value to match.
  23820. * @returns {Function} Returns the new spec function.
  23821. */
  23822. function matchesStrictComparable(key, srcValue) {
  23823. return function(object) {
  23824. if (object == null) {
  23825. return false;
  23826. }
  23827. return object[key] === srcValue &&
  23828. (srcValue !== undefined || (key in Object(object)));
  23829. };
  23830. }
  23831. /**
  23832. * A specialized version of `_.memoize` which clears the memoized function's
  23833. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  23834. *
  23835. * @private
  23836. * @param {Function} func The function to have its output memoized.
  23837. * @returns {Function} Returns the new memoized function.
  23838. */
  23839. function memoizeCapped(func) {
  23840. var result = memoize(func, function(key) {
  23841. if (cache.size === MAX_MEMOIZE_SIZE) {
  23842. cache.clear();
  23843. }
  23844. return key;
  23845. });
  23846. var cache = result.cache;
  23847. return result;
  23848. }
  23849. /**
  23850. * Merges the function metadata of `source` into `data`.
  23851. *
  23852. * Merging metadata reduces the number of wrappers used to invoke a function.
  23853. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
  23854. * may be applied regardless of execution order. Methods like `_.ary` and
  23855. * `_.rearg` modify function arguments, making the order in which they are
  23856. * executed important, preventing the merging of metadata. However, we make
  23857. * an exception for a safe combined case where curried functions have `_.ary`
  23858. * and or `_.rearg` applied.
  23859. *
  23860. * @private
  23861. * @param {Array} data The destination metadata.
  23862. * @param {Array} source The source metadata.
  23863. * @returns {Array} Returns `data`.
  23864. */
  23865. function mergeData(data, source) {
  23866. var bitmask = data[1],
  23867. srcBitmask = source[1],
  23868. newBitmask = bitmask | srcBitmask,
  23869. isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
  23870. var isCombo =
  23871. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
  23872. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
  23873. ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
  23874. // Exit early if metadata can't be merged.
  23875. if (!(isCommon || isCombo)) {
  23876. return data;
  23877. }
  23878. // Use source `thisArg` if available.
  23879. if (srcBitmask & WRAP_BIND_FLAG) {
  23880. data[2] = source[2];
  23881. // Set when currying a bound function.
  23882. newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
  23883. }
  23884. // Compose partial arguments.
  23885. var value = source[3];
  23886. if (value) {
  23887. var partials = data[3];
  23888. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  23889. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  23890. }
  23891. // Compose partial right arguments.
  23892. value = source[5];
  23893. if (value) {
  23894. partials = data[5];
  23895. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  23896. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  23897. }
  23898. // Use source `argPos` if available.
  23899. value = source[7];
  23900. if (value) {
  23901. data[7] = value;
  23902. }
  23903. // Use source `ary` if it's smaller.
  23904. if (srcBitmask & WRAP_ARY_FLAG) {
  23905. data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
  23906. }
  23907. // Use source `arity` if one is not provided.
  23908. if (data[9] == null) {
  23909. data[9] = source[9];
  23910. }
  23911. // Use source `func` and merge bitmasks.
  23912. data[0] = source[0];
  23913. data[1] = newBitmask;
  23914. return data;
  23915. }
  23916. /**
  23917. * This function is like
  23918. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  23919. * except that it includes inherited enumerable properties.
  23920. *
  23921. * @private
  23922. * @param {Object} object The object to query.
  23923. * @returns {Array} Returns the array of property names.
  23924. */
  23925. function nativeKeysIn(object) {
  23926. var result = [];
  23927. if (object != null) {
  23928. for (var key in Object(object)) {
  23929. result.push(key);
  23930. }
  23931. }
  23932. return result;
  23933. }
  23934. /**
  23935. * Converts `value` to a string using `Object.prototype.toString`.
  23936. *
  23937. * @private
  23938. * @param {*} value The value to convert.
  23939. * @returns {string} Returns the converted string.
  23940. */
  23941. function objectToString(value) {
  23942. return nativeObjectToString.call(value);
  23943. }
  23944. /**
  23945. * A specialized version of `baseRest` which transforms the rest array.
  23946. *
  23947. * @private
  23948. * @param {Function} func The function to apply a rest parameter to.
  23949. * @param {number} [start=func.length-1] The start position of the rest parameter.
  23950. * @param {Function} transform The rest array transform.
  23951. * @returns {Function} Returns the new function.
  23952. */
  23953. function overRest(func, start, transform) {
  23954. start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
  23955. return function() {
  23956. var args = arguments,
  23957. index = -1,
  23958. length = nativeMax(args.length - start, 0),
  23959. array = Array(length);
  23960. while (++index < length) {
  23961. array[index] = args[start + index];
  23962. }
  23963. index = -1;
  23964. var otherArgs = Array(start + 1);
  23965. while (++index < start) {
  23966. otherArgs[index] = args[index];
  23967. }
  23968. otherArgs[start] = transform(array);
  23969. return apply(func, this, otherArgs);
  23970. };
  23971. }
  23972. /**
  23973. * Gets the parent value at `path` of `object`.
  23974. *
  23975. * @private
  23976. * @param {Object} object The object to query.
  23977. * @param {Array} path The path to get the parent value of.
  23978. * @returns {*} Returns the parent value.
  23979. */
  23980. function parent(object, path) {
  23981. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  23982. }
  23983. /**
  23984. * Reorder `array` according to the specified indexes where the element at
  23985. * the first index is assigned as the first element, the element at
  23986. * the second index is assigned as the second element, and so on.
  23987. *
  23988. * @private
  23989. * @param {Array} array The array to reorder.
  23990. * @param {Array} indexes The arranged array indexes.
  23991. * @returns {Array} Returns `array`.
  23992. */
  23993. function reorder(array, indexes) {
  23994. var arrLength = array.length,
  23995. length = nativeMin(indexes.length, arrLength),
  23996. oldArray = copyArray(array);
  23997. while (length--) {
  23998. var index = indexes[length];
  23999. array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
  24000. }
  24001. return array;
  24002. }
  24003. /**
  24004. * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
  24005. *
  24006. * @private
  24007. * @param {Object} object The object to query.
  24008. * @param {string} key The key of the property to get.
  24009. * @returns {*} Returns the property value.
  24010. */
  24011. function safeGet(object, key) {
  24012. if (key === 'constructor' && typeof object[key] === 'function') {
  24013. return;
  24014. }
  24015. if (key == '__proto__') {
  24016. return;
  24017. }
  24018. return object[key];
  24019. }
  24020. /**
  24021. * Sets metadata for `func`.
  24022. *
  24023. * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
  24024. * period of time, it will trip its breaker and transition to an identity
  24025. * function to avoid garbage collection pauses in V8. See
  24026. * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
  24027. * for more details.
  24028. *
  24029. * @private
  24030. * @param {Function} func The function to associate metadata with.
  24031. * @param {*} data The metadata.
  24032. * @returns {Function} Returns `func`.
  24033. */
  24034. var setData = shortOut(baseSetData);
  24035. /**
  24036. * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
  24037. *
  24038. * @private
  24039. * @param {Function} func The function to delay.
  24040. * @param {number} wait The number of milliseconds to delay invocation.
  24041. * @returns {number|Object} Returns the timer id or timeout object.
  24042. */
  24043. var setTimeout = ctxSetTimeout || function(func, wait) {
  24044. return root.setTimeout(func, wait);
  24045. };
  24046. /**
  24047. * Sets the `toString` method of `func` to return `string`.
  24048. *
  24049. * @private
  24050. * @param {Function} func The function to modify.
  24051. * @param {Function} string The `toString` result.
  24052. * @returns {Function} Returns `func`.
  24053. */
  24054. var setToString = shortOut(baseSetToString);
  24055. /**
  24056. * Sets the `toString` method of `wrapper` to mimic the source of `reference`
  24057. * with wrapper details in a comment at the top of the source body.
  24058. *
  24059. * @private
  24060. * @param {Function} wrapper The function to modify.
  24061. * @param {Function} reference The reference function.
  24062. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  24063. * @returns {Function} Returns `wrapper`.
  24064. */
  24065. function setWrapToString(wrapper, reference, bitmask) {
  24066. var source = (reference + '');
  24067. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  24068. }
  24069. /**
  24070. * Creates a function that'll short out and invoke `identity` instead
  24071. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  24072. * milliseconds.
  24073. *
  24074. * @private
  24075. * @param {Function} func The function to restrict.
  24076. * @returns {Function} Returns the new shortable function.
  24077. */
  24078. function shortOut(func) {
  24079. var count = 0,
  24080. lastCalled = 0;
  24081. return function() {
  24082. var stamp = nativeNow(),
  24083. remaining = HOT_SPAN - (stamp - lastCalled);
  24084. lastCalled = stamp;
  24085. if (remaining > 0) {
  24086. if (++count >= HOT_COUNT) {
  24087. return arguments[0];
  24088. }
  24089. } else {
  24090. count = 0;
  24091. }
  24092. return func.apply(undefined, arguments);
  24093. };
  24094. }
  24095. /**
  24096. * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
  24097. *
  24098. * @private
  24099. * @param {Array} array The array to shuffle.
  24100. * @param {number} [size=array.length] The size of `array`.
  24101. * @returns {Array} Returns `array`.
  24102. */
  24103. function shuffleSelf(array, size) {
  24104. var index = -1,
  24105. length = array.length,
  24106. lastIndex = length - 1;
  24107. size = size === undefined ? length : size;
  24108. while (++index < size) {
  24109. var rand = baseRandom(index, lastIndex),
  24110. value = array[rand];
  24111. array[rand] = array[index];
  24112. array[index] = value;
  24113. }
  24114. array.length = size;
  24115. return array;
  24116. }
  24117. /**
  24118. * Converts `string` to a property path array.
  24119. *
  24120. * @private
  24121. * @param {string} string The string to convert.
  24122. * @returns {Array} Returns the property path array.
  24123. */
  24124. var stringToPath = memoizeCapped(function(string) {
  24125. var result = [];
  24126. if (string.charCodeAt(0) === 46 /* . */) {
  24127. result.push('');
  24128. }
  24129. string.replace(rePropName, function(match, number, quote, subString) {
  24130. result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
  24131. });
  24132. return result;
  24133. });
  24134. /**
  24135. * Converts `value` to a string key if it's not a string or symbol.
  24136. *
  24137. * @private
  24138. * @param {*} value The value to inspect.
  24139. * @returns {string|symbol} Returns the key.
  24140. */
  24141. function toKey(value) {
  24142. if (typeof value == 'string' || isSymbol(value)) {
  24143. return value;
  24144. }
  24145. var result = (value + '');
  24146. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  24147. }
  24148. /**
  24149. * Converts `func` to its source code.
  24150. *
  24151. * @private
  24152. * @param {Function} func The function to convert.
  24153. * @returns {string} Returns the source code.
  24154. */
  24155. function toSource(func) {
  24156. if (func != null) {
  24157. try {
  24158. return funcToString.call(func);
  24159. } catch (e) {}
  24160. try {
  24161. return (func + '');
  24162. } catch (e) {}
  24163. }
  24164. return '';
  24165. }
  24166. /**
  24167. * Updates wrapper `details` based on `bitmask` flags.
  24168. *
  24169. * @private
  24170. * @returns {Array} details The details to modify.
  24171. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  24172. * @returns {Array} Returns `details`.
  24173. */
  24174. function updateWrapDetails(details, bitmask) {
  24175. arrayEach(wrapFlags, function(pair) {
  24176. var value = '_.' + pair[0];
  24177. if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
  24178. details.push(value);
  24179. }
  24180. });
  24181. return details.sort();
  24182. }
  24183. /**
  24184. * Creates a clone of `wrapper`.
  24185. *
  24186. * @private
  24187. * @param {Object} wrapper The wrapper to clone.
  24188. * @returns {Object} Returns the cloned wrapper.
  24189. */
  24190. function wrapperClone(wrapper) {
  24191. if (wrapper instanceof LazyWrapper) {
  24192. return wrapper.clone();
  24193. }
  24194. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  24195. result.__actions__ = copyArray(wrapper.__actions__);
  24196. result.__index__ = wrapper.__index__;
  24197. result.__values__ = wrapper.__values__;
  24198. return result;
  24199. }
  24200. /*------------------------------------------------------------------------*/
  24201. /**
  24202. * Creates an array of elements split into groups the length of `size`.
  24203. * If `array` can't be split evenly, the final chunk will be the remaining
  24204. * elements.
  24205. *
  24206. * @static
  24207. * @memberOf _
  24208. * @since 3.0.0
  24209. * @category Array
  24210. * @param {Array} array The array to process.
  24211. * @param {number} [size=1] The length of each chunk
  24212. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24213. * @returns {Array} Returns the new array of chunks.
  24214. * @example
  24215. *
  24216. * _.chunk(['a', 'b', 'c', 'd'], 2);
  24217. * // => [['a', 'b'], ['c', 'd']]
  24218. *
  24219. * _.chunk(['a', 'b', 'c', 'd'], 3);
  24220. * // => [['a', 'b', 'c'], ['d']]
  24221. */
  24222. function chunk(array, size, guard) {
  24223. if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
  24224. size = 1;
  24225. } else {
  24226. size = nativeMax(toInteger(size), 0);
  24227. }
  24228. var length = array == null ? 0 : array.length;
  24229. if (!length || size < 1) {
  24230. return [];
  24231. }
  24232. var index = 0,
  24233. resIndex = 0,
  24234. result = Array(nativeCeil(length / size));
  24235. while (index < length) {
  24236. result[resIndex++] = baseSlice(array, index, (index += size));
  24237. }
  24238. return result;
  24239. }
  24240. /**
  24241. * Creates an array with all falsey values removed. The values `false`, `null`,
  24242. * `0`, `""`, `undefined`, and `NaN` are falsey.
  24243. *
  24244. * @static
  24245. * @memberOf _
  24246. * @since 0.1.0
  24247. * @category Array
  24248. * @param {Array} array The array to compact.
  24249. * @returns {Array} Returns the new array of filtered values.
  24250. * @example
  24251. *
  24252. * _.compact([0, 1, false, 2, '', 3]);
  24253. * // => [1, 2, 3]
  24254. */
  24255. function compact(array) {
  24256. var index = -1,
  24257. length = array == null ? 0 : array.length,
  24258. resIndex = 0,
  24259. result = [];
  24260. while (++index < length) {
  24261. var value = array[index];
  24262. if (value) {
  24263. result[resIndex++] = value;
  24264. }
  24265. }
  24266. return result;
  24267. }
  24268. /**
  24269. * Creates a new array concatenating `array` with any additional arrays
  24270. * and/or values.
  24271. *
  24272. * @static
  24273. * @memberOf _
  24274. * @since 4.0.0
  24275. * @category Array
  24276. * @param {Array} array The array to concatenate.
  24277. * @param {...*} [values] The values to concatenate.
  24278. * @returns {Array} Returns the new concatenated array.
  24279. * @example
  24280. *
  24281. * var array = [1];
  24282. * var other = _.concat(array, 2, [3], [[4]]);
  24283. *
  24284. * console.log(other);
  24285. * // => [1, 2, 3, [4]]
  24286. *
  24287. * console.log(array);
  24288. * // => [1]
  24289. */
  24290. function concat() {
  24291. var length = arguments.length;
  24292. if (!length) {
  24293. return [];
  24294. }
  24295. var args = Array(length - 1),
  24296. array = arguments[0],
  24297. index = length;
  24298. while (index--) {
  24299. args[index - 1] = arguments[index];
  24300. }
  24301. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  24302. }
  24303. /**
  24304. * Creates an array of `array` values not included in the other given arrays
  24305. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  24306. * for equality comparisons. The order and references of result values are
  24307. * determined by the first array.
  24308. *
  24309. * **Note:** Unlike `_.pullAll`, this method returns a new array.
  24310. *
  24311. * @static
  24312. * @memberOf _
  24313. * @since 0.1.0
  24314. * @category Array
  24315. * @param {Array} array The array to inspect.
  24316. * @param {...Array} [values] The values to exclude.
  24317. * @returns {Array} Returns the new array of filtered values.
  24318. * @see _.without, _.xor
  24319. * @example
  24320. *
  24321. * _.difference([2, 1], [2, 3]);
  24322. * // => [1]
  24323. */
  24324. var difference = baseRest(function(array, values) {
  24325. return isArrayLikeObject(array)
  24326. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
  24327. : [];
  24328. });
  24329. /**
  24330. * This method is like `_.difference` except that it accepts `iteratee` which
  24331. * is invoked for each element of `array` and `values` to generate the criterion
  24332. * by which they're compared. The order and references of result values are
  24333. * determined by the first array. The iteratee is invoked with one argument:
  24334. * (value).
  24335. *
  24336. * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
  24337. *
  24338. * @static
  24339. * @memberOf _
  24340. * @since 4.0.0
  24341. * @category Array
  24342. * @param {Array} array The array to inspect.
  24343. * @param {...Array} [values] The values to exclude.
  24344. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  24345. * @returns {Array} Returns the new array of filtered values.
  24346. * @example
  24347. *
  24348. * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  24349. * // => [1.2]
  24350. *
  24351. * // The `_.property` iteratee shorthand.
  24352. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
  24353. * // => [{ 'x': 2 }]
  24354. */
  24355. var differenceBy = baseRest(function(array, values) {
  24356. var iteratee = last(values);
  24357. if (isArrayLikeObject(iteratee)) {
  24358. iteratee = undefined;
  24359. }
  24360. return isArrayLikeObject(array)
  24361. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
  24362. : [];
  24363. });
  24364. /**
  24365. * This method is like `_.difference` except that it accepts `comparator`
  24366. * which is invoked to compare elements of `array` to `values`. The order and
  24367. * references of result values are determined by the first array. The comparator
  24368. * is invoked with two arguments: (arrVal, othVal).
  24369. *
  24370. * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
  24371. *
  24372. * @static
  24373. * @memberOf _
  24374. * @since 4.0.0
  24375. * @category Array
  24376. * @param {Array} array The array to inspect.
  24377. * @param {...Array} [values] The values to exclude.
  24378. * @param {Function} [comparator] The comparator invoked per element.
  24379. * @returns {Array} Returns the new array of filtered values.
  24380. * @example
  24381. *
  24382. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  24383. *
  24384. * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
  24385. * // => [{ 'x': 2, 'y': 1 }]
  24386. */
  24387. var differenceWith = baseRest(function(array, values) {
  24388. var comparator = last(values);
  24389. if (isArrayLikeObject(comparator)) {
  24390. comparator = undefined;
  24391. }
  24392. return isArrayLikeObject(array)
  24393. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
  24394. : [];
  24395. });
  24396. /**
  24397. * Creates a slice of `array` with `n` elements dropped from the beginning.
  24398. *
  24399. * @static
  24400. * @memberOf _
  24401. * @since 0.5.0
  24402. * @category Array
  24403. * @param {Array} array The array to query.
  24404. * @param {number} [n=1] The number of elements to drop.
  24405. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24406. * @returns {Array} Returns the slice of `array`.
  24407. * @example
  24408. *
  24409. * _.drop([1, 2, 3]);
  24410. * // => [2, 3]
  24411. *
  24412. * _.drop([1, 2, 3], 2);
  24413. * // => [3]
  24414. *
  24415. * _.drop([1, 2, 3], 5);
  24416. * // => []
  24417. *
  24418. * _.drop([1, 2, 3], 0);
  24419. * // => [1, 2, 3]
  24420. */
  24421. function drop(array, n, guard) {
  24422. var length = array == null ? 0 : array.length;
  24423. if (!length) {
  24424. return [];
  24425. }
  24426. n = (guard || n === undefined) ? 1 : toInteger(n);
  24427. return baseSlice(array, n < 0 ? 0 : n, length);
  24428. }
  24429. /**
  24430. * Creates a slice of `array` with `n` elements dropped from the end.
  24431. *
  24432. * @static
  24433. * @memberOf _
  24434. * @since 3.0.0
  24435. * @category Array
  24436. * @param {Array} array The array to query.
  24437. * @param {number} [n=1] The number of elements to drop.
  24438. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24439. * @returns {Array} Returns the slice of `array`.
  24440. * @example
  24441. *
  24442. * _.dropRight([1, 2, 3]);
  24443. * // => [1, 2]
  24444. *
  24445. * _.dropRight([1, 2, 3], 2);
  24446. * // => [1]
  24447. *
  24448. * _.dropRight([1, 2, 3], 5);
  24449. * // => []
  24450. *
  24451. * _.dropRight([1, 2, 3], 0);
  24452. * // => [1, 2, 3]
  24453. */
  24454. function dropRight(array, n, guard) {
  24455. var length = array == null ? 0 : array.length;
  24456. if (!length) {
  24457. return [];
  24458. }
  24459. n = (guard || n === undefined) ? 1 : toInteger(n);
  24460. n = length - n;
  24461. return baseSlice(array, 0, n < 0 ? 0 : n);
  24462. }
  24463. /**
  24464. * Creates a slice of `array` excluding elements dropped from the end.
  24465. * Elements are dropped until `predicate` returns falsey. The predicate is
  24466. * invoked with three arguments: (value, index, array).
  24467. *
  24468. * @static
  24469. * @memberOf _
  24470. * @since 3.0.0
  24471. * @category Array
  24472. * @param {Array} array The array to query.
  24473. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24474. * @returns {Array} Returns the slice of `array`.
  24475. * @example
  24476. *
  24477. * var users = [
  24478. * { 'user': 'barney', 'active': true },
  24479. * { 'user': 'fred', 'active': false },
  24480. * { 'user': 'pebbles', 'active': false }
  24481. * ];
  24482. *
  24483. * _.dropRightWhile(users, function(o) { return !o.active; });
  24484. * // => objects for ['barney']
  24485. *
  24486. * // The `_.matches` iteratee shorthand.
  24487. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
  24488. * // => objects for ['barney', 'fred']
  24489. *
  24490. * // The `_.matchesProperty` iteratee shorthand.
  24491. * _.dropRightWhile(users, ['active', false]);
  24492. * // => objects for ['barney']
  24493. *
  24494. * // The `_.property` iteratee shorthand.
  24495. * _.dropRightWhile(users, 'active');
  24496. * // => objects for ['barney', 'fred', 'pebbles']
  24497. */
  24498. function dropRightWhile(array, predicate) {
  24499. return (array && array.length)
  24500. ? baseWhile(array, getIteratee(predicate, 3), true, true)
  24501. : [];
  24502. }
  24503. /**
  24504. * Creates a slice of `array` excluding elements dropped from the beginning.
  24505. * Elements are dropped until `predicate` returns falsey. The predicate is
  24506. * invoked with three arguments: (value, index, array).
  24507. *
  24508. * @static
  24509. * @memberOf _
  24510. * @since 3.0.0
  24511. * @category Array
  24512. * @param {Array} array The array to query.
  24513. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24514. * @returns {Array} Returns the slice of `array`.
  24515. * @example
  24516. *
  24517. * var users = [
  24518. * { 'user': 'barney', 'active': false },
  24519. * { 'user': 'fred', 'active': false },
  24520. * { 'user': 'pebbles', 'active': true }
  24521. * ];
  24522. *
  24523. * _.dropWhile(users, function(o) { return !o.active; });
  24524. * // => objects for ['pebbles']
  24525. *
  24526. * // The `_.matches` iteratee shorthand.
  24527. * _.dropWhile(users, { 'user': 'barney', 'active': false });
  24528. * // => objects for ['fred', 'pebbles']
  24529. *
  24530. * // The `_.matchesProperty` iteratee shorthand.
  24531. * _.dropWhile(users, ['active', false]);
  24532. * // => objects for ['pebbles']
  24533. *
  24534. * // The `_.property` iteratee shorthand.
  24535. * _.dropWhile(users, 'active');
  24536. * // => objects for ['barney', 'fred', 'pebbles']
  24537. */
  24538. function dropWhile(array, predicate) {
  24539. return (array && array.length)
  24540. ? baseWhile(array, getIteratee(predicate, 3), true)
  24541. : [];
  24542. }
  24543. /**
  24544. * Fills elements of `array` with `value` from `start` up to, but not
  24545. * including, `end`.
  24546. *
  24547. * **Note:** This method mutates `array`.
  24548. *
  24549. * @static
  24550. * @memberOf _
  24551. * @since 3.2.0
  24552. * @category Array
  24553. * @param {Array} array The array to fill.
  24554. * @param {*} value The value to fill `array` with.
  24555. * @param {number} [start=0] The start position.
  24556. * @param {number} [end=array.length] The end position.
  24557. * @returns {Array} Returns `array`.
  24558. * @example
  24559. *
  24560. * var array = [1, 2, 3];
  24561. *
  24562. * _.fill(array, 'a');
  24563. * console.log(array);
  24564. * // => ['a', 'a', 'a']
  24565. *
  24566. * _.fill(Array(3), 2);
  24567. * // => [2, 2, 2]
  24568. *
  24569. * _.fill([4, 6, 8, 10], '*', 1, 3);
  24570. * // => [4, '*', '*', 10]
  24571. */
  24572. function fill(array, value, start, end) {
  24573. var length = array == null ? 0 : array.length;
  24574. if (!length) {
  24575. return [];
  24576. }
  24577. if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
  24578. start = 0;
  24579. end = length;
  24580. }
  24581. return baseFill(array, value, start, end);
  24582. }
  24583. /**
  24584. * This method is like `_.find` except that it returns the index of the first
  24585. * element `predicate` returns truthy for instead of the element itself.
  24586. *
  24587. * @static
  24588. * @memberOf _
  24589. * @since 1.1.0
  24590. * @category Array
  24591. * @param {Array} array The array to inspect.
  24592. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24593. * @param {number} [fromIndex=0] The index to search from.
  24594. * @returns {number} Returns the index of the found element, else `-1`.
  24595. * @example
  24596. *
  24597. * var users = [
  24598. * { 'user': 'barney', 'active': false },
  24599. * { 'user': 'fred', 'active': false },
  24600. * { 'user': 'pebbles', 'active': true }
  24601. * ];
  24602. *
  24603. * _.findIndex(users, function(o) { return o.user == 'barney'; });
  24604. * // => 0
  24605. *
  24606. * // The `_.matches` iteratee shorthand.
  24607. * _.findIndex(users, { 'user': 'fred', 'active': false });
  24608. * // => 1
  24609. *
  24610. * // The `_.matchesProperty` iteratee shorthand.
  24611. * _.findIndex(users, ['active', false]);
  24612. * // => 0
  24613. *
  24614. * // The `_.property` iteratee shorthand.
  24615. * _.findIndex(users, 'active');
  24616. * // => 2
  24617. */
  24618. function findIndex(array, predicate, fromIndex) {
  24619. var length = array == null ? 0 : array.length;
  24620. if (!length) {
  24621. return -1;
  24622. }
  24623. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  24624. if (index < 0) {
  24625. index = nativeMax(length + index, 0);
  24626. }
  24627. return baseFindIndex(array, getIteratee(predicate, 3), index);
  24628. }
  24629. /**
  24630. * This method is like `_.findIndex` except that it iterates over elements
  24631. * of `collection` from right to left.
  24632. *
  24633. * @static
  24634. * @memberOf _
  24635. * @since 2.0.0
  24636. * @category Array
  24637. * @param {Array} array The array to inspect.
  24638. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24639. * @param {number} [fromIndex=array.length-1] The index to search from.
  24640. * @returns {number} Returns the index of the found element, else `-1`.
  24641. * @example
  24642. *
  24643. * var users = [
  24644. * { 'user': 'barney', 'active': true },
  24645. * { 'user': 'fred', 'active': false },
  24646. * { 'user': 'pebbles', 'active': false }
  24647. * ];
  24648. *
  24649. * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
  24650. * // => 2
  24651. *
  24652. * // The `_.matches` iteratee shorthand.
  24653. * _.findLastIndex(users, { 'user': 'barney', 'active': true });
  24654. * // => 0
  24655. *
  24656. * // The `_.matchesProperty` iteratee shorthand.
  24657. * _.findLastIndex(users, ['active', false]);
  24658. * // => 2
  24659. *
  24660. * // The `_.property` iteratee shorthand.
  24661. * _.findLastIndex(users, 'active');
  24662. * // => 0
  24663. */
  24664. function findLastIndex(array, predicate, fromIndex) {
  24665. var length = array == null ? 0 : array.length;
  24666. if (!length) {
  24667. return -1;
  24668. }
  24669. var index = length - 1;
  24670. if (fromIndex !== undefined) {
  24671. index = toInteger(fromIndex);
  24672. index = fromIndex < 0
  24673. ? nativeMax(length + index, 0)
  24674. : nativeMin(index, length - 1);
  24675. }
  24676. return baseFindIndex(array, getIteratee(predicate, 3), index, true);
  24677. }
  24678. /**
  24679. * Flattens `array` a single level deep.
  24680. *
  24681. * @static
  24682. * @memberOf _
  24683. * @since 0.1.0
  24684. * @category Array
  24685. * @param {Array} array The array to flatten.
  24686. * @returns {Array} Returns the new flattened array.
  24687. * @example
  24688. *
  24689. * _.flatten([1, [2, [3, [4]], 5]]);
  24690. * // => [1, 2, [3, [4]], 5]
  24691. */
  24692. function flatten(array) {
  24693. var length = array == null ? 0 : array.length;
  24694. return length ? baseFlatten(array, 1) : [];
  24695. }
  24696. /**
  24697. * Recursively flattens `array`.
  24698. *
  24699. * @static
  24700. * @memberOf _
  24701. * @since 3.0.0
  24702. * @category Array
  24703. * @param {Array} array The array to flatten.
  24704. * @returns {Array} Returns the new flattened array.
  24705. * @example
  24706. *
  24707. * _.flattenDeep([1, [2, [3, [4]], 5]]);
  24708. * // => [1, 2, 3, 4, 5]
  24709. */
  24710. function flattenDeep(array) {
  24711. var length = array == null ? 0 : array.length;
  24712. return length ? baseFlatten(array, INFINITY) : [];
  24713. }
  24714. /**
  24715. * Recursively flatten `array` up to `depth` times.
  24716. *
  24717. * @static
  24718. * @memberOf _
  24719. * @since 4.4.0
  24720. * @category Array
  24721. * @param {Array} array The array to flatten.
  24722. * @param {number} [depth=1] The maximum recursion depth.
  24723. * @returns {Array} Returns the new flattened array.
  24724. * @example
  24725. *
  24726. * var array = [1, [2, [3, [4]], 5]];
  24727. *
  24728. * _.flattenDepth(array, 1);
  24729. * // => [1, 2, [3, [4]], 5]
  24730. *
  24731. * _.flattenDepth(array, 2);
  24732. * // => [1, 2, 3, [4], 5]
  24733. */
  24734. function flattenDepth(array, depth) {
  24735. var length = array == null ? 0 : array.length;
  24736. if (!length) {
  24737. return [];
  24738. }
  24739. depth = depth === undefined ? 1 : toInteger(depth);
  24740. return baseFlatten(array, depth);
  24741. }
  24742. /**
  24743. * The inverse of `_.toPairs`; this method returns an object composed
  24744. * from key-value `pairs`.
  24745. *
  24746. * @static
  24747. * @memberOf _
  24748. * @since 4.0.0
  24749. * @category Array
  24750. * @param {Array} pairs The key-value pairs.
  24751. * @returns {Object} Returns the new object.
  24752. * @example
  24753. *
  24754. * _.fromPairs([['a', 1], ['b', 2]]);
  24755. * // => { 'a': 1, 'b': 2 }
  24756. */
  24757. function fromPairs(pairs) {
  24758. var index = -1,
  24759. length = pairs == null ? 0 : pairs.length,
  24760. result = {};
  24761. while (++index < length) {
  24762. var pair = pairs[index];
  24763. result[pair[0]] = pair[1];
  24764. }
  24765. return result;
  24766. }
  24767. /**
  24768. * Gets the first element of `array`.
  24769. *
  24770. * @static
  24771. * @memberOf _
  24772. * @since 0.1.0
  24773. * @alias first
  24774. * @category Array
  24775. * @param {Array} array The array to query.
  24776. * @returns {*} Returns the first element of `array`.
  24777. * @example
  24778. *
  24779. * _.head([1, 2, 3]);
  24780. * // => 1
  24781. *
  24782. * _.head([]);
  24783. * // => undefined
  24784. */
  24785. function head(array) {
  24786. return (array && array.length) ? array[0] : undefined;
  24787. }
  24788. /**
  24789. * Gets the index at which the first occurrence of `value` is found in `array`
  24790. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  24791. * for equality comparisons. If `fromIndex` is negative, it's used as the
  24792. * offset from the end of `array`.
  24793. *
  24794. * @static
  24795. * @memberOf _
  24796. * @since 0.1.0
  24797. * @category Array
  24798. * @param {Array} array The array to inspect.
  24799. * @param {*} value The value to search for.
  24800. * @param {number} [fromIndex=0] The index to search from.
  24801. * @returns {number} Returns the index of the matched value, else `-1`.
  24802. * @example
  24803. *
  24804. * _.indexOf([1, 2, 1, 2], 2);
  24805. * // => 1
  24806. *
  24807. * // Search from the `fromIndex`.
  24808. * _.indexOf([1, 2, 1, 2], 2, 2);
  24809. * // => 3
  24810. */
  24811. function indexOf(array, value, fromIndex) {
  24812. var length = array == null ? 0 : array.length;
  24813. if (!length) {
  24814. return -1;
  24815. }
  24816. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  24817. if (index < 0) {
  24818. index = nativeMax(length + index, 0);
  24819. }
  24820. return baseIndexOf(array, value, index);
  24821. }
  24822. /**
  24823. * Gets all but the last element of `array`.
  24824. *
  24825. * @static
  24826. * @memberOf _
  24827. * @since 0.1.0
  24828. * @category Array
  24829. * @param {Array} array The array to query.
  24830. * @returns {Array} Returns the slice of `array`.
  24831. * @example
  24832. *
  24833. * _.initial([1, 2, 3]);
  24834. * // => [1, 2]
  24835. */
  24836. function initial(array) {
  24837. var length = array == null ? 0 : array.length;
  24838. return length ? baseSlice(array, 0, -1) : [];
  24839. }
  24840. /**
  24841. * Creates an array of unique values that are included in all given arrays
  24842. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  24843. * for equality comparisons. The order and references of result values are
  24844. * determined by the first array.
  24845. *
  24846. * @static
  24847. * @memberOf _
  24848. * @since 0.1.0
  24849. * @category Array
  24850. * @param {...Array} [arrays] The arrays to inspect.
  24851. * @returns {Array} Returns the new array of intersecting values.
  24852. * @example
  24853. *
  24854. * _.intersection([2, 1], [2, 3]);
  24855. * // => [2]
  24856. */
  24857. var intersection = baseRest(function(arrays) {
  24858. var mapped = arrayMap(arrays, castArrayLikeObject);
  24859. return (mapped.length && mapped[0] === arrays[0])
  24860. ? baseIntersection(mapped)
  24861. : [];
  24862. });
  24863. /**
  24864. * This method is like `_.intersection` except that it accepts `iteratee`
  24865. * which is invoked for each element of each `arrays` to generate the criterion
  24866. * by which they're compared. The order and references of result values are
  24867. * determined by the first array. The iteratee is invoked with one argument:
  24868. * (value).
  24869. *
  24870. * @static
  24871. * @memberOf _
  24872. * @since 4.0.0
  24873. * @category Array
  24874. * @param {...Array} [arrays] The arrays to inspect.
  24875. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  24876. * @returns {Array} Returns the new array of intersecting values.
  24877. * @example
  24878. *
  24879. * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  24880. * // => [2.1]
  24881. *
  24882. * // The `_.property` iteratee shorthand.
  24883. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  24884. * // => [{ 'x': 1 }]
  24885. */
  24886. var intersectionBy = baseRest(function(arrays) {
  24887. var iteratee = last(arrays),
  24888. mapped = arrayMap(arrays, castArrayLikeObject);
  24889. if (iteratee === last(mapped)) {
  24890. iteratee = undefined;
  24891. } else {
  24892. mapped.pop();
  24893. }
  24894. return (mapped.length && mapped[0] === arrays[0])
  24895. ? baseIntersection(mapped, getIteratee(iteratee, 2))
  24896. : [];
  24897. });
  24898. /**
  24899. * This method is like `_.intersection` except that it accepts `comparator`
  24900. * which is invoked to compare elements of `arrays`. The order and references
  24901. * of result values are determined by the first array. The comparator is
  24902. * invoked with two arguments: (arrVal, othVal).
  24903. *
  24904. * @static
  24905. * @memberOf _
  24906. * @since 4.0.0
  24907. * @category Array
  24908. * @param {...Array} [arrays] The arrays to inspect.
  24909. * @param {Function} [comparator] The comparator invoked per element.
  24910. * @returns {Array} Returns the new array of intersecting values.
  24911. * @example
  24912. *
  24913. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  24914. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  24915. *
  24916. * _.intersectionWith(objects, others, _.isEqual);
  24917. * // => [{ 'x': 1, 'y': 2 }]
  24918. */
  24919. var intersectionWith = baseRest(function(arrays) {
  24920. var comparator = last(arrays),
  24921. mapped = arrayMap(arrays, castArrayLikeObject);
  24922. comparator = typeof comparator == 'function' ? comparator : undefined;
  24923. if (comparator) {
  24924. mapped.pop();
  24925. }
  24926. return (mapped.length && mapped[0] === arrays[0])
  24927. ? baseIntersection(mapped, undefined, comparator)
  24928. : [];
  24929. });
  24930. /**
  24931. * Converts all elements in `array` into a string separated by `separator`.
  24932. *
  24933. * @static
  24934. * @memberOf _
  24935. * @since 4.0.0
  24936. * @category Array
  24937. * @param {Array} array The array to convert.
  24938. * @param {string} [separator=','] The element separator.
  24939. * @returns {string} Returns the joined string.
  24940. * @example
  24941. *
  24942. * _.join(['a', 'b', 'c'], '~');
  24943. * // => 'a~b~c'
  24944. */
  24945. function join(array, separator) {
  24946. return array == null ? '' : nativeJoin.call(array, separator);
  24947. }
  24948. /**
  24949. * Gets the last element of `array`.
  24950. *
  24951. * @static
  24952. * @memberOf _
  24953. * @since 0.1.0
  24954. * @category Array
  24955. * @param {Array} array The array to query.
  24956. * @returns {*} Returns the last element of `array`.
  24957. * @example
  24958. *
  24959. * _.last([1, 2, 3]);
  24960. * // => 3
  24961. */
  24962. function last(array) {
  24963. var length = array == null ? 0 : array.length;
  24964. return length ? array[length - 1] : undefined;
  24965. }
  24966. /**
  24967. * This method is like `_.indexOf` except that it iterates over elements of
  24968. * `array` from right to left.
  24969. *
  24970. * @static
  24971. * @memberOf _
  24972. * @since 0.1.0
  24973. * @category Array
  24974. * @param {Array} array The array to inspect.
  24975. * @param {*} value The value to search for.
  24976. * @param {number} [fromIndex=array.length-1] The index to search from.
  24977. * @returns {number} Returns the index of the matched value, else `-1`.
  24978. * @example
  24979. *
  24980. * _.lastIndexOf([1, 2, 1, 2], 2);
  24981. * // => 3
  24982. *
  24983. * // Search from the `fromIndex`.
  24984. * _.lastIndexOf([1, 2, 1, 2], 2, 2);
  24985. * // => 1
  24986. */
  24987. function lastIndexOf(array, value, fromIndex) {
  24988. var length = array == null ? 0 : array.length;
  24989. if (!length) {
  24990. return -1;
  24991. }
  24992. var index = length;
  24993. if (fromIndex !== undefined) {
  24994. index = toInteger(fromIndex);
  24995. index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
  24996. }
  24997. return value === value
  24998. ? strictLastIndexOf(array, value, index)
  24999. : baseFindIndex(array, baseIsNaN, index, true);
  25000. }
  25001. /**
  25002. * Gets the element at index `n` of `array`. If `n` is negative, the nth
  25003. * element from the end is returned.
  25004. *
  25005. * @static
  25006. * @memberOf _
  25007. * @since 4.11.0
  25008. * @category Array
  25009. * @param {Array} array The array to query.
  25010. * @param {number} [n=0] The index of the element to return.
  25011. * @returns {*} Returns the nth element of `array`.
  25012. * @example
  25013. *
  25014. * var array = ['a', 'b', 'c', 'd'];
  25015. *
  25016. * _.nth(array, 1);
  25017. * // => 'b'
  25018. *
  25019. * _.nth(array, -2);
  25020. * // => 'c';
  25021. */
  25022. function nth(array, n) {
  25023. return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
  25024. }
  25025. /**
  25026. * Removes all given values from `array` using
  25027. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25028. * for equality comparisons.
  25029. *
  25030. * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
  25031. * to remove elements from an array by predicate.
  25032. *
  25033. * @static
  25034. * @memberOf _
  25035. * @since 2.0.0
  25036. * @category Array
  25037. * @param {Array} array The array to modify.
  25038. * @param {...*} [values] The values to remove.
  25039. * @returns {Array} Returns `array`.
  25040. * @example
  25041. *
  25042. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  25043. *
  25044. * _.pull(array, 'a', 'c');
  25045. * console.log(array);
  25046. * // => ['b', 'b']
  25047. */
  25048. var pull = baseRest(pullAll);
  25049. /**
  25050. * This method is like `_.pull` except that it accepts an array of values to remove.
  25051. *
  25052. * **Note:** Unlike `_.difference`, this method mutates `array`.
  25053. *
  25054. * @static
  25055. * @memberOf _
  25056. * @since 4.0.0
  25057. * @category Array
  25058. * @param {Array} array The array to modify.
  25059. * @param {Array} values The values to remove.
  25060. * @returns {Array} Returns `array`.
  25061. * @example
  25062. *
  25063. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  25064. *
  25065. * _.pullAll(array, ['a', 'c']);
  25066. * console.log(array);
  25067. * // => ['b', 'b']
  25068. */
  25069. function pullAll(array, values) {
  25070. return (array && array.length && values && values.length)
  25071. ? basePullAll(array, values)
  25072. : array;
  25073. }
  25074. /**
  25075. * This method is like `_.pullAll` except that it accepts `iteratee` which is
  25076. * invoked for each element of `array` and `values` to generate the criterion
  25077. * by which they're compared. The iteratee is invoked with one argument: (value).
  25078. *
  25079. * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
  25080. *
  25081. * @static
  25082. * @memberOf _
  25083. * @since 4.0.0
  25084. * @category Array
  25085. * @param {Array} array The array to modify.
  25086. * @param {Array} values The values to remove.
  25087. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25088. * @returns {Array} Returns `array`.
  25089. * @example
  25090. *
  25091. * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
  25092. *
  25093. * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
  25094. * console.log(array);
  25095. * // => [{ 'x': 2 }]
  25096. */
  25097. function pullAllBy(array, values, iteratee) {
  25098. return (array && array.length && values && values.length)
  25099. ? basePullAll(array, values, getIteratee(iteratee, 2))
  25100. : array;
  25101. }
  25102. /**
  25103. * This method is like `_.pullAll` except that it accepts `comparator` which
  25104. * is invoked to compare elements of `array` to `values`. The comparator is
  25105. * invoked with two arguments: (arrVal, othVal).
  25106. *
  25107. * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
  25108. *
  25109. * @static
  25110. * @memberOf _
  25111. * @since 4.6.0
  25112. * @category Array
  25113. * @param {Array} array The array to modify.
  25114. * @param {Array} values The values to remove.
  25115. * @param {Function} [comparator] The comparator invoked per element.
  25116. * @returns {Array} Returns `array`.
  25117. * @example
  25118. *
  25119. * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
  25120. *
  25121. * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
  25122. * console.log(array);
  25123. * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
  25124. */
  25125. function pullAllWith(array, values, comparator) {
  25126. return (array && array.length && values && values.length)
  25127. ? basePullAll(array, values, undefined, comparator)
  25128. : array;
  25129. }
  25130. /**
  25131. * Removes elements from `array` corresponding to `indexes` and returns an
  25132. * array of removed elements.
  25133. *
  25134. * **Note:** Unlike `_.at`, this method mutates `array`.
  25135. *
  25136. * @static
  25137. * @memberOf _
  25138. * @since 3.0.0
  25139. * @category Array
  25140. * @param {Array} array The array to modify.
  25141. * @param {...(number|number[])} [indexes] The indexes of elements to remove.
  25142. * @returns {Array} Returns the new array of removed elements.
  25143. * @example
  25144. *
  25145. * var array = ['a', 'b', 'c', 'd'];
  25146. * var pulled = _.pullAt(array, [1, 3]);
  25147. *
  25148. * console.log(array);
  25149. * // => ['a', 'c']
  25150. *
  25151. * console.log(pulled);
  25152. * // => ['b', 'd']
  25153. */
  25154. var pullAt = flatRest(function(array, indexes) {
  25155. var length = array == null ? 0 : array.length,
  25156. result = baseAt(array, indexes);
  25157. basePullAt(array, arrayMap(indexes, function(index) {
  25158. return isIndex(index, length) ? +index : index;
  25159. }).sort(compareAscending));
  25160. return result;
  25161. });
  25162. /**
  25163. * Removes all elements from `array` that `predicate` returns truthy for
  25164. * and returns an array of the removed elements. The predicate is invoked
  25165. * with three arguments: (value, index, array).
  25166. *
  25167. * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
  25168. * to pull elements from an array by value.
  25169. *
  25170. * @static
  25171. * @memberOf _
  25172. * @since 2.0.0
  25173. * @category Array
  25174. * @param {Array} array The array to modify.
  25175. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25176. * @returns {Array} Returns the new array of removed elements.
  25177. * @example
  25178. *
  25179. * var array = [1, 2, 3, 4];
  25180. * var evens = _.remove(array, function(n) {
  25181. * return n % 2 == 0;
  25182. * });
  25183. *
  25184. * console.log(array);
  25185. * // => [1, 3]
  25186. *
  25187. * console.log(evens);
  25188. * // => [2, 4]
  25189. */
  25190. function remove(array, predicate) {
  25191. var result = [];
  25192. if (!(array && array.length)) {
  25193. return result;
  25194. }
  25195. var index = -1,
  25196. indexes = [],
  25197. length = array.length;
  25198. predicate = getIteratee(predicate, 3);
  25199. while (++index < length) {
  25200. var value = array[index];
  25201. if (predicate(value, index, array)) {
  25202. result.push(value);
  25203. indexes.push(index);
  25204. }
  25205. }
  25206. basePullAt(array, indexes);
  25207. return result;
  25208. }
  25209. /**
  25210. * Reverses `array` so that the first element becomes the last, the second
  25211. * element becomes the second to last, and so on.
  25212. *
  25213. * **Note:** This method mutates `array` and is based on
  25214. * [`Array#reverse`](https://mdn.io/Array/reverse).
  25215. *
  25216. * @static
  25217. * @memberOf _
  25218. * @since 4.0.0
  25219. * @category Array
  25220. * @param {Array} array The array to modify.
  25221. * @returns {Array} Returns `array`.
  25222. * @example
  25223. *
  25224. * var array = [1, 2, 3];
  25225. *
  25226. * _.reverse(array);
  25227. * // => [3, 2, 1]
  25228. *
  25229. * console.log(array);
  25230. * // => [3, 2, 1]
  25231. */
  25232. function reverse(array) {
  25233. return array == null ? array : nativeReverse.call(array);
  25234. }
  25235. /**
  25236. * Creates a slice of `array` from `start` up to, but not including, `end`.
  25237. *
  25238. * **Note:** This method is used instead of
  25239. * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
  25240. * returned.
  25241. *
  25242. * @static
  25243. * @memberOf _
  25244. * @since 3.0.0
  25245. * @category Array
  25246. * @param {Array} array The array to slice.
  25247. * @param {number} [start=0] The start position.
  25248. * @param {number} [end=array.length] The end position.
  25249. * @returns {Array} Returns the slice of `array`.
  25250. */
  25251. function slice(array, start, end) {
  25252. var length = array == null ? 0 : array.length;
  25253. if (!length) {
  25254. return [];
  25255. }
  25256. if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
  25257. start = 0;
  25258. end = length;
  25259. }
  25260. else {
  25261. start = start == null ? 0 : toInteger(start);
  25262. end = end === undefined ? length : toInteger(end);
  25263. }
  25264. return baseSlice(array, start, end);
  25265. }
  25266. /**
  25267. * Uses a binary search to determine the lowest index at which `value`
  25268. * should be inserted into `array` in order to maintain its sort order.
  25269. *
  25270. * @static
  25271. * @memberOf _
  25272. * @since 0.1.0
  25273. * @category Array
  25274. * @param {Array} array The sorted array to inspect.
  25275. * @param {*} value The value to evaluate.
  25276. * @returns {number} Returns the index at which `value` should be inserted
  25277. * into `array`.
  25278. * @example
  25279. *
  25280. * _.sortedIndex([30, 50], 40);
  25281. * // => 1
  25282. */
  25283. function sortedIndex(array, value) {
  25284. return baseSortedIndex(array, value);
  25285. }
  25286. /**
  25287. * This method is like `_.sortedIndex` except that it accepts `iteratee`
  25288. * which is invoked for `value` and each element of `array` to compute their
  25289. * sort ranking. The iteratee is invoked with one argument: (value).
  25290. *
  25291. * @static
  25292. * @memberOf _
  25293. * @since 4.0.0
  25294. * @category Array
  25295. * @param {Array} array The sorted array to inspect.
  25296. * @param {*} value The value to evaluate.
  25297. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25298. * @returns {number} Returns the index at which `value` should be inserted
  25299. * into `array`.
  25300. * @example
  25301. *
  25302. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  25303. *
  25304. * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  25305. * // => 0
  25306. *
  25307. * // The `_.property` iteratee shorthand.
  25308. * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
  25309. * // => 0
  25310. */
  25311. function sortedIndexBy(array, value, iteratee) {
  25312. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
  25313. }
  25314. /**
  25315. * This method is like `_.indexOf` except that it performs a binary
  25316. * search on a sorted `array`.
  25317. *
  25318. * @static
  25319. * @memberOf _
  25320. * @since 4.0.0
  25321. * @category Array
  25322. * @param {Array} array The array to inspect.
  25323. * @param {*} value The value to search for.
  25324. * @returns {number} Returns the index of the matched value, else `-1`.
  25325. * @example
  25326. *
  25327. * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
  25328. * // => 1
  25329. */
  25330. function sortedIndexOf(array, value) {
  25331. var length = array == null ? 0 : array.length;
  25332. if (length) {
  25333. var index = baseSortedIndex(array, value);
  25334. if (index < length && eq(array[index], value)) {
  25335. return index;
  25336. }
  25337. }
  25338. return -1;
  25339. }
  25340. /**
  25341. * This method is like `_.sortedIndex` except that it returns the highest
  25342. * index at which `value` should be inserted into `array` in order to
  25343. * maintain its sort order.
  25344. *
  25345. * @static
  25346. * @memberOf _
  25347. * @since 3.0.0
  25348. * @category Array
  25349. * @param {Array} array The sorted array to inspect.
  25350. * @param {*} value The value to evaluate.
  25351. * @returns {number} Returns the index at which `value` should be inserted
  25352. * into `array`.
  25353. * @example
  25354. *
  25355. * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
  25356. * // => 4
  25357. */
  25358. function sortedLastIndex(array, value) {
  25359. return baseSortedIndex(array, value, true);
  25360. }
  25361. /**
  25362. * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
  25363. * which is invoked for `value` and each element of `array` to compute their
  25364. * sort ranking. The iteratee is invoked with one argument: (value).
  25365. *
  25366. * @static
  25367. * @memberOf _
  25368. * @since 4.0.0
  25369. * @category Array
  25370. * @param {Array} array The sorted array to inspect.
  25371. * @param {*} value The value to evaluate.
  25372. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25373. * @returns {number} Returns the index at which `value` should be inserted
  25374. * into `array`.
  25375. * @example
  25376. *
  25377. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  25378. *
  25379. * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  25380. * // => 1
  25381. *
  25382. * // The `_.property` iteratee shorthand.
  25383. * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
  25384. * // => 1
  25385. */
  25386. function sortedLastIndexBy(array, value, iteratee) {
  25387. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
  25388. }
  25389. /**
  25390. * This method is like `_.lastIndexOf` except that it performs a binary
  25391. * search on a sorted `array`.
  25392. *
  25393. * @static
  25394. * @memberOf _
  25395. * @since 4.0.0
  25396. * @category Array
  25397. * @param {Array} array The array to inspect.
  25398. * @param {*} value The value to search for.
  25399. * @returns {number} Returns the index of the matched value, else `-1`.
  25400. * @example
  25401. *
  25402. * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
  25403. * // => 3
  25404. */
  25405. function sortedLastIndexOf(array, value) {
  25406. var length = array == null ? 0 : array.length;
  25407. if (length) {
  25408. var index = baseSortedIndex(array, value, true) - 1;
  25409. if (eq(array[index], value)) {
  25410. return index;
  25411. }
  25412. }
  25413. return -1;
  25414. }
  25415. /**
  25416. * This method is like `_.uniq` except that it's designed and optimized
  25417. * for sorted arrays.
  25418. *
  25419. * @static
  25420. * @memberOf _
  25421. * @since 4.0.0
  25422. * @category Array
  25423. * @param {Array} array The array to inspect.
  25424. * @returns {Array} Returns the new duplicate free array.
  25425. * @example
  25426. *
  25427. * _.sortedUniq([1, 1, 2]);
  25428. * // => [1, 2]
  25429. */
  25430. function sortedUniq(array) {
  25431. return (array && array.length)
  25432. ? baseSortedUniq(array)
  25433. : [];
  25434. }
  25435. /**
  25436. * This method is like `_.uniqBy` except that it's designed and optimized
  25437. * for sorted arrays.
  25438. *
  25439. * @static
  25440. * @memberOf _
  25441. * @since 4.0.0
  25442. * @category Array
  25443. * @param {Array} array The array to inspect.
  25444. * @param {Function} [iteratee] The iteratee invoked per element.
  25445. * @returns {Array} Returns the new duplicate free array.
  25446. * @example
  25447. *
  25448. * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
  25449. * // => [1.1, 2.3]
  25450. */
  25451. function sortedUniqBy(array, iteratee) {
  25452. return (array && array.length)
  25453. ? baseSortedUniq(array, getIteratee(iteratee, 2))
  25454. : [];
  25455. }
  25456. /**
  25457. * Gets all but the first element of `array`.
  25458. *
  25459. * @static
  25460. * @memberOf _
  25461. * @since 4.0.0
  25462. * @category Array
  25463. * @param {Array} array The array to query.
  25464. * @returns {Array} Returns the slice of `array`.
  25465. * @example
  25466. *
  25467. * _.tail([1, 2, 3]);
  25468. * // => [2, 3]
  25469. */
  25470. function tail(array) {
  25471. var length = array == null ? 0 : array.length;
  25472. return length ? baseSlice(array, 1, length) : [];
  25473. }
  25474. /**
  25475. * Creates a slice of `array` with `n` elements taken from the beginning.
  25476. *
  25477. * @static
  25478. * @memberOf _
  25479. * @since 0.1.0
  25480. * @category Array
  25481. * @param {Array} array The array to query.
  25482. * @param {number} [n=1] The number of elements to take.
  25483. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25484. * @returns {Array} Returns the slice of `array`.
  25485. * @example
  25486. *
  25487. * _.take([1, 2, 3]);
  25488. * // => [1]
  25489. *
  25490. * _.take([1, 2, 3], 2);
  25491. * // => [1, 2]
  25492. *
  25493. * _.take([1, 2, 3], 5);
  25494. * // => [1, 2, 3]
  25495. *
  25496. * _.take([1, 2, 3], 0);
  25497. * // => []
  25498. */
  25499. function take(array, n, guard) {
  25500. if (!(array && array.length)) {
  25501. return [];
  25502. }
  25503. n = (guard || n === undefined) ? 1 : toInteger(n);
  25504. return baseSlice(array, 0, n < 0 ? 0 : n);
  25505. }
  25506. /**
  25507. * Creates a slice of `array` with `n` elements taken from the end.
  25508. *
  25509. * @static
  25510. * @memberOf _
  25511. * @since 3.0.0
  25512. * @category Array
  25513. * @param {Array} array The array to query.
  25514. * @param {number} [n=1] The number of elements to take.
  25515. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25516. * @returns {Array} Returns the slice of `array`.
  25517. * @example
  25518. *
  25519. * _.takeRight([1, 2, 3]);
  25520. * // => [3]
  25521. *
  25522. * _.takeRight([1, 2, 3], 2);
  25523. * // => [2, 3]
  25524. *
  25525. * _.takeRight([1, 2, 3], 5);
  25526. * // => [1, 2, 3]
  25527. *
  25528. * _.takeRight([1, 2, 3], 0);
  25529. * // => []
  25530. */
  25531. function takeRight(array, n, guard) {
  25532. var length = array == null ? 0 : array.length;
  25533. if (!length) {
  25534. return [];
  25535. }
  25536. n = (guard || n === undefined) ? 1 : toInteger(n);
  25537. n = length - n;
  25538. return baseSlice(array, n < 0 ? 0 : n, length);
  25539. }
  25540. /**
  25541. * Creates a slice of `array` with elements taken from the end. Elements are
  25542. * taken until `predicate` returns falsey. The predicate is invoked with
  25543. * three arguments: (value, index, array).
  25544. *
  25545. * @static
  25546. * @memberOf _
  25547. * @since 3.0.0
  25548. * @category Array
  25549. * @param {Array} array The array to query.
  25550. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25551. * @returns {Array} Returns the slice of `array`.
  25552. * @example
  25553. *
  25554. * var users = [
  25555. * { 'user': 'barney', 'active': true },
  25556. * { 'user': 'fred', 'active': false },
  25557. * { 'user': 'pebbles', 'active': false }
  25558. * ];
  25559. *
  25560. * _.takeRightWhile(users, function(o) { return !o.active; });
  25561. * // => objects for ['fred', 'pebbles']
  25562. *
  25563. * // The `_.matches` iteratee shorthand.
  25564. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
  25565. * // => objects for ['pebbles']
  25566. *
  25567. * // The `_.matchesProperty` iteratee shorthand.
  25568. * _.takeRightWhile(users, ['active', false]);
  25569. * // => objects for ['fred', 'pebbles']
  25570. *
  25571. * // The `_.property` iteratee shorthand.
  25572. * _.takeRightWhile(users, 'active');
  25573. * // => []
  25574. */
  25575. function takeRightWhile(array, predicate) {
  25576. return (array && array.length)
  25577. ? baseWhile(array, getIteratee(predicate, 3), false, true)
  25578. : [];
  25579. }
  25580. /**
  25581. * Creates a slice of `array` with elements taken from the beginning. Elements
  25582. * are taken until `predicate` returns falsey. The predicate is invoked with
  25583. * three arguments: (value, index, array).
  25584. *
  25585. * @static
  25586. * @memberOf _
  25587. * @since 3.0.0
  25588. * @category Array
  25589. * @param {Array} array The array to query.
  25590. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25591. * @returns {Array} Returns the slice of `array`.
  25592. * @example
  25593. *
  25594. * var users = [
  25595. * { 'user': 'barney', 'active': false },
  25596. * { 'user': 'fred', 'active': false },
  25597. * { 'user': 'pebbles', 'active': true }
  25598. * ];
  25599. *
  25600. * _.takeWhile(users, function(o) { return !o.active; });
  25601. * // => objects for ['barney', 'fred']
  25602. *
  25603. * // The `_.matches` iteratee shorthand.
  25604. * _.takeWhile(users, { 'user': 'barney', 'active': false });
  25605. * // => objects for ['barney']
  25606. *
  25607. * // The `_.matchesProperty` iteratee shorthand.
  25608. * _.takeWhile(users, ['active', false]);
  25609. * // => objects for ['barney', 'fred']
  25610. *
  25611. * // The `_.property` iteratee shorthand.
  25612. * _.takeWhile(users, 'active');
  25613. * // => []
  25614. */
  25615. function takeWhile(array, predicate) {
  25616. return (array && array.length)
  25617. ? baseWhile(array, getIteratee(predicate, 3))
  25618. : [];
  25619. }
  25620. /**
  25621. * Creates an array of unique values, in order, from all given arrays using
  25622. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25623. * for equality comparisons.
  25624. *
  25625. * @static
  25626. * @memberOf _
  25627. * @since 0.1.0
  25628. * @category Array
  25629. * @param {...Array} [arrays] The arrays to inspect.
  25630. * @returns {Array} Returns the new array of combined values.
  25631. * @example
  25632. *
  25633. * _.union([2], [1, 2]);
  25634. * // => [2, 1]
  25635. */
  25636. var union = baseRest(function(arrays) {
  25637. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  25638. });
  25639. /**
  25640. * This method is like `_.union` except that it accepts `iteratee` which is
  25641. * invoked for each element of each `arrays` to generate the criterion by
  25642. * which uniqueness is computed. Result values are chosen from the first
  25643. * array in which the value occurs. The iteratee is invoked with one argument:
  25644. * (value).
  25645. *
  25646. * @static
  25647. * @memberOf _
  25648. * @since 4.0.0
  25649. * @category Array
  25650. * @param {...Array} [arrays] The arrays to inspect.
  25651. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25652. * @returns {Array} Returns the new array of combined values.
  25653. * @example
  25654. *
  25655. * _.unionBy([2.1], [1.2, 2.3], Math.floor);
  25656. * // => [2.1, 1.2]
  25657. *
  25658. * // The `_.property` iteratee shorthand.
  25659. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  25660. * // => [{ 'x': 1 }, { 'x': 2 }]
  25661. */
  25662. var unionBy = baseRest(function(arrays) {
  25663. var iteratee = last(arrays);
  25664. if (isArrayLikeObject(iteratee)) {
  25665. iteratee = undefined;
  25666. }
  25667. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
  25668. });
  25669. /**
  25670. * This method is like `_.union` except that it accepts `comparator` which
  25671. * is invoked to compare elements of `arrays`. Result values are chosen from
  25672. * the first array in which the value occurs. The comparator is invoked
  25673. * with two arguments: (arrVal, othVal).
  25674. *
  25675. * @static
  25676. * @memberOf _
  25677. * @since 4.0.0
  25678. * @category Array
  25679. * @param {...Array} [arrays] The arrays to inspect.
  25680. * @param {Function} [comparator] The comparator invoked per element.
  25681. * @returns {Array} Returns the new array of combined values.
  25682. * @example
  25683. *
  25684. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  25685. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  25686. *
  25687. * _.unionWith(objects, others, _.isEqual);
  25688. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  25689. */
  25690. var unionWith = baseRest(function(arrays) {
  25691. var comparator = last(arrays);
  25692. comparator = typeof comparator == 'function' ? comparator : undefined;
  25693. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
  25694. });
  25695. /**
  25696. * Creates a duplicate-free version of an array, using
  25697. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25698. * for equality comparisons, in which only the first occurrence of each element
  25699. * is kept. The order of result values is determined by the order they occur
  25700. * in the array.
  25701. *
  25702. * @static
  25703. * @memberOf _
  25704. * @since 0.1.0
  25705. * @category Array
  25706. * @param {Array} array The array to inspect.
  25707. * @returns {Array} Returns the new duplicate free array.
  25708. * @example
  25709. *
  25710. * _.uniq([2, 1, 2]);
  25711. * // => [2, 1]
  25712. */
  25713. function uniq(array) {
  25714. return (array && array.length) ? baseUniq(array) : [];
  25715. }
  25716. /**
  25717. * This method is like `_.uniq` except that it accepts `iteratee` which is
  25718. * invoked for each element in `array` to generate the criterion by which
  25719. * uniqueness is computed. The order of result values is determined by the
  25720. * order they occur in the array. The iteratee is invoked with one argument:
  25721. * (value).
  25722. *
  25723. * @static
  25724. * @memberOf _
  25725. * @since 4.0.0
  25726. * @category Array
  25727. * @param {Array} array The array to inspect.
  25728. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25729. * @returns {Array} Returns the new duplicate free array.
  25730. * @example
  25731. *
  25732. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  25733. * // => [2.1, 1.2]
  25734. *
  25735. * // The `_.property` iteratee shorthand.
  25736. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  25737. * // => [{ 'x': 1 }, { 'x': 2 }]
  25738. */
  25739. function uniqBy(array, iteratee) {
  25740. return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
  25741. }
  25742. /**
  25743. * This method is like `_.uniq` except that it accepts `comparator` which
  25744. * is invoked to compare elements of `array`. The order of result values is
  25745. * determined by the order they occur in the array.The comparator is invoked
  25746. * with two arguments: (arrVal, othVal).
  25747. *
  25748. * @static
  25749. * @memberOf _
  25750. * @since 4.0.0
  25751. * @category Array
  25752. * @param {Array} array The array to inspect.
  25753. * @param {Function} [comparator] The comparator invoked per element.
  25754. * @returns {Array} Returns the new duplicate free array.
  25755. * @example
  25756. *
  25757. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
  25758. *
  25759. * _.uniqWith(objects, _.isEqual);
  25760. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
  25761. */
  25762. function uniqWith(array, comparator) {
  25763. comparator = typeof comparator == 'function' ? comparator : undefined;
  25764. return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
  25765. }
  25766. /**
  25767. * This method is like `_.zip` except that it accepts an array of grouped
  25768. * elements and creates an array regrouping the elements to their pre-zip
  25769. * configuration.
  25770. *
  25771. * @static
  25772. * @memberOf _
  25773. * @since 1.2.0
  25774. * @category Array
  25775. * @param {Array} array The array of grouped elements to process.
  25776. * @returns {Array} Returns the new array of regrouped elements.
  25777. * @example
  25778. *
  25779. * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
  25780. * // => [['a', 1, true], ['b', 2, false]]
  25781. *
  25782. * _.unzip(zipped);
  25783. * // => [['a', 'b'], [1, 2], [true, false]]
  25784. */
  25785. function unzip(array) {
  25786. if (!(array && array.length)) {
  25787. return [];
  25788. }
  25789. var length = 0;
  25790. array = arrayFilter(array, function(group) {
  25791. if (isArrayLikeObject(group)) {
  25792. length = nativeMax(group.length, length);
  25793. return true;
  25794. }
  25795. });
  25796. return baseTimes(length, function(index) {
  25797. return arrayMap(array, baseProperty(index));
  25798. });
  25799. }
  25800. /**
  25801. * This method is like `_.unzip` except that it accepts `iteratee` to specify
  25802. * how regrouped values should be combined. The iteratee is invoked with the
  25803. * elements of each group: (...group).
  25804. *
  25805. * @static
  25806. * @memberOf _
  25807. * @since 3.8.0
  25808. * @category Array
  25809. * @param {Array} array The array of grouped elements to process.
  25810. * @param {Function} [iteratee=_.identity] The function to combine
  25811. * regrouped values.
  25812. * @returns {Array} Returns the new array of regrouped elements.
  25813. * @example
  25814. *
  25815. * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
  25816. * // => [[1, 10, 100], [2, 20, 200]]
  25817. *
  25818. * _.unzipWith(zipped, _.add);
  25819. * // => [3, 30, 300]
  25820. */
  25821. function unzipWith(array, iteratee) {
  25822. if (!(array && array.length)) {
  25823. return [];
  25824. }
  25825. var result = unzip(array);
  25826. if (iteratee == null) {
  25827. return result;
  25828. }
  25829. return arrayMap(result, function(group) {
  25830. return apply(iteratee, undefined, group);
  25831. });
  25832. }
  25833. /**
  25834. * Creates an array excluding all given values using
  25835. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25836. * for equality comparisons.
  25837. *
  25838. * **Note:** Unlike `_.pull`, this method returns a new array.
  25839. *
  25840. * @static
  25841. * @memberOf _
  25842. * @since 0.1.0
  25843. * @category Array
  25844. * @param {Array} array The array to inspect.
  25845. * @param {...*} [values] The values to exclude.
  25846. * @returns {Array} Returns the new array of filtered values.
  25847. * @see _.difference, _.xor
  25848. * @example
  25849. *
  25850. * _.without([2, 1, 2, 3], 1, 2);
  25851. * // => [3]
  25852. */
  25853. var without = baseRest(function(array, values) {
  25854. return isArrayLikeObject(array)
  25855. ? baseDifference(array, values)
  25856. : [];
  25857. });
  25858. /**
  25859. * Creates an array of unique values that is the
  25860. * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
  25861. * of the given arrays. The order of result values is determined by the order
  25862. * they occur in the arrays.
  25863. *
  25864. * @static
  25865. * @memberOf _
  25866. * @since 2.4.0
  25867. * @category Array
  25868. * @param {...Array} [arrays] The arrays to inspect.
  25869. * @returns {Array} Returns the new array of filtered values.
  25870. * @see _.difference, _.without
  25871. * @example
  25872. *
  25873. * _.xor([2, 1], [2, 3]);
  25874. * // => [1, 3]
  25875. */
  25876. var xor = baseRest(function(arrays) {
  25877. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  25878. });
  25879. /**
  25880. * This method is like `_.xor` except that it accepts `iteratee` which is
  25881. * invoked for each element of each `arrays` to generate the criterion by
  25882. * which by which they're compared. The order of result values is determined
  25883. * by the order they occur in the arrays. The iteratee is invoked with one
  25884. * argument: (value).
  25885. *
  25886. * @static
  25887. * @memberOf _
  25888. * @since 4.0.0
  25889. * @category Array
  25890. * @param {...Array} [arrays] The arrays to inspect.
  25891. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25892. * @returns {Array} Returns the new array of filtered values.
  25893. * @example
  25894. *
  25895. * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  25896. * // => [1.2, 3.4]
  25897. *
  25898. * // The `_.property` iteratee shorthand.
  25899. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  25900. * // => [{ 'x': 2 }]
  25901. */
  25902. var xorBy = baseRest(function(arrays) {
  25903. var iteratee = last(arrays);
  25904. if (isArrayLikeObject(iteratee)) {
  25905. iteratee = undefined;
  25906. }
  25907. return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
  25908. });
  25909. /**
  25910. * This method is like `_.xor` except that it accepts `comparator` which is
  25911. * invoked to compare elements of `arrays`. The order of result values is
  25912. * determined by the order they occur in the arrays. The comparator is invoked
  25913. * with two arguments: (arrVal, othVal).
  25914. *
  25915. * @static
  25916. * @memberOf _
  25917. * @since 4.0.0
  25918. * @category Array
  25919. * @param {...Array} [arrays] The arrays to inspect.
  25920. * @param {Function} [comparator] The comparator invoked per element.
  25921. * @returns {Array} Returns the new array of filtered values.
  25922. * @example
  25923. *
  25924. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  25925. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  25926. *
  25927. * _.xorWith(objects, others, _.isEqual);
  25928. * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  25929. */
  25930. var xorWith = baseRest(function(arrays) {
  25931. var comparator = last(arrays);
  25932. comparator = typeof comparator == 'function' ? comparator : undefined;
  25933. return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
  25934. });
  25935. /**
  25936. * Creates an array of grouped elements, the first of which contains the
  25937. * first elements of the given arrays, the second of which contains the
  25938. * second elements of the given arrays, and so on.
  25939. *
  25940. * @static
  25941. * @memberOf _
  25942. * @since 0.1.0
  25943. * @category Array
  25944. * @param {...Array} [arrays] The arrays to process.
  25945. * @returns {Array} Returns the new array of grouped elements.
  25946. * @example
  25947. *
  25948. * _.zip(['a', 'b'], [1, 2], [true, false]);
  25949. * // => [['a', 1, true], ['b', 2, false]]
  25950. */
  25951. var zip = baseRest(unzip);
  25952. /**
  25953. * This method is like `_.fromPairs` except that it accepts two arrays,
  25954. * one of property identifiers and one of corresponding values.
  25955. *
  25956. * @static
  25957. * @memberOf _
  25958. * @since 0.4.0
  25959. * @category Array
  25960. * @param {Array} [props=[]] The property identifiers.
  25961. * @param {Array} [values=[]] The property values.
  25962. * @returns {Object} Returns the new object.
  25963. * @example
  25964. *
  25965. * _.zipObject(['a', 'b'], [1, 2]);
  25966. * // => { 'a': 1, 'b': 2 }
  25967. */
  25968. function zipObject(props, values) {
  25969. return baseZipObject(props || [], values || [], assignValue);
  25970. }
  25971. /**
  25972. * This method is like `_.zipObject` except that it supports property paths.
  25973. *
  25974. * @static
  25975. * @memberOf _
  25976. * @since 4.1.0
  25977. * @category Array
  25978. * @param {Array} [props=[]] The property identifiers.
  25979. * @param {Array} [values=[]] The property values.
  25980. * @returns {Object} Returns the new object.
  25981. * @example
  25982. *
  25983. * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
  25984. * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
  25985. */
  25986. function zipObjectDeep(props, values) {
  25987. return baseZipObject(props || [], values || [], baseSet);
  25988. }
  25989. /**
  25990. * This method is like `_.zip` except that it accepts `iteratee` to specify
  25991. * how grouped values should be combined. The iteratee is invoked with the
  25992. * elements of each group: (...group).
  25993. *
  25994. * @static
  25995. * @memberOf _
  25996. * @since 3.8.0
  25997. * @category Array
  25998. * @param {...Array} [arrays] The arrays to process.
  25999. * @param {Function} [iteratee=_.identity] The function to combine
  26000. * grouped values.
  26001. * @returns {Array} Returns the new array of grouped elements.
  26002. * @example
  26003. *
  26004. * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
  26005. * return a + b + c;
  26006. * });
  26007. * // => [111, 222]
  26008. */
  26009. var zipWith = baseRest(function(arrays) {
  26010. var length = arrays.length,
  26011. iteratee = length > 1 ? arrays[length - 1] : undefined;
  26012. iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
  26013. return unzipWith(arrays, iteratee);
  26014. });
  26015. /*------------------------------------------------------------------------*/
  26016. /**
  26017. * Creates a `lodash` wrapper instance that wraps `value` with explicit method
  26018. * chain sequences enabled. The result of such sequences must be unwrapped
  26019. * with `_#value`.
  26020. *
  26021. * @static
  26022. * @memberOf _
  26023. * @since 1.3.0
  26024. * @category Seq
  26025. * @param {*} value The value to wrap.
  26026. * @returns {Object} Returns the new `lodash` wrapper instance.
  26027. * @example
  26028. *
  26029. * var users = [
  26030. * { 'user': 'barney', 'age': 36 },
  26031. * { 'user': 'fred', 'age': 40 },
  26032. * { 'user': 'pebbles', 'age': 1 }
  26033. * ];
  26034. *
  26035. * var youngest = _
  26036. * .chain(users)
  26037. * .sortBy('age')
  26038. * .map(function(o) {
  26039. * return o.user + ' is ' + o.age;
  26040. * })
  26041. * .head()
  26042. * .value();
  26043. * // => 'pebbles is 1'
  26044. */
  26045. function chain(value) {
  26046. var result = lodash(value);
  26047. result.__chain__ = true;
  26048. return result;
  26049. }
  26050. /**
  26051. * This method invokes `interceptor` and returns `value`. The interceptor
  26052. * is invoked with one argument; (value). The purpose of this method is to
  26053. * "tap into" a method chain sequence in order to modify intermediate results.
  26054. *
  26055. * @static
  26056. * @memberOf _
  26057. * @since 0.1.0
  26058. * @category Seq
  26059. * @param {*} value The value to provide to `interceptor`.
  26060. * @param {Function} interceptor The function to invoke.
  26061. * @returns {*} Returns `value`.
  26062. * @example
  26063. *
  26064. * _([1, 2, 3])
  26065. * .tap(function(array) {
  26066. * // Mutate input array.
  26067. * array.pop();
  26068. * })
  26069. * .reverse()
  26070. * .value();
  26071. * // => [2, 1]
  26072. */
  26073. function tap(value, interceptor) {
  26074. interceptor(value);
  26075. return value;
  26076. }
  26077. /**
  26078. * This method is like `_.tap` except that it returns the result of `interceptor`.
  26079. * The purpose of this method is to "pass thru" values replacing intermediate
  26080. * results in a method chain sequence.
  26081. *
  26082. * @static
  26083. * @memberOf _
  26084. * @since 3.0.0
  26085. * @category Seq
  26086. * @param {*} value The value to provide to `interceptor`.
  26087. * @param {Function} interceptor The function to invoke.
  26088. * @returns {*} Returns the result of `interceptor`.
  26089. * @example
  26090. *
  26091. * _(' abc ')
  26092. * .chain()
  26093. * .trim()
  26094. * .thru(function(value) {
  26095. * return [value];
  26096. * })
  26097. * .value();
  26098. * // => ['abc']
  26099. */
  26100. function thru(value, interceptor) {
  26101. return interceptor(value);
  26102. }
  26103. /**
  26104. * This method is the wrapper version of `_.at`.
  26105. *
  26106. * @name at
  26107. * @memberOf _
  26108. * @since 1.0.0
  26109. * @category Seq
  26110. * @param {...(string|string[])} [paths] The property paths to pick.
  26111. * @returns {Object} Returns the new `lodash` wrapper instance.
  26112. * @example
  26113. *
  26114. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  26115. *
  26116. * _(object).at(['a[0].b.c', 'a[1]']).value();
  26117. * // => [3, 4]
  26118. */
  26119. var wrapperAt = flatRest(function(paths) {
  26120. var length = paths.length,
  26121. start = length ? paths[0] : 0,
  26122. value = this.__wrapped__,
  26123. interceptor = function(object) { return baseAt(object, paths); };
  26124. if (length > 1 || this.__actions__.length ||
  26125. !(value instanceof LazyWrapper) || !isIndex(start)) {
  26126. return this.thru(interceptor);
  26127. }
  26128. value = value.slice(start, +start + (length ? 1 : 0));
  26129. value.__actions__.push({
  26130. 'func': thru,
  26131. 'args': [interceptor],
  26132. 'thisArg': undefined
  26133. });
  26134. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  26135. if (length && !array.length) {
  26136. array.push(undefined);
  26137. }
  26138. return array;
  26139. });
  26140. });
  26141. /**
  26142. * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
  26143. *
  26144. * @name chain
  26145. * @memberOf _
  26146. * @since 0.1.0
  26147. * @category Seq
  26148. * @returns {Object} Returns the new `lodash` wrapper instance.
  26149. * @example
  26150. *
  26151. * var users = [
  26152. * { 'user': 'barney', 'age': 36 },
  26153. * { 'user': 'fred', 'age': 40 }
  26154. * ];
  26155. *
  26156. * // A sequence without explicit chaining.
  26157. * _(users).head();
  26158. * // => { 'user': 'barney', 'age': 36 }
  26159. *
  26160. * // A sequence with explicit chaining.
  26161. * _(users)
  26162. * .chain()
  26163. * .head()
  26164. * .pick('user')
  26165. * .value();
  26166. * // => { 'user': 'barney' }
  26167. */
  26168. function wrapperChain() {
  26169. return chain(this);
  26170. }
  26171. /**
  26172. * Executes the chain sequence and returns the wrapped result.
  26173. *
  26174. * @name commit
  26175. * @memberOf _
  26176. * @since 3.2.0
  26177. * @category Seq
  26178. * @returns {Object} Returns the new `lodash` wrapper instance.
  26179. * @example
  26180. *
  26181. * var array = [1, 2];
  26182. * var wrapped = _(array).push(3);
  26183. *
  26184. * console.log(array);
  26185. * // => [1, 2]
  26186. *
  26187. * wrapped = wrapped.commit();
  26188. * console.log(array);
  26189. * // => [1, 2, 3]
  26190. *
  26191. * wrapped.last();
  26192. * // => 3
  26193. *
  26194. * console.log(array);
  26195. * // => [1, 2, 3]
  26196. */
  26197. function wrapperCommit() {
  26198. return new LodashWrapper(this.value(), this.__chain__);
  26199. }
  26200. /**
  26201. * Gets the next value on a wrapped object following the
  26202. * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
  26203. *
  26204. * @name next
  26205. * @memberOf _
  26206. * @since 4.0.0
  26207. * @category Seq
  26208. * @returns {Object} Returns the next iterator value.
  26209. * @example
  26210. *
  26211. * var wrapped = _([1, 2]);
  26212. *
  26213. * wrapped.next();
  26214. * // => { 'done': false, 'value': 1 }
  26215. *
  26216. * wrapped.next();
  26217. * // => { 'done': false, 'value': 2 }
  26218. *
  26219. * wrapped.next();
  26220. * // => { 'done': true, 'value': undefined }
  26221. */
  26222. function wrapperNext() {
  26223. if (this.__values__ === undefined) {
  26224. this.__values__ = toArray(this.value());
  26225. }
  26226. var done = this.__index__ >= this.__values__.length,
  26227. value = done ? undefined : this.__values__[this.__index__++];
  26228. return { 'done': done, 'value': value };
  26229. }
  26230. /**
  26231. * Enables the wrapper to be iterable.
  26232. *
  26233. * @name Symbol.iterator
  26234. * @memberOf _
  26235. * @since 4.0.0
  26236. * @category Seq
  26237. * @returns {Object} Returns the wrapper object.
  26238. * @example
  26239. *
  26240. * var wrapped = _([1, 2]);
  26241. *
  26242. * wrapped[Symbol.iterator]() === wrapped;
  26243. * // => true
  26244. *
  26245. * Array.from(wrapped);
  26246. * // => [1, 2]
  26247. */
  26248. function wrapperToIterator() {
  26249. return this;
  26250. }
  26251. /**
  26252. * Creates a clone of the chain sequence planting `value` as the wrapped value.
  26253. *
  26254. * @name plant
  26255. * @memberOf _
  26256. * @since 3.2.0
  26257. * @category Seq
  26258. * @param {*} value The value to plant.
  26259. * @returns {Object} Returns the new `lodash` wrapper instance.
  26260. * @example
  26261. *
  26262. * function square(n) {
  26263. * return n * n;
  26264. * }
  26265. *
  26266. * var wrapped = _([1, 2]).map(square);
  26267. * var other = wrapped.plant([3, 4]);
  26268. *
  26269. * other.value();
  26270. * // => [9, 16]
  26271. *
  26272. * wrapped.value();
  26273. * // => [1, 4]
  26274. */
  26275. function wrapperPlant(value) {
  26276. var result,
  26277. parent = this;
  26278. while (parent instanceof baseLodash) {
  26279. var clone = wrapperClone(parent);
  26280. clone.__index__ = 0;
  26281. clone.__values__ = undefined;
  26282. if (result) {
  26283. previous.__wrapped__ = clone;
  26284. } else {
  26285. result = clone;
  26286. }
  26287. var previous = clone;
  26288. parent = parent.__wrapped__;
  26289. }
  26290. previous.__wrapped__ = value;
  26291. return result;
  26292. }
  26293. /**
  26294. * This method is the wrapper version of `_.reverse`.
  26295. *
  26296. * **Note:** This method mutates the wrapped array.
  26297. *
  26298. * @name reverse
  26299. * @memberOf _
  26300. * @since 0.1.0
  26301. * @category Seq
  26302. * @returns {Object} Returns the new `lodash` wrapper instance.
  26303. * @example
  26304. *
  26305. * var array = [1, 2, 3];
  26306. *
  26307. * _(array).reverse().value()
  26308. * // => [3, 2, 1]
  26309. *
  26310. * console.log(array);
  26311. * // => [3, 2, 1]
  26312. */
  26313. function wrapperReverse() {
  26314. var value = this.__wrapped__;
  26315. if (value instanceof LazyWrapper) {
  26316. var wrapped = value;
  26317. if (this.__actions__.length) {
  26318. wrapped = new LazyWrapper(this);
  26319. }
  26320. wrapped = wrapped.reverse();
  26321. wrapped.__actions__.push({
  26322. 'func': thru,
  26323. 'args': [reverse],
  26324. 'thisArg': undefined
  26325. });
  26326. return new LodashWrapper(wrapped, this.__chain__);
  26327. }
  26328. return this.thru(reverse);
  26329. }
  26330. /**
  26331. * Executes the chain sequence to resolve the unwrapped value.
  26332. *
  26333. * @name value
  26334. * @memberOf _
  26335. * @since 0.1.0
  26336. * @alias toJSON, valueOf
  26337. * @category Seq
  26338. * @returns {*} Returns the resolved unwrapped value.
  26339. * @example
  26340. *
  26341. * _([1, 2, 3]).value();
  26342. * // => [1, 2, 3]
  26343. */
  26344. function wrapperValue() {
  26345. return baseWrapperValue(this.__wrapped__, this.__actions__);
  26346. }
  26347. /*------------------------------------------------------------------------*/
  26348. /**
  26349. * Creates an object composed of keys generated from the results of running
  26350. * each element of `collection` thru `iteratee`. The corresponding value of
  26351. * each key is the number of times the key was returned by `iteratee`. The
  26352. * iteratee is invoked with one argument: (value).
  26353. *
  26354. * @static
  26355. * @memberOf _
  26356. * @since 0.5.0
  26357. * @category Collection
  26358. * @param {Array|Object} collection The collection to iterate over.
  26359. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  26360. * @returns {Object} Returns the composed aggregate object.
  26361. * @example
  26362. *
  26363. * _.countBy([6.1, 4.2, 6.3], Math.floor);
  26364. * // => { '4': 1, '6': 2 }
  26365. *
  26366. * // The `_.property` iteratee shorthand.
  26367. * _.countBy(['one', 'two', 'three'], 'length');
  26368. * // => { '3': 2, '5': 1 }
  26369. */
  26370. var countBy = createAggregator(function(result, value, key) {
  26371. if (hasOwnProperty.call(result, key)) {
  26372. ++result[key];
  26373. } else {
  26374. baseAssignValue(result, key, 1);
  26375. }
  26376. });
  26377. /**
  26378. * Checks if `predicate` returns truthy for **all** elements of `collection`.
  26379. * Iteration is stopped once `predicate` returns falsey. The predicate is
  26380. * invoked with three arguments: (value, index|key, collection).
  26381. *
  26382. * **Note:** This method returns `true` for
  26383. * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
  26384. * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
  26385. * elements of empty collections.
  26386. *
  26387. * @static
  26388. * @memberOf _
  26389. * @since 0.1.0
  26390. * @category Collection
  26391. * @param {Array|Object} collection The collection to iterate over.
  26392. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26393. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  26394. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  26395. * else `false`.
  26396. * @example
  26397. *
  26398. * _.every([true, 1, null, 'yes'], Boolean);
  26399. * // => false
  26400. *
  26401. * var users = [
  26402. * { 'user': 'barney', 'age': 36, 'active': false },
  26403. * { 'user': 'fred', 'age': 40, 'active': false }
  26404. * ];
  26405. *
  26406. * // The `_.matches` iteratee shorthand.
  26407. * _.every(users, { 'user': 'barney', 'active': false });
  26408. * // => false
  26409. *
  26410. * // The `_.matchesProperty` iteratee shorthand.
  26411. * _.every(users, ['active', false]);
  26412. * // => true
  26413. *
  26414. * // The `_.property` iteratee shorthand.
  26415. * _.every(users, 'active');
  26416. * // => false
  26417. */
  26418. function every(collection, predicate, guard) {
  26419. var func = isArray(collection) ? arrayEvery : baseEvery;
  26420. if (guard && isIterateeCall(collection, predicate, guard)) {
  26421. predicate = undefined;
  26422. }
  26423. return func(collection, getIteratee(predicate, 3));
  26424. }
  26425. /**
  26426. * Iterates over elements of `collection`, returning an array of all elements
  26427. * `predicate` returns truthy for. The predicate is invoked with three
  26428. * arguments: (value, index|key, collection).
  26429. *
  26430. * **Note:** Unlike `_.remove`, this method returns a new array.
  26431. *
  26432. * @static
  26433. * @memberOf _
  26434. * @since 0.1.0
  26435. * @category Collection
  26436. * @param {Array|Object} collection The collection to iterate over.
  26437. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26438. * @returns {Array} Returns the new filtered array.
  26439. * @see _.reject
  26440. * @example
  26441. *
  26442. * var users = [
  26443. * { 'user': 'barney', 'age': 36, 'active': true },
  26444. * { 'user': 'fred', 'age': 40, 'active': false }
  26445. * ];
  26446. *
  26447. * _.filter(users, function(o) { return !o.active; });
  26448. * // => objects for ['fred']
  26449. *
  26450. * // The `_.matches` iteratee shorthand.
  26451. * _.filter(users, { 'age': 36, 'active': true });
  26452. * // => objects for ['barney']
  26453. *
  26454. * // The `_.matchesProperty` iteratee shorthand.
  26455. * _.filter(users, ['active', false]);
  26456. * // => objects for ['fred']
  26457. *
  26458. * // The `_.property` iteratee shorthand.
  26459. * _.filter(users, 'active');
  26460. * // => objects for ['barney']
  26461. */
  26462. function filter(collection, predicate) {
  26463. var func = isArray(collection) ? arrayFilter : baseFilter;
  26464. return func(collection, getIteratee(predicate, 3));
  26465. }
  26466. /**
  26467. * Iterates over elements of `collection`, returning the first element
  26468. * `predicate` returns truthy for. The predicate is invoked with three
  26469. * arguments: (value, index|key, collection).
  26470. *
  26471. * @static
  26472. * @memberOf _
  26473. * @since 0.1.0
  26474. * @category Collection
  26475. * @param {Array|Object} collection The collection to inspect.
  26476. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26477. * @param {number} [fromIndex=0] The index to search from.
  26478. * @returns {*} Returns the matched element, else `undefined`.
  26479. * @example
  26480. *
  26481. * var users = [
  26482. * { 'user': 'barney', 'age': 36, 'active': true },
  26483. * { 'user': 'fred', 'age': 40, 'active': false },
  26484. * { 'user': 'pebbles', 'age': 1, 'active': true }
  26485. * ];
  26486. *
  26487. * _.find(users, function(o) { return o.age < 40; });
  26488. * // => object for 'barney'
  26489. *
  26490. * // The `_.matches` iteratee shorthand.
  26491. * _.find(users, { 'age': 1, 'active': true });
  26492. * // => object for 'pebbles'
  26493. *
  26494. * // The `_.matchesProperty` iteratee shorthand.
  26495. * _.find(users, ['active', false]);
  26496. * // => object for 'fred'
  26497. *
  26498. * // The `_.property` iteratee shorthand.
  26499. * _.find(users, 'active');
  26500. * // => object for 'barney'
  26501. */
  26502. var find = createFind(findIndex);
  26503. /**
  26504. * This method is like `_.find` except that it iterates over elements of
  26505. * `collection` from right to left.
  26506. *
  26507. * @static
  26508. * @memberOf _
  26509. * @since 2.0.0
  26510. * @category Collection
  26511. * @param {Array|Object} collection The collection to inspect.
  26512. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26513. * @param {number} [fromIndex=collection.length-1] The index to search from.
  26514. * @returns {*} Returns the matched element, else `undefined`.
  26515. * @example
  26516. *
  26517. * _.findLast([1, 2, 3, 4], function(n) {
  26518. * return n % 2 == 1;
  26519. * });
  26520. * // => 3
  26521. */
  26522. var findLast = createFind(findLastIndex);
  26523. /**
  26524. * Creates a flattened array of values by running each element in `collection`
  26525. * thru `iteratee` and flattening the mapped results. The iteratee is invoked
  26526. * with three arguments: (value, index|key, collection).
  26527. *
  26528. * @static
  26529. * @memberOf _
  26530. * @since 4.0.0
  26531. * @category Collection
  26532. * @param {Array|Object} collection The collection to iterate over.
  26533. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26534. * @returns {Array} Returns the new flattened array.
  26535. * @example
  26536. *
  26537. * function duplicate(n) {
  26538. * return [n, n];
  26539. * }
  26540. *
  26541. * _.flatMap([1, 2], duplicate);
  26542. * // => [1, 1, 2, 2]
  26543. */
  26544. function flatMap(collection, iteratee) {
  26545. return baseFlatten(map(collection, iteratee), 1);
  26546. }
  26547. /**
  26548. * This method is like `_.flatMap` except that it recursively flattens the
  26549. * mapped results.
  26550. *
  26551. * @static
  26552. * @memberOf _
  26553. * @since 4.7.0
  26554. * @category Collection
  26555. * @param {Array|Object} collection The collection to iterate over.
  26556. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26557. * @returns {Array} Returns the new flattened array.
  26558. * @example
  26559. *
  26560. * function duplicate(n) {
  26561. * return [[[n, n]]];
  26562. * }
  26563. *
  26564. * _.flatMapDeep([1, 2], duplicate);
  26565. * // => [1, 1, 2, 2]
  26566. */
  26567. function flatMapDeep(collection, iteratee) {
  26568. return baseFlatten(map(collection, iteratee), INFINITY);
  26569. }
  26570. /**
  26571. * This method is like `_.flatMap` except that it recursively flattens the
  26572. * mapped results up to `depth` times.
  26573. *
  26574. * @static
  26575. * @memberOf _
  26576. * @since 4.7.0
  26577. * @category Collection
  26578. * @param {Array|Object} collection The collection to iterate over.
  26579. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26580. * @param {number} [depth=1] The maximum recursion depth.
  26581. * @returns {Array} Returns the new flattened array.
  26582. * @example
  26583. *
  26584. * function duplicate(n) {
  26585. * return [[[n, n]]];
  26586. * }
  26587. *
  26588. * _.flatMapDepth([1, 2], duplicate, 2);
  26589. * // => [[1, 1], [2, 2]]
  26590. */
  26591. function flatMapDepth(collection, iteratee, depth) {
  26592. depth = depth === undefined ? 1 : toInteger(depth);
  26593. return baseFlatten(map(collection, iteratee), depth);
  26594. }
  26595. /**
  26596. * Iterates over elements of `collection` and invokes `iteratee` for each element.
  26597. * The iteratee is invoked with three arguments: (value, index|key, collection).
  26598. * Iteratee functions may exit iteration early by explicitly returning `false`.
  26599. *
  26600. * **Note:** As with other "Collections" methods, objects with a "length"
  26601. * property are iterated like arrays. To avoid this behavior use `_.forIn`
  26602. * or `_.forOwn` for object iteration.
  26603. *
  26604. * @static
  26605. * @memberOf _
  26606. * @since 0.1.0
  26607. * @alias each
  26608. * @category Collection
  26609. * @param {Array|Object} collection The collection to iterate over.
  26610. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26611. * @returns {Array|Object} Returns `collection`.
  26612. * @see _.forEachRight
  26613. * @example
  26614. *
  26615. * _.forEach([1, 2], function(value) {
  26616. * console.log(value);
  26617. * });
  26618. * // => Logs `1` then `2`.
  26619. *
  26620. * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
  26621. * console.log(key);
  26622. * });
  26623. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  26624. */
  26625. function forEach(collection, iteratee) {
  26626. var func = isArray(collection) ? arrayEach : baseEach;
  26627. return func(collection, getIteratee(iteratee, 3));
  26628. }
  26629. /**
  26630. * This method is like `_.forEach` except that it iterates over elements of
  26631. * `collection` from right to left.
  26632. *
  26633. * @static
  26634. * @memberOf _
  26635. * @since 2.0.0
  26636. * @alias eachRight
  26637. * @category Collection
  26638. * @param {Array|Object} collection The collection to iterate over.
  26639. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26640. * @returns {Array|Object} Returns `collection`.
  26641. * @see _.forEach
  26642. * @example
  26643. *
  26644. * _.forEachRight([1, 2], function(value) {
  26645. * console.log(value);
  26646. * });
  26647. * // => Logs `2` then `1`.
  26648. */
  26649. function forEachRight(collection, iteratee) {
  26650. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  26651. return func(collection, getIteratee(iteratee, 3));
  26652. }
  26653. /**
  26654. * Creates an object composed of keys generated from the results of running
  26655. * each element of `collection` thru `iteratee`. The order of grouped values
  26656. * is determined by the order they occur in `collection`. The corresponding
  26657. * value of each key is an array of elements responsible for generating the
  26658. * key. The iteratee is invoked with one argument: (value).
  26659. *
  26660. * @static
  26661. * @memberOf _
  26662. * @since 0.1.0
  26663. * @category Collection
  26664. * @param {Array|Object} collection The collection to iterate over.
  26665. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  26666. * @returns {Object} Returns the composed aggregate object.
  26667. * @example
  26668. *
  26669. * _.groupBy([6.1, 4.2, 6.3], Math.floor);
  26670. * // => { '4': [4.2], '6': [6.1, 6.3] }
  26671. *
  26672. * // The `_.property` iteratee shorthand.
  26673. * _.groupBy(['one', 'two', 'three'], 'length');
  26674. * // => { '3': ['one', 'two'], '5': ['three'] }
  26675. */
  26676. var groupBy = createAggregator(function(result, value, key) {
  26677. if (hasOwnProperty.call(result, key)) {
  26678. result[key].push(value);
  26679. } else {
  26680. baseAssignValue(result, key, [value]);
  26681. }
  26682. });
  26683. /**
  26684. * Checks if `value` is in `collection`. If `collection` is a string, it's
  26685. * checked for a substring of `value`, otherwise
  26686. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26687. * is used for equality comparisons. If `fromIndex` is negative, it's used as
  26688. * the offset from the end of `collection`.
  26689. *
  26690. * @static
  26691. * @memberOf _
  26692. * @since 0.1.0
  26693. * @category Collection
  26694. * @param {Array|Object|string} collection The collection to inspect.
  26695. * @param {*} value The value to search for.
  26696. * @param {number} [fromIndex=0] The index to search from.
  26697. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  26698. * @returns {boolean} Returns `true` if `value` is found, else `false`.
  26699. * @example
  26700. *
  26701. * _.includes([1, 2, 3], 1);
  26702. * // => true
  26703. *
  26704. * _.includes([1, 2, 3], 1, 2);
  26705. * // => false
  26706. *
  26707. * _.includes({ 'a': 1, 'b': 2 }, 1);
  26708. * // => true
  26709. *
  26710. * _.includes('abcd', 'bc');
  26711. * // => true
  26712. */
  26713. function includes(collection, value, fromIndex, guard) {
  26714. collection = isArrayLike(collection) ? collection : values(collection);
  26715. fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
  26716. var length = collection.length;
  26717. if (fromIndex < 0) {
  26718. fromIndex = nativeMax(length + fromIndex, 0);
  26719. }
  26720. return isString(collection)
  26721. ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
  26722. : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
  26723. }
  26724. /**
  26725. * Invokes the method at `path` of each element in `collection`, returning
  26726. * an array of the results of each invoked method. Any additional arguments
  26727. * are provided to each invoked method. If `path` is a function, it's invoked
  26728. * for, and `this` bound to, each element in `collection`.
  26729. *
  26730. * @static
  26731. * @memberOf _
  26732. * @since 4.0.0
  26733. * @category Collection
  26734. * @param {Array|Object} collection The collection to iterate over.
  26735. * @param {Array|Function|string} path The path of the method to invoke or
  26736. * the function invoked per iteration.
  26737. * @param {...*} [args] The arguments to invoke each method with.
  26738. * @returns {Array} Returns the array of results.
  26739. * @example
  26740. *
  26741. * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
  26742. * // => [[1, 5, 7], [1, 2, 3]]
  26743. *
  26744. * _.invokeMap([123, 456], String.prototype.split, '');
  26745. * // => [['1', '2', '3'], ['4', '5', '6']]
  26746. */
  26747. var invokeMap = baseRest(function(collection, path, args) {
  26748. var index = -1,
  26749. isFunc = typeof path == 'function',
  26750. result = isArrayLike(collection) ? Array(collection.length) : [];
  26751. baseEach(collection, function(value) {
  26752. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  26753. });
  26754. return result;
  26755. });
  26756. /**
  26757. * Creates an object composed of keys generated from the results of running
  26758. * each element of `collection` thru `iteratee`. The corresponding value of
  26759. * each key is the last element responsible for generating the key. The
  26760. * iteratee is invoked with one argument: (value).
  26761. *
  26762. * @static
  26763. * @memberOf _
  26764. * @since 4.0.0
  26765. * @category Collection
  26766. * @param {Array|Object} collection The collection to iterate over.
  26767. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  26768. * @returns {Object} Returns the composed aggregate object.
  26769. * @example
  26770. *
  26771. * var array = [
  26772. * { 'dir': 'left', 'code': 97 },
  26773. * { 'dir': 'right', 'code': 100 }
  26774. * ];
  26775. *
  26776. * _.keyBy(array, function(o) {
  26777. * return String.fromCharCode(o.code);
  26778. * });
  26779. * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
  26780. *
  26781. * _.keyBy(array, 'dir');
  26782. * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
  26783. */
  26784. var keyBy = createAggregator(function(result, value, key) {
  26785. baseAssignValue(result, key, value);
  26786. });
  26787. /**
  26788. * Creates an array of values by running each element in `collection` thru
  26789. * `iteratee`. The iteratee is invoked with three arguments:
  26790. * (value, index|key, collection).
  26791. *
  26792. * Many lodash methods are guarded to work as iteratees for methods like
  26793. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  26794. *
  26795. * The guarded methods are:
  26796. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  26797. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  26798. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  26799. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  26800. *
  26801. * @static
  26802. * @memberOf _
  26803. * @since 0.1.0
  26804. * @category Collection
  26805. * @param {Array|Object} collection The collection to iterate over.
  26806. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26807. * @returns {Array} Returns the new mapped array.
  26808. * @example
  26809. *
  26810. * function square(n) {
  26811. * return n * n;
  26812. * }
  26813. *
  26814. * _.map([4, 8], square);
  26815. * // => [16, 64]
  26816. *
  26817. * _.map({ 'a': 4, 'b': 8 }, square);
  26818. * // => [16, 64] (iteration order is not guaranteed)
  26819. *
  26820. * var users = [
  26821. * { 'user': 'barney' },
  26822. * { 'user': 'fred' }
  26823. * ];
  26824. *
  26825. * // The `_.property` iteratee shorthand.
  26826. * _.map(users, 'user');
  26827. * // => ['barney', 'fred']
  26828. */
  26829. function map(collection, iteratee) {
  26830. var func = isArray(collection) ? arrayMap : baseMap;
  26831. return func(collection, getIteratee(iteratee, 3));
  26832. }
  26833. /**
  26834. * This method is like `_.sortBy` except that it allows specifying the sort
  26835. * orders of the iteratees to sort by. If `orders` is unspecified, all values
  26836. * are sorted in ascending order. Otherwise, specify an order of "desc" for
  26837. * descending or "asc" for ascending sort order of corresponding values.
  26838. *
  26839. * @static
  26840. * @memberOf _
  26841. * @since 4.0.0
  26842. * @category Collection
  26843. * @param {Array|Object} collection The collection to iterate over.
  26844. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
  26845. * The iteratees to sort by.
  26846. * @param {string[]} [orders] The sort orders of `iteratees`.
  26847. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  26848. * @returns {Array} Returns the new sorted array.
  26849. * @example
  26850. *
  26851. * var users = [
  26852. * { 'user': 'fred', 'age': 48 },
  26853. * { 'user': 'barney', 'age': 34 },
  26854. * { 'user': 'fred', 'age': 40 },
  26855. * { 'user': 'barney', 'age': 36 }
  26856. * ];
  26857. *
  26858. * // Sort by `user` in ascending order and by `age` in descending order.
  26859. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
  26860. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  26861. */
  26862. function orderBy(collection, iteratees, orders, guard) {
  26863. if (collection == null) {
  26864. return [];
  26865. }
  26866. if (!isArray(iteratees)) {
  26867. iteratees = iteratees == null ? [] : [iteratees];
  26868. }
  26869. orders = guard ? undefined : orders;
  26870. if (!isArray(orders)) {
  26871. orders = orders == null ? [] : [orders];
  26872. }
  26873. return baseOrderBy(collection, iteratees, orders);
  26874. }
  26875. /**
  26876. * Creates an array of elements split into two groups, the first of which
  26877. * contains elements `predicate` returns truthy for, the second of which
  26878. * contains elements `predicate` returns falsey for. The predicate is
  26879. * invoked with one argument: (value).
  26880. *
  26881. * @static
  26882. * @memberOf _
  26883. * @since 3.0.0
  26884. * @category Collection
  26885. * @param {Array|Object} collection The collection to iterate over.
  26886. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26887. * @returns {Array} Returns the array of grouped elements.
  26888. * @example
  26889. *
  26890. * var users = [
  26891. * { 'user': 'barney', 'age': 36, 'active': false },
  26892. * { 'user': 'fred', 'age': 40, 'active': true },
  26893. * { 'user': 'pebbles', 'age': 1, 'active': false }
  26894. * ];
  26895. *
  26896. * _.partition(users, function(o) { return o.active; });
  26897. * // => objects for [['fred'], ['barney', 'pebbles']]
  26898. *
  26899. * // The `_.matches` iteratee shorthand.
  26900. * _.partition(users, { 'age': 1, 'active': false });
  26901. * // => objects for [['pebbles'], ['barney', 'fred']]
  26902. *
  26903. * // The `_.matchesProperty` iteratee shorthand.
  26904. * _.partition(users, ['active', false]);
  26905. * // => objects for [['barney', 'pebbles'], ['fred']]
  26906. *
  26907. * // The `_.property` iteratee shorthand.
  26908. * _.partition(users, 'active');
  26909. * // => objects for [['fred'], ['barney', 'pebbles']]
  26910. */
  26911. var partition = createAggregator(function(result, value, key) {
  26912. result[key ? 0 : 1].push(value);
  26913. }, function() { return [[], []]; });
  26914. /**
  26915. * Reduces `collection` to a value which is the accumulated result of running
  26916. * each element in `collection` thru `iteratee`, where each successive
  26917. * invocation is supplied the return value of the previous. If `accumulator`
  26918. * is not given, the first element of `collection` is used as the initial
  26919. * value. The iteratee is invoked with four arguments:
  26920. * (accumulator, value, index|key, collection).
  26921. *
  26922. * Many lodash methods are guarded to work as iteratees for methods like
  26923. * `_.reduce`, `_.reduceRight`, and `_.transform`.
  26924. *
  26925. * The guarded methods are:
  26926. * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
  26927. * and `sortBy`
  26928. *
  26929. * @static
  26930. * @memberOf _
  26931. * @since 0.1.0
  26932. * @category Collection
  26933. * @param {Array|Object} collection The collection to iterate over.
  26934. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26935. * @param {*} [accumulator] The initial value.
  26936. * @returns {*} Returns the accumulated value.
  26937. * @see _.reduceRight
  26938. * @example
  26939. *
  26940. * _.reduce([1, 2], function(sum, n) {
  26941. * return sum + n;
  26942. * }, 0);
  26943. * // => 3
  26944. *
  26945. * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  26946. * (result[value] || (result[value] = [])).push(key);
  26947. * return result;
  26948. * }, {});
  26949. * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
  26950. */
  26951. function reduce(collection, iteratee, accumulator) {
  26952. var func = isArray(collection) ? arrayReduce : baseReduce,
  26953. initAccum = arguments.length < 3;
  26954. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
  26955. }
  26956. /**
  26957. * This method is like `_.reduce` except that it iterates over elements of
  26958. * `collection` from right to left.
  26959. *
  26960. * @static
  26961. * @memberOf _
  26962. * @since 0.1.0
  26963. * @category Collection
  26964. * @param {Array|Object} collection The collection to iterate over.
  26965. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26966. * @param {*} [accumulator] The initial value.
  26967. * @returns {*} Returns the accumulated value.
  26968. * @see _.reduce
  26969. * @example
  26970. *
  26971. * var array = [[0, 1], [2, 3], [4, 5]];
  26972. *
  26973. * _.reduceRight(array, function(flattened, other) {
  26974. * return flattened.concat(other);
  26975. * }, []);
  26976. * // => [4, 5, 2, 3, 0, 1]
  26977. */
  26978. function reduceRight(collection, iteratee, accumulator) {
  26979. var func = isArray(collection) ? arrayReduceRight : baseReduce,
  26980. initAccum = arguments.length < 3;
  26981. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
  26982. }
  26983. /**
  26984. * The opposite of `_.filter`; this method returns the elements of `collection`
  26985. * that `predicate` does **not** return truthy for.
  26986. *
  26987. * @static
  26988. * @memberOf _
  26989. * @since 0.1.0
  26990. * @category Collection
  26991. * @param {Array|Object} collection The collection to iterate over.
  26992. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26993. * @returns {Array} Returns the new filtered array.
  26994. * @see _.filter
  26995. * @example
  26996. *
  26997. * var users = [
  26998. * { 'user': 'barney', 'age': 36, 'active': false },
  26999. * { 'user': 'fred', 'age': 40, 'active': true }
  27000. * ];
  27001. *
  27002. * _.reject(users, function(o) { return !o.active; });
  27003. * // => objects for ['fred']
  27004. *
  27005. * // The `_.matches` iteratee shorthand.
  27006. * _.reject(users, { 'age': 40, 'active': true });
  27007. * // => objects for ['barney']
  27008. *
  27009. * // The `_.matchesProperty` iteratee shorthand.
  27010. * _.reject(users, ['active', false]);
  27011. * // => objects for ['fred']
  27012. *
  27013. * // The `_.property` iteratee shorthand.
  27014. * _.reject(users, 'active');
  27015. * // => objects for ['barney']
  27016. */
  27017. function reject(collection, predicate) {
  27018. var func = isArray(collection) ? arrayFilter : baseFilter;
  27019. return func(collection, negate(getIteratee(predicate, 3)));
  27020. }
  27021. /**
  27022. * Gets a random element from `collection`.
  27023. *
  27024. * @static
  27025. * @memberOf _
  27026. * @since 2.0.0
  27027. * @category Collection
  27028. * @param {Array|Object} collection The collection to sample.
  27029. * @returns {*} Returns the random element.
  27030. * @example
  27031. *
  27032. * _.sample([1, 2, 3, 4]);
  27033. * // => 2
  27034. */
  27035. function sample(collection) {
  27036. var func = isArray(collection) ? arraySample : baseSample;
  27037. return func(collection);
  27038. }
  27039. /**
  27040. * Gets `n` random elements at unique keys from `collection` up to the
  27041. * size of `collection`.
  27042. *
  27043. * @static
  27044. * @memberOf _
  27045. * @since 4.0.0
  27046. * @category Collection
  27047. * @param {Array|Object} collection The collection to sample.
  27048. * @param {number} [n=1] The number of elements to sample.
  27049. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27050. * @returns {Array} Returns the random elements.
  27051. * @example
  27052. *
  27053. * _.sampleSize([1, 2, 3], 2);
  27054. * // => [3, 1]
  27055. *
  27056. * _.sampleSize([1, 2, 3], 4);
  27057. * // => [2, 3, 1]
  27058. */
  27059. function sampleSize(collection, n, guard) {
  27060. if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
  27061. n = 1;
  27062. } else {
  27063. n = toInteger(n);
  27064. }
  27065. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  27066. return func(collection, n);
  27067. }
  27068. /**
  27069. * Creates an array of shuffled values, using a version of the
  27070. * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
  27071. *
  27072. * @static
  27073. * @memberOf _
  27074. * @since 0.1.0
  27075. * @category Collection
  27076. * @param {Array|Object} collection The collection to shuffle.
  27077. * @returns {Array} Returns the new shuffled array.
  27078. * @example
  27079. *
  27080. * _.shuffle([1, 2, 3, 4]);
  27081. * // => [4, 1, 3, 2]
  27082. */
  27083. function shuffle(collection) {
  27084. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  27085. return func(collection);
  27086. }
  27087. /**
  27088. * Gets the size of `collection` by returning its length for array-like
  27089. * values or the number of own enumerable string keyed properties for objects.
  27090. *
  27091. * @static
  27092. * @memberOf _
  27093. * @since 0.1.0
  27094. * @category Collection
  27095. * @param {Array|Object|string} collection The collection to inspect.
  27096. * @returns {number} Returns the collection size.
  27097. * @example
  27098. *
  27099. * _.size([1, 2, 3]);
  27100. * // => 3
  27101. *
  27102. * _.size({ 'a': 1, 'b': 2 });
  27103. * // => 2
  27104. *
  27105. * _.size('pebbles');
  27106. * // => 7
  27107. */
  27108. function size(collection) {
  27109. if (collection == null) {
  27110. return 0;
  27111. }
  27112. if (isArrayLike(collection)) {
  27113. return isString(collection) ? stringSize(collection) : collection.length;
  27114. }
  27115. var tag = getTag(collection);
  27116. if (tag == mapTag || tag == setTag) {
  27117. return collection.size;
  27118. }
  27119. return baseKeys(collection).length;
  27120. }
  27121. /**
  27122. * Checks if `predicate` returns truthy for **any** element of `collection`.
  27123. * Iteration is stopped once `predicate` returns truthy. The predicate is
  27124. * invoked with three arguments: (value, index|key, collection).
  27125. *
  27126. * @static
  27127. * @memberOf _
  27128. * @since 0.1.0
  27129. * @category Collection
  27130. * @param {Array|Object} collection The collection to iterate over.
  27131. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27132. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27133. * @returns {boolean} Returns `true` if any element passes the predicate check,
  27134. * else `false`.
  27135. * @example
  27136. *
  27137. * _.some([null, 0, 'yes', false], Boolean);
  27138. * // => true
  27139. *
  27140. * var users = [
  27141. * { 'user': 'barney', 'active': true },
  27142. * { 'user': 'fred', 'active': false }
  27143. * ];
  27144. *
  27145. * // The `_.matches` iteratee shorthand.
  27146. * _.some(users, { 'user': 'barney', 'active': false });
  27147. * // => false
  27148. *
  27149. * // The `_.matchesProperty` iteratee shorthand.
  27150. * _.some(users, ['active', false]);
  27151. * // => true
  27152. *
  27153. * // The `_.property` iteratee shorthand.
  27154. * _.some(users, 'active');
  27155. * // => true
  27156. */
  27157. function some(collection, predicate, guard) {
  27158. var func = isArray(collection) ? arraySome : baseSome;
  27159. if (guard && isIterateeCall(collection, predicate, guard)) {
  27160. predicate = undefined;
  27161. }
  27162. return func(collection, getIteratee(predicate, 3));
  27163. }
  27164. /**
  27165. * Creates an array of elements, sorted in ascending order by the results of
  27166. * running each element in a collection thru each iteratee. This method
  27167. * performs a stable sort, that is, it preserves the original sort order of
  27168. * equal elements. The iteratees are invoked with one argument: (value).
  27169. *
  27170. * @static
  27171. * @memberOf _
  27172. * @since 0.1.0
  27173. * @category Collection
  27174. * @param {Array|Object} collection The collection to iterate over.
  27175. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  27176. * The iteratees to sort by.
  27177. * @returns {Array} Returns the new sorted array.
  27178. * @example
  27179. *
  27180. * var users = [
  27181. * { 'user': 'fred', 'age': 48 },
  27182. * { 'user': 'barney', 'age': 36 },
  27183. * { 'user': 'fred', 'age': 40 },
  27184. * { 'user': 'barney', 'age': 34 }
  27185. * ];
  27186. *
  27187. * _.sortBy(users, [function(o) { return o.user; }]);
  27188. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  27189. *
  27190. * _.sortBy(users, ['user', 'age']);
  27191. * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
  27192. */
  27193. var sortBy = baseRest(function(collection, iteratees) {
  27194. if (collection == null) {
  27195. return [];
  27196. }
  27197. var length = iteratees.length;
  27198. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  27199. iteratees = [];
  27200. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  27201. iteratees = [iteratees[0]];
  27202. }
  27203. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  27204. });
  27205. /*------------------------------------------------------------------------*/
  27206. /**
  27207. * Gets the timestamp of the number of milliseconds that have elapsed since
  27208. * the Unix epoch (1 January 1970 00:00:00 UTC).
  27209. *
  27210. * @static
  27211. * @memberOf _
  27212. * @since 2.4.0
  27213. * @category Date
  27214. * @returns {number} Returns the timestamp.
  27215. * @example
  27216. *
  27217. * _.defer(function(stamp) {
  27218. * console.log(_.now() - stamp);
  27219. * }, _.now());
  27220. * // => Logs the number of milliseconds it took for the deferred invocation.
  27221. */
  27222. var now = ctxNow || function() {
  27223. return root.Date.now();
  27224. };
  27225. /*------------------------------------------------------------------------*/
  27226. /**
  27227. * The opposite of `_.before`; this method creates a function that invokes
  27228. * `func` once it's called `n` or more times.
  27229. *
  27230. * @static
  27231. * @memberOf _
  27232. * @since 0.1.0
  27233. * @category Function
  27234. * @param {number} n The number of calls before `func` is invoked.
  27235. * @param {Function} func The function to restrict.
  27236. * @returns {Function} Returns the new restricted function.
  27237. * @example
  27238. *
  27239. * var saves = ['profile', 'settings'];
  27240. *
  27241. * var done = _.after(saves.length, function() {
  27242. * console.log('done saving!');
  27243. * });
  27244. *
  27245. * _.forEach(saves, function(type) {
  27246. * asyncSave({ 'type': type, 'complete': done });
  27247. * });
  27248. * // => Logs 'done saving!' after the two async saves have completed.
  27249. */
  27250. function after(n, func) {
  27251. if (typeof func != 'function') {
  27252. throw new TypeError(FUNC_ERROR_TEXT);
  27253. }
  27254. n = toInteger(n);
  27255. return function() {
  27256. if (--n < 1) {
  27257. return func.apply(this, arguments);
  27258. }
  27259. };
  27260. }
  27261. /**
  27262. * Creates a function that invokes `func`, with up to `n` arguments,
  27263. * ignoring any additional arguments.
  27264. *
  27265. * @static
  27266. * @memberOf _
  27267. * @since 3.0.0
  27268. * @category Function
  27269. * @param {Function} func The function to cap arguments for.
  27270. * @param {number} [n=func.length] The arity cap.
  27271. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27272. * @returns {Function} Returns the new capped function.
  27273. * @example
  27274. *
  27275. * _.map(['6', '8', '10'], _.ary(parseInt, 1));
  27276. * // => [6, 8, 10]
  27277. */
  27278. function ary(func, n, guard) {
  27279. n = guard ? undefined : n;
  27280. n = (func && n == null) ? func.length : n;
  27281. return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
  27282. }
  27283. /**
  27284. * Creates a function that invokes `func`, with the `this` binding and arguments
  27285. * of the created function, while it's called less than `n` times. Subsequent
  27286. * calls to the created function return the result of the last `func` invocation.
  27287. *
  27288. * @static
  27289. * @memberOf _
  27290. * @since 3.0.0
  27291. * @category Function
  27292. * @param {number} n The number of calls at which `func` is no longer invoked.
  27293. * @param {Function} func The function to restrict.
  27294. * @returns {Function} Returns the new restricted function.
  27295. * @example
  27296. *
  27297. * jQuery(element).on('click', _.before(5, addContactToList));
  27298. * // => Allows adding up to 4 contacts to the list.
  27299. */
  27300. function before(n, func) {
  27301. var result;
  27302. if (typeof func != 'function') {
  27303. throw new TypeError(FUNC_ERROR_TEXT);
  27304. }
  27305. n = toInteger(n);
  27306. return function() {
  27307. if (--n > 0) {
  27308. result = func.apply(this, arguments);
  27309. }
  27310. if (n <= 1) {
  27311. func = undefined;
  27312. }
  27313. return result;
  27314. };
  27315. }
  27316. /**
  27317. * Creates a function that invokes `func` with the `this` binding of `thisArg`
  27318. * and `partials` prepended to the arguments it receives.
  27319. *
  27320. * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
  27321. * may be used as a placeholder for partially applied arguments.
  27322. *
  27323. * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
  27324. * property of bound functions.
  27325. *
  27326. * @static
  27327. * @memberOf _
  27328. * @since 0.1.0
  27329. * @category Function
  27330. * @param {Function} func The function to bind.
  27331. * @param {*} thisArg The `this` binding of `func`.
  27332. * @param {...*} [partials] The arguments to be partially applied.
  27333. * @returns {Function} Returns the new bound function.
  27334. * @example
  27335. *
  27336. * function greet(greeting, punctuation) {
  27337. * return greeting + ' ' + this.user + punctuation;
  27338. * }
  27339. *
  27340. * var object = { 'user': 'fred' };
  27341. *
  27342. * var bound = _.bind(greet, object, 'hi');
  27343. * bound('!');
  27344. * // => 'hi fred!'
  27345. *
  27346. * // Bound with placeholders.
  27347. * var bound = _.bind(greet, object, _, '!');
  27348. * bound('hi');
  27349. * // => 'hi fred!'
  27350. */
  27351. var bind = baseRest(function(func, thisArg, partials) {
  27352. var bitmask = WRAP_BIND_FLAG;
  27353. if (partials.length) {
  27354. var holders = replaceHolders(partials, getHolder(bind));
  27355. bitmask |= WRAP_PARTIAL_FLAG;
  27356. }
  27357. return createWrap(func, bitmask, thisArg, partials, holders);
  27358. });
  27359. /**
  27360. * Creates a function that invokes the method at `object[key]` with `partials`
  27361. * prepended to the arguments it receives.
  27362. *
  27363. * This method differs from `_.bind` by allowing bound functions to reference
  27364. * methods that may be redefined or don't yet exist. See
  27365. * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
  27366. * for more details.
  27367. *
  27368. * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
  27369. * builds, may be used as a placeholder for partially applied arguments.
  27370. *
  27371. * @static
  27372. * @memberOf _
  27373. * @since 0.10.0
  27374. * @category Function
  27375. * @param {Object} object The object to invoke the method on.
  27376. * @param {string} key The key of the method.
  27377. * @param {...*} [partials] The arguments to be partially applied.
  27378. * @returns {Function} Returns the new bound function.
  27379. * @example
  27380. *
  27381. * var object = {
  27382. * 'user': 'fred',
  27383. * 'greet': function(greeting, punctuation) {
  27384. * return greeting + ' ' + this.user + punctuation;
  27385. * }
  27386. * };
  27387. *
  27388. * var bound = _.bindKey(object, 'greet', 'hi');
  27389. * bound('!');
  27390. * // => 'hi fred!'
  27391. *
  27392. * object.greet = function(greeting, punctuation) {
  27393. * return greeting + 'ya ' + this.user + punctuation;
  27394. * };
  27395. *
  27396. * bound('!');
  27397. * // => 'hiya fred!'
  27398. *
  27399. * // Bound with placeholders.
  27400. * var bound = _.bindKey(object, 'greet', _, '!');
  27401. * bound('hi');
  27402. * // => 'hiya fred!'
  27403. */
  27404. var bindKey = baseRest(function(object, key, partials) {
  27405. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
  27406. if (partials.length) {
  27407. var holders = replaceHolders(partials, getHolder(bindKey));
  27408. bitmask |= WRAP_PARTIAL_FLAG;
  27409. }
  27410. return createWrap(key, bitmask, object, partials, holders);
  27411. });
  27412. /**
  27413. * Creates a function that accepts arguments of `func` and either invokes
  27414. * `func` returning its result, if at least `arity` number of arguments have
  27415. * been provided, or returns a function that accepts the remaining `func`
  27416. * arguments, and so on. The arity of `func` may be specified if `func.length`
  27417. * is not sufficient.
  27418. *
  27419. * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
  27420. * may be used as a placeholder for provided arguments.
  27421. *
  27422. * **Note:** This method doesn't set the "length" property of curried functions.
  27423. *
  27424. * @static
  27425. * @memberOf _
  27426. * @since 2.0.0
  27427. * @category Function
  27428. * @param {Function} func The function to curry.
  27429. * @param {number} [arity=func.length] The arity of `func`.
  27430. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27431. * @returns {Function} Returns the new curried function.
  27432. * @example
  27433. *
  27434. * var abc = function(a, b, c) {
  27435. * return [a, b, c];
  27436. * };
  27437. *
  27438. * var curried = _.curry(abc);
  27439. *
  27440. * curried(1)(2)(3);
  27441. * // => [1, 2, 3]
  27442. *
  27443. * curried(1, 2)(3);
  27444. * // => [1, 2, 3]
  27445. *
  27446. * curried(1, 2, 3);
  27447. * // => [1, 2, 3]
  27448. *
  27449. * // Curried with placeholders.
  27450. * curried(1)(_, 3)(2);
  27451. * // => [1, 2, 3]
  27452. */
  27453. function curry(func, arity, guard) {
  27454. arity = guard ? undefined : arity;
  27455. var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  27456. result.placeholder = curry.placeholder;
  27457. return result;
  27458. }
  27459. /**
  27460. * This method is like `_.curry` except that arguments are applied to `func`
  27461. * in the manner of `_.partialRight` instead of `_.partial`.
  27462. *
  27463. * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
  27464. * builds, may be used as a placeholder for provided arguments.
  27465. *
  27466. * **Note:** This method doesn't set the "length" property of curried functions.
  27467. *
  27468. * @static
  27469. * @memberOf _
  27470. * @since 3.0.0
  27471. * @category Function
  27472. * @param {Function} func The function to curry.
  27473. * @param {number} [arity=func.length] The arity of `func`.
  27474. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27475. * @returns {Function} Returns the new curried function.
  27476. * @example
  27477. *
  27478. * var abc = function(a, b, c) {
  27479. * return [a, b, c];
  27480. * };
  27481. *
  27482. * var curried = _.curryRight(abc);
  27483. *
  27484. * curried(3)(2)(1);
  27485. * // => [1, 2, 3]
  27486. *
  27487. * curried(2, 3)(1);
  27488. * // => [1, 2, 3]
  27489. *
  27490. * curried(1, 2, 3);
  27491. * // => [1, 2, 3]
  27492. *
  27493. * // Curried with placeholders.
  27494. * curried(3)(1, _)(2);
  27495. * // => [1, 2, 3]
  27496. */
  27497. function curryRight(func, arity, guard) {
  27498. arity = guard ? undefined : arity;
  27499. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  27500. result.placeholder = curryRight.placeholder;
  27501. return result;
  27502. }
  27503. /**
  27504. * Creates a debounced function that delays invoking `func` until after `wait`
  27505. * milliseconds have elapsed since the last time the debounced function was
  27506. * invoked. The debounced function comes with a `cancel` method to cancel
  27507. * delayed `func` invocations and a `flush` method to immediately invoke them.
  27508. * Provide `options` to indicate whether `func` should be invoked on the
  27509. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  27510. * with the last arguments provided to the debounced function. Subsequent
  27511. * calls to the debounced function return the result of the last `func`
  27512. * invocation.
  27513. *
  27514. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  27515. * invoked on the trailing edge of the timeout only if the debounced function
  27516. * is invoked more than once during the `wait` timeout.
  27517. *
  27518. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  27519. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  27520. *
  27521. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  27522. * for details over the differences between `_.debounce` and `_.throttle`.
  27523. *
  27524. * @static
  27525. * @memberOf _
  27526. * @since 0.1.0
  27527. * @category Function
  27528. * @param {Function} func The function to debounce.
  27529. * @param {number} [wait=0] The number of milliseconds to delay.
  27530. * @param {Object} [options={}] The options object.
  27531. * @param {boolean} [options.leading=false]
  27532. * Specify invoking on the leading edge of the timeout.
  27533. * @param {number} [options.maxWait]
  27534. * The maximum time `func` is allowed to be delayed before it's invoked.
  27535. * @param {boolean} [options.trailing=true]
  27536. * Specify invoking on the trailing edge of the timeout.
  27537. * @returns {Function} Returns the new debounced function.
  27538. * @example
  27539. *
  27540. * // Avoid costly calculations while the window size is in flux.
  27541. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  27542. *
  27543. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  27544. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  27545. * 'leading': true,
  27546. * 'trailing': false
  27547. * }));
  27548. *
  27549. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  27550. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  27551. * var source = new EventSource('/stream');
  27552. * jQuery(source).on('message', debounced);
  27553. *
  27554. * // Cancel the trailing debounced invocation.
  27555. * jQuery(window).on('popstate', debounced.cancel);
  27556. */
  27557. function debounce(func, wait, options) {
  27558. var lastArgs,
  27559. lastThis,
  27560. maxWait,
  27561. result,
  27562. timerId,
  27563. lastCallTime,
  27564. lastInvokeTime = 0,
  27565. leading = false,
  27566. maxing = false,
  27567. trailing = true;
  27568. if (typeof func != 'function') {
  27569. throw new TypeError(FUNC_ERROR_TEXT);
  27570. }
  27571. wait = toNumber(wait) || 0;
  27572. if (isObject(options)) {
  27573. leading = !!options.leading;
  27574. maxing = 'maxWait' in options;
  27575. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  27576. trailing = 'trailing' in options ? !!options.trailing : trailing;
  27577. }
  27578. function invokeFunc(time) {
  27579. var args = lastArgs,
  27580. thisArg = lastThis;
  27581. lastArgs = lastThis = undefined;
  27582. lastInvokeTime = time;
  27583. result = func.apply(thisArg, args);
  27584. return result;
  27585. }
  27586. function leadingEdge(time) {
  27587. // Reset any `maxWait` timer.
  27588. lastInvokeTime = time;
  27589. // Start the timer for the trailing edge.
  27590. timerId = setTimeout(timerExpired, wait);
  27591. // Invoke the leading edge.
  27592. return leading ? invokeFunc(time) : result;
  27593. }
  27594. function remainingWait(time) {
  27595. var timeSinceLastCall = time - lastCallTime,
  27596. timeSinceLastInvoke = time - lastInvokeTime,
  27597. timeWaiting = wait - timeSinceLastCall;
  27598. return maxing
  27599. ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
  27600. : timeWaiting;
  27601. }
  27602. function shouldInvoke(time) {
  27603. var timeSinceLastCall = time - lastCallTime,
  27604. timeSinceLastInvoke = time - lastInvokeTime;
  27605. // Either this is the first call, activity has stopped and we're at the
  27606. // trailing edge, the system time has gone backwards and we're treating
  27607. // it as the trailing edge, or we've hit the `maxWait` limit.
  27608. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  27609. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  27610. }
  27611. function timerExpired() {
  27612. var time = now();
  27613. if (shouldInvoke(time)) {
  27614. return trailingEdge(time);
  27615. }
  27616. // Restart the timer.
  27617. timerId = setTimeout(timerExpired, remainingWait(time));
  27618. }
  27619. function trailingEdge(time) {
  27620. timerId = undefined;
  27621. // Only invoke if we have `lastArgs` which means `func` has been
  27622. // debounced at least once.
  27623. if (trailing && lastArgs) {
  27624. return invokeFunc(time);
  27625. }
  27626. lastArgs = lastThis = undefined;
  27627. return result;
  27628. }
  27629. function cancel() {
  27630. if (timerId !== undefined) {
  27631. clearTimeout(timerId);
  27632. }
  27633. lastInvokeTime = 0;
  27634. lastArgs = lastCallTime = lastThis = timerId = undefined;
  27635. }
  27636. function flush() {
  27637. return timerId === undefined ? result : trailingEdge(now());
  27638. }
  27639. function debounced() {
  27640. var time = now(),
  27641. isInvoking = shouldInvoke(time);
  27642. lastArgs = arguments;
  27643. lastThis = this;
  27644. lastCallTime = time;
  27645. if (isInvoking) {
  27646. if (timerId === undefined) {
  27647. return leadingEdge(lastCallTime);
  27648. }
  27649. if (maxing) {
  27650. // Handle invocations in a tight loop.
  27651. clearTimeout(timerId);
  27652. timerId = setTimeout(timerExpired, wait);
  27653. return invokeFunc(lastCallTime);
  27654. }
  27655. }
  27656. if (timerId === undefined) {
  27657. timerId = setTimeout(timerExpired, wait);
  27658. }
  27659. return result;
  27660. }
  27661. debounced.cancel = cancel;
  27662. debounced.flush = flush;
  27663. return debounced;
  27664. }
  27665. /**
  27666. * Defers invoking the `func` until the current call stack has cleared. Any
  27667. * additional arguments are provided to `func` when it's invoked.
  27668. *
  27669. * @static
  27670. * @memberOf _
  27671. * @since 0.1.0
  27672. * @category Function
  27673. * @param {Function} func The function to defer.
  27674. * @param {...*} [args] The arguments to invoke `func` with.
  27675. * @returns {number} Returns the timer id.
  27676. * @example
  27677. *
  27678. * _.defer(function(text) {
  27679. * console.log(text);
  27680. * }, 'deferred');
  27681. * // => Logs 'deferred' after one millisecond.
  27682. */
  27683. var defer = baseRest(function(func, args) {
  27684. return baseDelay(func, 1, args);
  27685. });
  27686. /**
  27687. * Invokes `func` after `wait` milliseconds. Any additional arguments are
  27688. * provided to `func` when it's invoked.
  27689. *
  27690. * @static
  27691. * @memberOf _
  27692. * @since 0.1.0
  27693. * @category Function
  27694. * @param {Function} func The function to delay.
  27695. * @param {number} wait The number of milliseconds to delay invocation.
  27696. * @param {...*} [args] The arguments to invoke `func` with.
  27697. * @returns {number} Returns the timer id.
  27698. * @example
  27699. *
  27700. * _.delay(function(text) {
  27701. * console.log(text);
  27702. * }, 1000, 'later');
  27703. * // => Logs 'later' after one second.
  27704. */
  27705. var delay = baseRest(function(func, wait, args) {
  27706. return baseDelay(func, toNumber(wait) || 0, args);
  27707. });
  27708. /**
  27709. * Creates a function that invokes `func` with arguments reversed.
  27710. *
  27711. * @static
  27712. * @memberOf _
  27713. * @since 4.0.0
  27714. * @category Function
  27715. * @param {Function} func The function to flip arguments for.
  27716. * @returns {Function} Returns the new flipped function.
  27717. * @example
  27718. *
  27719. * var flipped = _.flip(function() {
  27720. * return _.toArray(arguments);
  27721. * });
  27722. *
  27723. * flipped('a', 'b', 'c', 'd');
  27724. * // => ['d', 'c', 'b', 'a']
  27725. */
  27726. function flip(func) {
  27727. return createWrap(func, WRAP_FLIP_FLAG);
  27728. }
  27729. /**
  27730. * Creates a function that memoizes the result of `func`. If `resolver` is
  27731. * provided, it determines the cache key for storing the result based on the
  27732. * arguments provided to the memoized function. By default, the first argument
  27733. * provided to the memoized function is used as the map cache key. The `func`
  27734. * is invoked with the `this` binding of the memoized function.
  27735. *
  27736. * **Note:** The cache is exposed as the `cache` property on the memoized
  27737. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  27738. * constructor with one whose instances implement the
  27739. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  27740. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  27741. *
  27742. * @static
  27743. * @memberOf _
  27744. * @since 0.1.0
  27745. * @category Function
  27746. * @param {Function} func The function to have its output memoized.
  27747. * @param {Function} [resolver] The function to resolve the cache key.
  27748. * @returns {Function} Returns the new memoized function.
  27749. * @example
  27750. *
  27751. * var object = { 'a': 1, 'b': 2 };
  27752. * var other = { 'c': 3, 'd': 4 };
  27753. *
  27754. * var values = _.memoize(_.values);
  27755. * values(object);
  27756. * // => [1, 2]
  27757. *
  27758. * values(other);
  27759. * // => [3, 4]
  27760. *
  27761. * object.a = 2;
  27762. * values(object);
  27763. * // => [1, 2]
  27764. *
  27765. * // Modify the result cache.
  27766. * values.cache.set(object, ['a', 'b']);
  27767. * values(object);
  27768. * // => ['a', 'b']
  27769. *
  27770. * // Replace `_.memoize.Cache`.
  27771. * _.memoize.Cache = WeakMap;
  27772. */
  27773. function memoize(func, resolver) {
  27774. if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
  27775. throw new TypeError(FUNC_ERROR_TEXT);
  27776. }
  27777. var memoized = function() {
  27778. var args = arguments,
  27779. key = resolver ? resolver.apply(this, args) : args[0],
  27780. cache = memoized.cache;
  27781. if (cache.has(key)) {
  27782. return cache.get(key);
  27783. }
  27784. var result = func.apply(this, args);
  27785. memoized.cache = cache.set(key, result) || cache;
  27786. return result;
  27787. };
  27788. memoized.cache = new (memoize.Cache || MapCache);
  27789. return memoized;
  27790. }
  27791. // Expose `MapCache`.
  27792. memoize.Cache = MapCache;
  27793. /**
  27794. * Creates a function that negates the result of the predicate `func`. The
  27795. * `func` predicate is invoked with the `this` binding and arguments of the
  27796. * created function.
  27797. *
  27798. * @static
  27799. * @memberOf _
  27800. * @since 3.0.0
  27801. * @category Function
  27802. * @param {Function} predicate The predicate to negate.
  27803. * @returns {Function} Returns the new negated function.
  27804. * @example
  27805. *
  27806. * function isEven(n) {
  27807. * return n % 2 == 0;
  27808. * }
  27809. *
  27810. * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
  27811. * // => [1, 3, 5]
  27812. */
  27813. function negate(predicate) {
  27814. if (typeof predicate != 'function') {
  27815. throw new TypeError(FUNC_ERROR_TEXT);
  27816. }
  27817. return function() {
  27818. var args = arguments;
  27819. switch (args.length) {
  27820. case 0: return !predicate.call(this);
  27821. case 1: return !predicate.call(this, args[0]);
  27822. case 2: return !predicate.call(this, args[0], args[1]);
  27823. case 3: return !predicate.call(this, args[0], args[1], args[2]);
  27824. }
  27825. return !predicate.apply(this, args);
  27826. };
  27827. }
  27828. /**
  27829. * Creates a function that is restricted to invoking `func` once. Repeat calls
  27830. * to the function return the value of the first invocation. The `func` is
  27831. * invoked with the `this` binding and arguments of the created function.
  27832. *
  27833. * @static
  27834. * @memberOf _
  27835. * @since 0.1.0
  27836. * @category Function
  27837. * @param {Function} func The function to restrict.
  27838. * @returns {Function} Returns the new restricted function.
  27839. * @example
  27840. *
  27841. * var initialize = _.once(createApplication);
  27842. * initialize();
  27843. * initialize();
  27844. * // => `createApplication` is invoked once
  27845. */
  27846. function once(func) {
  27847. return before(2, func);
  27848. }
  27849. /**
  27850. * Creates a function that invokes `func` with its arguments transformed.
  27851. *
  27852. * @static
  27853. * @since 4.0.0
  27854. * @memberOf _
  27855. * @category Function
  27856. * @param {Function} func The function to wrap.
  27857. * @param {...(Function|Function[])} [transforms=[_.identity]]
  27858. * The argument transforms.
  27859. * @returns {Function} Returns the new function.
  27860. * @example
  27861. *
  27862. * function doubled(n) {
  27863. * return n * 2;
  27864. * }
  27865. *
  27866. * function square(n) {
  27867. * return n * n;
  27868. * }
  27869. *
  27870. * var func = _.overArgs(function(x, y) {
  27871. * return [x, y];
  27872. * }, [square, doubled]);
  27873. *
  27874. * func(9, 3);
  27875. * // => [81, 6]
  27876. *
  27877. * func(10, 5);
  27878. * // => [100, 10]
  27879. */
  27880. var overArgs = castRest(function(func, transforms) {
  27881. transforms = (transforms.length == 1 && isArray(transforms[0]))
  27882. ? arrayMap(transforms[0], baseUnary(getIteratee()))
  27883. : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
  27884. var funcsLength = transforms.length;
  27885. return baseRest(function(args) {
  27886. var index = -1,
  27887. length = nativeMin(args.length, funcsLength);
  27888. while (++index < length) {
  27889. args[index] = transforms[index].call(this, args[index]);
  27890. }
  27891. return apply(func, this, args);
  27892. });
  27893. });
  27894. /**
  27895. * Creates a function that invokes `func` with `partials` prepended to the
  27896. * arguments it receives. This method is like `_.bind` except it does **not**
  27897. * alter the `this` binding.
  27898. *
  27899. * The `_.partial.placeholder` value, which defaults to `_` in monolithic
  27900. * builds, may be used as a placeholder for partially applied arguments.
  27901. *
  27902. * **Note:** This method doesn't set the "length" property of partially
  27903. * applied functions.
  27904. *
  27905. * @static
  27906. * @memberOf _
  27907. * @since 0.2.0
  27908. * @category Function
  27909. * @param {Function} func The function to partially apply arguments to.
  27910. * @param {...*} [partials] The arguments to be partially applied.
  27911. * @returns {Function} Returns the new partially applied function.
  27912. * @example
  27913. *
  27914. * function greet(greeting, name) {
  27915. * return greeting + ' ' + name;
  27916. * }
  27917. *
  27918. * var sayHelloTo = _.partial(greet, 'hello');
  27919. * sayHelloTo('fred');
  27920. * // => 'hello fred'
  27921. *
  27922. * // Partially applied with placeholders.
  27923. * var greetFred = _.partial(greet, _, 'fred');
  27924. * greetFred('hi');
  27925. * // => 'hi fred'
  27926. */
  27927. var partial = baseRest(function(func, partials) {
  27928. var holders = replaceHolders(partials, getHolder(partial));
  27929. return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
  27930. });
  27931. /**
  27932. * This method is like `_.partial` except that partially applied arguments
  27933. * are appended to the arguments it receives.
  27934. *
  27935. * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
  27936. * builds, may be used as a placeholder for partially applied arguments.
  27937. *
  27938. * **Note:** This method doesn't set the "length" property of partially
  27939. * applied functions.
  27940. *
  27941. * @static
  27942. * @memberOf _
  27943. * @since 1.0.0
  27944. * @category Function
  27945. * @param {Function} func The function to partially apply arguments to.
  27946. * @param {...*} [partials] The arguments to be partially applied.
  27947. * @returns {Function} Returns the new partially applied function.
  27948. * @example
  27949. *
  27950. * function greet(greeting, name) {
  27951. * return greeting + ' ' + name;
  27952. * }
  27953. *
  27954. * var greetFred = _.partialRight(greet, 'fred');
  27955. * greetFred('hi');
  27956. * // => 'hi fred'
  27957. *
  27958. * // Partially applied with placeholders.
  27959. * var sayHelloTo = _.partialRight(greet, 'hello', _);
  27960. * sayHelloTo('fred');
  27961. * // => 'hello fred'
  27962. */
  27963. var partialRight = baseRest(function(func, partials) {
  27964. var holders = replaceHolders(partials, getHolder(partialRight));
  27965. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
  27966. });
  27967. /**
  27968. * Creates a function that invokes `func` with arguments arranged according
  27969. * to the specified `indexes` where the argument value at the first index is
  27970. * provided as the first argument, the argument value at the second index is
  27971. * provided as the second argument, and so on.
  27972. *
  27973. * @static
  27974. * @memberOf _
  27975. * @since 3.0.0
  27976. * @category Function
  27977. * @param {Function} func The function to rearrange arguments for.
  27978. * @param {...(number|number[])} indexes The arranged argument indexes.
  27979. * @returns {Function} Returns the new function.
  27980. * @example
  27981. *
  27982. * var rearged = _.rearg(function(a, b, c) {
  27983. * return [a, b, c];
  27984. * }, [2, 0, 1]);
  27985. *
  27986. * rearged('b', 'c', 'a')
  27987. * // => ['a', 'b', 'c']
  27988. */
  27989. var rearg = flatRest(function(func, indexes) {
  27990. return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
  27991. });
  27992. /**
  27993. * Creates a function that invokes `func` with the `this` binding of the
  27994. * created function and arguments from `start` and beyond provided as
  27995. * an array.
  27996. *
  27997. * **Note:** This method is based on the
  27998. * [rest parameter](https://mdn.io/rest_parameters).
  27999. *
  28000. * @static
  28001. * @memberOf _
  28002. * @since 4.0.0
  28003. * @category Function
  28004. * @param {Function} func The function to apply a rest parameter to.
  28005. * @param {number} [start=func.length-1] The start position of the rest parameter.
  28006. * @returns {Function} Returns the new function.
  28007. * @example
  28008. *
  28009. * var say = _.rest(function(what, names) {
  28010. * return what + ' ' + _.initial(names).join(', ') +
  28011. * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
  28012. * });
  28013. *
  28014. * say('hello', 'fred', 'barney', 'pebbles');
  28015. * // => 'hello fred, barney, & pebbles'
  28016. */
  28017. function rest(func, start) {
  28018. if (typeof func != 'function') {
  28019. throw new TypeError(FUNC_ERROR_TEXT);
  28020. }
  28021. start = start === undefined ? start : toInteger(start);
  28022. return baseRest(func, start);
  28023. }
  28024. /**
  28025. * Creates a function that invokes `func` with the `this` binding of the
  28026. * create function and an array of arguments much like
  28027. * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
  28028. *
  28029. * **Note:** This method is based on the
  28030. * [spread operator](https://mdn.io/spread_operator).
  28031. *
  28032. * @static
  28033. * @memberOf _
  28034. * @since 3.2.0
  28035. * @category Function
  28036. * @param {Function} func The function to spread arguments over.
  28037. * @param {number} [start=0] The start position of the spread.
  28038. * @returns {Function} Returns the new function.
  28039. * @example
  28040. *
  28041. * var say = _.spread(function(who, what) {
  28042. * return who + ' says ' + what;
  28043. * });
  28044. *
  28045. * say(['fred', 'hello']);
  28046. * // => 'fred says hello'
  28047. *
  28048. * var numbers = Promise.all([
  28049. * Promise.resolve(40),
  28050. * Promise.resolve(36)
  28051. * ]);
  28052. *
  28053. * numbers.then(_.spread(function(x, y) {
  28054. * return x + y;
  28055. * }));
  28056. * // => a Promise of 76
  28057. */
  28058. function spread(func, start) {
  28059. if (typeof func != 'function') {
  28060. throw new TypeError(FUNC_ERROR_TEXT);
  28061. }
  28062. start = start == null ? 0 : nativeMax(toInteger(start), 0);
  28063. return baseRest(function(args) {
  28064. var array = args[start],
  28065. otherArgs = castSlice(args, 0, start);
  28066. if (array) {
  28067. arrayPush(otherArgs, array);
  28068. }
  28069. return apply(func, this, otherArgs);
  28070. });
  28071. }
  28072. /**
  28073. * Creates a throttled function that only invokes `func` at most once per
  28074. * every `wait` milliseconds. The throttled function comes with a `cancel`
  28075. * method to cancel delayed `func` invocations and a `flush` method to
  28076. * immediately invoke them. Provide `options` to indicate whether `func`
  28077. * should be invoked on the leading and/or trailing edge of the `wait`
  28078. * timeout. The `func` is invoked with the last arguments provided to the
  28079. * throttled function. Subsequent calls to the throttled function return the
  28080. * result of the last `func` invocation.
  28081. *
  28082. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  28083. * invoked on the trailing edge of the timeout only if the throttled function
  28084. * is invoked more than once during the `wait` timeout.
  28085. *
  28086. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  28087. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  28088. *
  28089. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  28090. * for details over the differences between `_.throttle` and `_.debounce`.
  28091. *
  28092. * @static
  28093. * @memberOf _
  28094. * @since 0.1.0
  28095. * @category Function
  28096. * @param {Function} func The function to throttle.
  28097. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  28098. * @param {Object} [options={}] The options object.
  28099. * @param {boolean} [options.leading=true]
  28100. * Specify invoking on the leading edge of the timeout.
  28101. * @param {boolean} [options.trailing=true]
  28102. * Specify invoking on the trailing edge of the timeout.
  28103. * @returns {Function} Returns the new throttled function.
  28104. * @example
  28105. *
  28106. * // Avoid excessively updating the position while scrolling.
  28107. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  28108. *
  28109. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  28110. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  28111. * jQuery(element).on('click', throttled);
  28112. *
  28113. * // Cancel the trailing throttled invocation.
  28114. * jQuery(window).on('popstate', throttled.cancel);
  28115. */
  28116. function throttle(func, wait, options) {
  28117. var leading = true,
  28118. trailing = true;
  28119. if (typeof func != 'function') {
  28120. throw new TypeError(FUNC_ERROR_TEXT);
  28121. }
  28122. if (isObject(options)) {
  28123. leading = 'leading' in options ? !!options.leading : leading;
  28124. trailing = 'trailing' in options ? !!options.trailing : trailing;
  28125. }
  28126. return debounce(func, wait, {
  28127. 'leading': leading,
  28128. 'maxWait': wait,
  28129. 'trailing': trailing
  28130. });
  28131. }
  28132. /**
  28133. * Creates a function that accepts up to one argument, ignoring any
  28134. * additional arguments.
  28135. *
  28136. * @static
  28137. * @memberOf _
  28138. * @since 4.0.0
  28139. * @category Function
  28140. * @param {Function} func The function to cap arguments for.
  28141. * @returns {Function} Returns the new capped function.
  28142. * @example
  28143. *
  28144. * _.map(['6', '8', '10'], _.unary(parseInt));
  28145. * // => [6, 8, 10]
  28146. */
  28147. function unary(func) {
  28148. return ary(func, 1);
  28149. }
  28150. /**
  28151. * Creates a function that provides `value` to `wrapper` as its first
  28152. * argument. Any additional arguments provided to the function are appended
  28153. * to those provided to the `wrapper`. The wrapper is invoked with the `this`
  28154. * binding of the created function.
  28155. *
  28156. * @static
  28157. * @memberOf _
  28158. * @since 0.1.0
  28159. * @category Function
  28160. * @param {*} value The value to wrap.
  28161. * @param {Function} [wrapper=identity] The wrapper function.
  28162. * @returns {Function} Returns the new function.
  28163. * @example
  28164. *
  28165. * var p = _.wrap(_.escape, function(func, text) {
  28166. * return '<p>' + func(text) + '</p>';
  28167. * });
  28168. *
  28169. * p('fred, barney, & pebbles');
  28170. * // => '<p>fred, barney, &amp; pebbles</p>'
  28171. */
  28172. function wrap(value, wrapper) {
  28173. return partial(castFunction(wrapper), value);
  28174. }
  28175. /*------------------------------------------------------------------------*/
  28176. /**
  28177. * Casts `value` as an array if it's not one.
  28178. *
  28179. * @static
  28180. * @memberOf _
  28181. * @since 4.4.0
  28182. * @category Lang
  28183. * @param {*} value The value to inspect.
  28184. * @returns {Array} Returns the cast array.
  28185. * @example
  28186. *
  28187. * _.castArray(1);
  28188. * // => [1]
  28189. *
  28190. * _.castArray({ 'a': 1 });
  28191. * // => [{ 'a': 1 }]
  28192. *
  28193. * _.castArray('abc');
  28194. * // => ['abc']
  28195. *
  28196. * _.castArray(null);
  28197. * // => [null]
  28198. *
  28199. * _.castArray(undefined);
  28200. * // => [undefined]
  28201. *
  28202. * _.castArray();
  28203. * // => []
  28204. *
  28205. * var array = [1, 2, 3];
  28206. * console.log(_.castArray(array) === array);
  28207. * // => true
  28208. */
  28209. function castArray() {
  28210. if (!arguments.length) {
  28211. return [];
  28212. }
  28213. var value = arguments[0];
  28214. return isArray(value) ? value : [value];
  28215. }
  28216. /**
  28217. * Creates a shallow clone of `value`.
  28218. *
  28219. * **Note:** This method is loosely based on the
  28220. * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
  28221. * and supports cloning arrays, array buffers, booleans, date objects, maps,
  28222. * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
  28223. * arrays. The own enumerable properties of `arguments` objects are cloned
  28224. * as plain objects. An empty object is returned for uncloneable values such
  28225. * as error objects, functions, DOM nodes, and WeakMaps.
  28226. *
  28227. * @static
  28228. * @memberOf _
  28229. * @since 0.1.0
  28230. * @category Lang
  28231. * @param {*} value The value to clone.
  28232. * @returns {*} Returns the cloned value.
  28233. * @see _.cloneDeep
  28234. * @example
  28235. *
  28236. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  28237. *
  28238. * var shallow = _.clone(objects);
  28239. * console.log(shallow[0] === objects[0]);
  28240. * // => true
  28241. */
  28242. function clone(value) {
  28243. return baseClone(value, CLONE_SYMBOLS_FLAG);
  28244. }
  28245. /**
  28246. * This method is like `_.clone` except that it accepts `customizer` which
  28247. * is invoked to produce the cloned value. If `customizer` returns `undefined`,
  28248. * cloning is handled by the method instead. The `customizer` is invoked with
  28249. * up to four arguments; (value [, index|key, object, stack]).
  28250. *
  28251. * @static
  28252. * @memberOf _
  28253. * @since 4.0.0
  28254. * @category Lang
  28255. * @param {*} value The value to clone.
  28256. * @param {Function} [customizer] The function to customize cloning.
  28257. * @returns {*} Returns the cloned value.
  28258. * @see _.cloneDeepWith
  28259. * @example
  28260. *
  28261. * function customizer(value) {
  28262. * if (_.isElement(value)) {
  28263. * return value.cloneNode(false);
  28264. * }
  28265. * }
  28266. *
  28267. * var el = _.cloneWith(document.body, customizer);
  28268. *
  28269. * console.log(el === document.body);
  28270. * // => false
  28271. * console.log(el.nodeName);
  28272. * // => 'BODY'
  28273. * console.log(el.childNodes.length);
  28274. * // => 0
  28275. */
  28276. function cloneWith(value, customizer) {
  28277. customizer = typeof customizer == 'function' ? customizer : undefined;
  28278. return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
  28279. }
  28280. /**
  28281. * This method is like `_.clone` except that it recursively clones `value`.
  28282. *
  28283. * @static
  28284. * @memberOf _
  28285. * @since 1.0.0
  28286. * @category Lang
  28287. * @param {*} value The value to recursively clone.
  28288. * @returns {*} Returns the deep cloned value.
  28289. * @see _.clone
  28290. * @example
  28291. *
  28292. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  28293. *
  28294. * var deep = _.cloneDeep(objects);
  28295. * console.log(deep[0] === objects[0]);
  28296. * // => false
  28297. */
  28298. function cloneDeep(value) {
  28299. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  28300. }
  28301. /**
  28302. * This method is like `_.cloneWith` except that it recursively clones `value`.
  28303. *
  28304. * @static
  28305. * @memberOf _
  28306. * @since 4.0.0
  28307. * @category Lang
  28308. * @param {*} value The value to recursively clone.
  28309. * @param {Function} [customizer] The function to customize cloning.
  28310. * @returns {*} Returns the deep cloned value.
  28311. * @see _.cloneWith
  28312. * @example
  28313. *
  28314. * function customizer(value) {
  28315. * if (_.isElement(value)) {
  28316. * return value.cloneNode(true);
  28317. * }
  28318. * }
  28319. *
  28320. * var el = _.cloneDeepWith(document.body, customizer);
  28321. *
  28322. * console.log(el === document.body);
  28323. * // => false
  28324. * console.log(el.nodeName);
  28325. * // => 'BODY'
  28326. * console.log(el.childNodes.length);
  28327. * // => 20
  28328. */
  28329. function cloneDeepWith(value, customizer) {
  28330. customizer = typeof customizer == 'function' ? customizer : undefined;
  28331. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
  28332. }
  28333. /**
  28334. * Checks if `object` conforms to `source` by invoking the predicate
  28335. * properties of `source` with the corresponding property values of `object`.
  28336. *
  28337. * **Note:** This method is equivalent to `_.conforms` when `source` is
  28338. * partially applied.
  28339. *
  28340. * @static
  28341. * @memberOf _
  28342. * @since 4.14.0
  28343. * @category Lang
  28344. * @param {Object} object The object to inspect.
  28345. * @param {Object} source The object of property predicates to conform to.
  28346. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  28347. * @example
  28348. *
  28349. * var object = { 'a': 1, 'b': 2 };
  28350. *
  28351. * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
  28352. * // => true
  28353. *
  28354. * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
  28355. * // => false
  28356. */
  28357. function conformsTo(object, source) {
  28358. return source == null || baseConformsTo(object, source, keys(source));
  28359. }
  28360. /**
  28361. * Performs a
  28362. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  28363. * comparison between two values to determine if they are equivalent.
  28364. *
  28365. * @static
  28366. * @memberOf _
  28367. * @since 4.0.0
  28368. * @category Lang
  28369. * @param {*} value The value to compare.
  28370. * @param {*} other The other value to compare.
  28371. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  28372. * @example
  28373. *
  28374. * var object = { 'a': 1 };
  28375. * var other = { 'a': 1 };
  28376. *
  28377. * _.eq(object, object);
  28378. * // => true
  28379. *
  28380. * _.eq(object, other);
  28381. * // => false
  28382. *
  28383. * _.eq('a', 'a');
  28384. * // => true
  28385. *
  28386. * _.eq('a', Object('a'));
  28387. * // => false
  28388. *
  28389. * _.eq(NaN, NaN);
  28390. * // => true
  28391. */
  28392. function eq(value, other) {
  28393. return value === other || (value !== value && other !== other);
  28394. }
  28395. /**
  28396. * Checks if `value` is greater than `other`.
  28397. *
  28398. * @static
  28399. * @memberOf _
  28400. * @since 3.9.0
  28401. * @category Lang
  28402. * @param {*} value The value to compare.
  28403. * @param {*} other The other value to compare.
  28404. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  28405. * else `false`.
  28406. * @see _.lt
  28407. * @example
  28408. *
  28409. * _.gt(3, 1);
  28410. * // => true
  28411. *
  28412. * _.gt(3, 3);
  28413. * // => false
  28414. *
  28415. * _.gt(1, 3);
  28416. * // => false
  28417. */
  28418. var gt = createRelationalOperation(baseGt);
  28419. /**
  28420. * Checks if `value` is greater than or equal to `other`.
  28421. *
  28422. * @static
  28423. * @memberOf _
  28424. * @since 3.9.0
  28425. * @category Lang
  28426. * @param {*} value The value to compare.
  28427. * @param {*} other The other value to compare.
  28428. * @returns {boolean} Returns `true` if `value` is greater than or equal to
  28429. * `other`, else `false`.
  28430. * @see _.lte
  28431. * @example
  28432. *
  28433. * _.gte(3, 1);
  28434. * // => true
  28435. *
  28436. * _.gte(3, 3);
  28437. * // => true
  28438. *
  28439. * _.gte(1, 3);
  28440. * // => false
  28441. */
  28442. var gte = createRelationalOperation(function(value, other) {
  28443. return value >= other;
  28444. });
  28445. /**
  28446. * Checks if `value` is likely an `arguments` object.
  28447. *
  28448. * @static
  28449. * @memberOf _
  28450. * @since 0.1.0
  28451. * @category Lang
  28452. * @param {*} value The value to check.
  28453. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  28454. * else `false`.
  28455. * @example
  28456. *
  28457. * _.isArguments(function() { return arguments; }());
  28458. * // => true
  28459. *
  28460. * _.isArguments([1, 2, 3]);
  28461. * // => false
  28462. */
  28463. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  28464. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  28465. !propertyIsEnumerable.call(value, 'callee');
  28466. };
  28467. /**
  28468. * Checks if `value` is classified as an `Array` object.
  28469. *
  28470. * @static
  28471. * @memberOf _
  28472. * @since 0.1.0
  28473. * @category Lang
  28474. * @param {*} value The value to check.
  28475. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  28476. * @example
  28477. *
  28478. * _.isArray([1, 2, 3]);
  28479. * // => true
  28480. *
  28481. * _.isArray(document.body.children);
  28482. * // => false
  28483. *
  28484. * _.isArray('abc');
  28485. * // => false
  28486. *
  28487. * _.isArray(_.noop);
  28488. * // => false
  28489. */
  28490. var isArray = Array.isArray;
  28491. /**
  28492. * Checks if `value` is classified as an `ArrayBuffer` object.
  28493. *
  28494. * @static
  28495. * @memberOf _
  28496. * @since 4.3.0
  28497. * @category Lang
  28498. * @param {*} value The value to check.
  28499. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  28500. * @example
  28501. *
  28502. * _.isArrayBuffer(new ArrayBuffer(2));
  28503. * // => true
  28504. *
  28505. * _.isArrayBuffer(new Array(2));
  28506. * // => false
  28507. */
  28508. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  28509. /**
  28510. * Checks if `value` is array-like. A value is considered array-like if it's
  28511. * not a function and has a `value.length` that's an integer greater than or
  28512. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  28513. *
  28514. * @static
  28515. * @memberOf _
  28516. * @since 4.0.0
  28517. * @category Lang
  28518. * @param {*} value The value to check.
  28519. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  28520. * @example
  28521. *
  28522. * _.isArrayLike([1, 2, 3]);
  28523. * // => true
  28524. *
  28525. * _.isArrayLike(document.body.children);
  28526. * // => true
  28527. *
  28528. * _.isArrayLike('abc');
  28529. * // => true
  28530. *
  28531. * _.isArrayLike(_.noop);
  28532. * // => false
  28533. */
  28534. function isArrayLike(value) {
  28535. return value != null && isLength(value.length) && !isFunction(value);
  28536. }
  28537. /**
  28538. * This method is like `_.isArrayLike` except that it also checks if `value`
  28539. * is an object.
  28540. *
  28541. * @static
  28542. * @memberOf _
  28543. * @since 4.0.0
  28544. * @category Lang
  28545. * @param {*} value The value to check.
  28546. * @returns {boolean} Returns `true` if `value` is an array-like object,
  28547. * else `false`.
  28548. * @example
  28549. *
  28550. * _.isArrayLikeObject([1, 2, 3]);
  28551. * // => true
  28552. *
  28553. * _.isArrayLikeObject(document.body.children);
  28554. * // => true
  28555. *
  28556. * _.isArrayLikeObject('abc');
  28557. * // => false
  28558. *
  28559. * _.isArrayLikeObject(_.noop);
  28560. * // => false
  28561. */
  28562. function isArrayLikeObject(value) {
  28563. return isObjectLike(value) && isArrayLike(value);
  28564. }
  28565. /**
  28566. * Checks if `value` is classified as a boolean primitive or object.
  28567. *
  28568. * @static
  28569. * @memberOf _
  28570. * @since 0.1.0
  28571. * @category Lang
  28572. * @param {*} value The value to check.
  28573. * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
  28574. * @example
  28575. *
  28576. * _.isBoolean(false);
  28577. * // => true
  28578. *
  28579. * _.isBoolean(null);
  28580. * // => false
  28581. */
  28582. function isBoolean(value) {
  28583. return value === true || value === false ||
  28584. (isObjectLike(value) && baseGetTag(value) == boolTag);
  28585. }
  28586. /**
  28587. * Checks if `value` is a buffer.
  28588. *
  28589. * @static
  28590. * @memberOf _
  28591. * @since 4.3.0
  28592. * @category Lang
  28593. * @param {*} value The value to check.
  28594. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  28595. * @example
  28596. *
  28597. * _.isBuffer(new Buffer(2));
  28598. * // => true
  28599. *
  28600. * _.isBuffer(new Uint8Array(2));
  28601. * // => false
  28602. */
  28603. var isBuffer = nativeIsBuffer || stubFalse;
  28604. /**
  28605. * Checks if `value` is classified as a `Date` object.
  28606. *
  28607. * @static
  28608. * @memberOf _
  28609. * @since 0.1.0
  28610. * @category Lang
  28611. * @param {*} value The value to check.
  28612. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  28613. * @example
  28614. *
  28615. * _.isDate(new Date);
  28616. * // => true
  28617. *
  28618. * _.isDate('Mon April 23 2012');
  28619. * // => false
  28620. */
  28621. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  28622. /**
  28623. * Checks if `value` is likely a DOM element.
  28624. *
  28625. * @static
  28626. * @memberOf _
  28627. * @since 0.1.0
  28628. * @category Lang
  28629. * @param {*} value The value to check.
  28630. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
  28631. * @example
  28632. *
  28633. * _.isElement(document.body);
  28634. * // => true
  28635. *
  28636. * _.isElement('<body>');
  28637. * // => false
  28638. */
  28639. function isElement(value) {
  28640. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  28641. }
  28642. /**
  28643. * Checks if `value` is an empty object, collection, map, or set.
  28644. *
  28645. * Objects are considered empty if they have no own enumerable string keyed
  28646. * properties.
  28647. *
  28648. * Array-like values such as `arguments` objects, arrays, buffers, strings, or
  28649. * jQuery-like collections are considered empty if they have a `length` of `0`.
  28650. * Similarly, maps and sets are considered empty if they have a `size` of `0`.
  28651. *
  28652. * @static
  28653. * @memberOf _
  28654. * @since 0.1.0
  28655. * @category Lang
  28656. * @param {*} value The value to check.
  28657. * @returns {boolean} Returns `true` if `value` is empty, else `false`.
  28658. * @example
  28659. *
  28660. * _.isEmpty(null);
  28661. * // => true
  28662. *
  28663. * _.isEmpty(true);
  28664. * // => true
  28665. *
  28666. * _.isEmpty(1);
  28667. * // => true
  28668. *
  28669. * _.isEmpty([1, 2, 3]);
  28670. * // => false
  28671. *
  28672. * _.isEmpty({ 'a': 1 });
  28673. * // => false
  28674. */
  28675. function isEmpty(value) {
  28676. if (value == null) {
  28677. return true;
  28678. }
  28679. if (isArrayLike(value) &&
  28680. (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
  28681. isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  28682. return !value.length;
  28683. }
  28684. var tag = getTag(value);
  28685. if (tag == mapTag || tag == setTag) {
  28686. return !value.size;
  28687. }
  28688. if (isPrototype(value)) {
  28689. return !baseKeys(value).length;
  28690. }
  28691. for (var key in value) {
  28692. if (hasOwnProperty.call(value, key)) {
  28693. return false;
  28694. }
  28695. }
  28696. return true;
  28697. }
  28698. /**
  28699. * Performs a deep comparison between two values to determine if they are
  28700. * equivalent.
  28701. *
  28702. * **Note:** This method supports comparing arrays, array buffers, booleans,
  28703. * date objects, error objects, maps, numbers, `Object` objects, regexes,
  28704. * sets, strings, symbols, and typed arrays. `Object` objects are compared
  28705. * by their own, not inherited, enumerable properties. Functions and DOM
  28706. * nodes are compared by strict equality, i.e. `===`.
  28707. *
  28708. * @static
  28709. * @memberOf _
  28710. * @since 0.1.0
  28711. * @category Lang
  28712. * @param {*} value The value to compare.
  28713. * @param {*} other The other value to compare.
  28714. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  28715. * @example
  28716. *
  28717. * var object = { 'a': 1 };
  28718. * var other = { 'a': 1 };
  28719. *
  28720. * _.isEqual(object, other);
  28721. * // => true
  28722. *
  28723. * object === other;
  28724. * // => false
  28725. */
  28726. function isEqual(value, other) {
  28727. return baseIsEqual(value, other);
  28728. }
  28729. /**
  28730. * This method is like `_.isEqual` except that it accepts `customizer` which
  28731. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  28732. * are handled by the method instead. The `customizer` is invoked with up to
  28733. * six arguments: (objValue, othValue [, index|key, object, other, stack]).
  28734. *
  28735. * @static
  28736. * @memberOf _
  28737. * @since 4.0.0
  28738. * @category Lang
  28739. * @param {*} value The value to compare.
  28740. * @param {*} other The other value to compare.
  28741. * @param {Function} [customizer] The function to customize comparisons.
  28742. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  28743. * @example
  28744. *
  28745. * function isGreeting(value) {
  28746. * return /^h(?:i|ello)$/.test(value);
  28747. * }
  28748. *
  28749. * function customizer(objValue, othValue) {
  28750. * if (isGreeting(objValue) && isGreeting(othValue)) {
  28751. * return true;
  28752. * }
  28753. * }
  28754. *
  28755. * var array = ['hello', 'goodbye'];
  28756. * var other = ['hi', 'goodbye'];
  28757. *
  28758. * _.isEqualWith(array, other, customizer);
  28759. * // => true
  28760. */
  28761. function isEqualWith(value, other, customizer) {
  28762. customizer = typeof customizer == 'function' ? customizer : undefined;
  28763. var result = customizer ? customizer(value, other) : undefined;
  28764. return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
  28765. }
  28766. /**
  28767. * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
  28768. * `SyntaxError`, `TypeError`, or `URIError` object.
  28769. *
  28770. * @static
  28771. * @memberOf _
  28772. * @since 3.0.0
  28773. * @category Lang
  28774. * @param {*} value The value to check.
  28775. * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
  28776. * @example
  28777. *
  28778. * _.isError(new Error);
  28779. * // => true
  28780. *
  28781. * _.isError(Error);
  28782. * // => false
  28783. */
  28784. function isError(value) {
  28785. if (!isObjectLike(value)) {
  28786. return false;
  28787. }
  28788. var tag = baseGetTag(value);
  28789. return tag == errorTag || tag == domExcTag ||
  28790. (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
  28791. }
  28792. /**
  28793. * Checks if `value` is a finite primitive number.
  28794. *
  28795. * **Note:** This method is based on
  28796. * [`Number.isFinite`](https://mdn.io/Number/isFinite).
  28797. *
  28798. * @static
  28799. * @memberOf _
  28800. * @since 0.1.0
  28801. * @category Lang
  28802. * @param {*} value The value to check.
  28803. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
  28804. * @example
  28805. *
  28806. * _.isFinite(3);
  28807. * // => true
  28808. *
  28809. * _.isFinite(Number.MIN_VALUE);
  28810. * // => true
  28811. *
  28812. * _.isFinite(Infinity);
  28813. * // => false
  28814. *
  28815. * _.isFinite('3');
  28816. * // => false
  28817. */
  28818. function isFinite(value) {
  28819. return typeof value == 'number' && nativeIsFinite(value);
  28820. }
  28821. /**
  28822. * Checks if `value` is classified as a `Function` object.
  28823. *
  28824. * @static
  28825. * @memberOf _
  28826. * @since 0.1.0
  28827. * @category Lang
  28828. * @param {*} value The value to check.
  28829. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  28830. * @example
  28831. *
  28832. * _.isFunction(_);
  28833. * // => true
  28834. *
  28835. * _.isFunction(/abc/);
  28836. * // => false
  28837. */
  28838. function isFunction(value) {
  28839. if (!isObject(value)) {
  28840. return false;
  28841. }
  28842. // The use of `Object#toString` avoids issues with the `typeof` operator
  28843. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  28844. var tag = baseGetTag(value);
  28845. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  28846. }
  28847. /**
  28848. * Checks if `value` is an integer.
  28849. *
  28850. * **Note:** This method is based on
  28851. * [`Number.isInteger`](https://mdn.io/Number/isInteger).
  28852. *
  28853. * @static
  28854. * @memberOf _
  28855. * @since 4.0.0
  28856. * @category Lang
  28857. * @param {*} value The value to check.
  28858. * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
  28859. * @example
  28860. *
  28861. * _.isInteger(3);
  28862. * // => true
  28863. *
  28864. * _.isInteger(Number.MIN_VALUE);
  28865. * // => false
  28866. *
  28867. * _.isInteger(Infinity);
  28868. * // => false
  28869. *
  28870. * _.isInteger('3');
  28871. * // => false
  28872. */
  28873. function isInteger(value) {
  28874. return typeof value == 'number' && value == toInteger(value);
  28875. }
  28876. /**
  28877. * Checks if `value` is a valid array-like length.
  28878. *
  28879. * **Note:** This method is loosely based on
  28880. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  28881. *
  28882. * @static
  28883. * @memberOf _
  28884. * @since 4.0.0
  28885. * @category Lang
  28886. * @param {*} value The value to check.
  28887. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  28888. * @example
  28889. *
  28890. * _.isLength(3);
  28891. * // => true
  28892. *
  28893. * _.isLength(Number.MIN_VALUE);
  28894. * // => false
  28895. *
  28896. * _.isLength(Infinity);
  28897. * // => false
  28898. *
  28899. * _.isLength('3');
  28900. * // => false
  28901. */
  28902. function isLength(value) {
  28903. return typeof value == 'number' &&
  28904. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  28905. }
  28906. /**
  28907. * Checks if `value` is the
  28908. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  28909. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  28910. *
  28911. * @static
  28912. * @memberOf _
  28913. * @since 0.1.0
  28914. * @category Lang
  28915. * @param {*} value The value to check.
  28916. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  28917. * @example
  28918. *
  28919. * _.isObject({});
  28920. * // => true
  28921. *
  28922. * _.isObject([1, 2, 3]);
  28923. * // => true
  28924. *
  28925. * _.isObject(_.noop);
  28926. * // => true
  28927. *
  28928. * _.isObject(null);
  28929. * // => false
  28930. */
  28931. function isObject(value) {
  28932. var type = typeof value;
  28933. return value != null && (type == 'object' || type == 'function');
  28934. }
  28935. /**
  28936. * Checks if `value` is object-like. A value is object-like if it's not `null`
  28937. * and has a `typeof` result of "object".
  28938. *
  28939. * @static
  28940. * @memberOf _
  28941. * @since 4.0.0
  28942. * @category Lang
  28943. * @param {*} value The value to check.
  28944. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  28945. * @example
  28946. *
  28947. * _.isObjectLike({});
  28948. * // => true
  28949. *
  28950. * _.isObjectLike([1, 2, 3]);
  28951. * // => true
  28952. *
  28953. * _.isObjectLike(_.noop);
  28954. * // => false
  28955. *
  28956. * _.isObjectLike(null);
  28957. * // => false
  28958. */
  28959. function isObjectLike(value) {
  28960. return value != null && typeof value == 'object';
  28961. }
  28962. /**
  28963. * Checks if `value` is classified as a `Map` object.
  28964. *
  28965. * @static
  28966. * @memberOf _
  28967. * @since 4.3.0
  28968. * @category Lang
  28969. * @param {*} value The value to check.
  28970. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  28971. * @example
  28972. *
  28973. * _.isMap(new Map);
  28974. * // => true
  28975. *
  28976. * _.isMap(new WeakMap);
  28977. * // => false
  28978. */
  28979. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  28980. /**
  28981. * Performs a partial deep comparison between `object` and `source` to
  28982. * determine if `object` contains equivalent property values.
  28983. *
  28984. * **Note:** This method is equivalent to `_.matches` when `source` is
  28985. * partially applied.
  28986. *
  28987. * Partial comparisons will match empty array and empty object `source`
  28988. * values against any array or object value, respectively. See `_.isEqual`
  28989. * for a list of supported value comparisons.
  28990. *
  28991. * @static
  28992. * @memberOf _
  28993. * @since 3.0.0
  28994. * @category Lang
  28995. * @param {Object} object The object to inspect.
  28996. * @param {Object} source The object of property values to match.
  28997. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  28998. * @example
  28999. *
  29000. * var object = { 'a': 1, 'b': 2 };
  29001. *
  29002. * _.isMatch(object, { 'b': 2 });
  29003. * // => true
  29004. *
  29005. * _.isMatch(object, { 'b': 1 });
  29006. * // => false
  29007. */
  29008. function isMatch(object, source) {
  29009. return object === source || baseIsMatch(object, source, getMatchData(source));
  29010. }
  29011. /**
  29012. * This method is like `_.isMatch` except that it accepts `customizer` which
  29013. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  29014. * are handled by the method instead. The `customizer` is invoked with five
  29015. * arguments: (objValue, srcValue, index|key, object, source).
  29016. *
  29017. * @static
  29018. * @memberOf _
  29019. * @since 4.0.0
  29020. * @category Lang
  29021. * @param {Object} object The object to inspect.
  29022. * @param {Object} source The object of property values to match.
  29023. * @param {Function} [customizer] The function to customize comparisons.
  29024. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  29025. * @example
  29026. *
  29027. * function isGreeting(value) {
  29028. * return /^h(?:i|ello)$/.test(value);
  29029. * }
  29030. *
  29031. * function customizer(objValue, srcValue) {
  29032. * if (isGreeting(objValue) && isGreeting(srcValue)) {
  29033. * return true;
  29034. * }
  29035. * }
  29036. *
  29037. * var object = { 'greeting': 'hello' };
  29038. * var source = { 'greeting': 'hi' };
  29039. *
  29040. * _.isMatchWith(object, source, customizer);
  29041. * // => true
  29042. */
  29043. function isMatchWith(object, source, customizer) {
  29044. customizer = typeof customizer == 'function' ? customizer : undefined;
  29045. return baseIsMatch(object, source, getMatchData(source), customizer);
  29046. }
  29047. /**
  29048. * Checks if `value` is `NaN`.
  29049. *
  29050. * **Note:** This method is based on
  29051. * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
  29052. * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
  29053. * `undefined` and other non-number values.
  29054. *
  29055. * @static
  29056. * @memberOf _
  29057. * @since 0.1.0
  29058. * @category Lang
  29059. * @param {*} value The value to check.
  29060. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  29061. * @example
  29062. *
  29063. * _.isNaN(NaN);
  29064. * // => true
  29065. *
  29066. * _.isNaN(new Number(NaN));
  29067. * // => true
  29068. *
  29069. * isNaN(undefined);
  29070. * // => true
  29071. *
  29072. * _.isNaN(undefined);
  29073. * // => false
  29074. */
  29075. function isNaN(value) {
  29076. // An `NaN` primitive is the only value that is not equal to itself.
  29077. // Perform the `toStringTag` check first to avoid errors with some
  29078. // ActiveX objects in IE.
  29079. return isNumber(value) && value != +value;
  29080. }
  29081. /**
  29082. * Checks if `value` is a pristine native function.
  29083. *
  29084. * **Note:** This method can't reliably detect native functions in the presence
  29085. * of the core-js package because core-js circumvents this kind of detection.
  29086. * Despite multiple requests, the core-js maintainer has made it clear: any
  29087. * attempt to fix the detection will be obstructed. As a result, we're left
  29088. * with little choice but to throw an error. Unfortunately, this also affects
  29089. * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
  29090. * which rely on core-js.
  29091. *
  29092. * @static
  29093. * @memberOf _
  29094. * @since 3.0.0
  29095. * @category Lang
  29096. * @param {*} value The value to check.
  29097. * @returns {boolean} Returns `true` if `value` is a native function,
  29098. * else `false`.
  29099. * @example
  29100. *
  29101. * _.isNative(Array.prototype.push);
  29102. * // => true
  29103. *
  29104. * _.isNative(_);
  29105. * // => false
  29106. */
  29107. function isNative(value) {
  29108. if (isMaskable(value)) {
  29109. throw new Error(CORE_ERROR_TEXT);
  29110. }
  29111. return baseIsNative(value);
  29112. }
  29113. /**
  29114. * Checks if `value` is `null`.
  29115. *
  29116. * @static
  29117. * @memberOf _
  29118. * @since 0.1.0
  29119. * @category Lang
  29120. * @param {*} value The value to check.
  29121. * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
  29122. * @example
  29123. *
  29124. * _.isNull(null);
  29125. * // => true
  29126. *
  29127. * _.isNull(void 0);
  29128. * // => false
  29129. */
  29130. function isNull(value) {
  29131. return value === null;
  29132. }
  29133. /**
  29134. * Checks if `value` is `null` or `undefined`.
  29135. *
  29136. * @static
  29137. * @memberOf _
  29138. * @since 4.0.0
  29139. * @category Lang
  29140. * @param {*} value The value to check.
  29141. * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
  29142. * @example
  29143. *
  29144. * _.isNil(null);
  29145. * // => true
  29146. *
  29147. * _.isNil(void 0);
  29148. * // => true
  29149. *
  29150. * _.isNil(NaN);
  29151. * // => false
  29152. */
  29153. function isNil(value) {
  29154. return value == null;
  29155. }
  29156. /**
  29157. * Checks if `value` is classified as a `Number` primitive or object.
  29158. *
  29159. * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
  29160. * classified as numbers, use the `_.isFinite` method.
  29161. *
  29162. * @static
  29163. * @memberOf _
  29164. * @since 0.1.0
  29165. * @category Lang
  29166. * @param {*} value The value to check.
  29167. * @returns {boolean} Returns `true` if `value` is a number, else `false`.
  29168. * @example
  29169. *
  29170. * _.isNumber(3);
  29171. * // => true
  29172. *
  29173. * _.isNumber(Number.MIN_VALUE);
  29174. * // => true
  29175. *
  29176. * _.isNumber(Infinity);
  29177. * // => true
  29178. *
  29179. * _.isNumber('3');
  29180. * // => false
  29181. */
  29182. function isNumber(value) {
  29183. return typeof value == 'number' ||
  29184. (isObjectLike(value) && baseGetTag(value) == numberTag);
  29185. }
  29186. /**
  29187. * Checks if `value` is a plain object, that is, an object created by the
  29188. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  29189. *
  29190. * @static
  29191. * @memberOf _
  29192. * @since 0.8.0
  29193. * @category Lang
  29194. * @param {*} value The value to check.
  29195. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  29196. * @example
  29197. *
  29198. * function Foo() {
  29199. * this.a = 1;
  29200. * }
  29201. *
  29202. * _.isPlainObject(new Foo);
  29203. * // => false
  29204. *
  29205. * _.isPlainObject([1, 2, 3]);
  29206. * // => false
  29207. *
  29208. * _.isPlainObject({ 'x': 0, 'y': 0 });
  29209. * // => true
  29210. *
  29211. * _.isPlainObject(Object.create(null));
  29212. * // => true
  29213. */
  29214. function isPlainObject(value) {
  29215. if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
  29216. return false;
  29217. }
  29218. var proto = getPrototype(value);
  29219. if (proto === null) {
  29220. return true;
  29221. }
  29222. var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  29223. return typeof Ctor == 'function' && Ctor instanceof Ctor &&
  29224. funcToString.call(Ctor) == objectCtorString;
  29225. }
  29226. /**
  29227. * Checks if `value` is classified as a `RegExp` object.
  29228. *
  29229. * @static
  29230. * @memberOf _
  29231. * @since 0.1.0
  29232. * @category Lang
  29233. * @param {*} value The value to check.
  29234. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  29235. * @example
  29236. *
  29237. * _.isRegExp(/abc/);
  29238. * // => true
  29239. *
  29240. * _.isRegExp('/abc/');
  29241. * // => false
  29242. */
  29243. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  29244. /**
  29245. * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
  29246. * double precision number which isn't the result of a rounded unsafe integer.
  29247. *
  29248. * **Note:** This method is based on
  29249. * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
  29250. *
  29251. * @static
  29252. * @memberOf _
  29253. * @since 4.0.0
  29254. * @category Lang
  29255. * @param {*} value The value to check.
  29256. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
  29257. * @example
  29258. *
  29259. * _.isSafeInteger(3);
  29260. * // => true
  29261. *
  29262. * _.isSafeInteger(Number.MIN_VALUE);
  29263. * // => false
  29264. *
  29265. * _.isSafeInteger(Infinity);
  29266. * // => false
  29267. *
  29268. * _.isSafeInteger('3');
  29269. * // => false
  29270. */
  29271. function isSafeInteger(value) {
  29272. return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
  29273. }
  29274. /**
  29275. * Checks if `value` is classified as a `Set` object.
  29276. *
  29277. * @static
  29278. * @memberOf _
  29279. * @since 4.3.0
  29280. * @category Lang
  29281. * @param {*} value The value to check.
  29282. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  29283. * @example
  29284. *
  29285. * _.isSet(new Set);
  29286. * // => true
  29287. *
  29288. * _.isSet(new WeakSet);
  29289. * // => false
  29290. */
  29291. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  29292. /**
  29293. * Checks if `value` is classified as a `String` primitive or object.
  29294. *
  29295. * @static
  29296. * @since 0.1.0
  29297. * @memberOf _
  29298. * @category Lang
  29299. * @param {*} value The value to check.
  29300. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  29301. * @example
  29302. *
  29303. * _.isString('abc');
  29304. * // => true
  29305. *
  29306. * _.isString(1);
  29307. * // => false
  29308. */
  29309. function isString(value) {
  29310. return typeof value == 'string' ||
  29311. (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
  29312. }
  29313. /**
  29314. * Checks if `value` is classified as a `Symbol` primitive or object.
  29315. *
  29316. * @static
  29317. * @memberOf _
  29318. * @since 4.0.0
  29319. * @category Lang
  29320. * @param {*} value The value to check.
  29321. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  29322. * @example
  29323. *
  29324. * _.isSymbol(Symbol.iterator);
  29325. * // => true
  29326. *
  29327. * _.isSymbol('abc');
  29328. * // => false
  29329. */
  29330. function isSymbol(value) {
  29331. return typeof value == 'symbol' ||
  29332. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  29333. }
  29334. /**
  29335. * Checks if `value` is classified as a typed array.
  29336. *
  29337. * @static
  29338. * @memberOf _
  29339. * @since 3.0.0
  29340. * @category Lang
  29341. * @param {*} value The value to check.
  29342. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  29343. * @example
  29344. *
  29345. * _.isTypedArray(new Uint8Array);
  29346. * // => true
  29347. *
  29348. * _.isTypedArray([]);
  29349. * // => false
  29350. */
  29351. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  29352. /**
  29353. * Checks if `value` is `undefined`.
  29354. *
  29355. * @static
  29356. * @since 0.1.0
  29357. * @memberOf _
  29358. * @category Lang
  29359. * @param {*} value The value to check.
  29360. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  29361. * @example
  29362. *
  29363. * _.isUndefined(void 0);
  29364. * // => true
  29365. *
  29366. * _.isUndefined(null);
  29367. * // => false
  29368. */
  29369. function isUndefined(value) {
  29370. return value === undefined;
  29371. }
  29372. /**
  29373. * Checks if `value` is classified as a `WeakMap` object.
  29374. *
  29375. * @static
  29376. * @memberOf _
  29377. * @since 4.3.0
  29378. * @category Lang
  29379. * @param {*} value The value to check.
  29380. * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
  29381. * @example
  29382. *
  29383. * _.isWeakMap(new WeakMap);
  29384. * // => true
  29385. *
  29386. * _.isWeakMap(new Map);
  29387. * // => false
  29388. */
  29389. function isWeakMap(value) {
  29390. return isObjectLike(value) && getTag(value) == weakMapTag;
  29391. }
  29392. /**
  29393. * Checks if `value` is classified as a `WeakSet` object.
  29394. *
  29395. * @static
  29396. * @memberOf _
  29397. * @since 4.3.0
  29398. * @category Lang
  29399. * @param {*} value The value to check.
  29400. * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
  29401. * @example
  29402. *
  29403. * _.isWeakSet(new WeakSet);
  29404. * // => true
  29405. *
  29406. * _.isWeakSet(new Set);
  29407. * // => false
  29408. */
  29409. function isWeakSet(value) {
  29410. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  29411. }
  29412. /**
  29413. * Checks if `value` is less than `other`.
  29414. *
  29415. * @static
  29416. * @memberOf _
  29417. * @since 3.9.0
  29418. * @category Lang
  29419. * @param {*} value The value to compare.
  29420. * @param {*} other The other value to compare.
  29421. * @returns {boolean} Returns `true` if `value` is less than `other`,
  29422. * else `false`.
  29423. * @see _.gt
  29424. * @example
  29425. *
  29426. * _.lt(1, 3);
  29427. * // => true
  29428. *
  29429. * _.lt(3, 3);
  29430. * // => false
  29431. *
  29432. * _.lt(3, 1);
  29433. * // => false
  29434. */
  29435. var lt = createRelationalOperation(baseLt);
  29436. /**
  29437. * Checks if `value` is less than or equal to `other`.
  29438. *
  29439. * @static
  29440. * @memberOf _
  29441. * @since 3.9.0
  29442. * @category Lang
  29443. * @param {*} value The value to compare.
  29444. * @param {*} other The other value to compare.
  29445. * @returns {boolean} Returns `true` if `value` is less than or equal to
  29446. * `other`, else `false`.
  29447. * @see _.gte
  29448. * @example
  29449. *
  29450. * _.lte(1, 3);
  29451. * // => true
  29452. *
  29453. * _.lte(3, 3);
  29454. * // => true
  29455. *
  29456. * _.lte(3, 1);
  29457. * // => false
  29458. */
  29459. var lte = createRelationalOperation(function(value, other) {
  29460. return value <= other;
  29461. });
  29462. /**
  29463. * Converts `value` to an array.
  29464. *
  29465. * @static
  29466. * @since 0.1.0
  29467. * @memberOf _
  29468. * @category Lang
  29469. * @param {*} value The value to convert.
  29470. * @returns {Array} Returns the converted array.
  29471. * @example
  29472. *
  29473. * _.toArray({ 'a': 1, 'b': 2 });
  29474. * // => [1, 2]
  29475. *
  29476. * _.toArray('abc');
  29477. * // => ['a', 'b', 'c']
  29478. *
  29479. * _.toArray(1);
  29480. * // => []
  29481. *
  29482. * _.toArray(null);
  29483. * // => []
  29484. */
  29485. function toArray(value) {
  29486. if (!value) {
  29487. return [];
  29488. }
  29489. if (isArrayLike(value)) {
  29490. return isString(value) ? stringToArray(value) : copyArray(value);
  29491. }
  29492. if (symIterator && value[symIterator]) {
  29493. return iteratorToArray(value[symIterator]());
  29494. }
  29495. var tag = getTag(value),
  29496. func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
  29497. return func(value);
  29498. }
  29499. /**
  29500. * Converts `value` to a finite number.
  29501. *
  29502. * @static
  29503. * @memberOf _
  29504. * @since 4.12.0
  29505. * @category Lang
  29506. * @param {*} value The value to convert.
  29507. * @returns {number} Returns the converted number.
  29508. * @example
  29509. *
  29510. * _.toFinite(3.2);
  29511. * // => 3.2
  29512. *
  29513. * _.toFinite(Number.MIN_VALUE);
  29514. * // => 5e-324
  29515. *
  29516. * _.toFinite(Infinity);
  29517. * // => 1.7976931348623157e+308
  29518. *
  29519. * _.toFinite('3.2');
  29520. * // => 3.2
  29521. */
  29522. function toFinite(value) {
  29523. if (!value) {
  29524. return value === 0 ? value : 0;
  29525. }
  29526. value = toNumber(value);
  29527. if (value === INFINITY || value === -INFINITY) {
  29528. var sign = (value < 0 ? -1 : 1);
  29529. return sign * MAX_INTEGER;
  29530. }
  29531. return value === value ? value : 0;
  29532. }
  29533. /**
  29534. * Converts `value` to an integer.
  29535. *
  29536. * **Note:** This method is loosely based on
  29537. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  29538. *
  29539. * @static
  29540. * @memberOf _
  29541. * @since 4.0.0
  29542. * @category Lang
  29543. * @param {*} value The value to convert.
  29544. * @returns {number} Returns the converted integer.
  29545. * @example
  29546. *
  29547. * _.toInteger(3.2);
  29548. * // => 3
  29549. *
  29550. * _.toInteger(Number.MIN_VALUE);
  29551. * // => 0
  29552. *
  29553. * _.toInteger(Infinity);
  29554. * // => 1.7976931348623157e+308
  29555. *
  29556. * _.toInteger('3.2');
  29557. * // => 3
  29558. */
  29559. function toInteger(value) {
  29560. var result = toFinite(value),
  29561. remainder = result % 1;
  29562. return result === result ? (remainder ? result - remainder : result) : 0;
  29563. }
  29564. /**
  29565. * Converts `value` to an integer suitable for use as the length of an
  29566. * array-like object.
  29567. *
  29568. * **Note:** This method is based on
  29569. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  29570. *
  29571. * @static
  29572. * @memberOf _
  29573. * @since 4.0.0
  29574. * @category Lang
  29575. * @param {*} value The value to convert.
  29576. * @returns {number} Returns the converted integer.
  29577. * @example
  29578. *
  29579. * _.toLength(3.2);
  29580. * // => 3
  29581. *
  29582. * _.toLength(Number.MIN_VALUE);
  29583. * // => 0
  29584. *
  29585. * _.toLength(Infinity);
  29586. * // => 4294967295
  29587. *
  29588. * _.toLength('3.2');
  29589. * // => 3
  29590. */
  29591. function toLength(value) {
  29592. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
  29593. }
  29594. /**
  29595. * Converts `value` to a number.
  29596. *
  29597. * @static
  29598. * @memberOf _
  29599. * @since 4.0.0
  29600. * @category Lang
  29601. * @param {*} value The value to process.
  29602. * @returns {number} Returns the number.
  29603. * @example
  29604. *
  29605. * _.toNumber(3.2);
  29606. * // => 3.2
  29607. *
  29608. * _.toNumber(Number.MIN_VALUE);
  29609. * // => 5e-324
  29610. *
  29611. * _.toNumber(Infinity);
  29612. * // => Infinity
  29613. *
  29614. * _.toNumber('3.2');
  29615. * // => 3.2
  29616. */
  29617. function toNumber(value) {
  29618. if (typeof value == 'number') {
  29619. return value;
  29620. }
  29621. if (isSymbol(value)) {
  29622. return NAN;
  29623. }
  29624. if (isObject(value)) {
  29625. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  29626. value = isObject(other) ? (other + '') : other;
  29627. }
  29628. if (typeof value != 'string') {
  29629. return value === 0 ? value : +value;
  29630. }
  29631. value = value.replace(reTrim, '');
  29632. var isBinary = reIsBinary.test(value);
  29633. return (isBinary || reIsOctal.test(value))
  29634. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  29635. : (reIsBadHex.test(value) ? NAN : +value);
  29636. }
  29637. /**
  29638. * Converts `value` to a plain object flattening inherited enumerable string
  29639. * keyed properties of `value` to own properties of the plain object.
  29640. *
  29641. * @static
  29642. * @memberOf _
  29643. * @since 3.0.0
  29644. * @category Lang
  29645. * @param {*} value The value to convert.
  29646. * @returns {Object} Returns the converted plain object.
  29647. * @example
  29648. *
  29649. * function Foo() {
  29650. * this.b = 2;
  29651. * }
  29652. *
  29653. * Foo.prototype.c = 3;
  29654. *
  29655. * _.assign({ 'a': 1 }, new Foo);
  29656. * // => { 'a': 1, 'b': 2 }
  29657. *
  29658. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  29659. * // => { 'a': 1, 'b': 2, 'c': 3 }
  29660. */
  29661. function toPlainObject(value) {
  29662. return copyObject(value, keysIn(value));
  29663. }
  29664. /**
  29665. * Converts `value` to a safe integer. A safe integer can be compared and
  29666. * represented correctly.
  29667. *
  29668. * @static
  29669. * @memberOf _
  29670. * @since 4.0.0
  29671. * @category Lang
  29672. * @param {*} value The value to convert.
  29673. * @returns {number} Returns the converted integer.
  29674. * @example
  29675. *
  29676. * _.toSafeInteger(3.2);
  29677. * // => 3
  29678. *
  29679. * _.toSafeInteger(Number.MIN_VALUE);
  29680. * // => 0
  29681. *
  29682. * _.toSafeInteger(Infinity);
  29683. * // => 9007199254740991
  29684. *
  29685. * _.toSafeInteger('3.2');
  29686. * // => 3
  29687. */
  29688. function toSafeInteger(value) {
  29689. return value
  29690. ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
  29691. : (value === 0 ? value : 0);
  29692. }
  29693. /**
  29694. * Converts `value` to a string. An empty string is returned for `null`
  29695. * and `undefined` values. The sign of `-0` is preserved.
  29696. *
  29697. * @static
  29698. * @memberOf _
  29699. * @since 4.0.0
  29700. * @category Lang
  29701. * @param {*} value The value to convert.
  29702. * @returns {string} Returns the converted string.
  29703. * @example
  29704. *
  29705. * _.toString(null);
  29706. * // => ''
  29707. *
  29708. * _.toString(-0);
  29709. * // => '-0'
  29710. *
  29711. * _.toString([1, 2, 3]);
  29712. * // => '1,2,3'
  29713. */
  29714. function toString(value) {
  29715. return value == null ? '' : baseToString(value);
  29716. }
  29717. /*------------------------------------------------------------------------*/
  29718. /**
  29719. * Assigns own enumerable string keyed properties of source objects to the
  29720. * destination object. Source objects are applied from left to right.
  29721. * Subsequent sources overwrite property assignments of previous sources.
  29722. *
  29723. * **Note:** This method mutates `object` and is loosely based on
  29724. * [`Object.assign`](https://mdn.io/Object/assign).
  29725. *
  29726. * @static
  29727. * @memberOf _
  29728. * @since 0.10.0
  29729. * @category Object
  29730. * @param {Object} object The destination object.
  29731. * @param {...Object} [sources] The source objects.
  29732. * @returns {Object} Returns `object`.
  29733. * @see _.assignIn
  29734. * @example
  29735. *
  29736. * function Foo() {
  29737. * this.a = 1;
  29738. * }
  29739. *
  29740. * function Bar() {
  29741. * this.c = 3;
  29742. * }
  29743. *
  29744. * Foo.prototype.b = 2;
  29745. * Bar.prototype.d = 4;
  29746. *
  29747. * _.assign({ 'a': 0 }, new Foo, new Bar);
  29748. * // => { 'a': 1, 'c': 3 }
  29749. */
  29750. var assign = createAssigner(function(object, source) {
  29751. if (isPrototype(source) || isArrayLike(source)) {
  29752. copyObject(source, keys(source), object);
  29753. return;
  29754. }
  29755. for (var key in source) {
  29756. if (hasOwnProperty.call(source, key)) {
  29757. assignValue(object, key, source[key]);
  29758. }
  29759. }
  29760. });
  29761. /**
  29762. * This method is like `_.assign` except that it iterates over own and
  29763. * inherited source properties.
  29764. *
  29765. * **Note:** This method mutates `object`.
  29766. *
  29767. * @static
  29768. * @memberOf _
  29769. * @since 4.0.0
  29770. * @alias extend
  29771. * @category Object
  29772. * @param {Object} object The destination object.
  29773. * @param {...Object} [sources] The source objects.
  29774. * @returns {Object} Returns `object`.
  29775. * @see _.assign
  29776. * @example
  29777. *
  29778. * function Foo() {
  29779. * this.a = 1;
  29780. * }
  29781. *
  29782. * function Bar() {
  29783. * this.c = 3;
  29784. * }
  29785. *
  29786. * Foo.prototype.b = 2;
  29787. * Bar.prototype.d = 4;
  29788. *
  29789. * _.assignIn({ 'a': 0 }, new Foo, new Bar);
  29790. * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
  29791. */
  29792. var assignIn = createAssigner(function(object, source) {
  29793. copyObject(source, keysIn(source), object);
  29794. });
  29795. /**
  29796. * This method is like `_.assignIn` except that it accepts `customizer`
  29797. * which is invoked to produce the assigned values. If `customizer` returns
  29798. * `undefined`, assignment is handled by the method instead. The `customizer`
  29799. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  29800. *
  29801. * **Note:** This method mutates `object`.
  29802. *
  29803. * @static
  29804. * @memberOf _
  29805. * @since 4.0.0
  29806. * @alias extendWith
  29807. * @category Object
  29808. * @param {Object} object The destination object.
  29809. * @param {...Object} sources The source objects.
  29810. * @param {Function} [customizer] The function to customize assigned values.
  29811. * @returns {Object} Returns `object`.
  29812. * @see _.assignWith
  29813. * @example
  29814. *
  29815. * function customizer(objValue, srcValue) {
  29816. * return _.isUndefined(objValue) ? srcValue : objValue;
  29817. * }
  29818. *
  29819. * var defaults = _.partialRight(_.assignInWith, customizer);
  29820. *
  29821. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  29822. * // => { 'a': 1, 'b': 2 }
  29823. */
  29824. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  29825. copyObject(source, keysIn(source), object, customizer);
  29826. });
  29827. /**
  29828. * This method is like `_.assign` except that it accepts `customizer`
  29829. * which is invoked to produce the assigned values. If `customizer` returns
  29830. * `undefined`, assignment is handled by the method instead. The `customizer`
  29831. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  29832. *
  29833. * **Note:** This method mutates `object`.
  29834. *
  29835. * @static
  29836. * @memberOf _
  29837. * @since 4.0.0
  29838. * @category Object
  29839. * @param {Object} object The destination object.
  29840. * @param {...Object} sources The source objects.
  29841. * @param {Function} [customizer] The function to customize assigned values.
  29842. * @returns {Object} Returns `object`.
  29843. * @see _.assignInWith
  29844. * @example
  29845. *
  29846. * function customizer(objValue, srcValue) {
  29847. * return _.isUndefined(objValue) ? srcValue : objValue;
  29848. * }
  29849. *
  29850. * var defaults = _.partialRight(_.assignWith, customizer);
  29851. *
  29852. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  29853. * // => { 'a': 1, 'b': 2 }
  29854. */
  29855. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  29856. copyObject(source, keys(source), object, customizer);
  29857. });
  29858. /**
  29859. * Creates an array of values corresponding to `paths` of `object`.
  29860. *
  29861. * @static
  29862. * @memberOf _
  29863. * @since 1.0.0
  29864. * @category Object
  29865. * @param {Object} object The object to iterate over.
  29866. * @param {...(string|string[])} [paths] The property paths to pick.
  29867. * @returns {Array} Returns the picked values.
  29868. * @example
  29869. *
  29870. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  29871. *
  29872. * _.at(object, ['a[0].b.c', 'a[1]']);
  29873. * // => [3, 4]
  29874. */
  29875. var at = flatRest(baseAt);
  29876. /**
  29877. * Creates an object that inherits from the `prototype` object. If a
  29878. * `properties` object is given, its own enumerable string keyed properties
  29879. * are assigned to the created object.
  29880. *
  29881. * @static
  29882. * @memberOf _
  29883. * @since 2.3.0
  29884. * @category Object
  29885. * @param {Object} prototype The object to inherit from.
  29886. * @param {Object} [properties] The properties to assign to the object.
  29887. * @returns {Object} Returns the new object.
  29888. * @example
  29889. *
  29890. * function Shape() {
  29891. * this.x = 0;
  29892. * this.y = 0;
  29893. * }
  29894. *
  29895. * function Circle() {
  29896. * Shape.call(this);
  29897. * }
  29898. *
  29899. * Circle.prototype = _.create(Shape.prototype, {
  29900. * 'constructor': Circle
  29901. * });
  29902. *
  29903. * var circle = new Circle;
  29904. * circle instanceof Circle;
  29905. * // => true
  29906. *
  29907. * circle instanceof Shape;
  29908. * // => true
  29909. */
  29910. function create(prototype, properties) {
  29911. var result = baseCreate(prototype);
  29912. return properties == null ? result : baseAssign(result, properties);
  29913. }
  29914. /**
  29915. * Assigns own and inherited enumerable string keyed properties of source
  29916. * objects to the destination object for all destination properties that
  29917. * resolve to `undefined`. Source objects are applied from left to right.
  29918. * Once a property is set, additional values of the same property are ignored.
  29919. *
  29920. * **Note:** This method mutates `object`.
  29921. *
  29922. * @static
  29923. * @since 0.1.0
  29924. * @memberOf _
  29925. * @category Object
  29926. * @param {Object} object The destination object.
  29927. * @param {...Object} [sources] The source objects.
  29928. * @returns {Object} Returns `object`.
  29929. * @see _.defaultsDeep
  29930. * @example
  29931. *
  29932. * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  29933. * // => { 'a': 1, 'b': 2 }
  29934. */
  29935. var defaults = baseRest(function(object, sources) {
  29936. object = Object(object);
  29937. var index = -1;
  29938. var length = sources.length;
  29939. var guard = length > 2 ? sources[2] : undefined;
  29940. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  29941. length = 1;
  29942. }
  29943. while (++index < length) {
  29944. var source = sources[index];
  29945. var props = keysIn(source);
  29946. var propsIndex = -1;
  29947. var propsLength = props.length;
  29948. while (++propsIndex < propsLength) {
  29949. var key = props[propsIndex];
  29950. var value = object[key];
  29951. if (value === undefined ||
  29952. (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  29953. object[key] = source[key];
  29954. }
  29955. }
  29956. }
  29957. return object;
  29958. });
  29959. /**
  29960. * This method is like `_.defaults` except that it recursively assigns
  29961. * default properties.
  29962. *
  29963. * **Note:** This method mutates `object`.
  29964. *
  29965. * @static
  29966. * @memberOf _
  29967. * @since 3.10.0
  29968. * @category Object
  29969. * @param {Object} object The destination object.
  29970. * @param {...Object} [sources] The source objects.
  29971. * @returns {Object} Returns `object`.
  29972. * @see _.defaults
  29973. * @example
  29974. *
  29975. * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
  29976. * // => { 'a': { 'b': 2, 'c': 3 } }
  29977. */
  29978. var defaultsDeep = baseRest(function(args) {
  29979. args.push(undefined, customDefaultsMerge);
  29980. return apply(mergeWith, undefined, args);
  29981. });
  29982. /**
  29983. * This method is like `_.find` except that it returns the key of the first
  29984. * element `predicate` returns truthy for instead of the element itself.
  29985. *
  29986. * @static
  29987. * @memberOf _
  29988. * @since 1.1.0
  29989. * @category Object
  29990. * @param {Object} object The object to inspect.
  29991. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  29992. * @returns {string|undefined} Returns the key of the matched element,
  29993. * else `undefined`.
  29994. * @example
  29995. *
  29996. * var users = {
  29997. * 'barney': { 'age': 36, 'active': true },
  29998. * 'fred': { 'age': 40, 'active': false },
  29999. * 'pebbles': { 'age': 1, 'active': true }
  30000. * };
  30001. *
  30002. * _.findKey(users, function(o) { return o.age < 40; });
  30003. * // => 'barney' (iteration order is not guaranteed)
  30004. *
  30005. * // The `_.matches` iteratee shorthand.
  30006. * _.findKey(users, { 'age': 1, 'active': true });
  30007. * // => 'pebbles'
  30008. *
  30009. * // The `_.matchesProperty` iteratee shorthand.
  30010. * _.findKey(users, ['active', false]);
  30011. * // => 'fred'
  30012. *
  30013. * // The `_.property` iteratee shorthand.
  30014. * _.findKey(users, 'active');
  30015. * // => 'barney'
  30016. */
  30017. function findKey(object, predicate) {
  30018. return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
  30019. }
  30020. /**
  30021. * This method is like `_.findKey` except that it iterates over elements of
  30022. * a collection in the opposite order.
  30023. *
  30024. * @static
  30025. * @memberOf _
  30026. * @since 2.0.0
  30027. * @category Object
  30028. * @param {Object} object The object to inspect.
  30029. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  30030. * @returns {string|undefined} Returns the key of the matched element,
  30031. * else `undefined`.
  30032. * @example
  30033. *
  30034. * var users = {
  30035. * 'barney': { 'age': 36, 'active': true },
  30036. * 'fred': { 'age': 40, 'active': false },
  30037. * 'pebbles': { 'age': 1, 'active': true }
  30038. * };
  30039. *
  30040. * _.findLastKey(users, function(o) { return o.age < 40; });
  30041. * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
  30042. *
  30043. * // The `_.matches` iteratee shorthand.
  30044. * _.findLastKey(users, { 'age': 36, 'active': true });
  30045. * // => 'barney'
  30046. *
  30047. * // The `_.matchesProperty` iteratee shorthand.
  30048. * _.findLastKey(users, ['active', false]);
  30049. * // => 'fred'
  30050. *
  30051. * // The `_.property` iteratee shorthand.
  30052. * _.findLastKey(users, 'active');
  30053. * // => 'pebbles'
  30054. */
  30055. function findLastKey(object, predicate) {
  30056. return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
  30057. }
  30058. /**
  30059. * Iterates over own and inherited enumerable string keyed properties of an
  30060. * object and invokes `iteratee` for each property. The iteratee is invoked
  30061. * with three arguments: (value, key, object). Iteratee functions may exit
  30062. * iteration early by explicitly returning `false`.
  30063. *
  30064. * @static
  30065. * @memberOf _
  30066. * @since 0.3.0
  30067. * @category Object
  30068. * @param {Object} object The object to iterate over.
  30069. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30070. * @returns {Object} Returns `object`.
  30071. * @see _.forInRight
  30072. * @example
  30073. *
  30074. * function Foo() {
  30075. * this.a = 1;
  30076. * this.b = 2;
  30077. * }
  30078. *
  30079. * Foo.prototype.c = 3;
  30080. *
  30081. * _.forIn(new Foo, function(value, key) {
  30082. * console.log(key);
  30083. * });
  30084. * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
  30085. */
  30086. function forIn(object, iteratee) {
  30087. return object == null
  30088. ? object
  30089. : baseFor(object, getIteratee(iteratee, 3), keysIn);
  30090. }
  30091. /**
  30092. * This method is like `_.forIn` except that it iterates over properties of
  30093. * `object` in the opposite order.
  30094. *
  30095. * @static
  30096. * @memberOf _
  30097. * @since 2.0.0
  30098. * @category Object
  30099. * @param {Object} object The object to iterate over.
  30100. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30101. * @returns {Object} Returns `object`.
  30102. * @see _.forIn
  30103. * @example
  30104. *
  30105. * function Foo() {
  30106. * this.a = 1;
  30107. * this.b = 2;
  30108. * }
  30109. *
  30110. * Foo.prototype.c = 3;
  30111. *
  30112. * _.forInRight(new Foo, function(value, key) {
  30113. * console.log(key);
  30114. * });
  30115. * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
  30116. */
  30117. function forInRight(object, iteratee) {
  30118. return object == null
  30119. ? object
  30120. : baseForRight(object, getIteratee(iteratee, 3), keysIn);
  30121. }
  30122. /**
  30123. * Iterates over own enumerable string keyed properties of an object and
  30124. * invokes `iteratee` for each property. The iteratee is invoked with three
  30125. * arguments: (value, key, object). Iteratee functions may exit iteration
  30126. * early by explicitly returning `false`.
  30127. *
  30128. * @static
  30129. * @memberOf _
  30130. * @since 0.3.0
  30131. * @category Object
  30132. * @param {Object} object The object to iterate over.
  30133. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30134. * @returns {Object} Returns `object`.
  30135. * @see _.forOwnRight
  30136. * @example
  30137. *
  30138. * function Foo() {
  30139. * this.a = 1;
  30140. * this.b = 2;
  30141. * }
  30142. *
  30143. * Foo.prototype.c = 3;
  30144. *
  30145. * _.forOwn(new Foo, function(value, key) {
  30146. * console.log(key);
  30147. * });
  30148. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  30149. */
  30150. function forOwn(object, iteratee) {
  30151. return object && baseForOwn(object, getIteratee(iteratee, 3));
  30152. }
  30153. /**
  30154. * This method is like `_.forOwn` except that it iterates over properties of
  30155. * `object` in the opposite order.
  30156. *
  30157. * @static
  30158. * @memberOf _
  30159. * @since 2.0.0
  30160. * @category Object
  30161. * @param {Object} object The object to iterate over.
  30162. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30163. * @returns {Object} Returns `object`.
  30164. * @see _.forOwn
  30165. * @example
  30166. *
  30167. * function Foo() {
  30168. * this.a = 1;
  30169. * this.b = 2;
  30170. * }
  30171. *
  30172. * Foo.prototype.c = 3;
  30173. *
  30174. * _.forOwnRight(new Foo, function(value, key) {
  30175. * console.log(key);
  30176. * });
  30177. * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
  30178. */
  30179. function forOwnRight(object, iteratee) {
  30180. return object && baseForOwnRight(object, getIteratee(iteratee, 3));
  30181. }
  30182. /**
  30183. * Creates an array of function property names from own enumerable properties
  30184. * of `object`.
  30185. *
  30186. * @static
  30187. * @since 0.1.0
  30188. * @memberOf _
  30189. * @category Object
  30190. * @param {Object} object The object to inspect.
  30191. * @returns {Array} Returns the function names.
  30192. * @see _.functionsIn
  30193. * @example
  30194. *
  30195. * function Foo() {
  30196. * this.a = _.constant('a');
  30197. * this.b = _.constant('b');
  30198. * }
  30199. *
  30200. * Foo.prototype.c = _.constant('c');
  30201. *
  30202. * _.functions(new Foo);
  30203. * // => ['a', 'b']
  30204. */
  30205. function functions(object) {
  30206. return object == null ? [] : baseFunctions(object, keys(object));
  30207. }
  30208. /**
  30209. * Creates an array of function property names from own and inherited
  30210. * enumerable properties of `object`.
  30211. *
  30212. * @static
  30213. * @memberOf _
  30214. * @since 4.0.0
  30215. * @category Object
  30216. * @param {Object} object The object to inspect.
  30217. * @returns {Array} Returns the function names.
  30218. * @see _.functions
  30219. * @example
  30220. *
  30221. * function Foo() {
  30222. * this.a = _.constant('a');
  30223. * this.b = _.constant('b');
  30224. * }
  30225. *
  30226. * Foo.prototype.c = _.constant('c');
  30227. *
  30228. * _.functionsIn(new Foo);
  30229. * // => ['a', 'b', 'c']
  30230. */
  30231. function functionsIn(object) {
  30232. return object == null ? [] : baseFunctions(object, keysIn(object));
  30233. }
  30234. /**
  30235. * Gets the value at `path` of `object`. If the resolved value is
  30236. * `undefined`, the `defaultValue` is returned in its place.
  30237. *
  30238. * @static
  30239. * @memberOf _
  30240. * @since 3.7.0
  30241. * @category Object
  30242. * @param {Object} object The object to query.
  30243. * @param {Array|string} path The path of the property to get.
  30244. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  30245. * @returns {*} Returns the resolved value.
  30246. * @example
  30247. *
  30248. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  30249. *
  30250. * _.get(object, 'a[0].b.c');
  30251. * // => 3
  30252. *
  30253. * _.get(object, ['a', '0', 'b', 'c']);
  30254. * // => 3
  30255. *
  30256. * _.get(object, 'a.b.c', 'default');
  30257. * // => 'default'
  30258. */
  30259. function get(object, path, defaultValue) {
  30260. var result = object == null ? undefined : baseGet(object, path);
  30261. return result === undefined ? defaultValue : result;
  30262. }
  30263. /**
  30264. * Checks if `path` is a direct property of `object`.
  30265. *
  30266. * @static
  30267. * @since 0.1.0
  30268. * @memberOf _
  30269. * @category Object
  30270. * @param {Object} object The object to query.
  30271. * @param {Array|string} path The path to check.
  30272. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  30273. * @example
  30274. *
  30275. * var object = { 'a': { 'b': 2 } };
  30276. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  30277. *
  30278. * _.has(object, 'a');
  30279. * // => true
  30280. *
  30281. * _.has(object, 'a.b');
  30282. * // => true
  30283. *
  30284. * _.has(object, ['a', 'b']);
  30285. * // => true
  30286. *
  30287. * _.has(other, 'a');
  30288. * // => false
  30289. */
  30290. function has(object, path) {
  30291. return object != null && hasPath(object, path, baseHas);
  30292. }
  30293. /**
  30294. * Checks if `path` is a direct or inherited property of `object`.
  30295. *
  30296. * @static
  30297. * @memberOf _
  30298. * @since 4.0.0
  30299. * @category Object
  30300. * @param {Object} object The object to query.
  30301. * @param {Array|string} path The path to check.
  30302. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  30303. * @example
  30304. *
  30305. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  30306. *
  30307. * _.hasIn(object, 'a');
  30308. * // => true
  30309. *
  30310. * _.hasIn(object, 'a.b');
  30311. * // => true
  30312. *
  30313. * _.hasIn(object, ['a', 'b']);
  30314. * // => true
  30315. *
  30316. * _.hasIn(object, 'b');
  30317. * // => false
  30318. */
  30319. function hasIn(object, path) {
  30320. return object != null && hasPath(object, path, baseHasIn);
  30321. }
  30322. /**
  30323. * Creates an object composed of the inverted keys and values of `object`.
  30324. * If `object` contains duplicate values, subsequent values overwrite
  30325. * property assignments of previous values.
  30326. *
  30327. * @static
  30328. * @memberOf _
  30329. * @since 0.7.0
  30330. * @category Object
  30331. * @param {Object} object The object to invert.
  30332. * @returns {Object} Returns the new inverted object.
  30333. * @example
  30334. *
  30335. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  30336. *
  30337. * _.invert(object);
  30338. * // => { '1': 'c', '2': 'b' }
  30339. */
  30340. var invert = createInverter(function(result, value, key) {
  30341. if (value != null &&
  30342. typeof value.toString != 'function') {
  30343. value = nativeObjectToString.call(value);
  30344. }
  30345. result[value] = key;
  30346. }, constant(identity));
  30347. /**
  30348. * This method is like `_.invert` except that the inverted object is generated
  30349. * from the results of running each element of `object` thru `iteratee`. The
  30350. * corresponding inverted value of each inverted key is an array of keys
  30351. * responsible for generating the inverted value. The iteratee is invoked
  30352. * with one argument: (value).
  30353. *
  30354. * @static
  30355. * @memberOf _
  30356. * @since 4.1.0
  30357. * @category Object
  30358. * @param {Object} object The object to invert.
  30359. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  30360. * @returns {Object} Returns the new inverted object.
  30361. * @example
  30362. *
  30363. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  30364. *
  30365. * _.invertBy(object);
  30366. * // => { '1': ['a', 'c'], '2': ['b'] }
  30367. *
  30368. * _.invertBy(object, function(value) {
  30369. * return 'group' + value;
  30370. * });
  30371. * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
  30372. */
  30373. var invertBy = createInverter(function(result, value, key) {
  30374. if (value != null &&
  30375. typeof value.toString != 'function') {
  30376. value = nativeObjectToString.call(value);
  30377. }
  30378. if (hasOwnProperty.call(result, value)) {
  30379. result[value].push(key);
  30380. } else {
  30381. result[value] = [key];
  30382. }
  30383. }, getIteratee);
  30384. /**
  30385. * Invokes the method at `path` of `object`.
  30386. *
  30387. * @static
  30388. * @memberOf _
  30389. * @since 4.0.0
  30390. * @category Object
  30391. * @param {Object} object The object to query.
  30392. * @param {Array|string} path The path of the method to invoke.
  30393. * @param {...*} [args] The arguments to invoke the method with.
  30394. * @returns {*} Returns the result of the invoked method.
  30395. * @example
  30396. *
  30397. * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
  30398. *
  30399. * _.invoke(object, 'a[0].b.c.slice', 1, 3);
  30400. * // => [2, 3]
  30401. */
  30402. var invoke = baseRest(baseInvoke);
  30403. /**
  30404. * Creates an array of the own enumerable property names of `object`.
  30405. *
  30406. * **Note:** Non-object values are coerced to objects. See the
  30407. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  30408. * for more details.
  30409. *
  30410. * @static
  30411. * @since 0.1.0
  30412. * @memberOf _
  30413. * @category Object
  30414. * @param {Object} object The object to query.
  30415. * @returns {Array} Returns the array of property names.
  30416. * @example
  30417. *
  30418. * function Foo() {
  30419. * this.a = 1;
  30420. * this.b = 2;
  30421. * }
  30422. *
  30423. * Foo.prototype.c = 3;
  30424. *
  30425. * _.keys(new Foo);
  30426. * // => ['a', 'b'] (iteration order is not guaranteed)
  30427. *
  30428. * _.keys('hi');
  30429. * // => ['0', '1']
  30430. */
  30431. function keys(object) {
  30432. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  30433. }
  30434. /**
  30435. * Creates an array of the own and inherited enumerable property names of `object`.
  30436. *
  30437. * **Note:** Non-object values are coerced to objects.
  30438. *
  30439. * @static
  30440. * @memberOf _
  30441. * @since 3.0.0
  30442. * @category Object
  30443. * @param {Object} object The object to query.
  30444. * @returns {Array} Returns the array of property names.
  30445. * @example
  30446. *
  30447. * function Foo() {
  30448. * this.a = 1;
  30449. * this.b = 2;
  30450. * }
  30451. *
  30452. * Foo.prototype.c = 3;
  30453. *
  30454. * _.keysIn(new Foo);
  30455. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  30456. */
  30457. function keysIn(object) {
  30458. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  30459. }
  30460. /**
  30461. * The opposite of `_.mapValues`; this method creates an object with the
  30462. * same values as `object` and keys generated by running each own enumerable
  30463. * string keyed property of `object` thru `iteratee`. The iteratee is invoked
  30464. * with three arguments: (value, key, object).
  30465. *
  30466. * @static
  30467. * @memberOf _
  30468. * @since 3.8.0
  30469. * @category Object
  30470. * @param {Object} object The object to iterate over.
  30471. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30472. * @returns {Object} Returns the new mapped object.
  30473. * @see _.mapValues
  30474. * @example
  30475. *
  30476. * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
  30477. * return key + value;
  30478. * });
  30479. * // => { 'a1': 1, 'b2': 2 }
  30480. */
  30481. function mapKeys(object, iteratee) {
  30482. var result = {};
  30483. iteratee = getIteratee(iteratee, 3);
  30484. baseForOwn(object, function(value, key, object) {
  30485. baseAssignValue(result, iteratee(value, key, object), value);
  30486. });
  30487. return result;
  30488. }
  30489. /**
  30490. * Creates an object with the same keys as `object` and values generated
  30491. * by running each own enumerable string keyed property of `object` thru
  30492. * `iteratee`. The iteratee is invoked with three arguments:
  30493. * (value, key, object).
  30494. *
  30495. * @static
  30496. * @memberOf _
  30497. * @since 2.4.0
  30498. * @category Object
  30499. * @param {Object} object The object to iterate over.
  30500. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30501. * @returns {Object} Returns the new mapped object.
  30502. * @see _.mapKeys
  30503. * @example
  30504. *
  30505. * var users = {
  30506. * 'fred': { 'user': 'fred', 'age': 40 },
  30507. * 'pebbles': { 'user': 'pebbles', 'age': 1 }
  30508. * };
  30509. *
  30510. * _.mapValues(users, function(o) { return o.age; });
  30511. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  30512. *
  30513. * // The `_.property` iteratee shorthand.
  30514. * _.mapValues(users, 'age');
  30515. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  30516. */
  30517. function mapValues(object, iteratee) {
  30518. var result = {};
  30519. iteratee = getIteratee(iteratee, 3);
  30520. baseForOwn(object, function(value, key, object) {
  30521. baseAssignValue(result, key, iteratee(value, key, object));
  30522. });
  30523. return result;
  30524. }
  30525. /**
  30526. * This method is like `_.assign` except that it recursively merges own and
  30527. * inherited enumerable string keyed properties of source objects into the
  30528. * destination object. Source properties that resolve to `undefined` are
  30529. * skipped if a destination value exists. Array and plain object properties
  30530. * are merged recursively. Other objects and value types are overridden by
  30531. * assignment. Source objects are applied from left to right. Subsequent
  30532. * sources overwrite property assignments of previous sources.
  30533. *
  30534. * **Note:** This method mutates `object`.
  30535. *
  30536. * @static
  30537. * @memberOf _
  30538. * @since 0.5.0
  30539. * @category Object
  30540. * @param {Object} object The destination object.
  30541. * @param {...Object} [sources] The source objects.
  30542. * @returns {Object} Returns `object`.
  30543. * @example
  30544. *
  30545. * var object = {
  30546. * 'a': [{ 'b': 2 }, { 'd': 4 }]
  30547. * };
  30548. *
  30549. * var other = {
  30550. * 'a': [{ 'c': 3 }, { 'e': 5 }]
  30551. * };
  30552. *
  30553. * _.merge(object, other);
  30554. * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
  30555. */
  30556. var merge = createAssigner(function(object, source, srcIndex) {
  30557. baseMerge(object, source, srcIndex);
  30558. });
  30559. /**
  30560. * This method is like `_.merge` except that it accepts `customizer` which
  30561. * is invoked to produce the merged values of the destination and source
  30562. * properties. If `customizer` returns `undefined`, merging is handled by the
  30563. * method instead. The `customizer` is invoked with six arguments:
  30564. * (objValue, srcValue, key, object, source, stack).
  30565. *
  30566. * **Note:** This method mutates `object`.
  30567. *
  30568. * @static
  30569. * @memberOf _
  30570. * @since 4.0.0
  30571. * @category Object
  30572. * @param {Object} object The destination object.
  30573. * @param {...Object} sources The source objects.
  30574. * @param {Function} customizer The function to customize assigned values.
  30575. * @returns {Object} Returns `object`.
  30576. * @example
  30577. *
  30578. * function customizer(objValue, srcValue) {
  30579. * if (_.isArray(objValue)) {
  30580. * return objValue.concat(srcValue);
  30581. * }
  30582. * }
  30583. *
  30584. * var object = { 'a': [1], 'b': [2] };
  30585. * var other = { 'a': [3], 'b': [4] };
  30586. *
  30587. * _.mergeWith(object, other, customizer);
  30588. * // => { 'a': [1, 3], 'b': [2, 4] }
  30589. */
  30590. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  30591. baseMerge(object, source, srcIndex, customizer);
  30592. });
  30593. /**
  30594. * The opposite of `_.pick`; this method creates an object composed of the
  30595. * own and inherited enumerable property paths of `object` that are not omitted.
  30596. *
  30597. * **Note:** This method is considerably slower than `_.pick`.
  30598. *
  30599. * @static
  30600. * @since 0.1.0
  30601. * @memberOf _
  30602. * @category Object
  30603. * @param {Object} object The source object.
  30604. * @param {...(string|string[])} [paths] The property paths to omit.
  30605. * @returns {Object} Returns the new object.
  30606. * @example
  30607. *
  30608. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30609. *
  30610. * _.omit(object, ['a', 'c']);
  30611. * // => { 'b': '2' }
  30612. */
  30613. var omit = flatRest(function(object, paths) {
  30614. var result = {};
  30615. if (object == null) {
  30616. return result;
  30617. }
  30618. var isDeep = false;
  30619. paths = arrayMap(paths, function(path) {
  30620. path = castPath(path, object);
  30621. isDeep || (isDeep = path.length > 1);
  30622. return path;
  30623. });
  30624. copyObject(object, getAllKeysIn(object), result);
  30625. if (isDeep) {
  30626. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  30627. }
  30628. var length = paths.length;
  30629. while (length--) {
  30630. baseUnset(result, paths[length]);
  30631. }
  30632. return result;
  30633. });
  30634. /**
  30635. * The opposite of `_.pickBy`; this method creates an object composed of
  30636. * the own and inherited enumerable string keyed properties of `object` that
  30637. * `predicate` doesn't return truthy for. The predicate is invoked with two
  30638. * arguments: (value, key).
  30639. *
  30640. * @static
  30641. * @memberOf _
  30642. * @since 4.0.0
  30643. * @category Object
  30644. * @param {Object} object The source object.
  30645. * @param {Function} [predicate=_.identity] The function invoked per property.
  30646. * @returns {Object} Returns the new object.
  30647. * @example
  30648. *
  30649. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30650. *
  30651. * _.omitBy(object, _.isNumber);
  30652. * // => { 'b': '2' }
  30653. */
  30654. function omitBy(object, predicate) {
  30655. return pickBy(object, negate(getIteratee(predicate)));
  30656. }
  30657. /**
  30658. * Creates an object composed of the picked `object` properties.
  30659. *
  30660. * @static
  30661. * @since 0.1.0
  30662. * @memberOf _
  30663. * @category Object
  30664. * @param {Object} object The source object.
  30665. * @param {...(string|string[])} [paths] The property paths to pick.
  30666. * @returns {Object} Returns the new object.
  30667. * @example
  30668. *
  30669. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30670. *
  30671. * _.pick(object, ['a', 'c']);
  30672. * // => { 'a': 1, 'c': 3 }
  30673. */
  30674. var pick = flatRest(function(object, paths) {
  30675. return object == null ? {} : basePick(object, paths);
  30676. });
  30677. /**
  30678. * Creates an object composed of the `object` properties `predicate` returns
  30679. * truthy for. The predicate is invoked with two arguments: (value, key).
  30680. *
  30681. * @static
  30682. * @memberOf _
  30683. * @since 4.0.0
  30684. * @category Object
  30685. * @param {Object} object The source object.
  30686. * @param {Function} [predicate=_.identity] The function invoked per property.
  30687. * @returns {Object} Returns the new object.
  30688. * @example
  30689. *
  30690. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30691. *
  30692. * _.pickBy(object, _.isNumber);
  30693. * // => { 'a': 1, 'c': 3 }
  30694. */
  30695. function pickBy(object, predicate) {
  30696. if (object == null) {
  30697. return {};
  30698. }
  30699. var props = arrayMap(getAllKeysIn(object), function(prop) {
  30700. return [prop];
  30701. });
  30702. predicate = getIteratee(predicate);
  30703. return basePickBy(object, props, function(value, path) {
  30704. return predicate(value, path[0]);
  30705. });
  30706. }
  30707. /**
  30708. * This method is like `_.get` except that if the resolved value is a
  30709. * function it's invoked with the `this` binding of its parent object and
  30710. * its result is returned.
  30711. *
  30712. * @static
  30713. * @since 0.1.0
  30714. * @memberOf _
  30715. * @category Object
  30716. * @param {Object} object The object to query.
  30717. * @param {Array|string} path The path of the property to resolve.
  30718. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  30719. * @returns {*} Returns the resolved value.
  30720. * @example
  30721. *
  30722. * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
  30723. *
  30724. * _.result(object, 'a[0].b.c1');
  30725. * // => 3
  30726. *
  30727. * _.result(object, 'a[0].b.c2');
  30728. * // => 4
  30729. *
  30730. * _.result(object, 'a[0].b.c3', 'default');
  30731. * // => 'default'
  30732. *
  30733. * _.result(object, 'a[0].b.c3', _.constant('default'));
  30734. * // => 'default'
  30735. */
  30736. function result(object, path, defaultValue) {
  30737. path = castPath(path, object);
  30738. var index = -1,
  30739. length = path.length;
  30740. // Ensure the loop is entered when path is empty.
  30741. if (!length) {
  30742. length = 1;
  30743. object = undefined;
  30744. }
  30745. while (++index < length) {
  30746. var value = object == null ? undefined : object[toKey(path[index])];
  30747. if (value === undefined) {
  30748. index = length;
  30749. value = defaultValue;
  30750. }
  30751. object = isFunction(value) ? value.call(object) : value;
  30752. }
  30753. return object;
  30754. }
  30755. /**
  30756. * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
  30757. * it's created. Arrays are created for missing index properties while objects
  30758. * are created for all other missing properties. Use `_.setWith` to customize
  30759. * `path` creation.
  30760. *
  30761. * **Note:** This method mutates `object`.
  30762. *
  30763. * @static
  30764. * @memberOf _
  30765. * @since 3.7.0
  30766. * @category Object
  30767. * @param {Object} object The object to modify.
  30768. * @param {Array|string} path The path of the property to set.
  30769. * @param {*} value The value to set.
  30770. * @returns {Object} Returns `object`.
  30771. * @example
  30772. *
  30773. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  30774. *
  30775. * _.set(object, 'a[0].b.c', 4);
  30776. * console.log(object.a[0].b.c);
  30777. * // => 4
  30778. *
  30779. * _.set(object, ['x', '0', 'y', 'z'], 5);
  30780. * console.log(object.x[0].y.z);
  30781. * // => 5
  30782. */
  30783. function set(object, path, value) {
  30784. return object == null ? object : baseSet(object, path, value);
  30785. }
  30786. /**
  30787. * This method is like `_.set` except that it accepts `customizer` which is
  30788. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  30789. * path creation is handled by the method instead. The `customizer` is invoked
  30790. * with three arguments: (nsValue, key, nsObject).
  30791. *
  30792. * **Note:** This method mutates `object`.
  30793. *
  30794. * @static
  30795. * @memberOf _
  30796. * @since 4.0.0
  30797. * @category Object
  30798. * @param {Object} object The object to modify.
  30799. * @param {Array|string} path The path of the property to set.
  30800. * @param {*} value The value to set.
  30801. * @param {Function} [customizer] The function to customize assigned values.
  30802. * @returns {Object} Returns `object`.
  30803. * @example
  30804. *
  30805. * var object = {};
  30806. *
  30807. * _.setWith(object, '[0][1]', 'a', Object);
  30808. * // => { '0': { '1': 'a' } }
  30809. */
  30810. function setWith(object, path, value, customizer) {
  30811. customizer = typeof customizer == 'function' ? customizer : undefined;
  30812. return object == null ? object : baseSet(object, path, value, customizer);
  30813. }
  30814. /**
  30815. * Creates an array of own enumerable string keyed-value pairs for `object`
  30816. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  30817. * entries are returned.
  30818. *
  30819. * @static
  30820. * @memberOf _
  30821. * @since 4.0.0
  30822. * @alias entries
  30823. * @category Object
  30824. * @param {Object} object The object to query.
  30825. * @returns {Array} Returns the key-value pairs.
  30826. * @example
  30827. *
  30828. * function Foo() {
  30829. * this.a = 1;
  30830. * this.b = 2;
  30831. * }
  30832. *
  30833. * Foo.prototype.c = 3;
  30834. *
  30835. * _.toPairs(new Foo);
  30836. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  30837. */
  30838. var toPairs = createToPairs(keys);
  30839. /**
  30840. * Creates an array of own and inherited enumerable string keyed-value pairs
  30841. * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
  30842. * or set, its entries are returned.
  30843. *
  30844. * @static
  30845. * @memberOf _
  30846. * @since 4.0.0
  30847. * @alias entriesIn
  30848. * @category Object
  30849. * @param {Object} object The object to query.
  30850. * @returns {Array} Returns the key-value pairs.
  30851. * @example
  30852. *
  30853. * function Foo() {
  30854. * this.a = 1;
  30855. * this.b = 2;
  30856. * }
  30857. *
  30858. * Foo.prototype.c = 3;
  30859. *
  30860. * _.toPairsIn(new Foo);
  30861. * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
  30862. */
  30863. var toPairsIn = createToPairs(keysIn);
  30864. /**
  30865. * An alternative to `_.reduce`; this method transforms `object` to a new
  30866. * `accumulator` object which is the result of running each of its own
  30867. * enumerable string keyed properties thru `iteratee`, with each invocation
  30868. * potentially mutating the `accumulator` object. If `accumulator` is not
  30869. * provided, a new object with the same `[[Prototype]]` will be used. The
  30870. * iteratee is invoked with four arguments: (accumulator, value, key, object).
  30871. * Iteratee functions may exit iteration early by explicitly returning `false`.
  30872. *
  30873. * @static
  30874. * @memberOf _
  30875. * @since 1.3.0
  30876. * @category Object
  30877. * @param {Object} object The object to iterate over.
  30878. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30879. * @param {*} [accumulator] The custom accumulator value.
  30880. * @returns {*} Returns the accumulated value.
  30881. * @example
  30882. *
  30883. * _.transform([2, 3, 4], function(result, n) {
  30884. * result.push(n *= n);
  30885. * return n % 2 == 0;
  30886. * }, []);
  30887. * // => [4, 9]
  30888. *
  30889. * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  30890. * (result[value] || (result[value] = [])).push(key);
  30891. * }, {});
  30892. * // => { '1': ['a', 'c'], '2': ['b'] }
  30893. */
  30894. function transform(object, iteratee, accumulator) {
  30895. var isArr = isArray(object),
  30896. isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  30897. iteratee = getIteratee(iteratee, 4);
  30898. if (accumulator == null) {
  30899. var Ctor = object && object.constructor;
  30900. if (isArrLike) {
  30901. accumulator = isArr ? new Ctor : [];
  30902. }
  30903. else if (isObject(object)) {
  30904. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  30905. }
  30906. else {
  30907. accumulator = {};
  30908. }
  30909. }
  30910. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
  30911. return iteratee(accumulator, value, index, object);
  30912. });
  30913. return accumulator;
  30914. }
  30915. /**
  30916. * Removes the property at `path` of `object`.
  30917. *
  30918. * **Note:** This method mutates `object`.
  30919. *
  30920. * @static
  30921. * @memberOf _
  30922. * @since 4.0.0
  30923. * @category Object
  30924. * @param {Object} object The object to modify.
  30925. * @param {Array|string} path The path of the property to unset.
  30926. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  30927. * @example
  30928. *
  30929. * var object = { 'a': [{ 'b': { 'c': 7 } }] };
  30930. * _.unset(object, 'a[0].b.c');
  30931. * // => true
  30932. *
  30933. * console.log(object);
  30934. * // => { 'a': [{ 'b': {} }] };
  30935. *
  30936. * _.unset(object, ['a', '0', 'b', 'c']);
  30937. * // => true
  30938. *
  30939. * console.log(object);
  30940. * // => { 'a': [{ 'b': {} }] };
  30941. */
  30942. function unset(object, path) {
  30943. return object == null ? true : baseUnset(object, path);
  30944. }
  30945. /**
  30946. * This method is like `_.set` except that accepts `updater` to produce the
  30947. * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
  30948. * is invoked with one argument: (value).
  30949. *
  30950. * **Note:** This method mutates `object`.
  30951. *
  30952. * @static
  30953. * @memberOf _
  30954. * @since 4.6.0
  30955. * @category Object
  30956. * @param {Object} object The object to modify.
  30957. * @param {Array|string} path The path of the property to set.
  30958. * @param {Function} updater The function to produce the updated value.
  30959. * @returns {Object} Returns `object`.
  30960. * @example
  30961. *
  30962. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  30963. *
  30964. * _.update(object, 'a[0].b.c', function(n) { return n * n; });
  30965. * console.log(object.a[0].b.c);
  30966. * // => 9
  30967. *
  30968. * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
  30969. * console.log(object.x[0].y.z);
  30970. * // => 0
  30971. */
  30972. function update(object, path, updater) {
  30973. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  30974. }
  30975. /**
  30976. * This method is like `_.update` except that it accepts `customizer` which is
  30977. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  30978. * path creation is handled by the method instead. The `customizer` is invoked
  30979. * with three arguments: (nsValue, key, nsObject).
  30980. *
  30981. * **Note:** This method mutates `object`.
  30982. *
  30983. * @static
  30984. * @memberOf _
  30985. * @since 4.6.0
  30986. * @category Object
  30987. * @param {Object} object The object to modify.
  30988. * @param {Array|string} path The path of the property to set.
  30989. * @param {Function} updater The function to produce the updated value.
  30990. * @param {Function} [customizer] The function to customize assigned values.
  30991. * @returns {Object} Returns `object`.
  30992. * @example
  30993. *
  30994. * var object = {};
  30995. *
  30996. * _.updateWith(object, '[0][1]', _.constant('a'), Object);
  30997. * // => { '0': { '1': 'a' } }
  30998. */
  30999. function updateWith(object, path, updater, customizer) {
  31000. customizer = typeof customizer == 'function' ? customizer : undefined;
  31001. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  31002. }
  31003. /**
  31004. * Creates an array of the own enumerable string keyed property values of `object`.
  31005. *
  31006. * **Note:** Non-object values are coerced to objects.
  31007. *
  31008. * @static
  31009. * @since 0.1.0
  31010. * @memberOf _
  31011. * @category Object
  31012. * @param {Object} object The object to query.
  31013. * @returns {Array} Returns the array of property values.
  31014. * @example
  31015. *
  31016. * function Foo() {
  31017. * this.a = 1;
  31018. * this.b = 2;
  31019. * }
  31020. *
  31021. * Foo.prototype.c = 3;
  31022. *
  31023. * _.values(new Foo);
  31024. * // => [1, 2] (iteration order is not guaranteed)
  31025. *
  31026. * _.values('hi');
  31027. * // => ['h', 'i']
  31028. */
  31029. function values(object) {
  31030. return object == null ? [] : baseValues(object, keys(object));
  31031. }
  31032. /**
  31033. * Creates an array of the own and inherited enumerable string keyed property
  31034. * values of `object`.
  31035. *
  31036. * **Note:** Non-object values are coerced to objects.
  31037. *
  31038. * @static
  31039. * @memberOf _
  31040. * @since 3.0.0
  31041. * @category Object
  31042. * @param {Object} object The object to query.
  31043. * @returns {Array} Returns the array of property values.
  31044. * @example
  31045. *
  31046. * function Foo() {
  31047. * this.a = 1;
  31048. * this.b = 2;
  31049. * }
  31050. *
  31051. * Foo.prototype.c = 3;
  31052. *
  31053. * _.valuesIn(new Foo);
  31054. * // => [1, 2, 3] (iteration order is not guaranteed)
  31055. */
  31056. function valuesIn(object) {
  31057. return object == null ? [] : baseValues(object, keysIn(object));
  31058. }
  31059. /*------------------------------------------------------------------------*/
  31060. /**
  31061. * Clamps `number` within the inclusive `lower` and `upper` bounds.
  31062. *
  31063. * @static
  31064. * @memberOf _
  31065. * @since 4.0.0
  31066. * @category Number
  31067. * @param {number} number The number to clamp.
  31068. * @param {number} [lower] The lower bound.
  31069. * @param {number} upper The upper bound.
  31070. * @returns {number} Returns the clamped number.
  31071. * @example
  31072. *
  31073. * _.clamp(-10, -5, 5);
  31074. * // => -5
  31075. *
  31076. * _.clamp(10, -5, 5);
  31077. * // => 5
  31078. */
  31079. function clamp(number, lower, upper) {
  31080. if (upper === undefined) {
  31081. upper = lower;
  31082. lower = undefined;
  31083. }
  31084. if (upper !== undefined) {
  31085. upper = toNumber(upper);
  31086. upper = upper === upper ? upper : 0;
  31087. }
  31088. if (lower !== undefined) {
  31089. lower = toNumber(lower);
  31090. lower = lower === lower ? lower : 0;
  31091. }
  31092. return baseClamp(toNumber(number), lower, upper);
  31093. }
  31094. /**
  31095. * Checks if `n` is between `start` and up to, but not including, `end`. If
  31096. * `end` is not specified, it's set to `start` with `start` then set to `0`.
  31097. * If `start` is greater than `end` the params are swapped to support
  31098. * negative ranges.
  31099. *
  31100. * @static
  31101. * @memberOf _
  31102. * @since 3.3.0
  31103. * @category Number
  31104. * @param {number} number The number to check.
  31105. * @param {number} [start=0] The start of the range.
  31106. * @param {number} end The end of the range.
  31107. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  31108. * @see _.range, _.rangeRight
  31109. * @example
  31110. *
  31111. * _.inRange(3, 2, 4);
  31112. * // => true
  31113. *
  31114. * _.inRange(4, 8);
  31115. * // => true
  31116. *
  31117. * _.inRange(4, 2);
  31118. * // => false
  31119. *
  31120. * _.inRange(2, 2);
  31121. * // => false
  31122. *
  31123. * _.inRange(1.2, 2);
  31124. * // => true
  31125. *
  31126. * _.inRange(5.2, 4);
  31127. * // => false
  31128. *
  31129. * _.inRange(-3, -2, -6);
  31130. * // => true
  31131. */
  31132. function inRange(number, start, end) {
  31133. start = toFinite(start);
  31134. if (end === undefined) {
  31135. end = start;
  31136. start = 0;
  31137. } else {
  31138. end = toFinite(end);
  31139. }
  31140. number = toNumber(number);
  31141. return baseInRange(number, start, end);
  31142. }
  31143. /**
  31144. * Produces a random number between the inclusive `lower` and `upper` bounds.
  31145. * If only one argument is provided a number between `0` and the given number
  31146. * is returned. If `floating` is `true`, or either `lower` or `upper` are
  31147. * floats, a floating-point number is returned instead of an integer.
  31148. *
  31149. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  31150. * floating-point values which can produce unexpected results.
  31151. *
  31152. * @static
  31153. * @memberOf _
  31154. * @since 0.7.0
  31155. * @category Number
  31156. * @param {number} [lower=0] The lower bound.
  31157. * @param {number} [upper=1] The upper bound.
  31158. * @param {boolean} [floating] Specify returning a floating-point number.
  31159. * @returns {number} Returns the random number.
  31160. * @example
  31161. *
  31162. * _.random(0, 5);
  31163. * // => an integer between 0 and 5
  31164. *
  31165. * _.random(5);
  31166. * // => also an integer between 0 and 5
  31167. *
  31168. * _.random(5, true);
  31169. * // => a floating-point number between 0 and 5
  31170. *
  31171. * _.random(1.2, 5.2);
  31172. * // => a floating-point number between 1.2 and 5.2
  31173. */
  31174. function random(lower, upper, floating) {
  31175. if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
  31176. upper = floating = undefined;
  31177. }
  31178. if (floating === undefined) {
  31179. if (typeof upper == 'boolean') {
  31180. floating = upper;
  31181. upper = undefined;
  31182. }
  31183. else if (typeof lower == 'boolean') {
  31184. floating = lower;
  31185. lower = undefined;
  31186. }
  31187. }
  31188. if (lower === undefined && upper === undefined) {
  31189. lower = 0;
  31190. upper = 1;
  31191. }
  31192. else {
  31193. lower = toFinite(lower);
  31194. if (upper === undefined) {
  31195. upper = lower;
  31196. lower = 0;
  31197. } else {
  31198. upper = toFinite(upper);
  31199. }
  31200. }
  31201. if (lower > upper) {
  31202. var temp = lower;
  31203. lower = upper;
  31204. upper = temp;
  31205. }
  31206. if (floating || lower % 1 || upper % 1) {
  31207. var rand = nativeRandom();
  31208. return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
  31209. }
  31210. return baseRandom(lower, upper);
  31211. }
  31212. /*------------------------------------------------------------------------*/
  31213. /**
  31214. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  31215. *
  31216. * @static
  31217. * @memberOf _
  31218. * @since 3.0.0
  31219. * @category String
  31220. * @param {string} [string=''] The string to convert.
  31221. * @returns {string} Returns the camel cased string.
  31222. * @example
  31223. *
  31224. * _.camelCase('Foo Bar');
  31225. * // => 'fooBar'
  31226. *
  31227. * _.camelCase('--foo-bar--');
  31228. * // => 'fooBar'
  31229. *
  31230. * _.camelCase('__FOO_BAR__');
  31231. * // => 'fooBar'
  31232. */
  31233. var camelCase = createCompounder(function(result, word, index) {
  31234. word = word.toLowerCase();
  31235. return result + (index ? capitalize(word) : word);
  31236. });
  31237. /**
  31238. * Converts the first character of `string` to upper case and the remaining
  31239. * to lower case.
  31240. *
  31241. * @static
  31242. * @memberOf _
  31243. * @since 3.0.0
  31244. * @category String
  31245. * @param {string} [string=''] The string to capitalize.
  31246. * @returns {string} Returns the capitalized string.
  31247. * @example
  31248. *
  31249. * _.capitalize('FRED');
  31250. * // => 'Fred'
  31251. */
  31252. function capitalize(string) {
  31253. return upperFirst(toString(string).toLowerCase());
  31254. }
  31255. /**
  31256. * Deburrs `string` by converting
  31257. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  31258. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  31259. * letters to basic Latin letters and removing
  31260. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  31261. *
  31262. * @static
  31263. * @memberOf _
  31264. * @since 3.0.0
  31265. * @category String
  31266. * @param {string} [string=''] The string to deburr.
  31267. * @returns {string} Returns the deburred string.
  31268. * @example
  31269. *
  31270. * _.deburr('déjà vu');
  31271. * // => 'deja vu'
  31272. */
  31273. function deburr(string) {
  31274. string = toString(string);
  31275. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  31276. }
  31277. /**
  31278. * Checks if `string` ends with the given target string.
  31279. *
  31280. * @static
  31281. * @memberOf _
  31282. * @since 3.0.0
  31283. * @category String
  31284. * @param {string} [string=''] The string to inspect.
  31285. * @param {string} [target] The string to search for.
  31286. * @param {number} [position=string.length] The position to search up to.
  31287. * @returns {boolean} Returns `true` if `string` ends with `target`,
  31288. * else `false`.
  31289. * @example
  31290. *
  31291. * _.endsWith('abc', 'c');
  31292. * // => true
  31293. *
  31294. * _.endsWith('abc', 'b');
  31295. * // => false
  31296. *
  31297. * _.endsWith('abc', 'b', 2);
  31298. * // => true
  31299. */
  31300. function endsWith(string, target, position) {
  31301. string = toString(string);
  31302. target = baseToString(target);
  31303. var length = string.length;
  31304. position = position === undefined
  31305. ? length
  31306. : baseClamp(toInteger(position), 0, length);
  31307. var end = position;
  31308. position -= target.length;
  31309. return position >= 0 && string.slice(position, end) == target;
  31310. }
  31311. /**
  31312. * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
  31313. * corresponding HTML entities.
  31314. *
  31315. * **Note:** No other characters are escaped. To escape additional
  31316. * characters use a third-party library like [_he_](https://mths.be/he).
  31317. *
  31318. * Though the ">" character is escaped for symmetry, characters like
  31319. * ">" and "/" don't need escaping in HTML and have no special meaning
  31320. * unless they're part of a tag or unquoted attribute value. See
  31321. * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
  31322. * (under "semi-related fun fact") for more details.
  31323. *
  31324. * When working with HTML you should always
  31325. * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
  31326. * XSS vectors.
  31327. *
  31328. * @static
  31329. * @since 0.1.0
  31330. * @memberOf _
  31331. * @category String
  31332. * @param {string} [string=''] The string to escape.
  31333. * @returns {string} Returns the escaped string.
  31334. * @example
  31335. *
  31336. * _.escape('fred, barney, & pebbles');
  31337. * // => 'fred, barney, &amp; pebbles'
  31338. */
  31339. function escape(string) {
  31340. string = toString(string);
  31341. return (string && reHasUnescapedHtml.test(string))
  31342. ? string.replace(reUnescapedHtml, escapeHtmlChar)
  31343. : string;
  31344. }
  31345. /**
  31346. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  31347. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  31348. *
  31349. * @static
  31350. * @memberOf _
  31351. * @since 3.0.0
  31352. * @category String
  31353. * @param {string} [string=''] The string to escape.
  31354. * @returns {string} Returns the escaped string.
  31355. * @example
  31356. *
  31357. * _.escapeRegExp('[lodash](https://lodash.com/)');
  31358. * // => '\[lodash\]\(https://lodash\.com/\)'
  31359. */
  31360. function escapeRegExp(string) {
  31361. string = toString(string);
  31362. return (string && reHasRegExpChar.test(string))
  31363. ? string.replace(reRegExpChar, '\\$&')
  31364. : string;
  31365. }
  31366. /**
  31367. * Converts `string` to
  31368. * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
  31369. *
  31370. * @static
  31371. * @memberOf _
  31372. * @since 3.0.0
  31373. * @category String
  31374. * @param {string} [string=''] The string to convert.
  31375. * @returns {string} Returns the kebab cased string.
  31376. * @example
  31377. *
  31378. * _.kebabCase('Foo Bar');
  31379. * // => 'foo-bar'
  31380. *
  31381. * _.kebabCase('fooBar');
  31382. * // => 'foo-bar'
  31383. *
  31384. * _.kebabCase('__FOO_BAR__');
  31385. * // => 'foo-bar'
  31386. */
  31387. var kebabCase = createCompounder(function(result, word, index) {
  31388. return result + (index ? '-' : '') + word.toLowerCase();
  31389. });
  31390. /**
  31391. * Converts `string`, as space separated words, to lower case.
  31392. *
  31393. * @static
  31394. * @memberOf _
  31395. * @since 4.0.0
  31396. * @category String
  31397. * @param {string} [string=''] The string to convert.
  31398. * @returns {string} Returns the lower cased string.
  31399. * @example
  31400. *
  31401. * _.lowerCase('--Foo-Bar--');
  31402. * // => 'foo bar'
  31403. *
  31404. * _.lowerCase('fooBar');
  31405. * // => 'foo bar'
  31406. *
  31407. * _.lowerCase('__FOO_BAR__');
  31408. * // => 'foo bar'
  31409. */
  31410. var lowerCase = createCompounder(function(result, word, index) {
  31411. return result + (index ? ' ' : '') + word.toLowerCase();
  31412. });
  31413. /**
  31414. * Converts the first character of `string` to lower case.
  31415. *
  31416. * @static
  31417. * @memberOf _
  31418. * @since 4.0.0
  31419. * @category String
  31420. * @param {string} [string=''] The string to convert.
  31421. * @returns {string} Returns the converted string.
  31422. * @example
  31423. *
  31424. * _.lowerFirst('Fred');
  31425. * // => 'fred'
  31426. *
  31427. * _.lowerFirst('FRED');
  31428. * // => 'fRED'
  31429. */
  31430. var lowerFirst = createCaseFirst('toLowerCase');
  31431. /**
  31432. * Pads `string` on the left and right sides if it's shorter than `length`.
  31433. * Padding characters are truncated if they can't be evenly divided by `length`.
  31434. *
  31435. * @static
  31436. * @memberOf _
  31437. * @since 3.0.0
  31438. * @category String
  31439. * @param {string} [string=''] The string to pad.
  31440. * @param {number} [length=0] The padding length.
  31441. * @param {string} [chars=' '] The string used as padding.
  31442. * @returns {string} Returns the padded string.
  31443. * @example
  31444. *
  31445. * _.pad('abc', 8);
  31446. * // => ' abc '
  31447. *
  31448. * _.pad('abc', 8, '_-');
  31449. * // => '_-abc_-_'
  31450. *
  31451. * _.pad('abc', 3);
  31452. * // => 'abc'
  31453. */
  31454. function pad(string, length, chars) {
  31455. string = toString(string);
  31456. length = toInteger(length);
  31457. var strLength = length ? stringSize(string) : 0;
  31458. if (!length || strLength >= length) {
  31459. return string;
  31460. }
  31461. var mid = (length - strLength) / 2;
  31462. return (
  31463. createPadding(nativeFloor(mid), chars) +
  31464. string +
  31465. createPadding(nativeCeil(mid), chars)
  31466. );
  31467. }
  31468. /**
  31469. * Pads `string` on the right side if it's shorter than `length`. Padding
  31470. * characters are truncated if they exceed `length`.
  31471. *
  31472. * @static
  31473. * @memberOf _
  31474. * @since 4.0.0
  31475. * @category String
  31476. * @param {string} [string=''] The string to pad.
  31477. * @param {number} [length=0] The padding length.
  31478. * @param {string} [chars=' '] The string used as padding.
  31479. * @returns {string} Returns the padded string.
  31480. * @example
  31481. *
  31482. * _.padEnd('abc', 6);
  31483. * // => 'abc '
  31484. *
  31485. * _.padEnd('abc', 6, '_-');
  31486. * // => 'abc_-_'
  31487. *
  31488. * _.padEnd('abc', 3);
  31489. * // => 'abc'
  31490. */
  31491. function padEnd(string, length, chars) {
  31492. string = toString(string);
  31493. length = toInteger(length);
  31494. var strLength = length ? stringSize(string) : 0;
  31495. return (length && strLength < length)
  31496. ? (string + createPadding(length - strLength, chars))
  31497. : string;
  31498. }
  31499. /**
  31500. * Pads `string` on the left side if it's shorter than `length`. Padding
  31501. * characters are truncated if they exceed `length`.
  31502. *
  31503. * @static
  31504. * @memberOf _
  31505. * @since 4.0.0
  31506. * @category String
  31507. * @param {string} [string=''] The string to pad.
  31508. * @param {number} [length=0] The padding length.
  31509. * @param {string} [chars=' '] The string used as padding.
  31510. * @returns {string} Returns the padded string.
  31511. * @example
  31512. *
  31513. * _.padStart('abc', 6);
  31514. * // => ' abc'
  31515. *
  31516. * _.padStart('abc', 6, '_-');
  31517. * // => '_-_abc'
  31518. *
  31519. * _.padStart('abc', 3);
  31520. * // => 'abc'
  31521. */
  31522. function padStart(string, length, chars) {
  31523. string = toString(string);
  31524. length = toInteger(length);
  31525. var strLength = length ? stringSize(string) : 0;
  31526. return (length && strLength < length)
  31527. ? (createPadding(length - strLength, chars) + string)
  31528. : string;
  31529. }
  31530. /**
  31531. * Converts `string` to an integer of the specified radix. If `radix` is
  31532. * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
  31533. * hexadecimal, in which case a `radix` of `16` is used.
  31534. *
  31535. * **Note:** This method aligns with the
  31536. * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
  31537. *
  31538. * @static
  31539. * @memberOf _
  31540. * @since 1.1.0
  31541. * @category String
  31542. * @param {string} string The string to convert.
  31543. * @param {number} [radix=10] The radix to interpret `value` by.
  31544. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31545. * @returns {number} Returns the converted integer.
  31546. * @example
  31547. *
  31548. * _.parseInt('08');
  31549. * // => 8
  31550. *
  31551. * _.map(['6', '08', '10'], _.parseInt);
  31552. * // => [6, 8, 10]
  31553. */
  31554. function parseInt(string, radix, guard) {
  31555. if (guard || radix == null) {
  31556. radix = 0;
  31557. } else if (radix) {
  31558. radix = +radix;
  31559. }
  31560. return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
  31561. }
  31562. /**
  31563. * Repeats the given string `n` times.
  31564. *
  31565. * @static
  31566. * @memberOf _
  31567. * @since 3.0.0
  31568. * @category String
  31569. * @param {string} [string=''] The string to repeat.
  31570. * @param {number} [n=1] The number of times to repeat the string.
  31571. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31572. * @returns {string} Returns the repeated string.
  31573. * @example
  31574. *
  31575. * _.repeat('*', 3);
  31576. * // => '***'
  31577. *
  31578. * _.repeat('abc', 2);
  31579. * // => 'abcabc'
  31580. *
  31581. * _.repeat('abc', 0);
  31582. * // => ''
  31583. */
  31584. function repeat(string, n, guard) {
  31585. if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
  31586. n = 1;
  31587. } else {
  31588. n = toInteger(n);
  31589. }
  31590. return baseRepeat(toString(string), n);
  31591. }
  31592. /**
  31593. * Replaces matches for `pattern` in `string` with `replacement`.
  31594. *
  31595. * **Note:** This method is based on
  31596. * [`String#replace`](https://mdn.io/String/replace).
  31597. *
  31598. * @static
  31599. * @memberOf _
  31600. * @since 4.0.0
  31601. * @category String
  31602. * @param {string} [string=''] The string to modify.
  31603. * @param {RegExp|string} pattern The pattern to replace.
  31604. * @param {Function|string} replacement The match replacement.
  31605. * @returns {string} Returns the modified string.
  31606. * @example
  31607. *
  31608. * _.replace('Hi Fred', 'Fred', 'Barney');
  31609. * // => 'Hi Barney'
  31610. */
  31611. function replace() {
  31612. var args = arguments,
  31613. string = toString(args[0]);
  31614. return args.length < 3 ? string : string.replace(args[1], args[2]);
  31615. }
  31616. /**
  31617. * Converts `string` to
  31618. * [snake case](https://en.wikipedia.org/wiki/Snake_case).
  31619. *
  31620. * @static
  31621. * @memberOf _
  31622. * @since 3.0.0
  31623. * @category String
  31624. * @param {string} [string=''] The string to convert.
  31625. * @returns {string} Returns the snake cased string.
  31626. * @example
  31627. *
  31628. * _.snakeCase('Foo Bar');
  31629. * // => 'foo_bar'
  31630. *
  31631. * _.snakeCase('fooBar');
  31632. * // => 'foo_bar'
  31633. *
  31634. * _.snakeCase('--FOO-BAR--');
  31635. * // => 'foo_bar'
  31636. */
  31637. var snakeCase = createCompounder(function(result, word, index) {
  31638. return result + (index ? '_' : '') + word.toLowerCase();
  31639. });
  31640. /**
  31641. * Splits `string` by `separator`.
  31642. *
  31643. * **Note:** This method is based on
  31644. * [`String#split`](https://mdn.io/String/split).
  31645. *
  31646. * @static
  31647. * @memberOf _
  31648. * @since 4.0.0
  31649. * @category String
  31650. * @param {string} [string=''] The string to split.
  31651. * @param {RegExp|string} separator The separator pattern to split by.
  31652. * @param {number} [limit] The length to truncate results to.
  31653. * @returns {Array} Returns the string segments.
  31654. * @example
  31655. *
  31656. * _.split('a-b-c', '-', 2);
  31657. * // => ['a', 'b']
  31658. */
  31659. function split(string, separator, limit) {
  31660. if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
  31661. separator = limit = undefined;
  31662. }
  31663. limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
  31664. if (!limit) {
  31665. return [];
  31666. }
  31667. string = toString(string);
  31668. if (string && (
  31669. typeof separator == 'string' ||
  31670. (separator != null && !isRegExp(separator))
  31671. )) {
  31672. separator = baseToString(separator);
  31673. if (!separator && hasUnicode(string)) {
  31674. return castSlice(stringToArray(string), 0, limit);
  31675. }
  31676. }
  31677. return string.split(separator, limit);
  31678. }
  31679. /**
  31680. * Converts `string` to
  31681. * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
  31682. *
  31683. * @static
  31684. * @memberOf _
  31685. * @since 3.1.0
  31686. * @category String
  31687. * @param {string} [string=''] The string to convert.
  31688. * @returns {string} Returns the start cased string.
  31689. * @example
  31690. *
  31691. * _.startCase('--foo-bar--');
  31692. * // => 'Foo Bar'
  31693. *
  31694. * _.startCase('fooBar');
  31695. * // => 'Foo Bar'
  31696. *
  31697. * _.startCase('__FOO_BAR__');
  31698. * // => 'FOO BAR'
  31699. */
  31700. var startCase = createCompounder(function(result, word, index) {
  31701. return result + (index ? ' ' : '') + upperFirst(word);
  31702. });
  31703. /**
  31704. * Checks if `string` starts with the given target string.
  31705. *
  31706. * @static
  31707. * @memberOf _
  31708. * @since 3.0.0
  31709. * @category String
  31710. * @param {string} [string=''] The string to inspect.
  31711. * @param {string} [target] The string to search for.
  31712. * @param {number} [position=0] The position to search from.
  31713. * @returns {boolean} Returns `true` if `string` starts with `target`,
  31714. * else `false`.
  31715. * @example
  31716. *
  31717. * _.startsWith('abc', 'a');
  31718. * // => true
  31719. *
  31720. * _.startsWith('abc', 'b');
  31721. * // => false
  31722. *
  31723. * _.startsWith('abc', 'b', 1);
  31724. * // => true
  31725. */
  31726. function startsWith(string, target, position) {
  31727. string = toString(string);
  31728. position = position == null
  31729. ? 0
  31730. : baseClamp(toInteger(position), 0, string.length);
  31731. target = baseToString(target);
  31732. return string.slice(position, position + target.length) == target;
  31733. }
  31734. /**
  31735. * Creates a compiled template function that can interpolate data properties
  31736. * in "interpolate" delimiters, HTML-escape interpolated data properties in
  31737. * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
  31738. * properties may be accessed as free variables in the template. If a setting
  31739. * object is given, it takes precedence over `_.templateSettings` values.
  31740. *
  31741. * **Note:** In the development build `_.template` utilizes
  31742. * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
  31743. * for easier debugging.
  31744. *
  31745. * For more information on precompiling templates see
  31746. * [lodash's custom builds documentation](https://lodash.com/custom-builds).
  31747. *
  31748. * For more information on Chrome extension sandboxes see
  31749. * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
  31750. *
  31751. * @static
  31752. * @since 0.1.0
  31753. * @memberOf _
  31754. * @category String
  31755. * @param {string} [string=''] The template string.
  31756. * @param {Object} [options={}] The options object.
  31757. * @param {RegExp} [options.escape=_.templateSettings.escape]
  31758. * The HTML "escape" delimiter.
  31759. * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
  31760. * The "evaluate" delimiter.
  31761. * @param {Object} [options.imports=_.templateSettings.imports]
  31762. * An object to import into the template as free variables.
  31763. * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
  31764. * The "interpolate" delimiter.
  31765. * @param {string} [options.sourceURL='lodash.templateSources[n]']
  31766. * The sourceURL of the compiled template.
  31767. * @param {string} [options.variable='obj']
  31768. * The data object variable name.
  31769. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31770. * @returns {Function} Returns the compiled template function.
  31771. * @example
  31772. *
  31773. * // Use the "interpolate" delimiter to create a compiled template.
  31774. * var compiled = _.template('hello <%= user %>!');
  31775. * compiled({ 'user': 'fred' });
  31776. * // => 'hello fred!'
  31777. *
  31778. * // Use the HTML "escape" delimiter to escape data property values.
  31779. * var compiled = _.template('<b><%- value %></b>');
  31780. * compiled({ 'value': '<script>' });
  31781. * // => '<b>&lt;script&gt;</b>'
  31782. *
  31783. * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
  31784. * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
  31785. * compiled({ 'users': ['fred', 'barney'] });
  31786. * // => '<li>fred</li><li>barney</li>'
  31787. *
  31788. * // Use the internal `print` function in "evaluate" delimiters.
  31789. * var compiled = _.template('<% print("hello " + user); %>!');
  31790. * compiled({ 'user': 'barney' });
  31791. * // => 'hello barney!'
  31792. *
  31793. * // Use the ES template literal delimiter as an "interpolate" delimiter.
  31794. * // Disable support by replacing the "interpolate" delimiter.
  31795. * var compiled = _.template('hello ${ user }!');
  31796. * compiled({ 'user': 'pebbles' });
  31797. * // => 'hello pebbles!'
  31798. *
  31799. * // Use backslashes to treat delimiters as plain text.
  31800. * var compiled = _.template('<%= "\\<%- value %\\>" %>');
  31801. * compiled({ 'value': 'ignored' });
  31802. * // => '<%- value %>'
  31803. *
  31804. * // Use the `imports` option to import `jQuery` as `jq`.
  31805. * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
  31806. * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
  31807. * compiled({ 'users': ['fred', 'barney'] });
  31808. * // => '<li>fred</li><li>barney</li>'
  31809. *
  31810. * // Use the `sourceURL` option to specify a custom sourceURL for the template.
  31811. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
  31812. * compiled(data);
  31813. * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
  31814. *
  31815. * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
  31816. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
  31817. * compiled.source;
  31818. * // => function(data) {
  31819. * // var __t, __p = '';
  31820. * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
  31821. * // return __p;
  31822. * // }
  31823. *
  31824. * // Use custom template delimiters.
  31825. * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
  31826. * var compiled = _.template('hello {{ user }}!');
  31827. * compiled({ 'user': 'mustache' });
  31828. * // => 'hello mustache!'
  31829. *
  31830. * // Use the `source` property to inline compiled templates for meaningful
  31831. * // line numbers in error messages and stack traces.
  31832. * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
  31833. * var JST = {\
  31834. * "main": ' + _.template(mainText).source + '\
  31835. * };\
  31836. * ');
  31837. */
  31838. function template(string, options, guard) {
  31839. // Based on John Resig's `tmpl` implementation
  31840. // (http://ejohn.org/blog/javascript-micro-templating/)
  31841. // and Laura Doktorova's doT.js (https://github.com/olado/doT).
  31842. var settings = lodash.templateSettings;
  31843. if (guard && isIterateeCall(string, options, guard)) {
  31844. options = undefined;
  31845. }
  31846. string = toString(string);
  31847. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  31848. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
  31849. importsKeys = keys(imports),
  31850. importsValues = baseValues(imports, importsKeys);
  31851. var isEscaping,
  31852. isEvaluating,
  31853. index = 0,
  31854. interpolate = options.interpolate || reNoMatch,
  31855. source = "__p += '";
  31856. // Compile the regexp to match each delimiter.
  31857. var reDelimiters = RegExp(
  31858. (options.escape || reNoMatch).source + '|' +
  31859. interpolate.source + '|' +
  31860. (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
  31861. (options.evaluate || reNoMatch).source + '|$'
  31862. , 'g');
  31863. // Use a sourceURL for easier debugging.
  31864. // The sourceURL gets injected into the source that's eval-ed, so be careful
  31865. // with lookup (in case of e.g. prototype pollution), and strip newlines if any.
  31866. // A newline wouldn't be a valid sourceURL anyway, and it'd enable code injection.
  31867. var sourceURL = '//# sourceURL=' +
  31868. (hasOwnProperty.call(options, 'sourceURL')
  31869. ? (options.sourceURL + '').replace(/[\r\n]/g, ' ')
  31870. : ('lodash.templateSources[' + (++templateCounter) + ']')
  31871. ) + '\n';
  31872. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  31873. interpolateValue || (interpolateValue = esTemplateValue);
  31874. // Escape characters that can't be included in string literals.
  31875. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  31876. // Replace delimiters with snippets.
  31877. if (escapeValue) {
  31878. isEscaping = true;
  31879. source += "' +\n__e(" + escapeValue + ") +\n'";
  31880. }
  31881. if (evaluateValue) {
  31882. isEvaluating = true;
  31883. source += "';\n" + evaluateValue + ";\n__p += '";
  31884. }
  31885. if (interpolateValue) {
  31886. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  31887. }
  31888. index = offset + match.length;
  31889. // The JS engine embedded in Adobe products needs `match` returned in
  31890. // order to produce the correct `offset` value.
  31891. return match;
  31892. });
  31893. source += "';\n";
  31894. // If `variable` is not specified wrap a with-statement around the generated
  31895. // code to add the data object to the top of the scope chain.
  31896. // Like with sourceURL, we take care to not check the option's prototype,
  31897. // as this configuration is a code injection vector.
  31898. var variable = hasOwnProperty.call(options, 'variable') && options.variable;
  31899. if (!variable) {
  31900. source = 'with (obj) {\n' + source + '\n}\n';
  31901. }
  31902. // Cleanup code by stripping empty strings.
  31903. source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
  31904. .replace(reEmptyStringMiddle, '$1')
  31905. .replace(reEmptyStringTrailing, '$1;');
  31906. // Frame code as the function body.
  31907. source = 'function(' + (variable || 'obj') + ') {\n' +
  31908. (variable
  31909. ? ''
  31910. : 'obj || (obj = {});\n'
  31911. ) +
  31912. "var __t, __p = ''" +
  31913. (isEscaping
  31914. ? ', __e = _.escape'
  31915. : ''
  31916. ) +
  31917. (isEvaluating
  31918. ? ', __j = Array.prototype.join;\n' +
  31919. "function print() { __p += __j.call(arguments, '') }\n"
  31920. : ';\n'
  31921. ) +
  31922. source +
  31923. 'return __p\n}';
  31924. var result = attempt(function() {
  31925. return Function(importsKeys, sourceURL + 'return ' + source)
  31926. .apply(undefined, importsValues);
  31927. });
  31928. // Provide the compiled function's source by its `toString` method or
  31929. // the `source` property as a convenience for inlining compiled templates.
  31930. result.source = source;
  31931. if (isError(result)) {
  31932. throw result;
  31933. }
  31934. return result;
  31935. }
  31936. /**
  31937. * Converts `string`, as a whole, to lower case just like
  31938. * [String#toLowerCase](https://mdn.io/toLowerCase).
  31939. *
  31940. * @static
  31941. * @memberOf _
  31942. * @since 4.0.0
  31943. * @category String
  31944. * @param {string} [string=''] The string to convert.
  31945. * @returns {string} Returns the lower cased string.
  31946. * @example
  31947. *
  31948. * _.toLower('--Foo-Bar--');
  31949. * // => '--foo-bar--'
  31950. *
  31951. * _.toLower('fooBar');
  31952. * // => 'foobar'
  31953. *
  31954. * _.toLower('__FOO_BAR__');
  31955. * // => '__foo_bar__'
  31956. */
  31957. function toLower(value) {
  31958. return toString(value).toLowerCase();
  31959. }
  31960. /**
  31961. * Converts `string`, as a whole, to upper case just like
  31962. * [String#toUpperCase](https://mdn.io/toUpperCase).
  31963. *
  31964. * @static
  31965. * @memberOf _
  31966. * @since 4.0.0
  31967. * @category String
  31968. * @param {string} [string=''] The string to convert.
  31969. * @returns {string} Returns the upper cased string.
  31970. * @example
  31971. *
  31972. * _.toUpper('--foo-bar--');
  31973. * // => '--FOO-BAR--'
  31974. *
  31975. * _.toUpper('fooBar');
  31976. * // => 'FOOBAR'
  31977. *
  31978. * _.toUpper('__foo_bar__');
  31979. * // => '__FOO_BAR__'
  31980. */
  31981. function toUpper(value) {
  31982. return toString(value).toUpperCase();
  31983. }
  31984. /**
  31985. * Removes leading and trailing whitespace or specified characters from `string`.
  31986. *
  31987. * @static
  31988. * @memberOf _
  31989. * @since 3.0.0
  31990. * @category String
  31991. * @param {string} [string=''] The string to trim.
  31992. * @param {string} [chars=whitespace] The characters to trim.
  31993. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31994. * @returns {string} Returns the trimmed string.
  31995. * @example
  31996. *
  31997. * _.trim(' abc ');
  31998. * // => 'abc'
  31999. *
  32000. * _.trim('-_-abc-_-', '_-');
  32001. * // => 'abc'
  32002. *
  32003. * _.map([' foo ', ' bar '], _.trim);
  32004. * // => ['foo', 'bar']
  32005. */
  32006. function trim(string, chars, guard) {
  32007. string = toString(string);
  32008. if (string && (guard || chars === undefined)) {
  32009. return string.replace(reTrim, '');
  32010. }
  32011. if (!string || !(chars = baseToString(chars))) {
  32012. return string;
  32013. }
  32014. var strSymbols = stringToArray(string),
  32015. chrSymbols = stringToArray(chars),
  32016. start = charsStartIndex(strSymbols, chrSymbols),
  32017. end = charsEndIndex(strSymbols, chrSymbols) + 1;
  32018. return castSlice(strSymbols, start, end).join('');
  32019. }
  32020. /**
  32021. * Removes trailing whitespace or specified characters from `string`.
  32022. *
  32023. * @static
  32024. * @memberOf _
  32025. * @since 4.0.0
  32026. * @category String
  32027. * @param {string} [string=''] The string to trim.
  32028. * @param {string} [chars=whitespace] The characters to trim.
  32029. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32030. * @returns {string} Returns the trimmed string.
  32031. * @example
  32032. *
  32033. * _.trimEnd(' abc ');
  32034. * // => ' abc'
  32035. *
  32036. * _.trimEnd('-_-abc-_-', '_-');
  32037. * // => '-_-abc'
  32038. */
  32039. function trimEnd(string, chars, guard) {
  32040. string = toString(string);
  32041. if (string && (guard || chars === undefined)) {
  32042. return string.replace(reTrimEnd, '');
  32043. }
  32044. if (!string || !(chars = baseToString(chars))) {
  32045. return string;
  32046. }
  32047. var strSymbols = stringToArray(string),
  32048. end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  32049. return castSlice(strSymbols, 0, end).join('');
  32050. }
  32051. /**
  32052. * Removes leading whitespace or specified characters from `string`.
  32053. *
  32054. * @static
  32055. * @memberOf _
  32056. * @since 4.0.0
  32057. * @category String
  32058. * @param {string} [string=''] The string to trim.
  32059. * @param {string} [chars=whitespace] The characters to trim.
  32060. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32061. * @returns {string} Returns the trimmed string.
  32062. * @example
  32063. *
  32064. * _.trimStart(' abc ');
  32065. * // => 'abc '
  32066. *
  32067. * _.trimStart('-_-abc-_-', '_-');
  32068. * // => 'abc-_-'
  32069. */
  32070. function trimStart(string, chars, guard) {
  32071. string = toString(string);
  32072. if (string && (guard || chars === undefined)) {
  32073. return string.replace(reTrimStart, '');
  32074. }
  32075. if (!string || !(chars = baseToString(chars))) {
  32076. return string;
  32077. }
  32078. var strSymbols = stringToArray(string),
  32079. start = charsStartIndex(strSymbols, stringToArray(chars));
  32080. return castSlice(strSymbols, start).join('');
  32081. }
  32082. /**
  32083. * Truncates `string` if it's longer than the given maximum string length.
  32084. * The last characters of the truncated string are replaced with the omission
  32085. * string which defaults to "...".
  32086. *
  32087. * @static
  32088. * @memberOf _
  32089. * @since 4.0.0
  32090. * @category String
  32091. * @param {string} [string=''] The string to truncate.
  32092. * @param {Object} [options={}] The options object.
  32093. * @param {number} [options.length=30] The maximum string length.
  32094. * @param {string} [options.omission='...'] The string to indicate text is omitted.
  32095. * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
  32096. * @returns {string} Returns the truncated string.
  32097. * @example
  32098. *
  32099. * _.truncate('hi-diddly-ho there, neighborino');
  32100. * // => 'hi-diddly-ho there, neighbo...'
  32101. *
  32102. * _.truncate('hi-diddly-ho there, neighborino', {
  32103. * 'length': 24,
  32104. * 'separator': ' '
  32105. * });
  32106. * // => 'hi-diddly-ho there,...'
  32107. *
  32108. * _.truncate('hi-diddly-ho there, neighborino', {
  32109. * 'length': 24,
  32110. * 'separator': /,? +/
  32111. * });
  32112. * // => 'hi-diddly-ho there...'
  32113. *
  32114. * _.truncate('hi-diddly-ho there, neighborino', {
  32115. * 'omission': ' [...]'
  32116. * });
  32117. * // => 'hi-diddly-ho there, neig [...]'
  32118. */
  32119. function truncate(string, options) {
  32120. var length = DEFAULT_TRUNC_LENGTH,
  32121. omission = DEFAULT_TRUNC_OMISSION;
  32122. if (isObject(options)) {
  32123. var separator = 'separator' in options ? options.separator : separator;
  32124. length = 'length' in options ? toInteger(options.length) : length;
  32125. omission = 'omission' in options ? baseToString(options.omission) : omission;
  32126. }
  32127. string = toString(string);
  32128. var strLength = string.length;
  32129. if (hasUnicode(string)) {
  32130. var strSymbols = stringToArray(string);
  32131. strLength = strSymbols.length;
  32132. }
  32133. if (length >= strLength) {
  32134. return string;
  32135. }
  32136. var end = length - stringSize(omission);
  32137. if (end < 1) {
  32138. return omission;
  32139. }
  32140. var result = strSymbols
  32141. ? castSlice(strSymbols, 0, end).join('')
  32142. : string.slice(0, end);
  32143. if (separator === undefined) {
  32144. return result + omission;
  32145. }
  32146. if (strSymbols) {
  32147. end += (result.length - end);
  32148. }
  32149. if (isRegExp(separator)) {
  32150. if (string.slice(end).search(separator)) {
  32151. var match,
  32152. substring = result;
  32153. if (!separator.global) {
  32154. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
  32155. }
  32156. separator.lastIndex = 0;
  32157. while ((match = separator.exec(substring))) {
  32158. var newEnd = match.index;
  32159. }
  32160. result = result.slice(0, newEnd === undefined ? end : newEnd);
  32161. }
  32162. } else if (string.indexOf(baseToString(separator), end) != end) {
  32163. var index = result.lastIndexOf(separator);
  32164. if (index > -1) {
  32165. result = result.slice(0, index);
  32166. }
  32167. }
  32168. return result + omission;
  32169. }
  32170. /**
  32171. * The inverse of `_.escape`; this method converts the HTML entities
  32172. * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
  32173. * their corresponding characters.
  32174. *
  32175. * **Note:** No other HTML entities are unescaped. To unescape additional
  32176. * HTML entities use a third-party library like [_he_](https://mths.be/he).
  32177. *
  32178. * @static
  32179. * @memberOf _
  32180. * @since 0.6.0
  32181. * @category String
  32182. * @param {string} [string=''] The string to unescape.
  32183. * @returns {string} Returns the unescaped string.
  32184. * @example
  32185. *
  32186. * _.unescape('fred, barney, &amp; pebbles');
  32187. * // => 'fred, barney, & pebbles'
  32188. */
  32189. function unescape(string) {
  32190. string = toString(string);
  32191. return (string && reHasEscapedHtml.test(string))
  32192. ? string.replace(reEscapedHtml, unescapeHtmlChar)
  32193. : string;
  32194. }
  32195. /**
  32196. * Converts `string`, as space separated words, to upper case.
  32197. *
  32198. * @static
  32199. * @memberOf _
  32200. * @since 4.0.0
  32201. * @category String
  32202. * @param {string} [string=''] The string to convert.
  32203. * @returns {string} Returns the upper cased string.
  32204. * @example
  32205. *
  32206. * _.upperCase('--foo-bar');
  32207. * // => 'FOO BAR'
  32208. *
  32209. * _.upperCase('fooBar');
  32210. * // => 'FOO BAR'
  32211. *
  32212. * _.upperCase('__foo_bar__');
  32213. * // => 'FOO BAR'
  32214. */
  32215. var upperCase = createCompounder(function(result, word, index) {
  32216. return result + (index ? ' ' : '') + word.toUpperCase();
  32217. });
  32218. /**
  32219. * Converts the first character of `string` to upper case.
  32220. *
  32221. * @static
  32222. * @memberOf _
  32223. * @since 4.0.0
  32224. * @category String
  32225. * @param {string} [string=''] The string to convert.
  32226. * @returns {string} Returns the converted string.
  32227. * @example
  32228. *
  32229. * _.upperFirst('fred');
  32230. * // => 'Fred'
  32231. *
  32232. * _.upperFirst('FRED');
  32233. * // => 'FRED'
  32234. */
  32235. var upperFirst = createCaseFirst('toUpperCase');
  32236. /**
  32237. * Splits `string` into an array of its words.
  32238. *
  32239. * @static
  32240. * @memberOf _
  32241. * @since 3.0.0
  32242. * @category String
  32243. * @param {string} [string=''] The string to inspect.
  32244. * @param {RegExp|string} [pattern] The pattern to match words.
  32245. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32246. * @returns {Array} Returns the words of `string`.
  32247. * @example
  32248. *
  32249. * _.words('fred, barney, & pebbles');
  32250. * // => ['fred', 'barney', 'pebbles']
  32251. *
  32252. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  32253. * // => ['fred', 'barney', '&', 'pebbles']
  32254. */
  32255. function words(string, pattern, guard) {
  32256. string = toString(string);
  32257. pattern = guard ? undefined : pattern;
  32258. if (pattern === undefined) {
  32259. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  32260. }
  32261. return string.match(pattern) || [];
  32262. }
  32263. /*------------------------------------------------------------------------*/
  32264. /**
  32265. * Attempts to invoke `func`, returning either the result or the caught error
  32266. * object. Any additional arguments are provided to `func` when it's invoked.
  32267. *
  32268. * @static
  32269. * @memberOf _
  32270. * @since 3.0.0
  32271. * @category Util
  32272. * @param {Function} func The function to attempt.
  32273. * @param {...*} [args] The arguments to invoke `func` with.
  32274. * @returns {*} Returns the `func` result or error object.
  32275. * @example
  32276. *
  32277. * // Avoid throwing errors for invalid selectors.
  32278. * var elements = _.attempt(function(selector) {
  32279. * return document.querySelectorAll(selector);
  32280. * }, '>_>');
  32281. *
  32282. * if (_.isError(elements)) {
  32283. * elements = [];
  32284. * }
  32285. */
  32286. var attempt = baseRest(function(func, args) {
  32287. try {
  32288. return apply(func, undefined, args);
  32289. } catch (e) {
  32290. return isError(e) ? e : new Error(e);
  32291. }
  32292. });
  32293. /**
  32294. * Binds methods of an object to the object itself, overwriting the existing
  32295. * method.
  32296. *
  32297. * **Note:** This method doesn't set the "length" property of bound functions.
  32298. *
  32299. * @static
  32300. * @since 0.1.0
  32301. * @memberOf _
  32302. * @category Util
  32303. * @param {Object} object The object to bind and assign the bound methods to.
  32304. * @param {...(string|string[])} methodNames The object method names to bind.
  32305. * @returns {Object} Returns `object`.
  32306. * @example
  32307. *
  32308. * var view = {
  32309. * 'label': 'docs',
  32310. * 'click': function() {
  32311. * console.log('clicked ' + this.label);
  32312. * }
  32313. * };
  32314. *
  32315. * _.bindAll(view, ['click']);
  32316. * jQuery(element).on('click', view.click);
  32317. * // => Logs 'clicked docs' when clicked.
  32318. */
  32319. var bindAll = flatRest(function(object, methodNames) {
  32320. arrayEach(methodNames, function(key) {
  32321. key = toKey(key);
  32322. baseAssignValue(object, key, bind(object[key], object));
  32323. });
  32324. return object;
  32325. });
  32326. /**
  32327. * Creates a function that iterates over `pairs` and invokes the corresponding
  32328. * function of the first predicate to return truthy. The predicate-function
  32329. * pairs are invoked with the `this` binding and arguments of the created
  32330. * function.
  32331. *
  32332. * @static
  32333. * @memberOf _
  32334. * @since 4.0.0
  32335. * @category Util
  32336. * @param {Array} pairs The predicate-function pairs.
  32337. * @returns {Function} Returns the new composite function.
  32338. * @example
  32339. *
  32340. * var func = _.cond([
  32341. * [_.matches({ 'a': 1 }), _.constant('matches A')],
  32342. * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
  32343. * [_.stubTrue, _.constant('no match')]
  32344. * ]);
  32345. *
  32346. * func({ 'a': 1, 'b': 2 });
  32347. * // => 'matches A'
  32348. *
  32349. * func({ 'a': 0, 'b': 1 });
  32350. * // => 'matches B'
  32351. *
  32352. * func({ 'a': '1', 'b': '2' });
  32353. * // => 'no match'
  32354. */
  32355. function cond(pairs) {
  32356. var length = pairs == null ? 0 : pairs.length,
  32357. toIteratee = getIteratee();
  32358. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  32359. if (typeof pair[1] != 'function') {
  32360. throw new TypeError(FUNC_ERROR_TEXT);
  32361. }
  32362. return [toIteratee(pair[0]), pair[1]];
  32363. });
  32364. return baseRest(function(args) {
  32365. var index = -1;
  32366. while (++index < length) {
  32367. var pair = pairs[index];
  32368. if (apply(pair[0], this, args)) {
  32369. return apply(pair[1], this, args);
  32370. }
  32371. }
  32372. });
  32373. }
  32374. /**
  32375. * Creates a function that invokes the predicate properties of `source` with
  32376. * the corresponding property values of a given object, returning `true` if
  32377. * all predicates return truthy, else `false`.
  32378. *
  32379. * **Note:** The created function is equivalent to `_.conformsTo` with
  32380. * `source` partially applied.
  32381. *
  32382. * @static
  32383. * @memberOf _
  32384. * @since 4.0.0
  32385. * @category Util
  32386. * @param {Object} source The object of property predicates to conform to.
  32387. * @returns {Function} Returns the new spec function.
  32388. * @example
  32389. *
  32390. * var objects = [
  32391. * { 'a': 2, 'b': 1 },
  32392. * { 'a': 1, 'b': 2 }
  32393. * ];
  32394. *
  32395. * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
  32396. * // => [{ 'a': 1, 'b': 2 }]
  32397. */
  32398. function conforms(source) {
  32399. return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
  32400. }
  32401. /**
  32402. * Creates a function that returns `value`.
  32403. *
  32404. * @static
  32405. * @memberOf _
  32406. * @since 2.4.0
  32407. * @category Util
  32408. * @param {*} value The value to return from the new function.
  32409. * @returns {Function} Returns the new constant function.
  32410. * @example
  32411. *
  32412. * var objects = _.times(2, _.constant({ 'a': 1 }));
  32413. *
  32414. * console.log(objects);
  32415. * // => [{ 'a': 1 }, { 'a': 1 }]
  32416. *
  32417. * console.log(objects[0] === objects[1]);
  32418. * // => true
  32419. */
  32420. function constant(value) {
  32421. return function() {
  32422. return value;
  32423. };
  32424. }
  32425. /**
  32426. * Checks `value` to determine whether a default value should be returned in
  32427. * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
  32428. * or `undefined`.
  32429. *
  32430. * @static
  32431. * @memberOf _
  32432. * @since 4.14.0
  32433. * @category Util
  32434. * @param {*} value The value to check.
  32435. * @param {*} defaultValue The default value.
  32436. * @returns {*} Returns the resolved value.
  32437. * @example
  32438. *
  32439. * _.defaultTo(1, 10);
  32440. * // => 1
  32441. *
  32442. * _.defaultTo(undefined, 10);
  32443. * // => 10
  32444. */
  32445. function defaultTo(value, defaultValue) {
  32446. return (value == null || value !== value) ? defaultValue : value;
  32447. }
  32448. /**
  32449. * Creates a function that returns the result of invoking the given functions
  32450. * with the `this` binding of the created function, where each successive
  32451. * invocation is supplied the return value of the previous.
  32452. *
  32453. * @static
  32454. * @memberOf _
  32455. * @since 3.0.0
  32456. * @category Util
  32457. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  32458. * @returns {Function} Returns the new composite function.
  32459. * @see _.flowRight
  32460. * @example
  32461. *
  32462. * function square(n) {
  32463. * return n * n;
  32464. * }
  32465. *
  32466. * var addSquare = _.flow([_.add, square]);
  32467. * addSquare(1, 2);
  32468. * // => 9
  32469. */
  32470. var flow = createFlow();
  32471. /**
  32472. * This method is like `_.flow` except that it creates a function that
  32473. * invokes the given functions from right to left.
  32474. *
  32475. * @static
  32476. * @since 3.0.0
  32477. * @memberOf _
  32478. * @category Util
  32479. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  32480. * @returns {Function} Returns the new composite function.
  32481. * @see _.flow
  32482. * @example
  32483. *
  32484. * function square(n) {
  32485. * return n * n;
  32486. * }
  32487. *
  32488. * var addSquare = _.flowRight([square, _.add]);
  32489. * addSquare(1, 2);
  32490. * // => 9
  32491. */
  32492. var flowRight = createFlow(true);
  32493. /**
  32494. * This method returns the first argument it receives.
  32495. *
  32496. * @static
  32497. * @since 0.1.0
  32498. * @memberOf _
  32499. * @category Util
  32500. * @param {*} value Any value.
  32501. * @returns {*} Returns `value`.
  32502. * @example
  32503. *
  32504. * var object = { 'a': 1 };
  32505. *
  32506. * console.log(_.identity(object) === object);
  32507. * // => true
  32508. */
  32509. function identity(value) {
  32510. return value;
  32511. }
  32512. /**
  32513. * Creates a function that invokes `func` with the arguments of the created
  32514. * function. If `func` is a property name, the created function returns the
  32515. * property value for a given element. If `func` is an array or object, the
  32516. * created function returns `true` for elements that contain the equivalent
  32517. * source properties, otherwise it returns `false`.
  32518. *
  32519. * @static
  32520. * @since 4.0.0
  32521. * @memberOf _
  32522. * @category Util
  32523. * @param {*} [func=_.identity] The value to convert to a callback.
  32524. * @returns {Function} Returns the callback.
  32525. * @example
  32526. *
  32527. * var users = [
  32528. * { 'user': 'barney', 'age': 36, 'active': true },
  32529. * { 'user': 'fred', 'age': 40, 'active': false }
  32530. * ];
  32531. *
  32532. * // The `_.matches` iteratee shorthand.
  32533. * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
  32534. * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
  32535. *
  32536. * // The `_.matchesProperty` iteratee shorthand.
  32537. * _.filter(users, _.iteratee(['user', 'fred']));
  32538. * // => [{ 'user': 'fred', 'age': 40 }]
  32539. *
  32540. * // The `_.property` iteratee shorthand.
  32541. * _.map(users, _.iteratee('user'));
  32542. * // => ['barney', 'fred']
  32543. *
  32544. * // Create custom iteratee shorthands.
  32545. * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
  32546. * return !_.isRegExp(func) ? iteratee(func) : function(string) {
  32547. * return func.test(string);
  32548. * };
  32549. * });
  32550. *
  32551. * _.filter(['abc', 'def'], /ef/);
  32552. * // => ['def']
  32553. */
  32554. function iteratee(func) {
  32555. return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
  32556. }
  32557. /**
  32558. * Creates a function that performs a partial deep comparison between a given
  32559. * object and `source`, returning `true` if the given object has equivalent
  32560. * property values, else `false`.
  32561. *
  32562. * **Note:** The created function is equivalent to `_.isMatch` with `source`
  32563. * partially applied.
  32564. *
  32565. * Partial comparisons will match empty array and empty object `source`
  32566. * values against any array or object value, respectively. See `_.isEqual`
  32567. * for a list of supported value comparisons.
  32568. *
  32569. * @static
  32570. * @memberOf _
  32571. * @since 3.0.0
  32572. * @category Util
  32573. * @param {Object} source The object of property values to match.
  32574. * @returns {Function} Returns the new spec function.
  32575. * @example
  32576. *
  32577. * var objects = [
  32578. * { 'a': 1, 'b': 2, 'c': 3 },
  32579. * { 'a': 4, 'b': 5, 'c': 6 }
  32580. * ];
  32581. *
  32582. * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
  32583. * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
  32584. */
  32585. function matches(source) {
  32586. return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
  32587. }
  32588. /**
  32589. * Creates a function that performs a partial deep comparison between the
  32590. * value at `path` of a given object to `srcValue`, returning `true` if the
  32591. * object value is equivalent, else `false`.
  32592. *
  32593. * **Note:** Partial comparisons will match empty array and empty object
  32594. * `srcValue` values against any array or object value, respectively. See
  32595. * `_.isEqual` for a list of supported value comparisons.
  32596. *
  32597. * @static
  32598. * @memberOf _
  32599. * @since 3.2.0
  32600. * @category Util
  32601. * @param {Array|string} path The path of the property to get.
  32602. * @param {*} srcValue The value to match.
  32603. * @returns {Function} Returns the new spec function.
  32604. * @example
  32605. *
  32606. * var objects = [
  32607. * { 'a': 1, 'b': 2, 'c': 3 },
  32608. * { 'a': 4, 'b': 5, 'c': 6 }
  32609. * ];
  32610. *
  32611. * _.find(objects, _.matchesProperty('a', 4));
  32612. * // => { 'a': 4, 'b': 5, 'c': 6 }
  32613. */
  32614. function matchesProperty(path, srcValue) {
  32615. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
  32616. }
  32617. /**
  32618. * Creates a function that invokes the method at `path` of a given object.
  32619. * Any additional arguments are provided to the invoked method.
  32620. *
  32621. * @static
  32622. * @memberOf _
  32623. * @since 3.7.0
  32624. * @category Util
  32625. * @param {Array|string} path The path of the method to invoke.
  32626. * @param {...*} [args] The arguments to invoke the method with.
  32627. * @returns {Function} Returns the new invoker function.
  32628. * @example
  32629. *
  32630. * var objects = [
  32631. * { 'a': { 'b': _.constant(2) } },
  32632. * { 'a': { 'b': _.constant(1) } }
  32633. * ];
  32634. *
  32635. * _.map(objects, _.method('a.b'));
  32636. * // => [2, 1]
  32637. *
  32638. * _.map(objects, _.method(['a', 'b']));
  32639. * // => [2, 1]
  32640. */
  32641. var method = baseRest(function(path, args) {
  32642. return function(object) {
  32643. return baseInvoke(object, path, args);
  32644. };
  32645. });
  32646. /**
  32647. * The opposite of `_.method`; this method creates a function that invokes
  32648. * the method at a given path of `object`. Any additional arguments are
  32649. * provided to the invoked method.
  32650. *
  32651. * @static
  32652. * @memberOf _
  32653. * @since 3.7.0
  32654. * @category Util
  32655. * @param {Object} object The object to query.
  32656. * @param {...*} [args] The arguments to invoke the method with.
  32657. * @returns {Function} Returns the new invoker function.
  32658. * @example
  32659. *
  32660. * var array = _.times(3, _.constant),
  32661. * object = { 'a': array, 'b': array, 'c': array };
  32662. *
  32663. * _.map(['a[2]', 'c[0]'], _.methodOf(object));
  32664. * // => [2, 0]
  32665. *
  32666. * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
  32667. * // => [2, 0]
  32668. */
  32669. var methodOf = baseRest(function(object, args) {
  32670. return function(path) {
  32671. return baseInvoke(object, path, args);
  32672. };
  32673. });
  32674. /**
  32675. * Adds all own enumerable string keyed function properties of a source
  32676. * object to the destination object. If `object` is a function, then methods
  32677. * are added to its prototype as well.
  32678. *
  32679. * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
  32680. * avoid conflicts caused by modifying the original.
  32681. *
  32682. * @static
  32683. * @since 0.1.0
  32684. * @memberOf _
  32685. * @category Util
  32686. * @param {Function|Object} [object=lodash] The destination object.
  32687. * @param {Object} source The object of functions to add.
  32688. * @param {Object} [options={}] The options object.
  32689. * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
  32690. * @returns {Function|Object} Returns `object`.
  32691. * @example
  32692. *
  32693. * function vowels(string) {
  32694. * return _.filter(string, function(v) {
  32695. * return /[aeiou]/i.test(v);
  32696. * });
  32697. * }
  32698. *
  32699. * _.mixin({ 'vowels': vowels });
  32700. * _.vowels('fred');
  32701. * // => ['e']
  32702. *
  32703. * _('fred').vowels().value();
  32704. * // => ['e']
  32705. *
  32706. * _.mixin({ 'vowels': vowels }, { 'chain': false });
  32707. * _('fred').vowels();
  32708. * // => ['e']
  32709. */
  32710. function mixin(object, source, options) {
  32711. var props = keys(source),
  32712. methodNames = baseFunctions(source, props);
  32713. if (options == null &&
  32714. !(isObject(source) && (methodNames.length || !props.length))) {
  32715. options = source;
  32716. source = object;
  32717. object = this;
  32718. methodNames = baseFunctions(source, keys(source));
  32719. }
  32720. var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
  32721. isFunc = isFunction(object);
  32722. arrayEach(methodNames, function(methodName) {
  32723. var func = source[methodName];
  32724. object[methodName] = func;
  32725. if (isFunc) {
  32726. object.prototype[methodName] = function() {
  32727. var chainAll = this.__chain__;
  32728. if (chain || chainAll) {
  32729. var result = object(this.__wrapped__),
  32730. actions = result.__actions__ = copyArray(this.__actions__);
  32731. actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
  32732. result.__chain__ = chainAll;
  32733. return result;
  32734. }
  32735. return func.apply(object, arrayPush([this.value()], arguments));
  32736. };
  32737. }
  32738. });
  32739. return object;
  32740. }
  32741. /**
  32742. * Reverts the `_` variable to its previous value and returns a reference to
  32743. * the `lodash` function.
  32744. *
  32745. * @static
  32746. * @since 0.1.0
  32747. * @memberOf _
  32748. * @category Util
  32749. * @returns {Function} Returns the `lodash` function.
  32750. * @example
  32751. *
  32752. * var lodash = _.noConflict();
  32753. */
  32754. function noConflict() {
  32755. if (root._ === this) {
  32756. root._ = oldDash;
  32757. }
  32758. return this;
  32759. }
  32760. /**
  32761. * This method returns `undefined`.
  32762. *
  32763. * @static
  32764. * @memberOf _
  32765. * @since 2.3.0
  32766. * @category Util
  32767. * @example
  32768. *
  32769. * _.times(2, _.noop);
  32770. * // => [undefined, undefined]
  32771. */
  32772. function noop() {
  32773. // No operation performed.
  32774. }
  32775. /**
  32776. * Creates a function that gets the argument at index `n`. If `n` is negative,
  32777. * the nth argument from the end is returned.
  32778. *
  32779. * @static
  32780. * @memberOf _
  32781. * @since 4.0.0
  32782. * @category Util
  32783. * @param {number} [n=0] The index of the argument to return.
  32784. * @returns {Function} Returns the new pass-thru function.
  32785. * @example
  32786. *
  32787. * var func = _.nthArg(1);
  32788. * func('a', 'b', 'c', 'd');
  32789. * // => 'b'
  32790. *
  32791. * var func = _.nthArg(-2);
  32792. * func('a', 'b', 'c', 'd');
  32793. * // => 'c'
  32794. */
  32795. function nthArg(n) {
  32796. n = toInteger(n);
  32797. return baseRest(function(args) {
  32798. return baseNth(args, n);
  32799. });
  32800. }
  32801. /**
  32802. * Creates a function that invokes `iteratees` with the arguments it receives
  32803. * and returns their results.
  32804. *
  32805. * @static
  32806. * @memberOf _
  32807. * @since 4.0.0
  32808. * @category Util
  32809. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  32810. * The iteratees to invoke.
  32811. * @returns {Function} Returns the new function.
  32812. * @example
  32813. *
  32814. * var func = _.over([Math.max, Math.min]);
  32815. *
  32816. * func(1, 2, 3, 4);
  32817. * // => [4, 1]
  32818. */
  32819. var over = createOver(arrayMap);
  32820. /**
  32821. * Creates a function that checks if **all** of the `predicates` return
  32822. * truthy when invoked with the arguments it receives.
  32823. *
  32824. * @static
  32825. * @memberOf _
  32826. * @since 4.0.0
  32827. * @category Util
  32828. * @param {...(Function|Function[])} [predicates=[_.identity]]
  32829. * The predicates to check.
  32830. * @returns {Function} Returns the new function.
  32831. * @example
  32832. *
  32833. * var func = _.overEvery([Boolean, isFinite]);
  32834. *
  32835. * func('1');
  32836. * // => true
  32837. *
  32838. * func(null);
  32839. * // => false
  32840. *
  32841. * func(NaN);
  32842. * // => false
  32843. */
  32844. var overEvery = createOver(arrayEvery);
  32845. /**
  32846. * Creates a function that checks if **any** of the `predicates` return
  32847. * truthy when invoked with the arguments it receives.
  32848. *
  32849. * @static
  32850. * @memberOf _
  32851. * @since 4.0.0
  32852. * @category Util
  32853. * @param {...(Function|Function[])} [predicates=[_.identity]]
  32854. * The predicates to check.
  32855. * @returns {Function} Returns the new function.
  32856. * @example
  32857. *
  32858. * var func = _.overSome([Boolean, isFinite]);
  32859. *
  32860. * func('1');
  32861. * // => true
  32862. *
  32863. * func(null);
  32864. * // => true
  32865. *
  32866. * func(NaN);
  32867. * // => false
  32868. */
  32869. var overSome = createOver(arraySome);
  32870. /**
  32871. * Creates a function that returns the value at `path` of a given object.
  32872. *
  32873. * @static
  32874. * @memberOf _
  32875. * @since 2.4.0
  32876. * @category Util
  32877. * @param {Array|string} path The path of the property to get.
  32878. * @returns {Function} Returns the new accessor function.
  32879. * @example
  32880. *
  32881. * var objects = [
  32882. * { 'a': { 'b': 2 } },
  32883. * { 'a': { 'b': 1 } }
  32884. * ];
  32885. *
  32886. * _.map(objects, _.property('a.b'));
  32887. * // => [2, 1]
  32888. *
  32889. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  32890. * // => [1, 2]
  32891. */
  32892. function property(path) {
  32893. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  32894. }
  32895. /**
  32896. * The opposite of `_.property`; this method creates a function that returns
  32897. * the value at a given path of `object`.
  32898. *
  32899. * @static
  32900. * @memberOf _
  32901. * @since 3.0.0
  32902. * @category Util
  32903. * @param {Object} object The object to query.
  32904. * @returns {Function} Returns the new accessor function.
  32905. * @example
  32906. *
  32907. * var array = [0, 1, 2],
  32908. * object = { 'a': array, 'b': array, 'c': array };
  32909. *
  32910. * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
  32911. * // => [2, 0]
  32912. *
  32913. * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
  32914. * // => [2, 0]
  32915. */
  32916. function propertyOf(object) {
  32917. return function(path) {
  32918. return object == null ? undefined : baseGet(object, path);
  32919. };
  32920. }
  32921. /**
  32922. * Creates an array of numbers (positive and/or negative) progressing from
  32923. * `start` up to, but not including, `end`. A step of `-1` is used if a negative
  32924. * `start` is specified without an `end` or `step`. If `end` is not specified,
  32925. * it's set to `start` with `start` then set to `0`.
  32926. *
  32927. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  32928. * floating-point values which can produce unexpected results.
  32929. *
  32930. * @static
  32931. * @since 0.1.0
  32932. * @memberOf _
  32933. * @category Util
  32934. * @param {number} [start=0] The start of the range.
  32935. * @param {number} end The end of the range.
  32936. * @param {number} [step=1] The value to increment or decrement by.
  32937. * @returns {Array} Returns the range of numbers.
  32938. * @see _.inRange, _.rangeRight
  32939. * @example
  32940. *
  32941. * _.range(4);
  32942. * // => [0, 1, 2, 3]
  32943. *
  32944. * _.range(-4);
  32945. * // => [0, -1, -2, -3]
  32946. *
  32947. * _.range(1, 5);
  32948. * // => [1, 2, 3, 4]
  32949. *
  32950. * _.range(0, 20, 5);
  32951. * // => [0, 5, 10, 15]
  32952. *
  32953. * _.range(0, -4, -1);
  32954. * // => [0, -1, -2, -3]
  32955. *
  32956. * _.range(1, 4, 0);
  32957. * // => [1, 1, 1]
  32958. *
  32959. * _.range(0);
  32960. * // => []
  32961. */
  32962. var range = createRange();
  32963. /**
  32964. * This method is like `_.range` except that it populates values in
  32965. * descending order.
  32966. *
  32967. * @static
  32968. * @memberOf _
  32969. * @since 4.0.0
  32970. * @category Util
  32971. * @param {number} [start=0] The start of the range.
  32972. * @param {number} end The end of the range.
  32973. * @param {number} [step=1] The value to increment or decrement by.
  32974. * @returns {Array} Returns the range of numbers.
  32975. * @see _.inRange, _.range
  32976. * @example
  32977. *
  32978. * _.rangeRight(4);
  32979. * // => [3, 2, 1, 0]
  32980. *
  32981. * _.rangeRight(-4);
  32982. * // => [-3, -2, -1, 0]
  32983. *
  32984. * _.rangeRight(1, 5);
  32985. * // => [4, 3, 2, 1]
  32986. *
  32987. * _.rangeRight(0, 20, 5);
  32988. * // => [15, 10, 5, 0]
  32989. *
  32990. * _.rangeRight(0, -4, -1);
  32991. * // => [-3, -2, -1, 0]
  32992. *
  32993. * _.rangeRight(1, 4, 0);
  32994. * // => [1, 1, 1]
  32995. *
  32996. * _.rangeRight(0);
  32997. * // => []
  32998. */
  32999. var rangeRight = createRange(true);
  33000. /**
  33001. * This method returns a new empty array.
  33002. *
  33003. * @static
  33004. * @memberOf _
  33005. * @since 4.13.0
  33006. * @category Util
  33007. * @returns {Array} Returns the new empty array.
  33008. * @example
  33009. *
  33010. * var arrays = _.times(2, _.stubArray);
  33011. *
  33012. * console.log(arrays);
  33013. * // => [[], []]
  33014. *
  33015. * console.log(arrays[0] === arrays[1]);
  33016. * // => false
  33017. */
  33018. function stubArray() {
  33019. return [];
  33020. }
  33021. /**
  33022. * This method returns `false`.
  33023. *
  33024. * @static
  33025. * @memberOf _
  33026. * @since 4.13.0
  33027. * @category Util
  33028. * @returns {boolean} Returns `false`.
  33029. * @example
  33030. *
  33031. * _.times(2, _.stubFalse);
  33032. * // => [false, false]
  33033. */
  33034. function stubFalse() {
  33035. return false;
  33036. }
  33037. /**
  33038. * This method returns a new empty object.
  33039. *
  33040. * @static
  33041. * @memberOf _
  33042. * @since 4.13.0
  33043. * @category Util
  33044. * @returns {Object} Returns the new empty object.
  33045. * @example
  33046. *
  33047. * var objects = _.times(2, _.stubObject);
  33048. *
  33049. * console.log(objects);
  33050. * // => [{}, {}]
  33051. *
  33052. * console.log(objects[0] === objects[1]);
  33053. * // => false
  33054. */
  33055. function stubObject() {
  33056. return {};
  33057. }
  33058. /**
  33059. * This method returns an empty string.
  33060. *
  33061. * @static
  33062. * @memberOf _
  33063. * @since 4.13.0
  33064. * @category Util
  33065. * @returns {string} Returns the empty string.
  33066. * @example
  33067. *
  33068. * _.times(2, _.stubString);
  33069. * // => ['', '']
  33070. */
  33071. function stubString() {
  33072. return '';
  33073. }
  33074. /**
  33075. * This method returns `true`.
  33076. *
  33077. * @static
  33078. * @memberOf _
  33079. * @since 4.13.0
  33080. * @category Util
  33081. * @returns {boolean} Returns `true`.
  33082. * @example
  33083. *
  33084. * _.times(2, _.stubTrue);
  33085. * // => [true, true]
  33086. */
  33087. function stubTrue() {
  33088. return true;
  33089. }
  33090. /**
  33091. * Invokes the iteratee `n` times, returning an array of the results of
  33092. * each invocation. The iteratee is invoked with one argument; (index).
  33093. *
  33094. * @static
  33095. * @since 0.1.0
  33096. * @memberOf _
  33097. * @category Util
  33098. * @param {number} n The number of times to invoke `iteratee`.
  33099. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  33100. * @returns {Array} Returns the array of results.
  33101. * @example
  33102. *
  33103. * _.times(3, String);
  33104. * // => ['0', '1', '2']
  33105. *
  33106. * _.times(4, _.constant(0));
  33107. * // => [0, 0, 0, 0]
  33108. */
  33109. function times(n, iteratee) {
  33110. n = toInteger(n);
  33111. if (n < 1 || n > MAX_SAFE_INTEGER) {
  33112. return [];
  33113. }
  33114. var index = MAX_ARRAY_LENGTH,
  33115. length = nativeMin(n, MAX_ARRAY_LENGTH);
  33116. iteratee = getIteratee(iteratee);
  33117. n -= MAX_ARRAY_LENGTH;
  33118. var result = baseTimes(length, iteratee);
  33119. while (++index < n) {
  33120. iteratee(index);
  33121. }
  33122. return result;
  33123. }
  33124. /**
  33125. * Converts `value` to a property path array.
  33126. *
  33127. * @static
  33128. * @memberOf _
  33129. * @since 4.0.0
  33130. * @category Util
  33131. * @param {*} value The value to convert.
  33132. * @returns {Array} Returns the new property path array.
  33133. * @example
  33134. *
  33135. * _.toPath('a.b.c');
  33136. * // => ['a', 'b', 'c']
  33137. *
  33138. * _.toPath('a[0].b.c');
  33139. * // => ['a', '0', 'b', 'c']
  33140. */
  33141. function toPath(value) {
  33142. if (isArray(value)) {
  33143. return arrayMap(value, toKey);
  33144. }
  33145. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  33146. }
  33147. /**
  33148. * Generates a unique ID. If `prefix` is given, the ID is appended to it.
  33149. *
  33150. * @static
  33151. * @since 0.1.0
  33152. * @memberOf _
  33153. * @category Util
  33154. * @param {string} [prefix=''] The value to prefix the ID with.
  33155. * @returns {string} Returns the unique ID.
  33156. * @example
  33157. *
  33158. * _.uniqueId('contact_');
  33159. * // => 'contact_104'
  33160. *
  33161. * _.uniqueId();
  33162. * // => '105'
  33163. */
  33164. function uniqueId(prefix) {
  33165. var id = ++idCounter;
  33166. return toString(prefix) + id;
  33167. }
  33168. /*------------------------------------------------------------------------*/
  33169. /**
  33170. * Adds two numbers.
  33171. *
  33172. * @static
  33173. * @memberOf _
  33174. * @since 3.4.0
  33175. * @category Math
  33176. * @param {number} augend The first number in an addition.
  33177. * @param {number} addend The second number in an addition.
  33178. * @returns {number} Returns the total.
  33179. * @example
  33180. *
  33181. * _.add(6, 4);
  33182. * // => 10
  33183. */
  33184. var add = createMathOperation(function(augend, addend) {
  33185. return augend + addend;
  33186. }, 0);
  33187. /**
  33188. * Computes `number` rounded up to `precision`.
  33189. *
  33190. * @static
  33191. * @memberOf _
  33192. * @since 3.10.0
  33193. * @category Math
  33194. * @param {number} number The number to round up.
  33195. * @param {number} [precision=0] The precision to round up to.
  33196. * @returns {number} Returns the rounded up number.
  33197. * @example
  33198. *
  33199. * _.ceil(4.006);
  33200. * // => 5
  33201. *
  33202. * _.ceil(6.004, 2);
  33203. * // => 6.01
  33204. *
  33205. * _.ceil(6040, -2);
  33206. * // => 6100
  33207. */
  33208. var ceil = createRound('ceil');
  33209. /**
  33210. * Divide two numbers.
  33211. *
  33212. * @static
  33213. * @memberOf _
  33214. * @since 4.7.0
  33215. * @category Math
  33216. * @param {number} dividend The first number in a division.
  33217. * @param {number} divisor The second number in a division.
  33218. * @returns {number} Returns the quotient.
  33219. * @example
  33220. *
  33221. * _.divide(6, 4);
  33222. * // => 1.5
  33223. */
  33224. var divide = createMathOperation(function(dividend, divisor) {
  33225. return dividend / divisor;
  33226. }, 1);
  33227. /**
  33228. * Computes `number` rounded down to `precision`.
  33229. *
  33230. * @static
  33231. * @memberOf _
  33232. * @since 3.10.0
  33233. * @category Math
  33234. * @param {number} number The number to round down.
  33235. * @param {number} [precision=0] The precision to round down to.
  33236. * @returns {number} Returns the rounded down number.
  33237. * @example
  33238. *
  33239. * _.floor(4.006);
  33240. * // => 4
  33241. *
  33242. * _.floor(0.046, 2);
  33243. * // => 0.04
  33244. *
  33245. * _.floor(4060, -2);
  33246. * // => 4000
  33247. */
  33248. var floor = createRound('floor');
  33249. /**
  33250. * Computes the maximum value of `array`. If `array` is empty or falsey,
  33251. * `undefined` is returned.
  33252. *
  33253. * @static
  33254. * @since 0.1.0
  33255. * @memberOf _
  33256. * @category Math
  33257. * @param {Array} array The array to iterate over.
  33258. * @returns {*} Returns the maximum value.
  33259. * @example
  33260. *
  33261. * _.max([4, 2, 8, 6]);
  33262. * // => 8
  33263. *
  33264. * _.max([]);
  33265. * // => undefined
  33266. */
  33267. function max(array) {
  33268. return (array && array.length)
  33269. ? baseExtremum(array, identity, baseGt)
  33270. : undefined;
  33271. }
  33272. /**
  33273. * This method is like `_.max` except that it accepts `iteratee` which is
  33274. * invoked for each element in `array` to generate the criterion by which
  33275. * the value is ranked. The iteratee is invoked with one argument: (value).
  33276. *
  33277. * @static
  33278. * @memberOf _
  33279. * @since 4.0.0
  33280. * @category Math
  33281. * @param {Array} array The array to iterate over.
  33282. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33283. * @returns {*} Returns the maximum value.
  33284. * @example
  33285. *
  33286. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  33287. *
  33288. * _.maxBy(objects, function(o) { return o.n; });
  33289. * // => { 'n': 2 }
  33290. *
  33291. * // The `_.property` iteratee shorthand.
  33292. * _.maxBy(objects, 'n');
  33293. * // => { 'n': 2 }
  33294. */
  33295. function maxBy(array, iteratee) {
  33296. return (array && array.length)
  33297. ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
  33298. : undefined;
  33299. }
  33300. /**
  33301. * Computes the mean of the values in `array`.
  33302. *
  33303. * @static
  33304. * @memberOf _
  33305. * @since 4.0.0
  33306. * @category Math
  33307. * @param {Array} array The array to iterate over.
  33308. * @returns {number} Returns the mean.
  33309. * @example
  33310. *
  33311. * _.mean([4, 2, 8, 6]);
  33312. * // => 5
  33313. */
  33314. function mean(array) {
  33315. return baseMean(array, identity);
  33316. }
  33317. /**
  33318. * This method is like `_.mean` except that it accepts `iteratee` which is
  33319. * invoked for each element in `array` to generate the value to be averaged.
  33320. * The iteratee is invoked with one argument: (value).
  33321. *
  33322. * @static
  33323. * @memberOf _
  33324. * @since 4.7.0
  33325. * @category Math
  33326. * @param {Array} array The array to iterate over.
  33327. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33328. * @returns {number} Returns the mean.
  33329. * @example
  33330. *
  33331. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  33332. *
  33333. * _.meanBy(objects, function(o) { return o.n; });
  33334. * // => 5
  33335. *
  33336. * // The `_.property` iteratee shorthand.
  33337. * _.meanBy(objects, 'n');
  33338. * // => 5
  33339. */
  33340. function meanBy(array, iteratee) {
  33341. return baseMean(array, getIteratee(iteratee, 2));
  33342. }
  33343. /**
  33344. * Computes the minimum value of `array`. If `array` is empty or falsey,
  33345. * `undefined` is returned.
  33346. *
  33347. * @static
  33348. * @since 0.1.0
  33349. * @memberOf _
  33350. * @category Math
  33351. * @param {Array} array The array to iterate over.
  33352. * @returns {*} Returns the minimum value.
  33353. * @example
  33354. *
  33355. * _.min([4, 2, 8, 6]);
  33356. * // => 2
  33357. *
  33358. * _.min([]);
  33359. * // => undefined
  33360. */
  33361. function min(array) {
  33362. return (array && array.length)
  33363. ? baseExtremum(array, identity, baseLt)
  33364. : undefined;
  33365. }
  33366. /**
  33367. * This method is like `_.min` except that it accepts `iteratee` which is
  33368. * invoked for each element in `array` to generate the criterion by which
  33369. * the value is ranked. The iteratee is invoked with one argument: (value).
  33370. *
  33371. * @static
  33372. * @memberOf _
  33373. * @since 4.0.0
  33374. * @category Math
  33375. * @param {Array} array The array to iterate over.
  33376. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33377. * @returns {*} Returns the minimum value.
  33378. * @example
  33379. *
  33380. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  33381. *
  33382. * _.minBy(objects, function(o) { return o.n; });
  33383. * // => { 'n': 1 }
  33384. *
  33385. * // The `_.property` iteratee shorthand.
  33386. * _.minBy(objects, 'n');
  33387. * // => { 'n': 1 }
  33388. */
  33389. function minBy(array, iteratee) {
  33390. return (array && array.length)
  33391. ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
  33392. : undefined;
  33393. }
  33394. /**
  33395. * Multiply two numbers.
  33396. *
  33397. * @static
  33398. * @memberOf _
  33399. * @since 4.7.0
  33400. * @category Math
  33401. * @param {number} multiplier The first number in a multiplication.
  33402. * @param {number} multiplicand The second number in a multiplication.
  33403. * @returns {number} Returns the product.
  33404. * @example
  33405. *
  33406. * _.multiply(6, 4);
  33407. * // => 24
  33408. */
  33409. var multiply = createMathOperation(function(multiplier, multiplicand) {
  33410. return multiplier * multiplicand;
  33411. }, 1);
  33412. /**
  33413. * Computes `number` rounded to `precision`.
  33414. *
  33415. * @static
  33416. * @memberOf _
  33417. * @since 3.10.0
  33418. * @category Math
  33419. * @param {number} number The number to round.
  33420. * @param {number} [precision=0] The precision to round to.
  33421. * @returns {number} Returns the rounded number.
  33422. * @example
  33423. *
  33424. * _.round(4.006);
  33425. * // => 4
  33426. *
  33427. * _.round(4.006, 2);
  33428. * // => 4.01
  33429. *
  33430. * _.round(4060, -2);
  33431. * // => 4100
  33432. */
  33433. var round = createRound('round');
  33434. /**
  33435. * Subtract two numbers.
  33436. *
  33437. * @static
  33438. * @memberOf _
  33439. * @since 4.0.0
  33440. * @category Math
  33441. * @param {number} minuend The first number in a subtraction.
  33442. * @param {number} subtrahend The second number in a subtraction.
  33443. * @returns {number} Returns the difference.
  33444. * @example
  33445. *
  33446. * _.subtract(6, 4);
  33447. * // => 2
  33448. */
  33449. var subtract = createMathOperation(function(minuend, subtrahend) {
  33450. return minuend - subtrahend;
  33451. }, 0);
  33452. /**
  33453. * Computes the sum of the values in `array`.
  33454. *
  33455. * @static
  33456. * @memberOf _
  33457. * @since 3.4.0
  33458. * @category Math
  33459. * @param {Array} array The array to iterate over.
  33460. * @returns {number} Returns the sum.
  33461. * @example
  33462. *
  33463. * _.sum([4, 2, 8, 6]);
  33464. * // => 20
  33465. */
  33466. function sum(array) {
  33467. return (array && array.length)
  33468. ? baseSum(array, identity)
  33469. : 0;
  33470. }
  33471. /**
  33472. * This method is like `_.sum` except that it accepts `iteratee` which is
  33473. * invoked for each element in `array` to generate the value to be summed.
  33474. * The iteratee is invoked with one argument: (value).
  33475. *
  33476. * @static
  33477. * @memberOf _
  33478. * @since 4.0.0
  33479. * @category Math
  33480. * @param {Array} array The array to iterate over.
  33481. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33482. * @returns {number} Returns the sum.
  33483. * @example
  33484. *
  33485. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  33486. *
  33487. * _.sumBy(objects, function(o) { return o.n; });
  33488. * // => 20
  33489. *
  33490. * // The `_.property` iteratee shorthand.
  33491. * _.sumBy(objects, 'n');
  33492. * // => 20
  33493. */
  33494. function sumBy(array, iteratee) {
  33495. return (array && array.length)
  33496. ? baseSum(array, getIteratee(iteratee, 2))
  33497. : 0;
  33498. }
  33499. /*------------------------------------------------------------------------*/
  33500. // Add methods that return wrapped values in chain sequences.
  33501. lodash.after = after;
  33502. lodash.ary = ary;
  33503. lodash.assign = assign;
  33504. lodash.assignIn = assignIn;
  33505. lodash.assignInWith = assignInWith;
  33506. lodash.assignWith = assignWith;
  33507. lodash.at = at;
  33508. lodash.before = before;
  33509. lodash.bind = bind;
  33510. lodash.bindAll = bindAll;
  33511. lodash.bindKey = bindKey;
  33512. lodash.castArray = castArray;
  33513. lodash.chain = chain;
  33514. lodash.chunk = chunk;
  33515. lodash.compact = compact;
  33516. lodash.concat = concat;
  33517. lodash.cond = cond;
  33518. lodash.conforms = conforms;
  33519. lodash.constant = constant;
  33520. lodash.countBy = countBy;
  33521. lodash.create = create;
  33522. lodash.curry = curry;
  33523. lodash.curryRight = curryRight;
  33524. lodash.debounce = debounce;
  33525. lodash.defaults = defaults;
  33526. lodash.defaultsDeep = defaultsDeep;
  33527. lodash.defer = defer;
  33528. lodash.delay = delay;
  33529. lodash.difference = difference;
  33530. lodash.differenceBy = differenceBy;
  33531. lodash.differenceWith = differenceWith;
  33532. lodash.drop = drop;
  33533. lodash.dropRight = dropRight;
  33534. lodash.dropRightWhile = dropRightWhile;
  33535. lodash.dropWhile = dropWhile;
  33536. lodash.fill = fill;
  33537. lodash.filter = filter;
  33538. lodash.flatMap = flatMap;
  33539. lodash.flatMapDeep = flatMapDeep;
  33540. lodash.flatMapDepth = flatMapDepth;
  33541. lodash.flatten = flatten;
  33542. lodash.flattenDeep = flattenDeep;
  33543. lodash.flattenDepth = flattenDepth;
  33544. lodash.flip = flip;
  33545. lodash.flow = flow;
  33546. lodash.flowRight = flowRight;
  33547. lodash.fromPairs = fromPairs;
  33548. lodash.functions = functions;
  33549. lodash.functionsIn = functionsIn;
  33550. lodash.groupBy = groupBy;
  33551. lodash.initial = initial;
  33552. lodash.intersection = intersection;
  33553. lodash.intersectionBy = intersectionBy;
  33554. lodash.intersectionWith = intersectionWith;
  33555. lodash.invert = invert;
  33556. lodash.invertBy = invertBy;
  33557. lodash.invokeMap = invokeMap;
  33558. lodash.iteratee = iteratee;
  33559. lodash.keyBy = keyBy;
  33560. lodash.keys = keys;
  33561. lodash.keysIn = keysIn;
  33562. lodash.map = map;
  33563. lodash.mapKeys = mapKeys;
  33564. lodash.mapValues = mapValues;
  33565. lodash.matches = matches;
  33566. lodash.matchesProperty = matchesProperty;
  33567. lodash.memoize = memoize;
  33568. lodash.merge = merge;
  33569. lodash.mergeWith = mergeWith;
  33570. lodash.method = method;
  33571. lodash.methodOf = methodOf;
  33572. lodash.mixin = mixin;
  33573. lodash.negate = negate;
  33574. lodash.nthArg = nthArg;
  33575. lodash.omit = omit;
  33576. lodash.omitBy = omitBy;
  33577. lodash.once = once;
  33578. lodash.orderBy = orderBy;
  33579. lodash.over = over;
  33580. lodash.overArgs = overArgs;
  33581. lodash.overEvery = overEvery;
  33582. lodash.overSome = overSome;
  33583. lodash.partial = partial;
  33584. lodash.partialRight = partialRight;
  33585. lodash.partition = partition;
  33586. lodash.pick = pick;
  33587. lodash.pickBy = pickBy;
  33588. lodash.property = property;
  33589. lodash.propertyOf = propertyOf;
  33590. lodash.pull = pull;
  33591. lodash.pullAll = pullAll;
  33592. lodash.pullAllBy = pullAllBy;
  33593. lodash.pullAllWith = pullAllWith;
  33594. lodash.pullAt = pullAt;
  33595. lodash.range = range;
  33596. lodash.rangeRight = rangeRight;
  33597. lodash.rearg = rearg;
  33598. lodash.reject = reject;
  33599. lodash.remove = remove;
  33600. lodash.rest = rest;
  33601. lodash.reverse = reverse;
  33602. lodash.sampleSize = sampleSize;
  33603. lodash.set = set;
  33604. lodash.setWith = setWith;
  33605. lodash.shuffle = shuffle;
  33606. lodash.slice = slice;
  33607. lodash.sortBy = sortBy;
  33608. lodash.sortedUniq = sortedUniq;
  33609. lodash.sortedUniqBy = sortedUniqBy;
  33610. lodash.split = split;
  33611. lodash.spread = spread;
  33612. lodash.tail = tail;
  33613. lodash.take = take;
  33614. lodash.takeRight = takeRight;
  33615. lodash.takeRightWhile = takeRightWhile;
  33616. lodash.takeWhile = takeWhile;
  33617. lodash.tap = tap;
  33618. lodash.throttle = throttle;
  33619. lodash.thru = thru;
  33620. lodash.toArray = toArray;
  33621. lodash.toPairs = toPairs;
  33622. lodash.toPairsIn = toPairsIn;
  33623. lodash.toPath = toPath;
  33624. lodash.toPlainObject = toPlainObject;
  33625. lodash.transform = transform;
  33626. lodash.unary = unary;
  33627. lodash.union = union;
  33628. lodash.unionBy = unionBy;
  33629. lodash.unionWith = unionWith;
  33630. lodash.uniq = uniq;
  33631. lodash.uniqBy = uniqBy;
  33632. lodash.uniqWith = uniqWith;
  33633. lodash.unset = unset;
  33634. lodash.unzip = unzip;
  33635. lodash.unzipWith = unzipWith;
  33636. lodash.update = update;
  33637. lodash.updateWith = updateWith;
  33638. lodash.values = values;
  33639. lodash.valuesIn = valuesIn;
  33640. lodash.without = without;
  33641. lodash.words = words;
  33642. lodash.wrap = wrap;
  33643. lodash.xor = xor;
  33644. lodash.xorBy = xorBy;
  33645. lodash.xorWith = xorWith;
  33646. lodash.zip = zip;
  33647. lodash.zipObject = zipObject;
  33648. lodash.zipObjectDeep = zipObjectDeep;
  33649. lodash.zipWith = zipWith;
  33650. // Add aliases.
  33651. lodash.entries = toPairs;
  33652. lodash.entriesIn = toPairsIn;
  33653. lodash.extend = assignIn;
  33654. lodash.extendWith = assignInWith;
  33655. // Add methods to `lodash.prototype`.
  33656. mixin(lodash, lodash);
  33657. /*------------------------------------------------------------------------*/
  33658. // Add methods that return unwrapped values in chain sequences.
  33659. lodash.add = add;
  33660. lodash.attempt = attempt;
  33661. lodash.camelCase = camelCase;
  33662. lodash.capitalize = capitalize;
  33663. lodash.ceil = ceil;
  33664. lodash.clamp = clamp;
  33665. lodash.clone = clone;
  33666. lodash.cloneDeep = cloneDeep;
  33667. lodash.cloneDeepWith = cloneDeepWith;
  33668. lodash.cloneWith = cloneWith;
  33669. lodash.conformsTo = conformsTo;
  33670. lodash.deburr = deburr;
  33671. lodash.defaultTo = defaultTo;
  33672. lodash.divide = divide;
  33673. lodash.endsWith = endsWith;
  33674. lodash.eq = eq;
  33675. lodash.escape = escape;
  33676. lodash.escapeRegExp = escapeRegExp;
  33677. lodash.every = every;
  33678. lodash.find = find;
  33679. lodash.findIndex = findIndex;
  33680. lodash.findKey = findKey;
  33681. lodash.findLast = findLast;
  33682. lodash.findLastIndex = findLastIndex;
  33683. lodash.findLastKey = findLastKey;
  33684. lodash.floor = floor;
  33685. lodash.forEach = forEach;
  33686. lodash.forEachRight = forEachRight;
  33687. lodash.forIn = forIn;
  33688. lodash.forInRight = forInRight;
  33689. lodash.forOwn = forOwn;
  33690. lodash.forOwnRight = forOwnRight;
  33691. lodash.get = get;
  33692. lodash.gt = gt;
  33693. lodash.gte = gte;
  33694. lodash.has = has;
  33695. lodash.hasIn = hasIn;
  33696. lodash.head = head;
  33697. lodash.identity = identity;
  33698. lodash.includes = includes;
  33699. lodash.indexOf = indexOf;
  33700. lodash.inRange = inRange;
  33701. lodash.invoke = invoke;
  33702. lodash.isArguments = isArguments;
  33703. lodash.isArray = isArray;
  33704. lodash.isArrayBuffer = isArrayBuffer;
  33705. lodash.isArrayLike = isArrayLike;
  33706. lodash.isArrayLikeObject = isArrayLikeObject;
  33707. lodash.isBoolean = isBoolean;
  33708. lodash.isBuffer = isBuffer;
  33709. lodash.isDate = isDate;
  33710. lodash.isElement = isElement;
  33711. lodash.isEmpty = isEmpty;
  33712. lodash.isEqual = isEqual;
  33713. lodash.isEqualWith = isEqualWith;
  33714. lodash.isError = isError;
  33715. lodash.isFinite = isFinite;
  33716. lodash.isFunction = isFunction;
  33717. lodash.isInteger = isInteger;
  33718. lodash.isLength = isLength;
  33719. lodash.isMap = isMap;
  33720. lodash.isMatch = isMatch;
  33721. lodash.isMatchWith = isMatchWith;
  33722. lodash.isNaN = isNaN;
  33723. lodash.isNative = isNative;
  33724. lodash.isNil = isNil;
  33725. lodash.isNull = isNull;
  33726. lodash.isNumber = isNumber;
  33727. lodash.isObject = isObject;
  33728. lodash.isObjectLike = isObjectLike;
  33729. lodash.isPlainObject = isPlainObject;
  33730. lodash.isRegExp = isRegExp;
  33731. lodash.isSafeInteger = isSafeInteger;
  33732. lodash.isSet = isSet;
  33733. lodash.isString = isString;
  33734. lodash.isSymbol = isSymbol;
  33735. lodash.isTypedArray = isTypedArray;
  33736. lodash.isUndefined = isUndefined;
  33737. lodash.isWeakMap = isWeakMap;
  33738. lodash.isWeakSet = isWeakSet;
  33739. lodash.join = join;
  33740. lodash.kebabCase = kebabCase;
  33741. lodash.last = last;
  33742. lodash.lastIndexOf = lastIndexOf;
  33743. lodash.lowerCase = lowerCase;
  33744. lodash.lowerFirst = lowerFirst;
  33745. lodash.lt = lt;
  33746. lodash.lte = lte;
  33747. lodash.max = max;
  33748. lodash.maxBy = maxBy;
  33749. lodash.mean = mean;
  33750. lodash.meanBy = meanBy;
  33751. lodash.min = min;
  33752. lodash.minBy = minBy;
  33753. lodash.stubArray = stubArray;
  33754. lodash.stubFalse = stubFalse;
  33755. lodash.stubObject = stubObject;
  33756. lodash.stubString = stubString;
  33757. lodash.stubTrue = stubTrue;
  33758. lodash.multiply = multiply;
  33759. lodash.nth = nth;
  33760. lodash.noConflict = noConflict;
  33761. lodash.noop = noop;
  33762. lodash.now = now;
  33763. lodash.pad = pad;
  33764. lodash.padEnd = padEnd;
  33765. lodash.padStart = padStart;
  33766. lodash.parseInt = parseInt;
  33767. lodash.random = random;
  33768. lodash.reduce = reduce;
  33769. lodash.reduceRight = reduceRight;
  33770. lodash.repeat = repeat;
  33771. lodash.replace = replace;
  33772. lodash.result = result;
  33773. lodash.round = round;
  33774. lodash.runInContext = runInContext;
  33775. lodash.sample = sample;
  33776. lodash.size = size;
  33777. lodash.snakeCase = snakeCase;
  33778. lodash.some = some;
  33779. lodash.sortedIndex = sortedIndex;
  33780. lodash.sortedIndexBy = sortedIndexBy;
  33781. lodash.sortedIndexOf = sortedIndexOf;
  33782. lodash.sortedLastIndex = sortedLastIndex;
  33783. lodash.sortedLastIndexBy = sortedLastIndexBy;
  33784. lodash.sortedLastIndexOf = sortedLastIndexOf;
  33785. lodash.startCase = startCase;
  33786. lodash.startsWith = startsWith;
  33787. lodash.subtract = subtract;
  33788. lodash.sum = sum;
  33789. lodash.sumBy = sumBy;
  33790. lodash.template = template;
  33791. lodash.times = times;
  33792. lodash.toFinite = toFinite;
  33793. lodash.toInteger = toInteger;
  33794. lodash.toLength = toLength;
  33795. lodash.toLower = toLower;
  33796. lodash.toNumber = toNumber;
  33797. lodash.toSafeInteger = toSafeInteger;
  33798. lodash.toString = toString;
  33799. lodash.toUpper = toUpper;
  33800. lodash.trim = trim;
  33801. lodash.trimEnd = trimEnd;
  33802. lodash.trimStart = trimStart;
  33803. lodash.truncate = truncate;
  33804. lodash.unescape = unescape;
  33805. lodash.uniqueId = uniqueId;
  33806. lodash.upperCase = upperCase;
  33807. lodash.upperFirst = upperFirst;
  33808. // Add aliases.
  33809. lodash.each = forEach;
  33810. lodash.eachRight = forEachRight;
  33811. lodash.first = head;
  33812. mixin(lodash, (function() {
  33813. var source = {};
  33814. baseForOwn(lodash, function(func, methodName) {
  33815. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  33816. source[methodName] = func;
  33817. }
  33818. });
  33819. return source;
  33820. }()), { 'chain': false });
  33821. /*------------------------------------------------------------------------*/
  33822. /**
  33823. * The semantic version number.
  33824. *
  33825. * @static
  33826. * @memberOf _
  33827. * @type {string}
  33828. */
  33829. lodash.VERSION = VERSION;
  33830. // Assign default placeholders.
  33831. arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
  33832. lodash[methodName].placeholder = lodash;
  33833. });
  33834. // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
  33835. arrayEach(['drop', 'take'], function(methodName, index) {
  33836. LazyWrapper.prototype[methodName] = function(n) {
  33837. n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
  33838. var result = (this.__filtered__ && !index)
  33839. ? new LazyWrapper(this)
  33840. : this.clone();
  33841. if (result.__filtered__) {
  33842. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  33843. } else {
  33844. result.__views__.push({
  33845. 'size': nativeMin(n, MAX_ARRAY_LENGTH),
  33846. 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
  33847. });
  33848. }
  33849. return result;
  33850. };
  33851. LazyWrapper.prototype[methodName + 'Right'] = function(n) {
  33852. return this.reverse()[methodName](n).reverse();
  33853. };
  33854. });
  33855. // Add `LazyWrapper` methods that accept an `iteratee` value.
  33856. arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
  33857. var type = index + 1,
  33858. isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  33859. LazyWrapper.prototype[methodName] = function(iteratee) {
  33860. var result = this.clone();
  33861. result.__iteratees__.push({
  33862. 'iteratee': getIteratee(iteratee, 3),
  33863. 'type': type
  33864. });
  33865. result.__filtered__ = result.__filtered__ || isFilter;
  33866. return result;
  33867. };
  33868. });
  33869. // Add `LazyWrapper` methods for `_.head` and `_.last`.
  33870. arrayEach(['head', 'last'], function(methodName, index) {
  33871. var takeName = 'take' + (index ? 'Right' : '');
  33872. LazyWrapper.prototype[methodName] = function() {
  33873. return this[takeName](1).value()[0];
  33874. };
  33875. });
  33876. // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
  33877. arrayEach(['initial', 'tail'], function(methodName, index) {
  33878. var dropName = 'drop' + (index ? '' : 'Right');
  33879. LazyWrapper.prototype[methodName] = function() {
  33880. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  33881. };
  33882. });
  33883. LazyWrapper.prototype.compact = function() {
  33884. return this.filter(identity);
  33885. };
  33886. LazyWrapper.prototype.find = function(predicate) {
  33887. return this.filter(predicate).head();
  33888. };
  33889. LazyWrapper.prototype.findLast = function(predicate) {
  33890. return this.reverse().find(predicate);
  33891. };
  33892. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  33893. if (typeof path == 'function') {
  33894. return new LazyWrapper(this);
  33895. }
  33896. return this.map(function(value) {
  33897. return baseInvoke(value, path, args);
  33898. });
  33899. });
  33900. LazyWrapper.prototype.reject = function(predicate) {
  33901. return this.filter(negate(getIteratee(predicate)));
  33902. };
  33903. LazyWrapper.prototype.slice = function(start, end) {
  33904. start = toInteger(start);
  33905. var result = this;
  33906. if (result.__filtered__ && (start > 0 || end < 0)) {
  33907. return new LazyWrapper(result);
  33908. }
  33909. if (start < 0) {
  33910. result = result.takeRight(-start);
  33911. } else if (start) {
  33912. result = result.drop(start);
  33913. }
  33914. if (end !== undefined) {
  33915. end = toInteger(end);
  33916. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  33917. }
  33918. return result;
  33919. };
  33920. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  33921. return this.reverse().takeWhile(predicate).reverse();
  33922. };
  33923. LazyWrapper.prototype.toArray = function() {
  33924. return this.take(MAX_ARRAY_LENGTH);
  33925. };
  33926. // Add `LazyWrapper` methods to `lodash.prototype`.
  33927. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  33928. var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
  33929. isTaker = /^(?:head|last)$/.test(methodName),
  33930. lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
  33931. retUnwrapped = isTaker || /^find/.test(methodName);
  33932. if (!lodashFunc) {
  33933. return;
  33934. }
  33935. lodash.prototype[methodName] = function() {
  33936. var value = this.__wrapped__,
  33937. args = isTaker ? [1] : arguments,
  33938. isLazy = value instanceof LazyWrapper,
  33939. iteratee = args[0],
  33940. useLazy = isLazy || isArray(value);
  33941. var interceptor = function(value) {
  33942. var result = lodashFunc.apply(lodash, arrayPush([value], args));
  33943. return (isTaker && chainAll) ? result[0] : result;
  33944. };
  33945. if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
  33946. // Avoid lazy use if the iteratee has a "length" value other than `1`.
  33947. isLazy = useLazy = false;
  33948. }
  33949. var chainAll = this.__chain__,
  33950. isHybrid = !!this.__actions__.length,
  33951. isUnwrapped = retUnwrapped && !chainAll,
  33952. onlyLazy = isLazy && !isHybrid;
  33953. if (!retUnwrapped && useLazy) {
  33954. value = onlyLazy ? value : new LazyWrapper(this);
  33955. var result = func.apply(value, args);
  33956. result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
  33957. return new LodashWrapper(result, chainAll);
  33958. }
  33959. if (isUnwrapped && onlyLazy) {
  33960. return func.apply(this, args);
  33961. }
  33962. result = this.thru(interceptor);
  33963. return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
  33964. };
  33965. });
  33966. // Add `Array` methods to `lodash.prototype`.
  33967. arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
  33968. var func = arrayProto[methodName],
  33969. chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
  33970. retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  33971. lodash.prototype[methodName] = function() {
  33972. var args = arguments;
  33973. if (retUnwrapped && !this.__chain__) {
  33974. var value = this.value();
  33975. return func.apply(isArray(value) ? value : [], args);
  33976. }
  33977. return this[chainName](function(value) {
  33978. return func.apply(isArray(value) ? value : [], args);
  33979. });
  33980. };
  33981. });
  33982. // Map minified method names to their real names.
  33983. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  33984. var lodashFunc = lodash[methodName];
  33985. if (lodashFunc) {
  33986. var key = lodashFunc.name + '';
  33987. if (!hasOwnProperty.call(realNames, key)) {
  33988. realNames[key] = [];
  33989. }
  33990. realNames[key].push({ 'name': methodName, 'func': lodashFunc });
  33991. }
  33992. });
  33993. realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
  33994. 'name': 'wrapper',
  33995. 'func': undefined
  33996. }];
  33997. // Add methods to `LazyWrapper`.
  33998. LazyWrapper.prototype.clone = lazyClone;
  33999. LazyWrapper.prototype.reverse = lazyReverse;
  34000. LazyWrapper.prototype.value = lazyValue;
  34001. // Add chain sequence methods to the `lodash` wrapper.
  34002. lodash.prototype.at = wrapperAt;
  34003. lodash.prototype.chain = wrapperChain;
  34004. lodash.prototype.commit = wrapperCommit;
  34005. lodash.prototype.next = wrapperNext;
  34006. lodash.prototype.plant = wrapperPlant;
  34007. lodash.prototype.reverse = wrapperReverse;
  34008. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
  34009. // Add lazy aliases.
  34010. lodash.prototype.first = lodash.prototype.head;
  34011. if (symIterator) {
  34012. lodash.prototype[symIterator] = wrapperToIterator;
  34013. }
  34014. return lodash;
  34015. });
  34016. /*--------------------------------------------------------------------------*/
  34017. // Export lodash.
  34018. var _ = runInContext();
  34019. // Some AMD build optimizers, like r.js, check for condition patterns like:
  34020. if (true) {
  34021. // Expose Lodash on the global object to prevent errors when Lodash is
  34022. // loaded by a script tag in the presence of an AMD loader.
  34023. // See http://requirejs.org/docs/errors.html#mismatch for more details.
  34024. // Use `_.noConflict` to remove Lodash from the global object.
  34025. root._ = _;
  34026. // Define as an anonymous module so, through path mapping, it can be
  34027. // referenced as the "underscore" module.
  34028. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  34029. return _;
  34030. }).call(exports, __webpack_require__, exports, module),
  34031. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  34032. }
  34033. // Check for `exports` after `define` in case a build optimizer adds it.
  34034. else {}
  34035. }.call(this));
  34036. /* 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)))
  34037. /***/ }),
  34038. /***/ "./node_modules/popper.js/dist/esm/popper.js":
  34039. /*!***************************************************!*\
  34040. !*** ./node_modules/popper.js/dist/esm/popper.js ***!
  34041. \***************************************************/
  34042. /*! exports provided: default */
  34043. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  34044. "use strict";
  34045. __webpack_require__.r(__webpack_exports__);
  34046. /* WEBPACK VAR INJECTION */(function(global) {/**!
  34047. * @fileOverview Kickass library to create and place poppers near their reference elements.
  34048. * @version 1.16.1
  34049. * @license
  34050. * Copyright (c) 2016 Federico Zivolo and contributors
  34051. *
  34052. * Permission is hereby granted, free of charge, to any person obtaining a copy
  34053. * of this software and associated documentation files (the "Software"), to deal
  34054. * in the Software without restriction, including without limitation the rights
  34055. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  34056. * copies of the Software, and to permit persons to whom the Software is
  34057. * furnished to do so, subject to the following conditions:
  34058. *
  34059. * The above copyright notice and this permission notice shall be included in all
  34060. * copies or substantial portions of the Software.
  34061. *
  34062. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  34063. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  34064. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  34065. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  34066. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  34067. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  34068. * SOFTWARE.
  34069. */
  34070. var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined';
  34071. var timeoutDuration = function () {
  34072. var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
  34073. for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
  34074. if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
  34075. return 1;
  34076. }
  34077. }
  34078. return 0;
  34079. }();
  34080. function microtaskDebounce(fn) {
  34081. var called = false;
  34082. return function () {
  34083. if (called) {
  34084. return;
  34085. }
  34086. called = true;
  34087. window.Promise.resolve().then(function () {
  34088. called = false;
  34089. fn();
  34090. });
  34091. };
  34092. }
  34093. function taskDebounce(fn) {
  34094. var scheduled = false;
  34095. return function () {
  34096. if (!scheduled) {
  34097. scheduled = true;
  34098. setTimeout(function () {
  34099. scheduled = false;
  34100. fn();
  34101. }, timeoutDuration);
  34102. }
  34103. };
  34104. }
  34105. var supportsMicroTasks = isBrowser && window.Promise;
  34106. /**
  34107. * Create a debounced version of a method, that's asynchronously deferred
  34108. * but called in the minimum time possible.
  34109. *
  34110. * @method
  34111. * @memberof Popper.Utils
  34112. * @argument {Function} fn
  34113. * @returns {Function}
  34114. */
  34115. var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
  34116. /**
  34117. * Check if the given variable is a function
  34118. * @method
  34119. * @memberof Popper.Utils
  34120. * @argument {Any} functionToCheck - variable to check
  34121. * @returns {Boolean} answer to: is a function?
  34122. */
  34123. function isFunction(functionToCheck) {
  34124. var getType = {};
  34125. return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
  34126. }
  34127. /**
  34128. * Get CSS computed property of the given element
  34129. * @method
  34130. * @memberof Popper.Utils
  34131. * @argument {Eement} element
  34132. * @argument {String} property
  34133. */
  34134. function getStyleComputedProperty(element, property) {
  34135. if (element.nodeType !== 1) {
  34136. return [];
  34137. }
  34138. // NOTE: 1 DOM access here
  34139. var window = element.ownerDocument.defaultView;
  34140. var css = window.getComputedStyle(element, null);
  34141. return property ? css[property] : css;
  34142. }
  34143. /**
  34144. * Returns the parentNode or the host of the element
  34145. * @method
  34146. * @memberof Popper.Utils
  34147. * @argument {Element} element
  34148. * @returns {Element} parent
  34149. */
  34150. function getParentNode(element) {
  34151. if (element.nodeName === 'HTML') {
  34152. return element;
  34153. }
  34154. return element.parentNode || element.host;
  34155. }
  34156. /**
  34157. * Returns the scrolling parent of the given element
  34158. * @method
  34159. * @memberof Popper.Utils
  34160. * @argument {Element} element
  34161. * @returns {Element} scroll parent
  34162. */
  34163. function getScrollParent(element) {
  34164. // Return body, `getScroll` will take care to get the correct `scrollTop` from it
  34165. if (!element) {
  34166. return document.body;
  34167. }
  34168. switch (element.nodeName) {
  34169. case 'HTML':
  34170. case 'BODY':
  34171. return element.ownerDocument.body;
  34172. case '#document':
  34173. return element.body;
  34174. }
  34175. // Firefox want us to check `-x` and `-y` variations as well
  34176. var _getStyleComputedProp = getStyleComputedProperty(element),
  34177. overflow = _getStyleComputedProp.overflow,
  34178. overflowX = _getStyleComputedProp.overflowX,
  34179. overflowY = _getStyleComputedProp.overflowY;
  34180. if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
  34181. return element;
  34182. }
  34183. return getScrollParent(getParentNode(element));
  34184. }
  34185. /**
  34186. * Returns the reference node of the reference object, or the reference object itself.
  34187. * @method
  34188. * @memberof Popper.Utils
  34189. * @param {Element|Object} reference - the reference element (the popper will be relative to this)
  34190. * @returns {Element} parent
  34191. */
  34192. function getReferenceNode(reference) {
  34193. return reference && reference.referenceNode ? reference.referenceNode : reference;
  34194. }
  34195. var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
  34196. var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
  34197. /**
  34198. * Determines if the browser is Internet Explorer
  34199. * @method
  34200. * @memberof Popper.Utils
  34201. * @param {Number} version to check
  34202. * @returns {Boolean} isIE
  34203. */
  34204. function isIE(version) {
  34205. if (version === 11) {
  34206. return isIE11;
  34207. }
  34208. if (version === 10) {
  34209. return isIE10;
  34210. }
  34211. return isIE11 || isIE10;
  34212. }
  34213. /**
  34214. * Returns the offset parent of the given element
  34215. * @method
  34216. * @memberof Popper.Utils
  34217. * @argument {Element} element
  34218. * @returns {Element} offset parent
  34219. */
  34220. function getOffsetParent(element) {
  34221. if (!element) {
  34222. return document.documentElement;
  34223. }
  34224. var noOffsetParent = isIE(10) ? document.body : null;
  34225. // NOTE: 1 DOM access here
  34226. var offsetParent = element.offsetParent || null;
  34227. // Skip hidden elements which don't have an offsetParent
  34228. while (offsetParent === noOffsetParent && element.nextElementSibling) {
  34229. offsetParent = (element = element.nextElementSibling).offsetParent;
  34230. }
  34231. var nodeName = offsetParent && offsetParent.nodeName;
  34232. if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
  34233. return element ? element.ownerDocument.documentElement : document.documentElement;
  34234. }
  34235. // .offsetParent will return the closest TH, TD or TABLE in case
  34236. // no offsetParent is present, I hate this job...
  34237. if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
  34238. return getOffsetParent(offsetParent);
  34239. }
  34240. return offsetParent;
  34241. }
  34242. function isOffsetContainer(element) {
  34243. var nodeName = element.nodeName;
  34244. if (nodeName === 'BODY') {
  34245. return false;
  34246. }
  34247. return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
  34248. }
  34249. /**
  34250. * Finds the root node (document, shadowDOM root) of the given element
  34251. * @method
  34252. * @memberof Popper.Utils
  34253. * @argument {Element} node
  34254. * @returns {Element} root node
  34255. */
  34256. function getRoot(node) {
  34257. if (node.parentNode !== null) {
  34258. return getRoot(node.parentNode);
  34259. }
  34260. return node;
  34261. }
  34262. /**
  34263. * Finds the offset parent common to the two provided nodes
  34264. * @method
  34265. * @memberof Popper.Utils
  34266. * @argument {Element} element1
  34267. * @argument {Element} element2
  34268. * @returns {Element} common offset parent
  34269. */
  34270. function findCommonOffsetParent(element1, element2) {
  34271. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  34272. if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
  34273. return document.documentElement;
  34274. }
  34275. // Here we make sure to give as "start" the element that comes first in the DOM
  34276. var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
  34277. var start = order ? element1 : element2;
  34278. var end = order ? element2 : element1;
  34279. // Get common ancestor container
  34280. var range = document.createRange();
  34281. range.setStart(start, 0);
  34282. range.setEnd(end, 0);
  34283. var commonAncestorContainer = range.commonAncestorContainer;
  34284. // Both nodes are inside #document
  34285. if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
  34286. if (isOffsetContainer(commonAncestorContainer)) {
  34287. return commonAncestorContainer;
  34288. }
  34289. return getOffsetParent(commonAncestorContainer);
  34290. }
  34291. // one of the nodes is inside shadowDOM, find which one
  34292. var element1root = getRoot(element1);
  34293. if (element1root.host) {
  34294. return findCommonOffsetParent(element1root.host, element2);
  34295. } else {
  34296. return findCommonOffsetParent(element1, getRoot(element2).host);
  34297. }
  34298. }
  34299. /**
  34300. * Gets the scroll value of the given element in the given side (top and left)
  34301. * @method
  34302. * @memberof Popper.Utils
  34303. * @argument {Element} element
  34304. * @argument {String} side `top` or `left`
  34305. * @returns {number} amount of scrolled pixels
  34306. */
  34307. function getScroll(element) {
  34308. var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
  34309. var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
  34310. var nodeName = element.nodeName;
  34311. if (nodeName === 'BODY' || nodeName === 'HTML') {
  34312. var html = element.ownerDocument.documentElement;
  34313. var scrollingElement = element.ownerDocument.scrollingElement || html;
  34314. return scrollingElement[upperSide];
  34315. }
  34316. return element[upperSide];
  34317. }
  34318. /*
  34319. * Sum or subtract the element scroll values (left and top) from a given rect object
  34320. * @method
  34321. * @memberof Popper.Utils
  34322. * @param {Object} rect - Rect object you want to change
  34323. * @param {HTMLElement} element - The element from the function reads the scroll values
  34324. * @param {Boolean} subtract - set to true if you want to subtract the scroll values
  34325. * @return {Object} rect - The modifier rect object
  34326. */
  34327. function includeScroll(rect, element) {
  34328. var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  34329. var scrollTop = getScroll(element, 'top');
  34330. var scrollLeft = getScroll(element, 'left');
  34331. var modifier = subtract ? -1 : 1;
  34332. rect.top += scrollTop * modifier;
  34333. rect.bottom += scrollTop * modifier;
  34334. rect.left += scrollLeft * modifier;
  34335. rect.right += scrollLeft * modifier;
  34336. return rect;
  34337. }
  34338. /*
  34339. * Helper to detect borders of a given element
  34340. * @method
  34341. * @memberof Popper.Utils
  34342. * @param {CSSStyleDeclaration} styles
  34343. * Result of `getStyleComputedProperty` on the given element
  34344. * @param {String} axis - `x` or `y`
  34345. * @return {number} borders - The borders size of the given axis
  34346. */
  34347. function getBordersSize(styles, axis) {
  34348. var sideA = axis === 'x' ? 'Left' : 'Top';
  34349. var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
  34350. return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']);
  34351. }
  34352. function getSize(axis, body, html, computedStyle) {
  34353. 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);
  34354. }
  34355. function getWindowSizes(document) {
  34356. var body = document.body;
  34357. var html = document.documentElement;
  34358. var computedStyle = isIE(10) && getComputedStyle(html);
  34359. return {
  34360. height: getSize('Height', body, html, computedStyle),
  34361. width: getSize('Width', body, html, computedStyle)
  34362. };
  34363. }
  34364. var classCallCheck = function (instance, Constructor) {
  34365. if (!(instance instanceof Constructor)) {
  34366. throw new TypeError("Cannot call a class as a function");
  34367. }
  34368. };
  34369. var createClass = function () {
  34370. function defineProperties(target, props) {
  34371. for (var i = 0; i < props.length; i++) {
  34372. var descriptor = props[i];
  34373. descriptor.enumerable = descriptor.enumerable || false;
  34374. descriptor.configurable = true;
  34375. if ("value" in descriptor) descriptor.writable = true;
  34376. Object.defineProperty(target, descriptor.key, descriptor);
  34377. }
  34378. }
  34379. return function (Constructor, protoProps, staticProps) {
  34380. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  34381. if (staticProps) defineProperties(Constructor, staticProps);
  34382. return Constructor;
  34383. };
  34384. }();
  34385. var defineProperty = function (obj, key, value) {
  34386. if (key in obj) {
  34387. Object.defineProperty(obj, key, {
  34388. value: value,
  34389. enumerable: true,
  34390. configurable: true,
  34391. writable: true
  34392. });
  34393. } else {
  34394. obj[key] = value;
  34395. }
  34396. return obj;
  34397. };
  34398. var _extends = Object.assign || function (target) {
  34399. for (var i = 1; i < arguments.length; i++) {
  34400. var source = arguments[i];
  34401. for (var key in source) {
  34402. if (Object.prototype.hasOwnProperty.call(source, key)) {
  34403. target[key] = source[key];
  34404. }
  34405. }
  34406. }
  34407. return target;
  34408. };
  34409. /**
  34410. * Given element offsets, generate an output similar to getBoundingClientRect
  34411. * @method
  34412. * @memberof Popper.Utils
  34413. * @argument {Object} offsets
  34414. * @returns {Object} ClientRect like output
  34415. */
  34416. function getClientRect(offsets) {
  34417. return _extends({}, offsets, {
  34418. right: offsets.left + offsets.width,
  34419. bottom: offsets.top + offsets.height
  34420. });
  34421. }
  34422. /**
  34423. * Get bounding client rect of given element
  34424. * @method
  34425. * @memberof Popper.Utils
  34426. * @param {HTMLElement} element
  34427. * @return {Object} client rect
  34428. */
  34429. function getBoundingClientRect(element) {
  34430. var rect = {};
  34431. // IE10 10 FIX: Please, don't ask, the element isn't
  34432. // considered in DOM in some circumstances...
  34433. // This isn't reproducible in IE10 compatibility mode of IE11
  34434. try {
  34435. if (isIE(10)) {
  34436. rect = element.getBoundingClientRect();
  34437. var scrollTop = getScroll(element, 'top');
  34438. var scrollLeft = getScroll(element, 'left');
  34439. rect.top += scrollTop;
  34440. rect.left += scrollLeft;
  34441. rect.bottom += scrollTop;
  34442. rect.right += scrollLeft;
  34443. } else {
  34444. rect = element.getBoundingClientRect();
  34445. }
  34446. } catch (e) {}
  34447. var result = {
  34448. left: rect.left,
  34449. top: rect.top,
  34450. width: rect.right - rect.left,
  34451. height: rect.bottom - rect.top
  34452. };
  34453. // subtract scrollbar size from sizes
  34454. var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
  34455. var width = sizes.width || element.clientWidth || result.width;
  34456. var height = sizes.height || element.clientHeight || result.height;
  34457. var horizScrollbar = element.offsetWidth - width;
  34458. var vertScrollbar = element.offsetHeight - height;
  34459. // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
  34460. // we make this check conditional for performance reasons
  34461. if (horizScrollbar || vertScrollbar) {
  34462. var styles = getStyleComputedProperty(element);
  34463. horizScrollbar -= getBordersSize(styles, 'x');
  34464. vertScrollbar -= getBordersSize(styles, 'y');
  34465. result.width -= horizScrollbar;
  34466. result.height -= vertScrollbar;
  34467. }
  34468. return getClientRect(result);
  34469. }
  34470. function getOffsetRectRelativeToArbitraryNode(children, parent) {
  34471. var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  34472. var isIE10 = isIE(10);
  34473. var isHTML = parent.nodeName === 'HTML';
  34474. var childrenRect = getBoundingClientRect(children);
  34475. var parentRect = getBoundingClientRect(parent);
  34476. var scrollParent = getScrollParent(children);
  34477. var styles = getStyleComputedProperty(parent);
  34478. var borderTopWidth = parseFloat(styles.borderTopWidth);
  34479. var borderLeftWidth = parseFloat(styles.borderLeftWidth);
  34480. // In cases where the parent is fixed, we must ignore negative scroll in offset calc
  34481. if (fixedPosition && isHTML) {
  34482. parentRect.top = Math.max(parentRect.top, 0);
  34483. parentRect.left = Math.max(parentRect.left, 0);
  34484. }
  34485. var offsets = getClientRect({
  34486. top: childrenRect.top - parentRect.top - borderTopWidth,
  34487. left: childrenRect.left - parentRect.left - borderLeftWidth,
  34488. width: childrenRect.width,
  34489. height: childrenRect.height
  34490. });
  34491. offsets.marginTop = 0;
  34492. offsets.marginLeft = 0;
  34493. // Subtract margins of documentElement in case it's being used as parent
  34494. // we do this only on HTML because it's the only element that behaves
  34495. // differently when margins are applied to it. The margins are included in
  34496. // the box of the documentElement, in the other cases not.
  34497. if (!isIE10 && isHTML) {
  34498. var marginTop = parseFloat(styles.marginTop);
  34499. var marginLeft = parseFloat(styles.marginLeft);
  34500. offsets.top -= borderTopWidth - marginTop;
  34501. offsets.bottom -= borderTopWidth - marginTop;
  34502. offsets.left -= borderLeftWidth - marginLeft;
  34503. offsets.right -= borderLeftWidth - marginLeft;
  34504. // Attach marginTop and marginLeft because in some circumstances we may need them
  34505. offsets.marginTop = marginTop;
  34506. offsets.marginLeft = marginLeft;
  34507. }
  34508. if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
  34509. offsets = includeScroll(offsets, parent);
  34510. }
  34511. return offsets;
  34512. }
  34513. function getViewportOffsetRectRelativeToArtbitraryNode(element) {
  34514. var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  34515. var html = element.ownerDocument.documentElement;
  34516. var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
  34517. var width = Math.max(html.clientWidth, window.innerWidth || 0);
  34518. var height = Math.max(html.clientHeight, window.innerHeight || 0);
  34519. var scrollTop = !excludeScroll ? getScroll(html) : 0;
  34520. var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
  34521. var offset = {
  34522. top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
  34523. left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
  34524. width: width,
  34525. height: height
  34526. };
  34527. return getClientRect(offset);
  34528. }
  34529. /**
  34530. * Check if the given element is fixed or is inside a fixed parent
  34531. * @method
  34532. * @memberof Popper.Utils
  34533. * @argument {Element} element
  34534. * @argument {Element} customContainer
  34535. * @returns {Boolean} answer to "isFixed?"
  34536. */
  34537. function isFixed(element) {
  34538. var nodeName = element.nodeName;
  34539. if (nodeName === 'BODY' || nodeName === 'HTML') {
  34540. return false;
  34541. }
  34542. if (getStyleComputedProperty(element, 'position') === 'fixed') {
  34543. return true;
  34544. }
  34545. var parentNode = getParentNode(element);
  34546. if (!parentNode) {
  34547. return false;
  34548. }
  34549. return isFixed(parentNode);
  34550. }
  34551. /**
  34552. * Finds the first parent of an element that has a transformed property defined
  34553. * @method
  34554. * @memberof Popper.Utils
  34555. * @argument {Element} element
  34556. * @returns {Element} first transformed parent or documentElement
  34557. */
  34558. function getFixedPositionOffsetParent(element) {
  34559. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  34560. if (!element || !element.parentElement || isIE()) {
  34561. return document.documentElement;
  34562. }
  34563. var el = element.parentElement;
  34564. while (el && getStyleComputedProperty(el, 'transform') === 'none') {
  34565. el = el.parentElement;
  34566. }
  34567. return el || document.documentElement;
  34568. }
  34569. /**
  34570. * Computed the boundaries limits and return them
  34571. * @method
  34572. * @memberof Popper.Utils
  34573. * @param {HTMLElement} popper
  34574. * @param {HTMLElement} reference
  34575. * @param {number} padding
  34576. * @param {HTMLElement} boundariesElement - Element used to define the boundaries
  34577. * @param {Boolean} fixedPosition - Is in fixed position mode
  34578. * @returns {Object} Coordinates of the boundaries
  34579. */
  34580. function getBoundaries(popper, reference, padding, boundariesElement) {
  34581. var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  34582. // NOTE: 1 DOM access here
  34583. var boundaries = { top: 0, left: 0 };
  34584. var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  34585. // Handle viewport case
  34586. if (boundariesElement === 'viewport') {
  34587. boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
  34588. } else {
  34589. // Handle other cases based on DOM element used as boundaries
  34590. var boundariesNode = void 0;
  34591. if (boundariesElement === 'scrollParent') {
  34592. boundariesNode = getScrollParent(getParentNode(reference));
  34593. if (boundariesNode.nodeName === 'BODY') {
  34594. boundariesNode = popper.ownerDocument.documentElement;
  34595. }
  34596. } else if (boundariesElement === 'window') {
  34597. boundariesNode = popper.ownerDocument.documentElement;
  34598. } else {
  34599. boundariesNode = boundariesElement;
  34600. }
  34601. var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
  34602. // In case of HTML, we need a different computation
  34603. if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
  34604. var _getWindowSizes = getWindowSizes(popper.ownerDocument),
  34605. height = _getWindowSizes.height,
  34606. width = _getWindowSizes.width;
  34607. boundaries.top += offsets.top - offsets.marginTop;
  34608. boundaries.bottom = height + offsets.top;
  34609. boundaries.left += offsets.left - offsets.marginLeft;
  34610. boundaries.right = width + offsets.left;
  34611. } else {
  34612. // for all the other DOM elements, this one is good
  34613. boundaries = offsets;
  34614. }
  34615. }
  34616. // Add paddings
  34617. padding = padding || 0;
  34618. var isPaddingNumber = typeof padding === 'number';
  34619. boundaries.left += isPaddingNumber ? padding : padding.left || 0;
  34620. boundaries.top += isPaddingNumber ? padding : padding.top || 0;
  34621. boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
  34622. boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
  34623. return boundaries;
  34624. }
  34625. function getArea(_ref) {
  34626. var width = _ref.width,
  34627. height = _ref.height;
  34628. return width * height;
  34629. }
  34630. /**
  34631. * Utility used to transform the `auto` placement to the placement with more
  34632. * available space.
  34633. * @method
  34634. * @memberof Popper.Utils
  34635. * @argument {Object} data - The data object generated by update method
  34636. * @argument {Object} options - Modifiers configuration and options
  34637. * @returns {Object} The data object, properly modified
  34638. */
  34639. function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
  34640. var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  34641. if (placement.indexOf('auto') === -1) {
  34642. return placement;
  34643. }
  34644. var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
  34645. var rects = {
  34646. top: {
  34647. width: boundaries.width,
  34648. height: refRect.top - boundaries.top
  34649. },
  34650. right: {
  34651. width: boundaries.right - refRect.right,
  34652. height: boundaries.height
  34653. },
  34654. bottom: {
  34655. width: boundaries.width,
  34656. height: boundaries.bottom - refRect.bottom
  34657. },
  34658. left: {
  34659. width: refRect.left - boundaries.left,
  34660. height: boundaries.height
  34661. }
  34662. };
  34663. var sortedAreas = Object.keys(rects).map(function (key) {
  34664. return _extends({
  34665. key: key
  34666. }, rects[key], {
  34667. area: getArea(rects[key])
  34668. });
  34669. }).sort(function (a, b) {
  34670. return b.area - a.area;
  34671. });
  34672. var filteredAreas = sortedAreas.filter(function (_ref2) {
  34673. var width = _ref2.width,
  34674. height = _ref2.height;
  34675. return width >= popper.clientWidth && height >= popper.clientHeight;
  34676. });
  34677. var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
  34678. var variation = placement.split('-')[1];
  34679. return computedPlacement + (variation ? '-' + variation : '');
  34680. }
  34681. /**
  34682. * Get offsets to the reference element
  34683. * @method
  34684. * @memberof Popper.Utils
  34685. * @param {Object} state
  34686. * @param {Element} popper - the popper element
  34687. * @param {Element} reference - the reference element (the popper will be relative to this)
  34688. * @param {Element} fixedPosition - is in fixed position mode
  34689. * @returns {Object} An object containing the offsets which will be applied to the popper
  34690. */
  34691. function getReferenceOffsets(state, popper, reference) {
  34692. var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  34693. var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  34694. return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
  34695. }
  34696. /**
  34697. * Get the outer sizes of the given element (offset size + margins)
  34698. * @method
  34699. * @memberof Popper.Utils
  34700. * @argument {Element} element
  34701. * @returns {Object} object containing width and height properties
  34702. */
  34703. function getOuterSizes(element) {
  34704. var window = element.ownerDocument.defaultView;
  34705. var styles = window.getComputedStyle(element);
  34706. var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
  34707. var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
  34708. var result = {
  34709. width: element.offsetWidth + y,
  34710. height: element.offsetHeight + x
  34711. };
  34712. return result;
  34713. }
  34714. /**
  34715. * Get the opposite placement of the given one
  34716. * @method
  34717. * @memberof Popper.Utils
  34718. * @argument {String} placement
  34719. * @returns {String} flipped placement
  34720. */
  34721. function getOppositePlacement(placement) {
  34722. var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
  34723. return placement.replace(/left|right|bottom|top/g, function (matched) {
  34724. return hash[matched];
  34725. });
  34726. }
  34727. /**
  34728. * Get offsets to the popper
  34729. * @method
  34730. * @memberof Popper.Utils
  34731. * @param {Object} position - CSS position the Popper will get applied
  34732. * @param {HTMLElement} popper - the popper element
  34733. * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
  34734. * @param {String} placement - one of the valid placement options
  34735. * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
  34736. */
  34737. function getPopperOffsets(popper, referenceOffsets, placement) {
  34738. placement = placement.split('-')[0];
  34739. // Get popper node sizes
  34740. var popperRect = getOuterSizes(popper);
  34741. // Add position, width and height to our offsets object
  34742. var popperOffsets = {
  34743. width: popperRect.width,
  34744. height: popperRect.height
  34745. };
  34746. // depending by the popper placement we have to compute its offsets slightly differently
  34747. var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
  34748. var mainSide = isHoriz ? 'top' : 'left';
  34749. var secondarySide = isHoriz ? 'left' : 'top';
  34750. var measurement = isHoriz ? 'height' : 'width';
  34751. var secondaryMeasurement = !isHoriz ? 'height' : 'width';
  34752. popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
  34753. if (placement === secondarySide) {
  34754. popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
  34755. } else {
  34756. popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
  34757. }
  34758. return popperOffsets;
  34759. }
  34760. /**
  34761. * Mimics the `find` method of Array
  34762. * @method
  34763. * @memberof Popper.Utils
  34764. * @argument {Array} arr
  34765. * @argument prop
  34766. * @argument value
  34767. * @returns index or -1
  34768. */
  34769. function find(arr, check) {
  34770. // use native find if supported
  34771. if (Array.prototype.find) {
  34772. return arr.find(check);
  34773. }
  34774. // use `filter` to obtain the same behavior of `find`
  34775. return arr.filter(check)[0];
  34776. }
  34777. /**
  34778. * Return the index of the matching object
  34779. * @method
  34780. * @memberof Popper.Utils
  34781. * @argument {Array} arr
  34782. * @argument prop
  34783. * @argument value
  34784. * @returns index or -1
  34785. */
  34786. function findIndex(arr, prop, value) {
  34787. // use native findIndex if supported
  34788. if (Array.prototype.findIndex) {
  34789. return arr.findIndex(function (cur) {
  34790. return cur[prop] === value;
  34791. });
  34792. }
  34793. // use `find` + `indexOf` if `findIndex` isn't supported
  34794. var match = find(arr, function (obj) {
  34795. return obj[prop] === value;
  34796. });
  34797. return arr.indexOf(match);
  34798. }
  34799. /**
  34800. * Loop trough the list of modifiers and run them in order,
  34801. * each of them will then edit the data object.
  34802. * @method
  34803. * @memberof Popper.Utils
  34804. * @param {dataObject} data
  34805. * @param {Array} modifiers
  34806. * @param {String} ends - Optional modifier name used as stopper
  34807. * @returns {dataObject}
  34808. */
  34809. function runModifiers(modifiers, data, ends) {
  34810. var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
  34811. modifiersToRun.forEach(function (modifier) {
  34812. if (modifier['function']) {
  34813. // eslint-disable-line dot-notation
  34814. console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
  34815. }
  34816. var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation
  34817. if (modifier.enabled && isFunction(fn)) {
  34818. // Add properties to offsets to make them a complete clientRect object
  34819. // we do this before each modifier to make sure the previous one doesn't
  34820. // mess with these values
  34821. data.offsets.popper = getClientRect(data.offsets.popper);
  34822. data.offsets.reference = getClientRect(data.offsets.reference);
  34823. data = fn(data, modifier);
  34824. }
  34825. });
  34826. return data;
  34827. }
  34828. /**
  34829. * Updates the position of the popper, computing the new offsets and applying
  34830. * the new style.<br />
  34831. * Prefer `scheduleUpdate` over `update` because of performance reasons.
  34832. * @method
  34833. * @memberof Popper
  34834. */
  34835. function update() {
  34836. // if popper is destroyed, don't perform any further update
  34837. if (this.state.isDestroyed) {
  34838. return;
  34839. }
  34840. var data = {
  34841. instance: this,
  34842. styles: {},
  34843. arrowStyles: {},
  34844. attributes: {},
  34845. flipped: false,
  34846. offsets: {}
  34847. };
  34848. // compute reference element offsets
  34849. data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);
  34850. // compute auto placement, store placement inside the data object,
  34851. // modifiers will be able to edit `placement` if needed
  34852. // and refer to originalPlacement to know the original value
  34853. data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
  34854. // store the computed placement inside `originalPlacement`
  34855. data.originalPlacement = data.placement;
  34856. data.positionFixed = this.options.positionFixed;
  34857. // compute the popper offsets
  34858. data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
  34859. data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';
  34860. // run the modifiers
  34861. data = runModifiers(this.modifiers, data);
  34862. // the first `update` will call `onCreate` callback
  34863. // the other ones will call `onUpdate` callback
  34864. if (!this.state.isCreated) {
  34865. this.state.isCreated = true;
  34866. this.options.onCreate(data);
  34867. } else {
  34868. this.options.onUpdate(data);
  34869. }
  34870. }
  34871. /**
  34872. * Helper used to know if the given modifier is enabled.
  34873. * @method
  34874. * @memberof Popper.Utils
  34875. * @returns {Boolean}
  34876. */
  34877. function isModifierEnabled(modifiers, modifierName) {
  34878. return modifiers.some(function (_ref) {
  34879. var name = _ref.name,
  34880. enabled = _ref.enabled;
  34881. return enabled && name === modifierName;
  34882. });
  34883. }
  34884. /**
  34885. * Get the prefixed supported property name
  34886. * @method
  34887. * @memberof Popper.Utils
  34888. * @argument {String} property (camelCase)
  34889. * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
  34890. */
  34891. function getSupportedPropertyName(property) {
  34892. var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
  34893. var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
  34894. for (var i = 0; i < prefixes.length; i++) {
  34895. var prefix = prefixes[i];
  34896. var toCheck = prefix ? '' + prefix + upperProp : property;
  34897. if (typeof document.body.style[toCheck] !== 'undefined') {
  34898. return toCheck;
  34899. }
  34900. }
  34901. return null;
  34902. }
  34903. /**
  34904. * Destroys the popper.
  34905. * @method
  34906. * @memberof Popper
  34907. */
  34908. function destroy() {
  34909. this.state.isDestroyed = true;
  34910. // touch DOM only if `applyStyle` modifier is enabled
  34911. if (isModifierEnabled(this.modifiers, 'applyStyle')) {
  34912. this.popper.removeAttribute('x-placement');
  34913. this.popper.style.position = '';
  34914. this.popper.style.top = '';
  34915. this.popper.style.left = '';
  34916. this.popper.style.right = '';
  34917. this.popper.style.bottom = '';
  34918. this.popper.style.willChange = '';
  34919. this.popper.style[getSupportedPropertyName('transform')] = '';
  34920. }
  34921. this.disableEventListeners();
  34922. // remove the popper if user explicitly asked for the deletion on destroy
  34923. // do not use `remove` because IE11 doesn't support it
  34924. if (this.options.removeOnDestroy) {
  34925. this.popper.parentNode.removeChild(this.popper);
  34926. }
  34927. return this;
  34928. }
  34929. /**
  34930. * Get the window associated with the element
  34931. * @argument {Element} element
  34932. * @returns {Window}
  34933. */
  34934. function getWindow(element) {
  34935. var ownerDocument = element.ownerDocument;
  34936. return ownerDocument ? ownerDocument.defaultView : window;
  34937. }
  34938. function attachToScrollParents(scrollParent, event, callback, scrollParents) {
  34939. var isBody = scrollParent.nodeName === 'BODY';
  34940. var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
  34941. target.addEventListener(event, callback, { passive: true });
  34942. if (!isBody) {
  34943. attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
  34944. }
  34945. scrollParents.push(target);
  34946. }
  34947. /**
  34948. * Setup needed event listeners used to update the popper position
  34949. * @method
  34950. * @memberof Popper.Utils
  34951. * @private
  34952. */
  34953. function setupEventListeners(reference, options, state, updateBound) {
  34954. // Resize event listener on window
  34955. state.updateBound = updateBound;
  34956. getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });
  34957. // Scroll event listener on scroll parents
  34958. var scrollElement = getScrollParent(reference);
  34959. attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
  34960. state.scrollElement = scrollElement;
  34961. state.eventsEnabled = true;
  34962. return state;
  34963. }
  34964. /**
  34965. * It will add resize/scroll events and start recalculating
  34966. * position of the popper element when they are triggered.
  34967. * @method
  34968. * @memberof Popper
  34969. */
  34970. function enableEventListeners() {
  34971. if (!this.state.eventsEnabled) {
  34972. this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
  34973. }
  34974. }
  34975. /**
  34976. * Remove event listeners used to update the popper position
  34977. * @method
  34978. * @memberof Popper.Utils
  34979. * @private
  34980. */
  34981. function removeEventListeners(reference, state) {
  34982. // Remove resize event listener on window
  34983. getWindow(reference).removeEventListener('resize', state.updateBound);
  34984. // Remove scroll event listener on scroll parents
  34985. state.scrollParents.forEach(function (target) {
  34986. target.removeEventListener('scroll', state.updateBound);
  34987. });
  34988. // Reset state
  34989. state.updateBound = null;
  34990. state.scrollParents = [];
  34991. state.scrollElement = null;
  34992. state.eventsEnabled = false;
  34993. return state;
  34994. }
  34995. /**
  34996. * It will remove resize/scroll events and won't recalculate popper position
  34997. * when they are triggered. It also won't trigger `onUpdate` callback anymore,
  34998. * unless you call `update` method manually.
  34999. * @method
  35000. * @memberof Popper
  35001. */
  35002. function disableEventListeners() {
  35003. if (this.state.eventsEnabled) {
  35004. cancelAnimationFrame(this.scheduleUpdate);
  35005. this.state = removeEventListeners(this.reference, this.state);
  35006. }
  35007. }
  35008. /**
  35009. * Tells if a given input is a number
  35010. * @method
  35011. * @memberof Popper.Utils
  35012. * @param {*} input to check
  35013. * @return {Boolean}
  35014. */
  35015. function isNumeric(n) {
  35016. return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
  35017. }
  35018. /**
  35019. * Set the style to the given popper
  35020. * @method
  35021. * @memberof Popper.Utils
  35022. * @argument {Element} element - Element to apply the style to
  35023. * @argument {Object} styles
  35024. * Object with a list of properties and values which will be applied to the element
  35025. */
  35026. function setStyles(element, styles) {
  35027. Object.keys(styles).forEach(function (prop) {
  35028. var unit = '';
  35029. // add unit if the value is numeric and is one of the following
  35030. if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
  35031. unit = 'px';
  35032. }
  35033. element.style[prop] = styles[prop] + unit;
  35034. });
  35035. }
  35036. /**
  35037. * Set the attributes to the given popper
  35038. * @method
  35039. * @memberof Popper.Utils
  35040. * @argument {Element} element - Element to apply the attributes to
  35041. * @argument {Object} styles
  35042. * Object with a list of properties and values which will be applied to the element
  35043. */
  35044. function setAttributes(element, attributes) {
  35045. Object.keys(attributes).forEach(function (prop) {
  35046. var value = attributes[prop];
  35047. if (value !== false) {
  35048. element.setAttribute(prop, attributes[prop]);
  35049. } else {
  35050. element.removeAttribute(prop);
  35051. }
  35052. });
  35053. }
  35054. /**
  35055. * @function
  35056. * @memberof Modifiers
  35057. * @argument {Object} data - The data object generated by `update` method
  35058. * @argument {Object} data.styles - List of style properties - values to apply to popper element
  35059. * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
  35060. * @argument {Object} options - Modifiers configuration and options
  35061. * @returns {Object} The same data object
  35062. */
  35063. function applyStyle(data) {
  35064. // any property present in `data.styles` will be applied to the popper,
  35065. // in this way we can make the 3rd party modifiers add custom styles to it
  35066. // Be aware, modifiers could override the properties defined in the previous
  35067. // lines of this modifier!
  35068. setStyles(data.instance.popper, data.styles);
  35069. // any property present in `data.attributes` will be applied to the popper,
  35070. // they will be set as HTML attributes of the element
  35071. setAttributes(data.instance.popper, data.attributes);
  35072. // if arrowElement is defined and arrowStyles has some properties
  35073. if (data.arrowElement && Object.keys(data.arrowStyles).length) {
  35074. setStyles(data.arrowElement, data.arrowStyles);
  35075. }
  35076. return data;
  35077. }
  35078. /**
  35079. * Set the x-placement attribute before everything else because it could be used
  35080. * to add margins to the popper margins needs to be calculated to get the
  35081. * correct popper offsets.
  35082. * @method
  35083. * @memberof Popper.modifiers
  35084. * @param {HTMLElement} reference - The reference element used to position the popper
  35085. * @param {HTMLElement} popper - The HTML element used as popper
  35086. * @param {Object} options - Popper.js options
  35087. */
  35088. function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
  35089. // compute reference element offsets
  35090. var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
  35091. // compute auto placement, store placement inside the data object,
  35092. // modifiers will be able to edit `placement` if needed
  35093. // and refer to originalPlacement to know the original value
  35094. var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
  35095. popper.setAttribute('x-placement', placement);
  35096. // Apply `position` to popper before anything else because
  35097. // without the position applied we can't guarantee correct computations
  35098. setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });
  35099. return options;
  35100. }
  35101. /**
  35102. * @function
  35103. * @memberof Popper.Utils
  35104. * @argument {Object} data - The data object generated by `update` method
  35105. * @argument {Boolean} shouldRound - If the offsets should be rounded at all
  35106. * @returns {Object} The popper's position offsets rounded
  35107. *
  35108. * The tale of pixel-perfect positioning. It's still not 100% perfect, but as
  35109. * good as it can be within reason.
  35110. * Discussion here: https://github.com/FezVrasta/popper.js/pull/715
  35111. *
  35112. * Low DPI screens cause a popper to be blurry if not using full pixels (Safari
  35113. * as well on High DPI screens).
  35114. *
  35115. * Firefox prefers no rounding for positioning and does not have blurriness on
  35116. * high DPI screens.
  35117. *
  35118. * Only horizontal placement and left/right values need to be considered.
  35119. */
  35120. function getRoundedOffsets(data, shouldRound) {
  35121. var _data$offsets = data.offsets,
  35122. popper = _data$offsets.popper,
  35123. reference = _data$offsets.reference;
  35124. var round = Math.round,
  35125. floor = Math.floor;
  35126. var noRound = function noRound(v) {
  35127. return v;
  35128. };
  35129. var referenceWidth = round(reference.width);
  35130. var popperWidth = round(popper.width);
  35131. var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
  35132. var isVariation = data.placement.indexOf('-') !== -1;
  35133. var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
  35134. var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
  35135. var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
  35136. var verticalToInteger = !shouldRound ? noRound : round;
  35137. return {
  35138. left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
  35139. top: verticalToInteger(popper.top),
  35140. bottom: verticalToInteger(popper.bottom),
  35141. right: horizontalToInteger(popper.right)
  35142. };
  35143. }
  35144. var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);
  35145. /**
  35146. * @function
  35147. * @memberof Modifiers
  35148. * @argument {Object} data - The data object generated by `update` method
  35149. * @argument {Object} options - Modifiers configuration and options
  35150. * @returns {Object} The data object, properly modified
  35151. */
  35152. function computeStyle(data, options) {
  35153. var x = options.x,
  35154. y = options.y;
  35155. var popper = data.offsets.popper;
  35156. // Remove this legacy support in Popper.js v2
  35157. var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
  35158. return modifier.name === 'applyStyle';
  35159. }).gpuAcceleration;
  35160. if (legacyGpuAccelerationOption !== undefined) {
  35161. console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
  35162. }
  35163. var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
  35164. var offsetParent = getOffsetParent(data.instance.popper);
  35165. var offsetParentRect = getBoundingClientRect(offsetParent);
  35166. // Styles
  35167. var styles = {
  35168. position: popper.position
  35169. };
  35170. var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
  35171. var sideA = x === 'bottom' ? 'top' : 'bottom';
  35172. var sideB = y === 'right' ? 'left' : 'right';
  35173. // if gpuAcceleration is set to `true` and transform is supported,
  35174. // we use `translate3d` to apply the position to the popper we
  35175. // automatically use the supported prefixed version if needed
  35176. var prefixedProperty = getSupportedPropertyName('transform');
  35177. // now, let's make a step back and look at this code closely (wtf?)
  35178. // If the content of the popper grows once it's been positioned, it
  35179. // may happen that the popper gets misplaced because of the new content
  35180. // overflowing its reference element
  35181. // To avoid this problem, we provide two options (x and y), which allow
  35182. // the consumer to define the offset origin.
  35183. // If we position a popper on top of a reference element, we can set
  35184. // `x` to `top` to make the popper grow towards its top instead of
  35185. // its bottom.
  35186. var left = void 0,
  35187. top = void 0;
  35188. if (sideA === 'bottom') {
  35189. // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
  35190. // and not the bottom of the html element
  35191. if (offsetParent.nodeName === 'HTML') {
  35192. top = -offsetParent.clientHeight + offsets.bottom;
  35193. } else {
  35194. top = -offsetParentRect.height + offsets.bottom;
  35195. }
  35196. } else {
  35197. top = offsets.top;
  35198. }
  35199. if (sideB === 'right') {
  35200. if (offsetParent.nodeName === 'HTML') {
  35201. left = -offsetParent.clientWidth + offsets.right;
  35202. } else {
  35203. left = -offsetParentRect.width + offsets.right;
  35204. }
  35205. } else {
  35206. left = offsets.left;
  35207. }
  35208. if (gpuAcceleration && prefixedProperty) {
  35209. styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
  35210. styles[sideA] = 0;
  35211. styles[sideB] = 0;
  35212. styles.willChange = 'transform';
  35213. } else {
  35214. // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
  35215. var invertTop = sideA === 'bottom' ? -1 : 1;
  35216. var invertLeft = sideB === 'right' ? -1 : 1;
  35217. styles[sideA] = top * invertTop;
  35218. styles[sideB] = left * invertLeft;
  35219. styles.willChange = sideA + ', ' + sideB;
  35220. }
  35221. // Attributes
  35222. var attributes = {
  35223. 'x-placement': data.placement
  35224. };
  35225. // Update `data` attributes, styles and arrowStyles
  35226. data.attributes = _extends({}, attributes, data.attributes);
  35227. data.styles = _extends({}, styles, data.styles);
  35228. data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles);
  35229. return data;
  35230. }
  35231. /**
  35232. * Helper used to know if the given modifier depends from another one.<br />
  35233. * It checks if the needed modifier is listed and enabled.
  35234. * @method
  35235. * @memberof Popper.Utils
  35236. * @param {Array} modifiers - list of modifiers
  35237. * @param {String} requestingName - name of requesting modifier
  35238. * @param {String} requestedName - name of requested modifier
  35239. * @returns {Boolean}
  35240. */
  35241. function isModifierRequired(modifiers, requestingName, requestedName) {
  35242. var requesting = find(modifiers, function (_ref) {
  35243. var name = _ref.name;
  35244. return name === requestingName;
  35245. });
  35246. var isRequired = !!requesting && modifiers.some(function (modifier) {
  35247. return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
  35248. });
  35249. if (!isRequired) {
  35250. var _requesting = '`' + requestingName + '`';
  35251. var requested = '`' + requestedName + '`';
  35252. console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
  35253. }
  35254. return isRequired;
  35255. }
  35256. /**
  35257. * @function
  35258. * @memberof Modifiers
  35259. * @argument {Object} data - The data object generated by update method
  35260. * @argument {Object} options - Modifiers configuration and options
  35261. * @returns {Object} The data object, properly modified
  35262. */
  35263. function arrow(data, options) {
  35264. var _data$offsets$arrow;
  35265. // arrow depends on keepTogether in order to work
  35266. if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
  35267. return data;
  35268. }
  35269. var arrowElement = options.element;
  35270. // if arrowElement is a string, suppose it's a CSS selector
  35271. if (typeof arrowElement === 'string') {
  35272. arrowElement = data.instance.popper.querySelector(arrowElement);
  35273. // if arrowElement is not found, don't run the modifier
  35274. if (!arrowElement) {
  35275. return data;
  35276. }
  35277. } else {
  35278. // if the arrowElement isn't a query selector we must check that the
  35279. // provided DOM node is child of its popper node
  35280. if (!data.instance.popper.contains(arrowElement)) {
  35281. console.warn('WARNING: `arrow.element` must be child of its popper element!');
  35282. return data;
  35283. }
  35284. }
  35285. var placement = data.placement.split('-')[0];
  35286. var _data$offsets = data.offsets,
  35287. popper = _data$offsets.popper,
  35288. reference = _data$offsets.reference;
  35289. var isVertical = ['left', 'right'].indexOf(placement) !== -1;
  35290. var len = isVertical ? 'height' : 'width';
  35291. var sideCapitalized = isVertical ? 'Top' : 'Left';
  35292. var side = sideCapitalized.toLowerCase();
  35293. var altSide = isVertical ? 'left' : 'top';
  35294. var opSide = isVertical ? 'bottom' : 'right';
  35295. var arrowElementSize = getOuterSizes(arrowElement)[len];
  35296. //
  35297. // extends keepTogether behavior making sure the popper and its
  35298. // reference have enough pixels in conjunction
  35299. //
  35300. // top/left side
  35301. if (reference[opSide] - arrowElementSize < popper[side]) {
  35302. data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
  35303. }
  35304. // bottom/right side
  35305. if (reference[side] + arrowElementSize > popper[opSide]) {
  35306. data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
  35307. }
  35308. data.offsets.popper = getClientRect(data.offsets.popper);
  35309. // compute center of the popper
  35310. var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
  35311. // Compute the sideValue using the updated popper offsets
  35312. // take popper margin in account because we don't have this info available
  35313. var css = getStyleComputedProperty(data.instance.popper);
  35314. var popperMarginSide = parseFloat(css['margin' + sideCapitalized]);
  35315. var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width']);
  35316. var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
  35317. // prevent arrowElement from being placed not contiguously to its popper
  35318. sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
  35319. data.arrowElement = arrowElement;
  35320. data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
  35321. return data;
  35322. }
  35323. /**
  35324. * Get the opposite placement variation of the given one
  35325. * @method
  35326. * @memberof Popper.Utils
  35327. * @argument {String} placement variation
  35328. * @returns {String} flipped placement variation
  35329. */
  35330. function getOppositeVariation(variation) {
  35331. if (variation === 'end') {
  35332. return 'start';
  35333. } else if (variation === 'start') {
  35334. return 'end';
  35335. }
  35336. return variation;
  35337. }
  35338. /**
  35339. * List of accepted placements to use as values of the `placement` option.<br />
  35340. * Valid placements are:
  35341. * - `auto`
  35342. * - `top`
  35343. * - `right`
  35344. * - `bottom`
  35345. * - `left`
  35346. *
  35347. * Each placement can have a variation from this list:
  35348. * - `-start`
  35349. * - `-end`
  35350. *
  35351. * Variations are interpreted easily if you think of them as the left to right
  35352. * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
  35353. * is right.<br />
  35354. * Vertically (`left` and `right`), `start` is top and `end` is bottom.
  35355. *
  35356. * Some valid examples are:
  35357. * - `top-end` (on top of reference, right aligned)
  35358. * - `right-start` (on right of reference, top aligned)
  35359. * - `bottom` (on bottom, centered)
  35360. * - `auto-end` (on the side with more space available, alignment depends by placement)
  35361. *
  35362. * @static
  35363. * @type {Array}
  35364. * @enum {String}
  35365. * @readonly
  35366. * @method placements
  35367. * @memberof Popper
  35368. */
  35369. 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'];
  35370. // Get rid of `auto` `auto-start` and `auto-end`
  35371. var validPlacements = placements.slice(3);
  35372. /**
  35373. * Given an initial placement, returns all the subsequent placements
  35374. * clockwise (or counter-clockwise).
  35375. *
  35376. * @method
  35377. * @memberof Popper.Utils
  35378. * @argument {String} placement - A valid placement (it accepts variations)
  35379. * @argument {Boolean} counter - Set to true to walk the placements counterclockwise
  35380. * @returns {Array} placements including their variations
  35381. */
  35382. function clockwise(placement) {
  35383. var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  35384. var index = validPlacements.indexOf(placement);
  35385. var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
  35386. return counter ? arr.reverse() : arr;
  35387. }
  35388. var BEHAVIORS = {
  35389. FLIP: 'flip',
  35390. CLOCKWISE: 'clockwise',
  35391. COUNTERCLOCKWISE: 'counterclockwise'
  35392. };
  35393. /**
  35394. * @function
  35395. * @memberof Modifiers
  35396. * @argument {Object} data - The data object generated by update method
  35397. * @argument {Object} options - Modifiers configuration and options
  35398. * @returns {Object} The data object, properly modified
  35399. */
  35400. function flip(data, options) {
  35401. // if `inner` modifier is enabled, we can't use the `flip` modifier
  35402. if (isModifierEnabled(data.instance.modifiers, 'inner')) {
  35403. return data;
  35404. }
  35405. if (data.flipped && data.placement === data.originalPlacement) {
  35406. // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
  35407. return data;
  35408. }
  35409. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
  35410. var placement = data.placement.split('-')[0];
  35411. var placementOpposite = getOppositePlacement(placement);
  35412. var variation = data.placement.split('-')[1] || '';
  35413. var flipOrder = [];
  35414. switch (options.behavior) {
  35415. case BEHAVIORS.FLIP:
  35416. flipOrder = [placement, placementOpposite];
  35417. break;
  35418. case BEHAVIORS.CLOCKWISE:
  35419. flipOrder = clockwise(placement);
  35420. break;
  35421. case BEHAVIORS.COUNTERCLOCKWISE:
  35422. flipOrder = clockwise(placement, true);
  35423. break;
  35424. default:
  35425. flipOrder = options.behavior;
  35426. }
  35427. flipOrder.forEach(function (step, index) {
  35428. if (placement !== step || flipOrder.length === index + 1) {
  35429. return data;
  35430. }
  35431. placement = data.placement.split('-')[0];
  35432. placementOpposite = getOppositePlacement(placement);
  35433. var popperOffsets = data.offsets.popper;
  35434. var refOffsets = data.offsets.reference;
  35435. // using floor because the reference offsets may contain decimals we are not going to consider here
  35436. var floor = Math.floor;
  35437. 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);
  35438. var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
  35439. var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
  35440. var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
  35441. var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
  35442. var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
  35443. // flip the variation if required
  35444. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  35445. // flips variation if reference element overflows boundaries
  35446. var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);
  35447. // flips variation if popper content overflows boundaries
  35448. var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop);
  35449. var flippedVariation = flippedVariationByRef || flippedVariationByContent;
  35450. if (overlapsRef || overflowsBoundaries || flippedVariation) {
  35451. // this boolean to detect any flip loop
  35452. data.flipped = true;
  35453. if (overlapsRef || overflowsBoundaries) {
  35454. placement = flipOrder[index + 1];
  35455. }
  35456. if (flippedVariation) {
  35457. variation = getOppositeVariation(variation);
  35458. }
  35459. data.placement = placement + (variation ? '-' + variation : '');
  35460. // this object contains `position`, we want to preserve it along with
  35461. // any additional property we may add in the future
  35462. data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
  35463. data = runModifiers(data.instance.modifiers, data, 'flip');
  35464. }
  35465. });
  35466. return data;
  35467. }
  35468. /**
  35469. * @function
  35470. * @memberof Modifiers
  35471. * @argument {Object} data - The data object generated by update method
  35472. * @argument {Object} options - Modifiers configuration and options
  35473. * @returns {Object} The data object, properly modified
  35474. */
  35475. function keepTogether(data) {
  35476. var _data$offsets = data.offsets,
  35477. popper = _data$offsets.popper,
  35478. reference = _data$offsets.reference;
  35479. var placement = data.placement.split('-')[0];
  35480. var floor = Math.floor;
  35481. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  35482. var side = isVertical ? 'right' : 'bottom';
  35483. var opSide = isVertical ? 'left' : 'top';
  35484. var measurement = isVertical ? 'width' : 'height';
  35485. if (popper[side] < floor(reference[opSide])) {
  35486. data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
  35487. }
  35488. if (popper[opSide] > floor(reference[side])) {
  35489. data.offsets.popper[opSide] = floor(reference[side]);
  35490. }
  35491. return data;
  35492. }
  35493. /**
  35494. * Converts a string containing value + unit into a px value number
  35495. * @function
  35496. * @memberof {modifiers~offset}
  35497. * @private
  35498. * @argument {String} str - Value + unit string
  35499. * @argument {String} measurement - `height` or `width`
  35500. * @argument {Object} popperOffsets
  35501. * @argument {Object} referenceOffsets
  35502. * @returns {Number|String}
  35503. * Value in pixels, or original string if no values were extracted
  35504. */
  35505. function toValue(str, measurement, popperOffsets, referenceOffsets) {
  35506. // separate value from unit
  35507. var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
  35508. var value = +split[1];
  35509. var unit = split[2];
  35510. // If it's not a number it's an operator, I guess
  35511. if (!value) {
  35512. return str;
  35513. }
  35514. if (unit.indexOf('%') === 0) {
  35515. var element = void 0;
  35516. switch (unit) {
  35517. case '%p':
  35518. element = popperOffsets;
  35519. break;
  35520. case '%':
  35521. case '%r':
  35522. default:
  35523. element = referenceOffsets;
  35524. }
  35525. var rect = getClientRect(element);
  35526. return rect[measurement] / 100 * value;
  35527. } else if (unit === 'vh' || unit === 'vw') {
  35528. // if is a vh or vw, we calculate the size based on the viewport
  35529. var size = void 0;
  35530. if (unit === 'vh') {
  35531. size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
  35532. } else {
  35533. size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
  35534. }
  35535. return size / 100 * value;
  35536. } else {
  35537. // if is an explicit pixel unit, we get rid of the unit and keep the value
  35538. // if is an implicit unit, it's px, and we return just the value
  35539. return value;
  35540. }
  35541. }
  35542. /**
  35543. * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
  35544. * @function
  35545. * @memberof {modifiers~offset}
  35546. * @private
  35547. * @argument {String} offset
  35548. * @argument {Object} popperOffsets
  35549. * @argument {Object} referenceOffsets
  35550. * @argument {String} basePlacement
  35551. * @returns {Array} a two cells array with x and y offsets in numbers
  35552. */
  35553. function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
  35554. var offsets = [0, 0];
  35555. // Use height if placement is left or right and index is 0 otherwise use width
  35556. // in this way the first offset will use an axis and the second one
  35557. // will use the other one
  35558. var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
  35559. // Split the offset string to obtain a list of values and operands
  35560. // The regex addresses values with the plus or minus sign in front (+10, -20, etc)
  35561. var fragments = offset.split(/(\+|\-)/).map(function (frag) {
  35562. return frag.trim();
  35563. });
  35564. // Detect if the offset string contains a pair of values or a single one
  35565. // they could be separated by comma or space
  35566. var divider = fragments.indexOf(find(fragments, function (frag) {
  35567. return frag.search(/,|\s/) !== -1;
  35568. }));
  35569. if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
  35570. console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
  35571. }
  35572. // If divider is found, we divide the list of values and operands to divide
  35573. // them by ofset X and Y.
  35574. var splitRegex = /\s*,\s*|\s+/;
  35575. 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];
  35576. // Convert the values with units to absolute pixels to allow our computations
  35577. ops = ops.map(function (op, index) {
  35578. // Most of the units rely on the orientation of the popper
  35579. var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
  35580. var mergeWithPrevious = false;
  35581. return op
  35582. // This aggregates any `+` or `-` sign that aren't considered operators
  35583. // e.g.: 10 + +5 => [10, +, +5]
  35584. .reduce(function (a, b) {
  35585. if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
  35586. a[a.length - 1] = b;
  35587. mergeWithPrevious = true;
  35588. return a;
  35589. } else if (mergeWithPrevious) {
  35590. a[a.length - 1] += b;
  35591. mergeWithPrevious = false;
  35592. return a;
  35593. } else {
  35594. return a.concat(b);
  35595. }
  35596. }, [])
  35597. // Here we convert the string values into number values (in px)
  35598. .map(function (str) {
  35599. return toValue(str, measurement, popperOffsets, referenceOffsets);
  35600. });
  35601. });
  35602. // Loop trough the offsets arrays and execute the operations
  35603. ops.forEach(function (op, index) {
  35604. op.forEach(function (frag, index2) {
  35605. if (isNumeric(frag)) {
  35606. offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
  35607. }
  35608. });
  35609. });
  35610. return offsets;
  35611. }
  35612. /**
  35613. * @function
  35614. * @memberof Modifiers
  35615. * @argument {Object} data - The data object generated by update method
  35616. * @argument {Object} options - Modifiers configuration and options
  35617. * @argument {Number|String} options.offset=0
  35618. * The offset value as described in the modifier description
  35619. * @returns {Object} The data object, properly modified
  35620. */
  35621. function offset(data, _ref) {
  35622. var offset = _ref.offset;
  35623. var placement = data.placement,
  35624. _data$offsets = data.offsets,
  35625. popper = _data$offsets.popper,
  35626. reference = _data$offsets.reference;
  35627. var basePlacement = placement.split('-')[0];
  35628. var offsets = void 0;
  35629. if (isNumeric(+offset)) {
  35630. offsets = [+offset, 0];
  35631. } else {
  35632. offsets = parseOffset(offset, popper, reference, basePlacement);
  35633. }
  35634. if (basePlacement === 'left') {
  35635. popper.top += offsets[0];
  35636. popper.left -= offsets[1];
  35637. } else if (basePlacement === 'right') {
  35638. popper.top += offsets[0];
  35639. popper.left += offsets[1];
  35640. } else if (basePlacement === 'top') {
  35641. popper.left += offsets[0];
  35642. popper.top -= offsets[1];
  35643. } else if (basePlacement === 'bottom') {
  35644. popper.left += offsets[0];
  35645. popper.top += offsets[1];
  35646. }
  35647. data.popper = popper;
  35648. return data;
  35649. }
  35650. /**
  35651. * @function
  35652. * @memberof Modifiers
  35653. * @argument {Object} data - The data object generated by `update` method
  35654. * @argument {Object} options - Modifiers configuration and options
  35655. * @returns {Object} The data object, properly modified
  35656. */
  35657. function preventOverflow(data, options) {
  35658. var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
  35659. // If offsetParent is the reference element, we really want to
  35660. // go one step up and use the next offsetParent as reference to
  35661. // avoid to make this modifier completely useless and look like broken
  35662. if (data.instance.reference === boundariesElement) {
  35663. boundariesElement = getOffsetParent(boundariesElement);
  35664. }
  35665. // NOTE: DOM access here
  35666. // resets the popper's position so that the document size can be calculated excluding
  35667. // the size of the popper element itself
  35668. var transformProp = getSupportedPropertyName('transform');
  35669. var popperStyles = data.instance.popper.style; // assignment to help minification
  35670. var top = popperStyles.top,
  35671. left = popperStyles.left,
  35672. transform = popperStyles[transformProp];
  35673. popperStyles.top = '';
  35674. popperStyles.left = '';
  35675. popperStyles[transformProp] = '';
  35676. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
  35677. // NOTE: DOM access here
  35678. // restores the original style properties after the offsets have been computed
  35679. popperStyles.top = top;
  35680. popperStyles.left = left;
  35681. popperStyles[transformProp] = transform;
  35682. options.boundaries = boundaries;
  35683. var order = options.priority;
  35684. var popper = data.offsets.popper;
  35685. var check = {
  35686. primary: function primary(placement) {
  35687. var value = popper[placement];
  35688. if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
  35689. value = Math.max(popper[placement], boundaries[placement]);
  35690. }
  35691. return defineProperty({}, placement, value);
  35692. },
  35693. secondary: function secondary(placement) {
  35694. var mainSide = placement === 'right' ? 'left' : 'top';
  35695. var value = popper[mainSide];
  35696. if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
  35697. value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
  35698. }
  35699. return defineProperty({}, mainSide, value);
  35700. }
  35701. };
  35702. order.forEach(function (placement) {
  35703. var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
  35704. popper = _extends({}, popper, check[side](placement));
  35705. });
  35706. data.offsets.popper = popper;
  35707. return data;
  35708. }
  35709. /**
  35710. * @function
  35711. * @memberof Modifiers
  35712. * @argument {Object} data - The data object generated by `update` method
  35713. * @argument {Object} options - Modifiers configuration and options
  35714. * @returns {Object} The data object, properly modified
  35715. */
  35716. function shift(data) {
  35717. var placement = data.placement;
  35718. var basePlacement = placement.split('-')[0];
  35719. var shiftvariation = placement.split('-')[1];
  35720. // if shift shiftvariation is specified, run the modifier
  35721. if (shiftvariation) {
  35722. var _data$offsets = data.offsets,
  35723. reference = _data$offsets.reference,
  35724. popper = _data$offsets.popper;
  35725. var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
  35726. var side = isVertical ? 'left' : 'top';
  35727. var measurement = isVertical ? 'width' : 'height';
  35728. var shiftOffsets = {
  35729. start: defineProperty({}, side, reference[side]),
  35730. end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
  35731. };
  35732. data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]);
  35733. }
  35734. return data;
  35735. }
  35736. /**
  35737. * @function
  35738. * @memberof Modifiers
  35739. * @argument {Object} data - The data object generated by update method
  35740. * @argument {Object} options - Modifiers configuration and options
  35741. * @returns {Object} The data object, properly modified
  35742. */
  35743. function hide(data) {
  35744. if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
  35745. return data;
  35746. }
  35747. var refRect = data.offsets.reference;
  35748. var bound = find(data.instance.modifiers, function (modifier) {
  35749. return modifier.name === 'preventOverflow';
  35750. }).boundaries;
  35751. if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
  35752. // Avoid unnecessary DOM access if visibility hasn't changed
  35753. if (data.hide === true) {
  35754. return data;
  35755. }
  35756. data.hide = true;
  35757. data.attributes['x-out-of-boundaries'] = '';
  35758. } else {
  35759. // Avoid unnecessary DOM access if visibility hasn't changed
  35760. if (data.hide === false) {
  35761. return data;
  35762. }
  35763. data.hide = false;
  35764. data.attributes['x-out-of-boundaries'] = false;
  35765. }
  35766. return data;
  35767. }
  35768. /**
  35769. * @function
  35770. * @memberof Modifiers
  35771. * @argument {Object} data - The data object generated by `update` method
  35772. * @argument {Object} options - Modifiers configuration and options
  35773. * @returns {Object} The data object, properly modified
  35774. */
  35775. function inner(data) {
  35776. var placement = data.placement;
  35777. var basePlacement = placement.split('-')[0];
  35778. var _data$offsets = data.offsets,
  35779. popper = _data$offsets.popper,
  35780. reference = _data$offsets.reference;
  35781. var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
  35782. var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
  35783. popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
  35784. data.placement = getOppositePlacement(placement);
  35785. data.offsets.popper = getClientRect(popper);
  35786. return data;
  35787. }
  35788. /**
  35789. * Modifier function, each modifier can have a function of this type assigned
  35790. * to its `fn` property.<br />
  35791. * These functions will be called on each update, this means that you must
  35792. * make sure they are performant enough to avoid performance bottlenecks.
  35793. *
  35794. * @function ModifierFn
  35795. * @argument {dataObject} data - The data object generated by `update` method
  35796. * @argument {Object} options - Modifiers configuration and options
  35797. * @returns {dataObject} The data object, properly modified
  35798. */
  35799. /**
  35800. * Modifiers are plugins used to alter the behavior of your poppers.<br />
  35801. * Popper.js uses a set of 9 modifiers to provide all the basic functionalities
  35802. * needed by the library.
  35803. *
  35804. * Usually you don't want to override the `order`, `fn` and `onLoad` props.
  35805. * All the other properties are configurations that could be tweaked.
  35806. * @namespace modifiers
  35807. */
  35808. var modifiers = {
  35809. /**
  35810. * Modifier used to shift the popper on the start or end of its reference
  35811. * element.<br />
  35812. * It will read the variation of the `placement` property.<br />
  35813. * It can be one either `-end` or `-start`.
  35814. * @memberof modifiers
  35815. * @inner
  35816. */
  35817. shift: {
  35818. /** @prop {number} order=100 - Index used to define the order of execution */
  35819. order: 100,
  35820. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35821. enabled: true,
  35822. /** @prop {ModifierFn} */
  35823. fn: shift
  35824. },
  35825. /**
  35826. * The `offset` modifier can shift your popper on both its axis.
  35827. *
  35828. * It accepts the following units:
  35829. * - `px` or unit-less, interpreted as pixels
  35830. * - `%` or `%r`, percentage relative to the length of the reference element
  35831. * - `%p`, percentage relative to the length of the popper element
  35832. * - `vw`, CSS viewport width unit
  35833. * - `vh`, CSS viewport height unit
  35834. *
  35835. * For length is intended the main axis relative to the placement of the popper.<br />
  35836. * This means that if the placement is `top` or `bottom`, the length will be the
  35837. * `width`. In case of `left` or `right`, it will be the `height`.
  35838. *
  35839. * You can provide a single value (as `Number` or `String`), or a pair of values
  35840. * as `String` divided by a comma or one (or more) white spaces.<br />
  35841. * The latter is a deprecated method because it leads to confusion and will be
  35842. * removed in v2.<br />
  35843. * Additionally, it accepts additions and subtractions between different units.
  35844. * Note that multiplications and divisions aren't supported.
  35845. *
  35846. * Valid examples are:
  35847. * ```
  35848. * 10
  35849. * '10%'
  35850. * '10, 10'
  35851. * '10%, 10'
  35852. * '10 + 10%'
  35853. * '10 - 5vh + 3%'
  35854. * '-10px + 5vh, 5px - 6%'
  35855. * ```
  35856. * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
  35857. * > with their reference element, unfortunately, you will have to disable the `flip` modifier.
  35858. * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).
  35859. *
  35860. * @memberof modifiers
  35861. * @inner
  35862. */
  35863. offset: {
  35864. /** @prop {number} order=200 - Index used to define the order of execution */
  35865. order: 200,
  35866. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35867. enabled: true,
  35868. /** @prop {ModifierFn} */
  35869. fn: offset,
  35870. /** @prop {Number|String} offset=0
  35871. * The offset value as described in the modifier description
  35872. */
  35873. offset: 0
  35874. },
  35875. /**
  35876. * Modifier used to prevent the popper from being positioned outside the boundary.
  35877. *
  35878. * A scenario exists where the reference itself is not within the boundaries.<br />
  35879. * We can say it has "escaped the boundaries" — or just "escaped".<br />
  35880. * In this case we need to decide whether the popper should either:
  35881. *
  35882. * - detach from the reference and remain "trapped" in the boundaries, or
  35883. * - if it should ignore the boundary and "escape with its reference"
  35884. *
  35885. * When `escapeWithReference` is set to`true` and reference is completely
  35886. * outside its boundaries, the popper will overflow (or completely leave)
  35887. * the boundaries in order to remain attached to the edge of the reference.
  35888. *
  35889. * @memberof modifiers
  35890. * @inner
  35891. */
  35892. preventOverflow: {
  35893. /** @prop {number} order=300 - Index used to define the order of execution */
  35894. order: 300,
  35895. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35896. enabled: true,
  35897. /** @prop {ModifierFn} */
  35898. fn: preventOverflow,
  35899. /**
  35900. * @prop {Array} [priority=['left','right','top','bottom']]
  35901. * Popper will try to prevent overflow following these priorities by default,
  35902. * then, it could overflow on the left and on top of the `boundariesElement`
  35903. */
  35904. priority: ['left', 'right', 'top', 'bottom'],
  35905. /**
  35906. * @prop {number} padding=5
  35907. * Amount of pixel used to define a minimum distance between the boundaries
  35908. * and the popper. This makes sure the popper always has a little padding
  35909. * between the edges of its container
  35910. */
  35911. padding: 5,
  35912. /**
  35913. * @prop {String|HTMLElement} boundariesElement='scrollParent'
  35914. * Boundaries used by the modifier. Can be `scrollParent`, `window`,
  35915. * `viewport` or any DOM element.
  35916. */
  35917. boundariesElement: 'scrollParent'
  35918. },
  35919. /**
  35920. * Modifier used to make sure the reference and its popper stay near each other
  35921. * without leaving any gap between the two. Especially useful when the arrow is
  35922. * enabled and you want to ensure that it points to its reference element.
  35923. * It cares only about the first axis. You can still have poppers with margin
  35924. * between the popper and its reference element.
  35925. * @memberof modifiers
  35926. * @inner
  35927. */
  35928. keepTogether: {
  35929. /** @prop {number} order=400 - Index used to define the order of execution */
  35930. order: 400,
  35931. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35932. enabled: true,
  35933. /** @prop {ModifierFn} */
  35934. fn: keepTogether
  35935. },
  35936. /**
  35937. * This modifier is used to move the `arrowElement` of the popper to make
  35938. * sure it is positioned between the reference element and its popper element.
  35939. * It will read the outer size of the `arrowElement` node to detect how many
  35940. * pixels of conjunction are needed.
  35941. *
  35942. * It has no effect if no `arrowElement` is provided.
  35943. * @memberof modifiers
  35944. * @inner
  35945. */
  35946. arrow: {
  35947. /** @prop {number} order=500 - Index used to define the order of execution */
  35948. order: 500,
  35949. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35950. enabled: true,
  35951. /** @prop {ModifierFn} */
  35952. fn: arrow,
  35953. /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
  35954. element: '[x-arrow]'
  35955. },
  35956. /**
  35957. * Modifier used to flip the popper's placement when it starts to overlap its
  35958. * reference element.
  35959. *
  35960. * Requires the `preventOverflow` modifier before it in order to work.
  35961. *
  35962. * **NOTE:** this modifier will interrupt the current update cycle and will
  35963. * restart it if it detects the need to flip the placement.
  35964. * @memberof modifiers
  35965. * @inner
  35966. */
  35967. flip: {
  35968. /** @prop {number} order=600 - Index used to define the order of execution */
  35969. order: 600,
  35970. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  35971. enabled: true,
  35972. /** @prop {ModifierFn} */
  35973. fn: flip,
  35974. /**
  35975. * @prop {String|Array} behavior='flip'
  35976. * The behavior used to change the popper's placement. It can be one of
  35977. * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
  35978. * placements (with optional variations)
  35979. */
  35980. behavior: 'flip',
  35981. /**
  35982. * @prop {number} padding=5
  35983. * The popper will flip if it hits the edges of the `boundariesElement`
  35984. */
  35985. padding: 5,
  35986. /**
  35987. * @prop {String|HTMLElement} boundariesElement='viewport'
  35988. * The element which will define the boundaries of the popper position.
  35989. * The popper will never be placed outside of the defined boundaries
  35990. * (except if `keepTogether` is enabled)
  35991. */
  35992. boundariesElement: 'viewport',
  35993. /**
  35994. * @prop {Boolean} flipVariations=false
  35995. * The popper will switch placement variation between `-start` and `-end` when
  35996. * the reference element overlaps its boundaries.
  35997. *
  35998. * The original placement should have a set variation.
  35999. */
  36000. flipVariations: false,
  36001. /**
  36002. * @prop {Boolean} flipVariationsByContent=false
  36003. * The popper will switch placement variation between `-start` and `-end` when
  36004. * the popper element overlaps its reference boundaries.
  36005. *
  36006. * The original placement should have a set variation.
  36007. */
  36008. flipVariationsByContent: false
  36009. },
  36010. /**
  36011. * Modifier used to make the popper flow toward the inner of the reference element.
  36012. * By default, when this modifier is disabled, the popper will be placed outside
  36013. * the reference element.
  36014. * @memberof modifiers
  36015. * @inner
  36016. */
  36017. inner: {
  36018. /** @prop {number} order=700 - Index used to define the order of execution */
  36019. order: 700,
  36020. /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
  36021. enabled: false,
  36022. /** @prop {ModifierFn} */
  36023. fn: inner
  36024. },
  36025. /**
  36026. * Modifier used to hide the popper when its reference element is outside of the
  36027. * popper boundaries. It will set a `x-out-of-boundaries` attribute which can
  36028. * be used to hide with a CSS selector the popper when its reference is
  36029. * out of boundaries.
  36030. *
  36031. * Requires the `preventOverflow` modifier before it in order to work.
  36032. * @memberof modifiers
  36033. * @inner
  36034. */
  36035. hide: {
  36036. /** @prop {number} order=800 - Index used to define the order of execution */
  36037. order: 800,
  36038. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36039. enabled: true,
  36040. /** @prop {ModifierFn} */
  36041. fn: hide
  36042. },
  36043. /**
  36044. * Computes the style that will be applied to the popper element to gets
  36045. * properly positioned.
  36046. *
  36047. * Note that this modifier will not touch the DOM, it just prepares the styles
  36048. * so that `applyStyle` modifier can apply it. This separation is useful
  36049. * in case you need to replace `applyStyle` with a custom implementation.
  36050. *
  36051. * This modifier has `850` as `order` value to maintain backward compatibility
  36052. * with previous versions of Popper.js. Expect the modifiers ordering method
  36053. * to change in future major versions of the library.
  36054. *
  36055. * @memberof modifiers
  36056. * @inner
  36057. */
  36058. computeStyle: {
  36059. /** @prop {number} order=850 - Index used to define the order of execution */
  36060. order: 850,
  36061. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36062. enabled: true,
  36063. /** @prop {ModifierFn} */
  36064. fn: computeStyle,
  36065. /**
  36066. * @prop {Boolean} gpuAcceleration=true
  36067. * If true, it uses the CSS 3D transformation to position the popper.
  36068. * Otherwise, it will use the `top` and `left` properties
  36069. */
  36070. gpuAcceleration: true,
  36071. /**
  36072. * @prop {string} [x='bottom']
  36073. * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
  36074. * Change this if your popper should grow in a direction different from `bottom`
  36075. */
  36076. x: 'bottom',
  36077. /**
  36078. * @prop {string} [x='left']
  36079. * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
  36080. * Change this if your popper should grow in a direction different from `right`
  36081. */
  36082. y: 'right'
  36083. },
  36084. /**
  36085. * Applies the computed styles to the popper element.
  36086. *
  36087. * All the DOM manipulations are limited to this modifier. This is useful in case
  36088. * you want to integrate Popper.js inside a framework or view library and you
  36089. * want to delegate all the DOM manipulations to it.
  36090. *
  36091. * Note that if you disable this modifier, you must make sure the popper element
  36092. * has its position set to `absolute` before Popper.js can do its work!
  36093. *
  36094. * Just disable this modifier and define your own to achieve the desired effect.
  36095. *
  36096. * @memberof modifiers
  36097. * @inner
  36098. */
  36099. applyStyle: {
  36100. /** @prop {number} order=900 - Index used to define the order of execution */
  36101. order: 900,
  36102. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36103. enabled: true,
  36104. /** @prop {ModifierFn} */
  36105. fn: applyStyle,
  36106. /** @prop {Function} */
  36107. onLoad: applyStyleOnLoad,
  36108. /**
  36109. * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
  36110. * @prop {Boolean} gpuAcceleration=true
  36111. * If true, it uses the CSS 3D transformation to position the popper.
  36112. * Otherwise, it will use the `top` and `left` properties
  36113. */
  36114. gpuAcceleration: undefined
  36115. }
  36116. };
  36117. /**
  36118. * The `dataObject` is an object containing all the information used by Popper.js.
  36119. * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
  36120. * @name dataObject
  36121. * @property {Object} data.instance The Popper.js instance
  36122. * @property {String} data.placement Placement applied to popper
  36123. * @property {String} data.originalPlacement Placement originally defined on init
  36124. * @property {Boolean} data.flipped True if popper has been flipped by flip modifier
  36125. * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper
  36126. * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
  36127. * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)
  36128. * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)
  36129. * @property {Object} data.boundaries Offsets of the popper boundaries
  36130. * @property {Object} data.offsets The measurements of popper, reference and arrow elements
  36131. * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
  36132. * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
  36133. * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
  36134. */
  36135. /**
  36136. * Default options provided to Popper.js constructor.<br />
  36137. * These can be overridden using the `options` argument of Popper.js.<br />
  36138. * To override an option, simply pass an object with the same
  36139. * structure of the `options` object, as the 3rd argument. For example:
  36140. * ```
  36141. * new Popper(ref, pop, {
  36142. * modifiers: {
  36143. * preventOverflow: { enabled: false }
  36144. * }
  36145. * })
  36146. * ```
  36147. * @type {Object}
  36148. * @static
  36149. * @memberof Popper
  36150. */
  36151. var Defaults = {
  36152. /**
  36153. * Popper's placement.
  36154. * @prop {Popper.placements} placement='bottom'
  36155. */
  36156. placement: 'bottom',
  36157. /**
  36158. * Set this to true if you want popper to position it self in 'fixed' mode
  36159. * @prop {Boolean} positionFixed=false
  36160. */
  36161. positionFixed: false,
  36162. /**
  36163. * Whether events (resize, scroll) are initially enabled.
  36164. * @prop {Boolean} eventsEnabled=true
  36165. */
  36166. eventsEnabled: true,
  36167. /**
  36168. * Set to true if you want to automatically remove the popper when
  36169. * you call the `destroy` method.
  36170. * @prop {Boolean} removeOnDestroy=false
  36171. */
  36172. removeOnDestroy: false,
  36173. /**
  36174. * Callback called when the popper is created.<br />
  36175. * By default, it is set to no-op.<br />
  36176. * Access Popper.js instance with `data.instance`.
  36177. * @prop {onCreate}
  36178. */
  36179. onCreate: function onCreate() {},
  36180. /**
  36181. * Callback called when the popper is updated. This callback is not called
  36182. * on the initialization/creation of the popper, but only on subsequent
  36183. * updates.<br />
  36184. * By default, it is set to no-op.<br />
  36185. * Access Popper.js instance with `data.instance`.
  36186. * @prop {onUpdate}
  36187. */
  36188. onUpdate: function onUpdate() {},
  36189. /**
  36190. * List of modifiers used to modify the offsets before they are applied to the popper.
  36191. * They provide most of the functionalities of Popper.js.
  36192. * @prop {modifiers}
  36193. */
  36194. modifiers: modifiers
  36195. };
  36196. /**
  36197. * @callback onCreate
  36198. * @param {dataObject} data
  36199. */
  36200. /**
  36201. * @callback onUpdate
  36202. * @param {dataObject} data
  36203. */
  36204. // Utils
  36205. // Methods
  36206. var Popper = function () {
  36207. /**
  36208. * Creates a new Popper.js instance.
  36209. * @class Popper
  36210. * @param {Element|referenceObject} reference - The reference element used to position the popper
  36211. * @param {Element} popper - The HTML / XML element used as the popper
  36212. * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
  36213. * @return {Object} instance - The generated Popper.js instance
  36214. */
  36215. function Popper(reference, popper) {
  36216. var _this = this;
  36217. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  36218. classCallCheck(this, Popper);
  36219. this.scheduleUpdate = function () {
  36220. return requestAnimationFrame(_this.update);
  36221. };
  36222. // make update() debounced, so that it only runs at most once-per-tick
  36223. this.update = debounce(this.update.bind(this));
  36224. // with {} we create a new object with the options inside it
  36225. this.options = _extends({}, Popper.Defaults, options);
  36226. // init state
  36227. this.state = {
  36228. isDestroyed: false,
  36229. isCreated: false,
  36230. scrollParents: []
  36231. };
  36232. // get reference and popper elements (allow jQuery wrappers)
  36233. this.reference = reference && reference.jquery ? reference[0] : reference;
  36234. this.popper = popper && popper.jquery ? popper[0] : popper;
  36235. // Deep merge modifiers options
  36236. this.options.modifiers = {};
  36237. Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
  36238. _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
  36239. });
  36240. // Refactoring modifiers' list (Object => Array)
  36241. this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
  36242. return _extends({
  36243. name: name
  36244. }, _this.options.modifiers[name]);
  36245. })
  36246. // sort the modifiers by order
  36247. .sort(function (a, b) {
  36248. return a.order - b.order;
  36249. });
  36250. // modifiers have the ability to execute arbitrary code when Popper.js get inited
  36251. // such code is executed in the same order of its modifier
  36252. // they could add new properties to their options configuration
  36253. // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
  36254. this.modifiers.forEach(function (modifierOptions) {
  36255. if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
  36256. modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
  36257. }
  36258. });
  36259. // fire the first update to position the popper in the right place
  36260. this.update();
  36261. var eventsEnabled = this.options.eventsEnabled;
  36262. if (eventsEnabled) {
  36263. // setup event listeners, they will take care of update the position in specific situations
  36264. this.enableEventListeners();
  36265. }
  36266. this.state.eventsEnabled = eventsEnabled;
  36267. }
  36268. // We can't use class properties because they don't get listed in the
  36269. // class prototype and break stuff like Sinon stubs
  36270. createClass(Popper, [{
  36271. key: 'update',
  36272. value: function update$$1() {
  36273. return update.call(this);
  36274. }
  36275. }, {
  36276. key: 'destroy',
  36277. value: function destroy$$1() {
  36278. return destroy.call(this);
  36279. }
  36280. }, {
  36281. key: 'enableEventListeners',
  36282. value: function enableEventListeners$$1() {
  36283. return enableEventListeners.call(this);
  36284. }
  36285. }, {
  36286. key: 'disableEventListeners',
  36287. value: function disableEventListeners$$1() {
  36288. return disableEventListeners.call(this);
  36289. }
  36290. /**
  36291. * Schedules an update. It will run on the next UI update available.
  36292. * @method scheduleUpdate
  36293. * @memberof Popper
  36294. */
  36295. /**
  36296. * Collection of utilities useful when writing custom modifiers.
  36297. * Starting from version 1.7, this method is available only if you
  36298. * include `popper-utils.js` before `popper.js`.
  36299. *
  36300. * **DEPRECATION**: This way to access PopperUtils is deprecated
  36301. * and will be removed in v2! Use the PopperUtils module directly instead.
  36302. * Due to the high instability of the methods contained in Utils, we can't
  36303. * guarantee them to follow semver. Use them at your own risk!
  36304. * @static
  36305. * @private
  36306. * @type {Object}
  36307. * @deprecated since version 1.8
  36308. * @member Utils
  36309. * @memberof Popper
  36310. */
  36311. }]);
  36312. return Popper;
  36313. }();
  36314. /**
  36315. * The `referenceObject` is an object that provides an interface compatible with Popper.js
  36316. * and lets you use it as replacement of a real DOM node.<br />
  36317. * You can use this method to position a popper relatively to a set of coordinates
  36318. * in case you don't have a DOM node to use as reference.
  36319. *
  36320. * ```
  36321. * new Popper(referenceObject, popperNode);
  36322. * ```
  36323. *
  36324. * NB: This feature isn't supported in Internet Explorer 10.
  36325. * @name referenceObject
  36326. * @property {Function} data.getBoundingClientRect
  36327. * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
  36328. * @property {number} data.clientWidth
  36329. * An ES6 getter that will return the width of the virtual reference element.
  36330. * @property {number} data.clientHeight
  36331. * An ES6 getter that will return the height of the virtual reference element.
  36332. */
  36333. Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
  36334. Popper.placements = placements;
  36335. Popper.Defaults = Defaults;
  36336. /* harmony default export */ __webpack_exports__["default"] = (Popper);
  36337. //# sourceMappingURL=popper.js.map
  36338. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  36339. /***/ }),
  36340. /***/ "./node_modules/process/browser.js":
  36341. /*!*****************************************!*\
  36342. !*** ./node_modules/process/browser.js ***!
  36343. \*****************************************/
  36344. /*! no static exports found */
  36345. /***/ (function(module, exports) {
  36346. // shim for using process in browser
  36347. var process = module.exports = {};
  36348. // cached from whatever global is present so that test runners that stub it
  36349. // don't break things. But we need to wrap it in a try catch in case it is
  36350. // wrapped in strict mode code which doesn't define any globals. It's inside a
  36351. // function because try/catches deoptimize in certain engines.
  36352. var cachedSetTimeout;
  36353. var cachedClearTimeout;
  36354. function defaultSetTimout() {
  36355. throw new Error('setTimeout has not been defined');
  36356. }
  36357. function defaultClearTimeout () {
  36358. throw new Error('clearTimeout has not been defined');
  36359. }
  36360. (function () {
  36361. try {
  36362. if (typeof setTimeout === 'function') {
  36363. cachedSetTimeout = setTimeout;
  36364. } else {
  36365. cachedSetTimeout = defaultSetTimout;
  36366. }
  36367. } catch (e) {
  36368. cachedSetTimeout = defaultSetTimout;
  36369. }
  36370. try {
  36371. if (typeof clearTimeout === 'function') {
  36372. cachedClearTimeout = clearTimeout;
  36373. } else {
  36374. cachedClearTimeout = defaultClearTimeout;
  36375. }
  36376. } catch (e) {
  36377. cachedClearTimeout = defaultClearTimeout;
  36378. }
  36379. } ())
  36380. function runTimeout(fun) {
  36381. if (cachedSetTimeout === setTimeout) {
  36382. //normal enviroments in sane situations
  36383. return setTimeout(fun, 0);
  36384. }
  36385. // if setTimeout wasn't available but was latter defined
  36386. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  36387. cachedSetTimeout = setTimeout;
  36388. return setTimeout(fun, 0);
  36389. }
  36390. try {
  36391. // when when somebody has screwed with setTimeout but no I.E. maddness
  36392. return cachedSetTimeout(fun, 0);
  36393. } catch(e){
  36394. try {
  36395. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  36396. return cachedSetTimeout.call(null, fun, 0);
  36397. } catch(e){
  36398. // 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
  36399. return cachedSetTimeout.call(this, fun, 0);
  36400. }
  36401. }
  36402. }
  36403. function runClearTimeout(marker) {
  36404. if (cachedClearTimeout === clearTimeout) {
  36405. //normal enviroments in sane situations
  36406. return clearTimeout(marker);
  36407. }
  36408. // if clearTimeout wasn't available but was latter defined
  36409. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  36410. cachedClearTimeout = clearTimeout;
  36411. return clearTimeout(marker);
  36412. }
  36413. try {
  36414. // when when somebody has screwed with setTimeout but no I.E. maddness
  36415. return cachedClearTimeout(marker);
  36416. } catch (e){
  36417. try {
  36418. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  36419. return cachedClearTimeout.call(null, marker);
  36420. } catch (e){
  36421. // 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.
  36422. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  36423. return cachedClearTimeout.call(this, marker);
  36424. }
  36425. }
  36426. }
  36427. var queue = [];
  36428. var draining = false;
  36429. var currentQueue;
  36430. var queueIndex = -1;
  36431. function cleanUpNextTick() {
  36432. if (!draining || !currentQueue) {
  36433. return;
  36434. }
  36435. draining = false;
  36436. if (currentQueue.length) {
  36437. queue = currentQueue.concat(queue);
  36438. } else {
  36439. queueIndex = -1;
  36440. }
  36441. if (queue.length) {
  36442. drainQueue();
  36443. }
  36444. }
  36445. function drainQueue() {
  36446. if (draining) {
  36447. return;
  36448. }
  36449. var timeout = runTimeout(cleanUpNextTick);
  36450. draining = true;
  36451. var len = queue.length;
  36452. while(len) {
  36453. currentQueue = queue;
  36454. queue = [];
  36455. while (++queueIndex < len) {
  36456. if (currentQueue) {
  36457. currentQueue[queueIndex].run();
  36458. }
  36459. }
  36460. queueIndex = -1;
  36461. len = queue.length;
  36462. }
  36463. currentQueue = null;
  36464. draining = false;
  36465. runClearTimeout(timeout);
  36466. }
  36467. process.nextTick = function (fun) {
  36468. var args = new Array(arguments.length - 1);
  36469. if (arguments.length > 1) {
  36470. for (var i = 1; i < arguments.length; i++) {
  36471. args[i - 1] = arguments[i];
  36472. }
  36473. }
  36474. queue.push(new Item(fun, args));
  36475. if (queue.length === 1 && !draining) {
  36476. runTimeout(drainQueue);
  36477. }
  36478. };
  36479. // v8 likes predictible objects
  36480. function Item(fun, array) {
  36481. this.fun = fun;
  36482. this.array = array;
  36483. }
  36484. Item.prototype.run = function () {
  36485. this.fun.apply(null, this.array);
  36486. };
  36487. process.title = 'browser';
  36488. process.browser = true;
  36489. process.env = {};
  36490. process.argv = [];
  36491. process.version = ''; // empty string to avoid regexp issues
  36492. process.versions = {};
  36493. function noop() {}
  36494. process.on = noop;
  36495. process.addListener = noop;
  36496. process.once = noop;
  36497. process.off = noop;
  36498. process.removeListener = noop;
  36499. process.removeAllListeners = noop;
  36500. process.emit = noop;
  36501. process.prependListener = noop;
  36502. process.prependOnceListener = noop;
  36503. process.listeners = function (name) { return [] }
  36504. process.binding = function (name) {
  36505. throw new Error('process.binding is not supported');
  36506. };
  36507. process.cwd = function () { return '/' };
  36508. process.chdir = function (dir) {
  36509. throw new Error('process.chdir is not supported');
  36510. };
  36511. process.umask = function() { return 0; };
  36512. /***/ }),
  36513. /***/ "./node_modules/pusher-js/dist/web/pusher.js":
  36514. /*!***************************************************!*\
  36515. !*** ./node_modules/pusher-js/dist/web/pusher.js ***!
  36516. \***************************************************/
  36517. /*! no static exports found */
  36518. /***/ (function(module, exports, __webpack_require__) {
  36519. /* WEBPACK VAR INJECTION */(function(Buffer) {/*!
  36520. * Pusher JavaScript Library v5.0.3
  36521. * https://pusher.com/
  36522. *
  36523. * Copyright 2017, Pusher
  36524. * Released under the MIT licence.
  36525. */
  36526. (function webpackUniversalModuleDefinition(root, factory) {
  36527. if(true)
  36528. module.exports = factory();
  36529. else {}
  36530. })(window, function() {
  36531. return /******/ (function(modules) { // webpackBootstrap
  36532. /******/ // The module cache
  36533. /******/ var installedModules = {};
  36534. /******/
  36535. /******/ // The require function
  36536. /******/ function __webpack_require__(moduleId) {
  36537. /******/
  36538. /******/ // Check if module is in cache
  36539. /******/ if(installedModules[moduleId]) {
  36540. /******/ return installedModules[moduleId].exports;
  36541. /******/ }
  36542. /******/ // Create a new module (and put it into the cache)
  36543. /******/ var module = installedModules[moduleId] = {
  36544. /******/ i: moduleId,
  36545. /******/ l: false,
  36546. /******/ exports: {}
  36547. /******/ };
  36548. /******/
  36549. /******/ // Execute the module function
  36550. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  36551. /******/
  36552. /******/ // Flag the module as loaded
  36553. /******/ module.l = true;
  36554. /******/
  36555. /******/ // Return the exports of the module
  36556. /******/ return module.exports;
  36557. /******/ }
  36558. /******/
  36559. /******/
  36560. /******/ // expose the modules object (__webpack_modules__)
  36561. /******/ __webpack_require__.m = modules;
  36562. /******/
  36563. /******/ // expose the module cache
  36564. /******/ __webpack_require__.c = installedModules;
  36565. /******/
  36566. /******/ // define getter function for harmony exports
  36567. /******/ __webpack_require__.d = function(exports, name, getter) {
  36568. /******/ if(!__webpack_require__.o(exports, name)) {
  36569. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  36570. /******/ }
  36571. /******/ };
  36572. /******/
  36573. /******/ // define __esModule on exports
  36574. /******/ __webpack_require__.r = function(exports) {
  36575. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  36576. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  36577. /******/ }
  36578. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  36579. /******/ };
  36580. /******/
  36581. /******/ // create a fake namespace object
  36582. /******/ // mode & 1: value is a module id, require it
  36583. /******/ // mode & 2: merge all properties of value into the ns
  36584. /******/ // mode & 4: return value when already ns object
  36585. /******/ // mode & 8|1: behave like require
  36586. /******/ __webpack_require__.t = function(value, mode) {
  36587. /******/ if(mode & 1) value = __webpack_require__(value);
  36588. /******/ if(mode & 8) return value;
  36589. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  36590. /******/ var ns = Object.create(null);
  36591. /******/ __webpack_require__.r(ns);
  36592. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  36593. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  36594. /******/ return ns;
  36595. /******/ };
  36596. /******/
  36597. /******/ // getDefaultExport function for compatibility with non-harmony modules
  36598. /******/ __webpack_require__.n = function(module) {
  36599. /******/ var getter = module && module.__esModule ?
  36600. /******/ function getDefault() { return module['default']; } :
  36601. /******/ function getModuleExports() { return module; };
  36602. /******/ __webpack_require__.d(getter, 'a', getter);
  36603. /******/ return getter;
  36604. /******/ };
  36605. /******/
  36606. /******/ // Object.prototype.hasOwnProperty.call
  36607. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  36608. /******/
  36609. /******/ // __webpack_public_path__
  36610. /******/ __webpack_require__.p = "";
  36611. /******/
  36612. /******/
  36613. /******/ // Load entry module and return exports
  36614. /******/ return __webpack_require__(__webpack_require__.s = 2);
  36615. /******/ })
  36616. /************************************************************************/
  36617. /******/ ([
  36618. /* 0 */
  36619. /***/ (function(module, exports, __webpack_require__) {
  36620. (function(nacl) {
  36621. 'use strict';
  36622. // Ported in 2014 by Dmitry Chestnykh and Devi Mandiri.
  36623. // Public domain.
  36624. //
  36625. // Implementation derived from TweetNaCl version 20140427.
  36626. // See for details: http://tweetnacl.cr.yp.to/
  36627. var gf = function(init) {
  36628. var i, r = new Float64Array(16);
  36629. if (init) for (i = 0; i < init.length; i++) r[i] = init[i];
  36630. return r;
  36631. };
  36632. // Pluggable, initialized in high-level API below.
  36633. var randombytes = function(/* x, n */) { throw new Error('no PRNG'); };
  36634. var _0 = new Uint8Array(16);
  36635. var _9 = new Uint8Array(32); _9[0] = 9;
  36636. var gf0 = gf(),
  36637. gf1 = gf([1]),
  36638. _121665 = gf([0xdb41, 1]),
  36639. D = gf([0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203]),
  36640. D2 = gf([0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406]),
  36641. X = gf([0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169]),
  36642. Y = gf([0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666]),
  36643. I = gf([0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83]);
  36644. function ts64(x, i, h, l) {
  36645. x[i] = (h >> 24) & 0xff;
  36646. x[i+1] = (h >> 16) & 0xff;
  36647. x[i+2] = (h >> 8) & 0xff;
  36648. x[i+3] = h & 0xff;
  36649. x[i+4] = (l >> 24) & 0xff;
  36650. x[i+5] = (l >> 16) & 0xff;
  36651. x[i+6] = (l >> 8) & 0xff;
  36652. x[i+7] = l & 0xff;
  36653. }
  36654. function vn(x, xi, y, yi, n) {
  36655. var i,d = 0;
  36656. for (i = 0; i < n; i++) d |= x[xi+i]^y[yi+i];
  36657. return (1 & ((d - 1) >>> 8)) - 1;
  36658. }
  36659. function crypto_verify_16(x, xi, y, yi) {
  36660. return vn(x,xi,y,yi,16);
  36661. }
  36662. function crypto_verify_32(x, xi, y, yi) {
  36663. return vn(x,xi,y,yi,32);
  36664. }
  36665. function core_salsa20(o, p, k, c) {
  36666. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  36667. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  36668. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  36669. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  36670. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  36671. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  36672. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  36673. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  36674. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  36675. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  36676. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  36677. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  36678. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  36679. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  36680. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  36681. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  36682. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  36683. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  36684. x15 = j15, u;
  36685. for (var i = 0; i < 20; i += 2) {
  36686. u = x0 + x12 | 0;
  36687. x4 ^= u<<7 | u>>>(32-7);
  36688. u = x4 + x0 | 0;
  36689. x8 ^= u<<9 | u>>>(32-9);
  36690. u = x8 + x4 | 0;
  36691. x12 ^= u<<13 | u>>>(32-13);
  36692. u = x12 + x8 | 0;
  36693. x0 ^= u<<18 | u>>>(32-18);
  36694. u = x5 + x1 | 0;
  36695. x9 ^= u<<7 | u>>>(32-7);
  36696. u = x9 + x5 | 0;
  36697. x13 ^= u<<9 | u>>>(32-9);
  36698. u = x13 + x9 | 0;
  36699. x1 ^= u<<13 | u>>>(32-13);
  36700. u = x1 + x13 | 0;
  36701. x5 ^= u<<18 | u>>>(32-18);
  36702. u = x10 + x6 | 0;
  36703. x14 ^= u<<7 | u>>>(32-7);
  36704. u = x14 + x10 | 0;
  36705. x2 ^= u<<9 | u>>>(32-9);
  36706. u = x2 + x14 | 0;
  36707. x6 ^= u<<13 | u>>>(32-13);
  36708. u = x6 + x2 | 0;
  36709. x10 ^= u<<18 | u>>>(32-18);
  36710. u = x15 + x11 | 0;
  36711. x3 ^= u<<7 | u>>>(32-7);
  36712. u = x3 + x15 | 0;
  36713. x7 ^= u<<9 | u>>>(32-9);
  36714. u = x7 + x3 | 0;
  36715. x11 ^= u<<13 | u>>>(32-13);
  36716. u = x11 + x7 | 0;
  36717. x15 ^= u<<18 | u>>>(32-18);
  36718. u = x0 + x3 | 0;
  36719. x1 ^= u<<7 | u>>>(32-7);
  36720. u = x1 + x0 | 0;
  36721. x2 ^= u<<9 | u>>>(32-9);
  36722. u = x2 + x1 | 0;
  36723. x3 ^= u<<13 | u>>>(32-13);
  36724. u = x3 + x2 | 0;
  36725. x0 ^= u<<18 | u>>>(32-18);
  36726. u = x5 + x4 | 0;
  36727. x6 ^= u<<7 | u>>>(32-7);
  36728. u = x6 + x5 | 0;
  36729. x7 ^= u<<9 | u>>>(32-9);
  36730. u = x7 + x6 | 0;
  36731. x4 ^= u<<13 | u>>>(32-13);
  36732. u = x4 + x7 | 0;
  36733. x5 ^= u<<18 | u>>>(32-18);
  36734. u = x10 + x9 | 0;
  36735. x11 ^= u<<7 | u>>>(32-7);
  36736. u = x11 + x10 | 0;
  36737. x8 ^= u<<9 | u>>>(32-9);
  36738. u = x8 + x11 | 0;
  36739. x9 ^= u<<13 | u>>>(32-13);
  36740. u = x9 + x8 | 0;
  36741. x10 ^= u<<18 | u>>>(32-18);
  36742. u = x15 + x14 | 0;
  36743. x12 ^= u<<7 | u>>>(32-7);
  36744. u = x12 + x15 | 0;
  36745. x13 ^= u<<9 | u>>>(32-9);
  36746. u = x13 + x12 | 0;
  36747. x14 ^= u<<13 | u>>>(32-13);
  36748. u = x14 + x13 | 0;
  36749. x15 ^= u<<18 | u>>>(32-18);
  36750. }
  36751. x0 = x0 + j0 | 0;
  36752. x1 = x1 + j1 | 0;
  36753. x2 = x2 + j2 | 0;
  36754. x3 = x3 + j3 | 0;
  36755. x4 = x4 + j4 | 0;
  36756. x5 = x5 + j5 | 0;
  36757. x6 = x6 + j6 | 0;
  36758. x7 = x7 + j7 | 0;
  36759. x8 = x8 + j8 | 0;
  36760. x9 = x9 + j9 | 0;
  36761. x10 = x10 + j10 | 0;
  36762. x11 = x11 + j11 | 0;
  36763. x12 = x12 + j12 | 0;
  36764. x13 = x13 + j13 | 0;
  36765. x14 = x14 + j14 | 0;
  36766. x15 = x15 + j15 | 0;
  36767. o[ 0] = x0 >>> 0 & 0xff;
  36768. o[ 1] = x0 >>> 8 & 0xff;
  36769. o[ 2] = x0 >>> 16 & 0xff;
  36770. o[ 3] = x0 >>> 24 & 0xff;
  36771. o[ 4] = x1 >>> 0 & 0xff;
  36772. o[ 5] = x1 >>> 8 & 0xff;
  36773. o[ 6] = x1 >>> 16 & 0xff;
  36774. o[ 7] = x1 >>> 24 & 0xff;
  36775. o[ 8] = x2 >>> 0 & 0xff;
  36776. o[ 9] = x2 >>> 8 & 0xff;
  36777. o[10] = x2 >>> 16 & 0xff;
  36778. o[11] = x2 >>> 24 & 0xff;
  36779. o[12] = x3 >>> 0 & 0xff;
  36780. o[13] = x3 >>> 8 & 0xff;
  36781. o[14] = x3 >>> 16 & 0xff;
  36782. o[15] = x3 >>> 24 & 0xff;
  36783. o[16] = x4 >>> 0 & 0xff;
  36784. o[17] = x4 >>> 8 & 0xff;
  36785. o[18] = x4 >>> 16 & 0xff;
  36786. o[19] = x4 >>> 24 & 0xff;
  36787. o[20] = x5 >>> 0 & 0xff;
  36788. o[21] = x5 >>> 8 & 0xff;
  36789. o[22] = x5 >>> 16 & 0xff;
  36790. o[23] = x5 >>> 24 & 0xff;
  36791. o[24] = x6 >>> 0 & 0xff;
  36792. o[25] = x6 >>> 8 & 0xff;
  36793. o[26] = x6 >>> 16 & 0xff;
  36794. o[27] = x6 >>> 24 & 0xff;
  36795. o[28] = x7 >>> 0 & 0xff;
  36796. o[29] = x7 >>> 8 & 0xff;
  36797. o[30] = x7 >>> 16 & 0xff;
  36798. o[31] = x7 >>> 24 & 0xff;
  36799. o[32] = x8 >>> 0 & 0xff;
  36800. o[33] = x8 >>> 8 & 0xff;
  36801. o[34] = x8 >>> 16 & 0xff;
  36802. o[35] = x8 >>> 24 & 0xff;
  36803. o[36] = x9 >>> 0 & 0xff;
  36804. o[37] = x9 >>> 8 & 0xff;
  36805. o[38] = x9 >>> 16 & 0xff;
  36806. o[39] = x9 >>> 24 & 0xff;
  36807. o[40] = x10 >>> 0 & 0xff;
  36808. o[41] = x10 >>> 8 & 0xff;
  36809. o[42] = x10 >>> 16 & 0xff;
  36810. o[43] = x10 >>> 24 & 0xff;
  36811. o[44] = x11 >>> 0 & 0xff;
  36812. o[45] = x11 >>> 8 & 0xff;
  36813. o[46] = x11 >>> 16 & 0xff;
  36814. o[47] = x11 >>> 24 & 0xff;
  36815. o[48] = x12 >>> 0 & 0xff;
  36816. o[49] = x12 >>> 8 & 0xff;
  36817. o[50] = x12 >>> 16 & 0xff;
  36818. o[51] = x12 >>> 24 & 0xff;
  36819. o[52] = x13 >>> 0 & 0xff;
  36820. o[53] = x13 >>> 8 & 0xff;
  36821. o[54] = x13 >>> 16 & 0xff;
  36822. o[55] = x13 >>> 24 & 0xff;
  36823. o[56] = x14 >>> 0 & 0xff;
  36824. o[57] = x14 >>> 8 & 0xff;
  36825. o[58] = x14 >>> 16 & 0xff;
  36826. o[59] = x14 >>> 24 & 0xff;
  36827. o[60] = x15 >>> 0 & 0xff;
  36828. o[61] = x15 >>> 8 & 0xff;
  36829. o[62] = x15 >>> 16 & 0xff;
  36830. o[63] = x15 >>> 24 & 0xff;
  36831. }
  36832. function core_hsalsa20(o,p,k,c) {
  36833. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  36834. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  36835. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  36836. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  36837. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  36838. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  36839. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  36840. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  36841. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  36842. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  36843. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  36844. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  36845. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  36846. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  36847. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  36848. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  36849. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  36850. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  36851. x15 = j15, u;
  36852. for (var i = 0; i < 20; i += 2) {
  36853. u = x0 + x12 | 0;
  36854. x4 ^= u<<7 | u>>>(32-7);
  36855. u = x4 + x0 | 0;
  36856. x8 ^= u<<9 | u>>>(32-9);
  36857. u = x8 + x4 | 0;
  36858. x12 ^= u<<13 | u>>>(32-13);
  36859. u = x12 + x8 | 0;
  36860. x0 ^= u<<18 | u>>>(32-18);
  36861. u = x5 + x1 | 0;
  36862. x9 ^= u<<7 | u>>>(32-7);
  36863. u = x9 + x5 | 0;
  36864. x13 ^= u<<9 | u>>>(32-9);
  36865. u = x13 + x9 | 0;
  36866. x1 ^= u<<13 | u>>>(32-13);
  36867. u = x1 + x13 | 0;
  36868. x5 ^= u<<18 | u>>>(32-18);
  36869. u = x10 + x6 | 0;
  36870. x14 ^= u<<7 | u>>>(32-7);
  36871. u = x14 + x10 | 0;
  36872. x2 ^= u<<9 | u>>>(32-9);
  36873. u = x2 + x14 | 0;
  36874. x6 ^= u<<13 | u>>>(32-13);
  36875. u = x6 + x2 | 0;
  36876. x10 ^= u<<18 | u>>>(32-18);
  36877. u = x15 + x11 | 0;
  36878. x3 ^= u<<7 | u>>>(32-7);
  36879. u = x3 + x15 | 0;
  36880. x7 ^= u<<9 | u>>>(32-9);
  36881. u = x7 + x3 | 0;
  36882. x11 ^= u<<13 | u>>>(32-13);
  36883. u = x11 + x7 | 0;
  36884. x15 ^= u<<18 | u>>>(32-18);
  36885. u = x0 + x3 | 0;
  36886. x1 ^= u<<7 | u>>>(32-7);
  36887. u = x1 + x0 | 0;
  36888. x2 ^= u<<9 | u>>>(32-9);
  36889. u = x2 + x1 | 0;
  36890. x3 ^= u<<13 | u>>>(32-13);
  36891. u = x3 + x2 | 0;
  36892. x0 ^= u<<18 | u>>>(32-18);
  36893. u = x5 + x4 | 0;
  36894. x6 ^= u<<7 | u>>>(32-7);
  36895. u = x6 + x5 | 0;
  36896. x7 ^= u<<9 | u>>>(32-9);
  36897. u = x7 + x6 | 0;
  36898. x4 ^= u<<13 | u>>>(32-13);
  36899. u = x4 + x7 | 0;
  36900. x5 ^= u<<18 | u>>>(32-18);
  36901. u = x10 + x9 | 0;
  36902. x11 ^= u<<7 | u>>>(32-7);
  36903. u = x11 + x10 | 0;
  36904. x8 ^= u<<9 | u>>>(32-9);
  36905. u = x8 + x11 | 0;
  36906. x9 ^= u<<13 | u>>>(32-13);
  36907. u = x9 + x8 | 0;
  36908. x10 ^= u<<18 | u>>>(32-18);
  36909. u = x15 + x14 | 0;
  36910. x12 ^= u<<7 | u>>>(32-7);
  36911. u = x12 + x15 | 0;
  36912. x13 ^= u<<9 | u>>>(32-9);
  36913. u = x13 + x12 | 0;
  36914. x14 ^= u<<13 | u>>>(32-13);
  36915. u = x14 + x13 | 0;
  36916. x15 ^= u<<18 | u>>>(32-18);
  36917. }
  36918. o[ 0] = x0 >>> 0 & 0xff;
  36919. o[ 1] = x0 >>> 8 & 0xff;
  36920. o[ 2] = x0 >>> 16 & 0xff;
  36921. o[ 3] = x0 >>> 24 & 0xff;
  36922. o[ 4] = x5 >>> 0 & 0xff;
  36923. o[ 5] = x5 >>> 8 & 0xff;
  36924. o[ 6] = x5 >>> 16 & 0xff;
  36925. o[ 7] = x5 >>> 24 & 0xff;
  36926. o[ 8] = x10 >>> 0 & 0xff;
  36927. o[ 9] = x10 >>> 8 & 0xff;
  36928. o[10] = x10 >>> 16 & 0xff;
  36929. o[11] = x10 >>> 24 & 0xff;
  36930. o[12] = x15 >>> 0 & 0xff;
  36931. o[13] = x15 >>> 8 & 0xff;
  36932. o[14] = x15 >>> 16 & 0xff;
  36933. o[15] = x15 >>> 24 & 0xff;
  36934. o[16] = x6 >>> 0 & 0xff;
  36935. o[17] = x6 >>> 8 & 0xff;
  36936. o[18] = x6 >>> 16 & 0xff;
  36937. o[19] = x6 >>> 24 & 0xff;
  36938. o[20] = x7 >>> 0 & 0xff;
  36939. o[21] = x7 >>> 8 & 0xff;
  36940. o[22] = x7 >>> 16 & 0xff;
  36941. o[23] = x7 >>> 24 & 0xff;
  36942. o[24] = x8 >>> 0 & 0xff;
  36943. o[25] = x8 >>> 8 & 0xff;
  36944. o[26] = x8 >>> 16 & 0xff;
  36945. o[27] = x8 >>> 24 & 0xff;
  36946. o[28] = x9 >>> 0 & 0xff;
  36947. o[29] = x9 >>> 8 & 0xff;
  36948. o[30] = x9 >>> 16 & 0xff;
  36949. o[31] = x9 >>> 24 & 0xff;
  36950. }
  36951. function crypto_core_salsa20(out,inp,k,c) {
  36952. core_salsa20(out,inp,k,c);
  36953. }
  36954. function crypto_core_hsalsa20(out,inp,k,c) {
  36955. core_hsalsa20(out,inp,k,c);
  36956. }
  36957. var sigma = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]);
  36958. // "expand 32-byte k"
  36959. function crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k) {
  36960. var z = new Uint8Array(16), x = new Uint8Array(64);
  36961. var u, i;
  36962. for (i = 0; i < 16; i++) z[i] = 0;
  36963. for (i = 0; i < 8; i++) z[i] = n[i];
  36964. while (b >= 64) {
  36965. crypto_core_salsa20(x,z,k,sigma);
  36966. for (i = 0; i < 64; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  36967. u = 1;
  36968. for (i = 8; i < 16; i++) {
  36969. u = u + (z[i] & 0xff) | 0;
  36970. z[i] = u & 0xff;
  36971. u >>>= 8;
  36972. }
  36973. b -= 64;
  36974. cpos += 64;
  36975. mpos += 64;
  36976. }
  36977. if (b > 0) {
  36978. crypto_core_salsa20(x,z,k,sigma);
  36979. for (i = 0; i < b; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  36980. }
  36981. return 0;
  36982. }
  36983. function crypto_stream_salsa20(c,cpos,b,n,k) {
  36984. var z = new Uint8Array(16), x = new Uint8Array(64);
  36985. var u, i;
  36986. for (i = 0; i < 16; i++) z[i] = 0;
  36987. for (i = 0; i < 8; i++) z[i] = n[i];
  36988. while (b >= 64) {
  36989. crypto_core_salsa20(x,z,k,sigma);
  36990. for (i = 0; i < 64; i++) c[cpos+i] = x[i];
  36991. u = 1;
  36992. for (i = 8; i < 16; i++) {
  36993. u = u + (z[i] & 0xff) | 0;
  36994. z[i] = u & 0xff;
  36995. u >>>= 8;
  36996. }
  36997. b -= 64;
  36998. cpos += 64;
  36999. }
  37000. if (b > 0) {
  37001. crypto_core_salsa20(x,z,k,sigma);
  37002. for (i = 0; i < b; i++) c[cpos+i] = x[i];
  37003. }
  37004. return 0;
  37005. }
  37006. function crypto_stream(c,cpos,d,n,k) {
  37007. var s = new Uint8Array(32);
  37008. crypto_core_hsalsa20(s,n,k,sigma);
  37009. var sn = new Uint8Array(8);
  37010. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  37011. return crypto_stream_salsa20(c,cpos,d,sn,s);
  37012. }
  37013. function crypto_stream_xor(c,cpos,m,mpos,d,n,k) {
  37014. var s = new Uint8Array(32);
  37015. crypto_core_hsalsa20(s,n,k,sigma);
  37016. var sn = new Uint8Array(8);
  37017. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  37018. return crypto_stream_salsa20_xor(c,cpos,m,mpos,d,sn,s);
  37019. }
  37020. /*
  37021. * Port of Andrew Moon's Poly1305-donna-16. Public domain.
  37022. * https://github.com/floodyberry/poly1305-donna
  37023. */
  37024. var poly1305 = function(key) {
  37025. this.buffer = new Uint8Array(16);
  37026. this.r = new Uint16Array(10);
  37027. this.h = new Uint16Array(10);
  37028. this.pad = new Uint16Array(8);
  37029. this.leftover = 0;
  37030. this.fin = 0;
  37031. var t0, t1, t2, t3, t4, t5, t6, t7;
  37032. t0 = key[ 0] & 0xff | (key[ 1] & 0xff) << 8; this.r[0] = ( t0 ) & 0x1fff;
  37033. t1 = key[ 2] & 0xff | (key[ 3] & 0xff) << 8; this.r[1] = ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  37034. t2 = key[ 4] & 0xff | (key[ 5] & 0xff) << 8; this.r[2] = ((t1 >>> 10) | (t2 << 6)) & 0x1f03;
  37035. t3 = key[ 6] & 0xff | (key[ 7] & 0xff) << 8; this.r[3] = ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  37036. t4 = key[ 8] & 0xff | (key[ 9] & 0xff) << 8; this.r[4] = ((t3 >>> 4) | (t4 << 12)) & 0x00ff;
  37037. this.r[5] = ((t4 >>> 1)) & 0x1ffe;
  37038. t5 = key[10] & 0xff | (key[11] & 0xff) << 8; this.r[6] = ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  37039. t6 = key[12] & 0xff | (key[13] & 0xff) << 8; this.r[7] = ((t5 >>> 11) | (t6 << 5)) & 0x1f81;
  37040. t7 = key[14] & 0xff | (key[15] & 0xff) << 8; this.r[8] = ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  37041. this.r[9] = ((t7 >>> 5)) & 0x007f;
  37042. this.pad[0] = key[16] & 0xff | (key[17] & 0xff) << 8;
  37043. this.pad[1] = key[18] & 0xff | (key[19] & 0xff) << 8;
  37044. this.pad[2] = key[20] & 0xff | (key[21] & 0xff) << 8;
  37045. this.pad[3] = key[22] & 0xff | (key[23] & 0xff) << 8;
  37046. this.pad[4] = key[24] & 0xff | (key[25] & 0xff) << 8;
  37047. this.pad[5] = key[26] & 0xff | (key[27] & 0xff) << 8;
  37048. this.pad[6] = key[28] & 0xff | (key[29] & 0xff) << 8;
  37049. this.pad[7] = key[30] & 0xff | (key[31] & 0xff) << 8;
  37050. };
  37051. poly1305.prototype.blocks = function(m, mpos, bytes) {
  37052. var hibit = this.fin ? 0 : (1 << 11);
  37053. var t0, t1, t2, t3, t4, t5, t6, t7, c;
  37054. var d0, d1, d2, d3, d4, d5, d6, d7, d8, d9;
  37055. var h0 = this.h[0],
  37056. h1 = this.h[1],
  37057. h2 = this.h[2],
  37058. h3 = this.h[3],
  37059. h4 = this.h[4],
  37060. h5 = this.h[5],
  37061. h6 = this.h[6],
  37062. h7 = this.h[7],
  37063. h8 = this.h[8],
  37064. h9 = this.h[9];
  37065. var r0 = this.r[0],
  37066. r1 = this.r[1],
  37067. r2 = this.r[2],
  37068. r3 = this.r[3],
  37069. r4 = this.r[4],
  37070. r5 = this.r[5],
  37071. r6 = this.r[6],
  37072. r7 = this.r[7],
  37073. r8 = this.r[8],
  37074. r9 = this.r[9];
  37075. while (bytes >= 16) {
  37076. t0 = m[mpos+ 0] & 0xff | (m[mpos+ 1] & 0xff) << 8; h0 += ( t0 ) & 0x1fff;
  37077. t1 = m[mpos+ 2] & 0xff | (m[mpos+ 3] & 0xff) << 8; h1 += ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  37078. t2 = m[mpos+ 4] & 0xff | (m[mpos+ 5] & 0xff) << 8; h2 += ((t1 >>> 10) | (t2 << 6)) & 0x1fff;
  37079. t3 = m[mpos+ 6] & 0xff | (m[mpos+ 7] & 0xff) << 8; h3 += ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  37080. t4 = m[mpos+ 8] & 0xff | (m[mpos+ 9] & 0xff) << 8; h4 += ((t3 >>> 4) | (t4 << 12)) & 0x1fff;
  37081. h5 += ((t4 >>> 1)) & 0x1fff;
  37082. t5 = m[mpos+10] & 0xff | (m[mpos+11] & 0xff) << 8; h6 += ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  37083. t6 = m[mpos+12] & 0xff | (m[mpos+13] & 0xff) << 8; h7 += ((t5 >>> 11) | (t6 << 5)) & 0x1fff;
  37084. t7 = m[mpos+14] & 0xff | (m[mpos+15] & 0xff) << 8; h8 += ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  37085. h9 += ((t7 >>> 5)) | hibit;
  37086. c = 0;
  37087. d0 = c;
  37088. d0 += h0 * r0;
  37089. d0 += h1 * (5 * r9);
  37090. d0 += h2 * (5 * r8);
  37091. d0 += h3 * (5 * r7);
  37092. d0 += h4 * (5 * r6);
  37093. c = (d0 >>> 13); d0 &= 0x1fff;
  37094. d0 += h5 * (5 * r5);
  37095. d0 += h6 * (5 * r4);
  37096. d0 += h7 * (5 * r3);
  37097. d0 += h8 * (5 * r2);
  37098. d0 += h9 * (5 * r1);
  37099. c += (d0 >>> 13); d0 &= 0x1fff;
  37100. d1 = c;
  37101. d1 += h0 * r1;
  37102. d1 += h1 * r0;
  37103. d1 += h2 * (5 * r9);
  37104. d1 += h3 * (5 * r8);
  37105. d1 += h4 * (5 * r7);
  37106. c = (d1 >>> 13); d1 &= 0x1fff;
  37107. d1 += h5 * (5 * r6);
  37108. d1 += h6 * (5 * r5);
  37109. d1 += h7 * (5 * r4);
  37110. d1 += h8 * (5 * r3);
  37111. d1 += h9 * (5 * r2);
  37112. c += (d1 >>> 13); d1 &= 0x1fff;
  37113. d2 = c;
  37114. d2 += h0 * r2;
  37115. d2 += h1 * r1;
  37116. d2 += h2 * r0;
  37117. d2 += h3 * (5 * r9);
  37118. d2 += h4 * (5 * r8);
  37119. c = (d2 >>> 13); d2 &= 0x1fff;
  37120. d2 += h5 * (5 * r7);
  37121. d2 += h6 * (5 * r6);
  37122. d2 += h7 * (5 * r5);
  37123. d2 += h8 * (5 * r4);
  37124. d2 += h9 * (5 * r3);
  37125. c += (d2 >>> 13); d2 &= 0x1fff;
  37126. d3 = c;
  37127. d3 += h0 * r3;
  37128. d3 += h1 * r2;
  37129. d3 += h2 * r1;
  37130. d3 += h3 * r0;
  37131. d3 += h4 * (5 * r9);
  37132. c = (d3 >>> 13); d3 &= 0x1fff;
  37133. d3 += h5 * (5 * r8);
  37134. d3 += h6 * (5 * r7);
  37135. d3 += h7 * (5 * r6);
  37136. d3 += h8 * (5 * r5);
  37137. d3 += h9 * (5 * r4);
  37138. c += (d3 >>> 13); d3 &= 0x1fff;
  37139. d4 = c;
  37140. d4 += h0 * r4;
  37141. d4 += h1 * r3;
  37142. d4 += h2 * r2;
  37143. d4 += h3 * r1;
  37144. d4 += h4 * r0;
  37145. c = (d4 >>> 13); d4 &= 0x1fff;
  37146. d4 += h5 * (5 * r9);
  37147. d4 += h6 * (5 * r8);
  37148. d4 += h7 * (5 * r7);
  37149. d4 += h8 * (5 * r6);
  37150. d4 += h9 * (5 * r5);
  37151. c += (d4 >>> 13); d4 &= 0x1fff;
  37152. d5 = c;
  37153. d5 += h0 * r5;
  37154. d5 += h1 * r4;
  37155. d5 += h2 * r3;
  37156. d5 += h3 * r2;
  37157. d5 += h4 * r1;
  37158. c = (d5 >>> 13); d5 &= 0x1fff;
  37159. d5 += h5 * r0;
  37160. d5 += h6 * (5 * r9);
  37161. d5 += h7 * (5 * r8);
  37162. d5 += h8 * (5 * r7);
  37163. d5 += h9 * (5 * r6);
  37164. c += (d5 >>> 13); d5 &= 0x1fff;
  37165. d6 = c;
  37166. d6 += h0 * r6;
  37167. d6 += h1 * r5;
  37168. d6 += h2 * r4;
  37169. d6 += h3 * r3;
  37170. d6 += h4 * r2;
  37171. c = (d6 >>> 13); d6 &= 0x1fff;
  37172. d6 += h5 * r1;
  37173. d6 += h6 * r0;
  37174. d6 += h7 * (5 * r9);
  37175. d6 += h8 * (5 * r8);
  37176. d6 += h9 * (5 * r7);
  37177. c += (d6 >>> 13); d6 &= 0x1fff;
  37178. d7 = c;
  37179. d7 += h0 * r7;
  37180. d7 += h1 * r6;
  37181. d7 += h2 * r5;
  37182. d7 += h3 * r4;
  37183. d7 += h4 * r3;
  37184. c = (d7 >>> 13); d7 &= 0x1fff;
  37185. d7 += h5 * r2;
  37186. d7 += h6 * r1;
  37187. d7 += h7 * r0;
  37188. d7 += h8 * (5 * r9);
  37189. d7 += h9 * (5 * r8);
  37190. c += (d7 >>> 13); d7 &= 0x1fff;
  37191. d8 = c;
  37192. d8 += h0 * r8;
  37193. d8 += h1 * r7;
  37194. d8 += h2 * r6;
  37195. d8 += h3 * r5;
  37196. d8 += h4 * r4;
  37197. c = (d8 >>> 13); d8 &= 0x1fff;
  37198. d8 += h5 * r3;
  37199. d8 += h6 * r2;
  37200. d8 += h7 * r1;
  37201. d8 += h8 * r0;
  37202. d8 += h9 * (5 * r9);
  37203. c += (d8 >>> 13); d8 &= 0x1fff;
  37204. d9 = c;
  37205. d9 += h0 * r9;
  37206. d9 += h1 * r8;
  37207. d9 += h2 * r7;
  37208. d9 += h3 * r6;
  37209. d9 += h4 * r5;
  37210. c = (d9 >>> 13); d9 &= 0x1fff;
  37211. d9 += h5 * r4;
  37212. d9 += h6 * r3;
  37213. d9 += h7 * r2;
  37214. d9 += h8 * r1;
  37215. d9 += h9 * r0;
  37216. c += (d9 >>> 13); d9 &= 0x1fff;
  37217. c = (((c << 2) + c)) | 0;
  37218. c = (c + d0) | 0;
  37219. d0 = c & 0x1fff;
  37220. c = (c >>> 13);
  37221. d1 += c;
  37222. h0 = d0;
  37223. h1 = d1;
  37224. h2 = d2;
  37225. h3 = d3;
  37226. h4 = d4;
  37227. h5 = d5;
  37228. h6 = d6;
  37229. h7 = d7;
  37230. h8 = d8;
  37231. h9 = d9;
  37232. mpos += 16;
  37233. bytes -= 16;
  37234. }
  37235. this.h[0] = h0;
  37236. this.h[1] = h1;
  37237. this.h[2] = h2;
  37238. this.h[3] = h3;
  37239. this.h[4] = h4;
  37240. this.h[5] = h5;
  37241. this.h[6] = h6;
  37242. this.h[7] = h7;
  37243. this.h[8] = h8;
  37244. this.h[9] = h9;
  37245. };
  37246. poly1305.prototype.finish = function(mac, macpos) {
  37247. var g = new Uint16Array(10);
  37248. var c, mask, f, i;
  37249. if (this.leftover) {
  37250. i = this.leftover;
  37251. this.buffer[i++] = 1;
  37252. for (; i < 16; i++) this.buffer[i] = 0;
  37253. this.fin = 1;
  37254. this.blocks(this.buffer, 0, 16);
  37255. }
  37256. c = this.h[1] >>> 13;
  37257. this.h[1] &= 0x1fff;
  37258. for (i = 2; i < 10; i++) {
  37259. this.h[i] += c;
  37260. c = this.h[i] >>> 13;
  37261. this.h[i] &= 0x1fff;
  37262. }
  37263. this.h[0] += (c * 5);
  37264. c = this.h[0] >>> 13;
  37265. this.h[0] &= 0x1fff;
  37266. this.h[1] += c;
  37267. c = this.h[1] >>> 13;
  37268. this.h[1] &= 0x1fff;
  37269. this.h[2] += c;
  37270. g[0] = this.h[0] + 5;
  37271. c = g[0] >>> 13;
  37272. g[0] &= 0x1fff;
  37273. for (i = 1; i < 10; i++) {
  37274. g[i] = this.h[i] + c;
  37275. c = g[i] >>> 13;
  37276. g[i] &= 0x1fff;
  37277. }
  37278. g[9] -= (1 << 13);
  37279. mask = (c ^ 1) - 1;
  37280. for (i = 0; i < 10; i++) g[i] &= mask;
  37281. mask = ~mask;
  37282. for (i = 0; i < 10; i++) this.h[i] = (this.h[i] & mask) | g[i];
  37283. this.h[0] = ((this.h[0] ) | (this.h[1] << 13) ) & 0xffff;
  37284. this.h[1] = ((this.h[1] >>> 3) | (this.h[2] << 10) ) & 0xffff;
  37285. this.h[2] = ((this.h[2] >>> 6) | (this.h[3] << 7) ) & 0xffff;
  37286. this.h[3] = ((this.h[3] >>> 9) | (this.h[4] << 4) ) & 0xffff;
  37287. this.h[4] = ((this.h[4] >>> 12) | (this.h[5] << 1) | (this.h[6] << 14)) & 0xffff;
  37288. this.h[5] = ((this.h[6] >>> 2) | (this.h[7] << 11) ) & 0xffff;
  37289. this.h[6] = ((this.h[7] >>> 5) | (this.h[8] << 8) ) & 0xffff;
  37290. this.h[7] = ((this.h[8] >>> 8) | (this.h[9] << 5) ) & 0xffff;
  37291. f = this.h[0] + this.pad[0];
  37292. this.h[0] = f & 0xffff;
  37293. for (i = 1; i < 8; i++) {
  37294. f = (((this.h[i] + this.pad[i]) | 0) + (f >>> 16)) | 0;
  37295. this.h[i] = f & 0xffff;
  37296. }
  37297. mac[macpos+ 0] = (this.h[0] >>> 0) & 0xff;
  37298. mac[macpos+ 1] = (this.h[0] >>> 8) & 0xff;
  37299. mac[macpos+ 2] = (this.h[1] >>> 0) & 0xff;
  37300. mac[macpos+ 3] = (this.h[1] >>> 8) & 0xff;
  37301. mac[macpos+ 4] = (this.h[2] >>> 0) & 0xff;
  37302. mac[macpos+ 5] = (this.h[2] >>> 8) & 0xff;
  37303. mac[macpos+ 6] = (this.h[3] >>> 0) & 0xff;
  37304. mac[macpos+ 7] = (this.h[3] >>> 8) & 0xff;
  37305. mac[macpos+ 8] = (this.h[4] >>> 0) & 0xff;
  37306. mac[macpos+ 9] = (this.h[4] >>> 8) & 0xff;
  37307. mac[macpos+10] = (this.h[5] >>> 0) & 0xff;
  37308. mac[macpos+11] = (this.h[5] >>> 8) & 0xff;
  37309. mac[macpos+12] = (this.h[6] >>> 0) & 0xff;
  37310. mac[macpos+13] = (this.h[6] >>> 8) & 0xff;
  37311. mac[macpos+14] = (this.h[7] >>> 0) & 0xff;
  37312. mac[macpos+15] = (this.h[7] >>> 8) & 0xff;
  37313. };
  37314. poly1305.prototype.update = function(m, mpos, bytes) {
  37315. var i, want;
  37316. if (this.leftover) {
  37317. want = (16 - this.leftover);
  37318. if (want > bytes)
  37319. want = bytes;
  37320. for (i = 0; i < want; i++)
  37321. this.buffer[this.leftover + i] = m[mpos+i];
  37322. bytes -= want;
  37323. mpos += want;
  37324. this.leftover += want;
  37325. if (this.leftover < 16)
  37326. return;
  37327. this.blocks(this.buffer, 0, 16);
  37328. this.leftover = 0;
  37329. }
  37330. if (bytes >= 16) {
  37331. want = bytes - (bytes % 16);
  37332. this.blocks(m, mpos, want);
  37333. mpos += want;
  37334. bytes -= want;
  37335. }
  37336. if (bytes) {
  37337. for (i = 0; i < bytes; i++)
  37338. this.buffer[this.leftover + i] = m[mpos+i];
  37339. this.leftover += bytes;
  37340. }
  37341. };
  37342. function crypto_onetimeauth(out, outpos, m, mpos, n, k) {
  37343. var s = new poly1305(k);
  37344. s.update(m, mpos, n);
  37345. s.finish(out, outpos);
  37346. return 0;
  37347. }
  37348. function crypto_onetimeauth_verify(h, hpos, m, mpos, n, k) {
  37349. var x = new Uint8Array(16);
  37350. crypto_onetimeauth(x,0,m,mpos,n,k);
  37351. return crypto_verify_16(h,hpos,x,0);
  37352. }
  37353. function crypto_secretbox(c,m,d,n,k) {
  37354. var i;
  37355. if (d < 32) return -1;
  37356. crypto_stream_xor(c,0,m,0,d,n,k);
  37357. crypto_onetimeauth(c, 16, c, 32, d - 32, c);
  37358. for (i = 0; i < 16; i++) c[i] = 0;
  37359. return 0;
  37360. }
  37361. function crypto_secretbox_open(m,c,d,n,k) {
  37362. var i;
  37363. var x = new Uint8Array(32);
  37364. if (d < 32) return -1;
  37365. crypto_stream(x,0,32,n,k);
  37366. if (crypto_onetimeauth_verify(c, 16,c, 32,d - 32,x) !== 0) return -1;
  37367. crypto_stream_xor(m,0,c,0,d,n,k);
  37368. for (i = 0; i < 32; i++) m[i] = 0;
  37369. return 0;
  37370. }
  37371. function set25519(r, a) {
  37372. var i;
  37373. for (i = 0; i < 16; i++) r[i] = a[i]|0;
  37374. }
  37375. function car25519(o) {
  37376. var i, v, c = 1;
  37377. for (i = 0; i < 16; i++) {
  37378. v = o[i] + c + 65535;
  37379. c = Math.floor(v / 65536);
  37380. o[i] = v - c * 65536;
  37381. }
  37382. o[0] += c-1 + 37 * (c-1);
  37383. }
  37384. function sel25519(p, q, b) {
  37385. var t, c = ~(b-1);
  37386. for (var i = 0; i < 16; i++) {
  37387. t = c & (p[i] ^ q[i]);
  37388. p[i] ^= t;
  37389. q[i] ^= t;
  37390. }
  37391. }
  37392. function pack25519(o, n) {
  37393. var i, j, b;
  37394. var m = gf(), t = gf();
  37395. for (i = 0; i < 16; i++) t[i] = n[i];
  37396. car25519(t);
  37397. car25519(t);
  37398. car25519(t);
  37399. for (j = 0; j < 2; j++) {
  37400. m[0] = t[0] - 0xffed;
  37401. for (i = 1; i < 15; i++) {
  37402. m[i] = t[i] - 0xffff - ((m[i-1]>>16) & 1);
  37403. m[i-1] &= 0xffff;
  37404. }
  37405. m[15] = t[15] - 0x7fff - ((m[14]>>16) & 1);
  37406. b = (m[15]>>16) & 1;
  37407. m[14] &= 0xffff;
  37408. sel25519(t, m, 1-b);
  37409. }
  37410. for (i = 0; i < 16; i++) {
  37411. o[2*i] = t[i] & 0xff;
  37412. o[2*i+1] = t[i]>>8;
  37413. }
  37414. }
  37415. function neq25519(a, b) {
  37416. var c = new Uint8Array(32), d = new Uint8Array(32);
  37417. pack25519(c, a);
  37418. pack25519(d, b);
  37419. return crypto_verify_32(c, 0, d, 0);
  37420. }
  37421. function par25519(a) {
  37422. var d = new Uint8Array(32);
  37423. pack25519(d, a);
  37424. return d[0] & 1;
  37425. }
  37426. function unpack25519(o, n) {
  37427. var i;
  37428. for (i = 0; i < 16; i++) o[i] = n[2*i] + (n[2*i+1] << 8);
  37429. o[15] &= 0x7fff;
  37430. }
  37431. function A(o, a, b) {
  37432. for (var i = 0; i < 16; i++) o[i] = a[i] + b[i];
  37433. }
  37434. function Z(o, a, b) {
  37435. for (var i = 0; i < 16; i++) o[i] = a[i] - b[i];
  37436. }
  37437. function M(o, a, b) {
  37438. var v, c,
  37439. t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0,
  37440. t8 = 0, t9 = 0, t10 = 0, t11 = 0, t12 = 0, t13 = 0, t14 = 0, t15 = 0,
  37441. t16 = 0, t17 = 0, t18 = 0, t19 = 0, t20 = 0, t21 = 0, t22 = 0, t23 = 0,
  37442. t24 = 0, t25 = 0, t26 = 0, t27 = 0, t28 = 0, t29 = 0, t30 = 0,
  37443. b0 = b[0],
  37444. b1 = b[1],
  37445. b2 = b[2],
  37446. b3 = b[3],
  37447. b4 = b[4],
  37448. b5 = b[5],
  37449. b6 = b[6],
  37450. b7 = b[7],
  37451. b8 = b[8],
  37452. b9 = b[9],
  37453. b10 = b[10],
  37454. b11 = b[11],
  37455. b12 = b[12],
  37456. b13 = b[13],
  37457. b14 = b[14],
  37458. b15 = b[15];
  37459. v = a[0];
  37460. t0 += v * b0;
  37461. t1 += v * b1;
  37462. t2 += v * b2;
  37463. t3 += v * b3;
  37464. t4 += v * b4;
  37465. t5 += v * b5;
  37466. t6 += v * b6;
  37467. t7 += v * b7;
  37468. t8 += v * b8;
  37469. t9 += v * b9;
  37470. t10 += v * b10;
  37471. t11 += v * b11;
  37472. t12 += v * b12;
  37473. t13 += v * b13;
  37474. t14 += v * b14;
  37475. t15 += v * b15;
  37476. v = a[1];
  37477. t1 += v * b0;
  37478. t2 += v * b1;
  37479. t3 += v * b2;
  37480. t4 += v * b3;
  37481. t5 += v * b4;
  37482. t6 += v * b5;
  37483. t7 += v * b6;
  37484. t8 += v * b7;
  37485. t9 += v * b8;
  37486. t10 += v * b9;
  37487. t11 += v * b10;
  37488. t12 += v * b11;
  37489. t13 += v * b12;
  37490. t14 += v * b13;
  37491. t15 += v * b14;
  37492. t16 += v * b15;
  37493. v = a[2];
  37494. t2 += v * b0;
  37495. t3 += v * b1;
  37496. t4 += v * b2;
  37497. t5 += v * b3;
  37498. t6 += v * b4;
  37499. t7 += v * b5;
  37500. t8 += v * b6;
  37501. t9 += v * b7;
  37502. t10 += v * b8;
  37503. t11 += v * b9;
  37504. t12 += v * b10;
  37505. t13 += v * b11;
  37506. t14 += v * b12;
  37507. t15 += v * b13;
  37508. t16 += v * b14;
  37509. t17 += v * b15;
  37510. v = a[3];
  37511. t3 += v * b0;
  37512. t4 += v * b1;
  37513. t5 += v * b2;
  37514. t6 += v * b3;
  37515. t7 += v * b4;
  37516. t8 += v * b5;
  37517. t9 += v * b6;
  37518. t10 += v * b7;
  37519. t11 += v * b8;
  37520. t12 += v * b9;
  37521. t13 += v * b10;
  37522. t14 += v * b11;
  37523. t15 += v * b12;
  37524. t16 += v * b13;
  37525. t17 += v * b14;
  37526. t18 += v * b15;
  37527. v = a[4];
  37528. t4 += v * b0;
  37529. t5 += v * b1;
  37530. t6 += v * b2;
  37531. t7 += v * b3;
  37532. t8 += v * b4;
  37533. t9 += v * b5;
  37534. t10 += v * b6;
  37535. t11 += v * b7;
  37536. t12 += v * b8;
  37537. t13 += v * b9;
  37538. t14 += v * b10;
  37539. t15 += v * b11;
  37540. t16 += v * b12;
  37541. t17 += v * b13;
  37542. t18 += v * b14;
  37543. t19 += v * b15;
  37544. v = a[5];
  37545. t5 += v * b0;
  37546. t6 += v * b1;
  37547. t7 += v * b2;
  37548. t8 += v * b3;
  37549. t9 += v * b4;
  37550. t10 += v * b5;
  37551. t11 += v * b6;
  37552. t12 += v * b7;
  37553. t13 += v * b8;
  37554. t14 += v * b9;
  37555. t15 += v * b10;
  37556. t16 += v * b11;
  37557. t17 += v * b12;
  37558. t18 += v * b13;
  37559. t19 += v * b14;
  37560. t20 += v * b15;
  37561. v = a[6];
  37562. t6 += v * b0;
  37563. t7 += v * b1;
  37564. t8 += v * b2;
  37565. t9 += v * b3;
  37566. t10 += v * b4;
  37567. t11 += v * b5;
  37568. t12 += v * b6;
  37569. t13 += v * b7;
  37570. t14 += v * b8;
  37571. t15 += v * b9;
  37572. t16 += v * b10;
  37573. t17 += v * b11;
  37574. t18 += v * b12;
  37575. t19 += v * b13;
  37576. t20 += v * b14;
  37577. t21 += v * b15;
  37578. v = a[7];
  37579. t7 += v * b0;
  37580. t8 += v * b1;
  37581. t9 += v * b2;
  37582. t10 += v * b3;
  37583. t11 += v * b4;
  37584. t12 += v * b5;
  37585. t13 += v * b6;
  37586. t14 += v * b7;
  37587. t15 += v * b8;
  37588. t16 += v * b9;
  37589. t17 += v * b10;
  37590. t18 += v * b11;
  37591. t19 += v * b12;
  37592. t20 += v * b13;
  37593. t21 += v * b14;
  37594. t22 += v * b15;
  37595. v = a[8];
  37596. t8 += v * b0;
  37597. t9 += v * b1;
  37598. t10 += v * b2;
  37599. t11 += v * b3;
  37600. t12 += v * b4;
  37601. t13 += v * b5;
  37602. t14 += v * b6;
  37603. t15 += v * b7;
  37604. t16 += v * b8;
  37605. t17 += v * b9;
  37606. t18 += v * b10;
  37607. t19 += v * b11;
  37608. t20 += v * b12;
  37609. t21 += v * b13;
  37610. t22 += v * b14;
  37611. t23 += v * b15;
  37612. v = a[9];
  37613. t9 += v * b0;
  37614. t10 += v * b1;
  37615. t11 += v * b2;
  37616. t12 += v * b3;
  37617. t13 += v * b4;
  37618. t14 += v * b5;
  37619. t15 += v * b6;
  37620. t16 += v * b7;
  37621. t17 += v * b8;
  37622. t18 += v * b9;
  37623. t19 += v * b10;
  37624. t20 += v * b11;
  37625. t21 += v * b12;
  37626. t22 += v * b13;
  37627. t23 += v * b14;
  37628. t24 += v * b15;
  37629. v = a[10];
  37630. t10 += v * b0;
  37631. t11 += v * b1;
  37632. t12 += v * b2;
  37633. t13 += v * b3;
  37634. t14 += v * b4;
  37635. t15 += v * b5;
  37636. t16 += v * b6;
  37637. t17 += v * b7;
  37638. t18 += v * b8;
  37639. t19 += v * b9;
  37640. t20 += v * b10;
  37641. t21 += v * b11;
  37642. t22 += v * b12;
  37643. t23 += v * b13;
  37644. t24 += v * b14;
  37645. t25 += v * b15;
  37646. v = a[11];
  37647. t11 += v * b0;
  37648. t12 += v * b1;
  37649. t13 += v * b2;
  37650. t14 += v * b3;
  37651. t15 += v * b4;
  37652. t16 += v * b5;
  37653. t17 += v * b6;
  37654. t18 += v * b7;
  37655. t19 += v * b8;
  37656. t20 += v * b9;
  37657. t21 += v * b10;
  37658. t22 += v * b11;
  37659. t23 += v * b12;
  37660. t24 += v * b13;
  37661. t25 += v * b14;
  37662. t26 += v * b15;
  37663. v = a[12];
  37664. t12 += v * b0;
  37665. t13 += v * b1;
  37666. t14 += v * b2;
  37667. t15 += v * b3;
  37668. t16 += v * b4;
  37669. t17 += v * b5;
  37670. t18 += v * b6;
  37671. t19 += v * b7;
  37672. t20 += v * b8;
  37673. t21 += v * b9;
  37674. t22 += v * b10;
  37675. t23 += v * b11;
  37676. t24 += v * b12;
  37677. t25 += v * b13;
  37678. t26 += v * b14;
  37679. t27 += v * b15;
  37680. v = a[13];
  37681. t13 += v * b0;
  37682. t14 += v * b1;
  37683. t15 += v * b2;
  37684. t16 += v * b3;
  37685. t17 += v * b4;
  37686. t18 += v * b5;
  37687. t19 += v * b6;
  37688. t20 += v * b7;
  37689. t21 += v * b8;
  37690. t22 += v * b9;
  37691. t23 += v * b10;
  37692. t24 += v * b11;
  37693. t25 += v * b12;
  37694. t26 += v * b13;
  37695. t27 += v * b14;
  37696. t28 += v * b15;
  37697. v = a[14];
  37698. t14 += v * b0;
  37699. t15 += v * b1;
  37700. t16 += v * b2;
  37701. t17 += v * b3;
  37702. t18 += v * b4;
  37703. t19 += v * b5;
  37704. t20 += v * b6;
  37705. t21 += v * b7;
  37706. t22 += v * b8;
  37707. t23 += v * b9;
  37708. t24 += v * b10;
  37709. t25 += v * b11;
  37710. t26 += v * b12;
  37711. t27 += v * b13;
  37712. t28 += v * b14;
  37713. t29 += v * b15;
  37714. v = a[15];
  37715. t15 += v * b0;
  37716. t16 += v * b1;
  37717. t17 += v * b2;
  37718. t18 += v * b3;
  37719. t19 += v * b4;
  37720. t20 += v * b5;
  37721. t21 += v * b6;
  37722. t22 += v * b7;
  37723. t23 += v * b8;
  37724. t24 += v * b9;
  37725. t25 += v * b10;
  37726. t26 += v * b11;
  37727. t27 += v * b12;
  37728. t28 += v * b13;
  37729. t29 += v * b14;
  37730. t30 += v * b15;
  37731. t0 += 38 * t16;
  37732. t1 += 38 * t17;
  37733. t2 += 38 * t18;
  37734. t3 += 38 * t19;
  37735. t4 += 38 * t20;
  37736. t5 += 38 * t21;
  37737. t6 += 38 * t22;
  37738. t7 += 38 * t23;
  37739. t8 += 38 * t24;
  37740. t9 += 38 * t25;
  37741. t10 += 38 * t26;
  37742. t11 += 38 * t27;
  37743. t12 += 38 * t28;
  37744. t13 += 38 * t29;
  37745. t14 += 38 * t30;
  37746. // t15 left as is
  37747. // first car
  37748. c = 1;
  37749. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  37750. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  37751. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  37752. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  37753. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  37754. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  37755. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  37756. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  37757. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  37758. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  37759. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  37760. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  37761. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  37762. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  37763. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  37764. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  37765. t0 += c-1 + 37 * (c-1);
  37766. // second car
  37767. c = 1;
  37768. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  37769. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  37770. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  37771. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  37772. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  37773. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  37774. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  37775. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  37776. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  37777. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  37778. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  37779. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  37780. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  37781. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  37782. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  37783. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  37784. t0 += c-1 + 37 * (c-1);
  37785. o[ 0] = t0;
  37786. o[ 1] = t1;
  37787. o[ 2] = t2;
  37788. o[ 3] = t3;
  37789. o[ 4] = t4;
  37790. o[ 5] = t5;
  37791. o[ 6] = t6;
  37792. o[ 7] = t7;
  37793. o[ 8] = t8;
  37794. o[ 9] = t9;
  37795. o[10] = t10;
  37796. o[11] = t11;
  37797. o[12] = t12;
  37798. o[13] = t13;
  37799. o[14] = t14;
  37800. o[15] = t15;
  37801. }
  37802. function S(o, a) {
  37803. M(o, a, a);
  37804. }
  37805. function inv25519(o, i) {
  37806. var c = gf();
  37807. var a;
  37808. for (a = 0; a < 16; a++) c[a] = i[a];
  37809. for (a = 253; a >= 0; a--) {
  37810. S(c, c);
  37811. if(a !== 2 && a !== 4) M(c, c, i);
  37812. }
  37813. for (a = 0; a < 16; a++) o[a] = c[a];
  37814. }
  37815. function pow2523(o, i) {
  37816. var c = gf();
  37817. var a;
  37818. for (a = 0; a < 16; a++) c[a] = i[a];
  37819. for (a = 250; a >= 0; a--) {
  37820. S(c, c);
  37821. if(a !== 1) M(c, c, i);
  37822. }
  37823. for (a = 0; a < 16; a++) o[a] = c[a];
  37824. }
  37825. function crypto_scalarmult(q, n, p) {
  37826. var z = new Uint8Array(32);
  37827. var x = new Float64Array(80), r, i;
  37828. var a = gf(), b = gf(), c = gf(),
  37829. d = gf(), e = gf(), f = gf();
  37830. for (i = 0; i < 31; i++) z[i] = n[i];
  37831. z[31]=(n[31]&127)|64;
  37832. z[0]&=248;
  37833. unpack25519(x,p);
  37834. for (i = 0; i < 16; i++) {
  37835. b[i]=x[i];
  37836. d[i]=a[i]=c[i]=0;
  37837. }
  37838. a[0]=d[0]=1;
  37839. for (i=254; i>=0; --i) {
  37840. r=(z[i>>>3]>>>(i&7))&1;
  37841. sel25519(a,b,r);
  37842. sel25519(c,d,r);
  37843. A(e,a,c);
  37844. Z(a,a,c);
  37845. A(c,b,d);
  37846. Z(b,b,d);
  37847. S(d,e);
  37848. S(f,a);
  37849. M(a,c,a);
  37850. M(c,b,e);
  37851. A(e,a,c);
  37852. Z(a,a,c);
  37853. S(b,a);
  37854. Z(c,d,f);
  37855. M(a,c,_121665);
  37856. A(a,a,d);
  37857. M(c,c,a);
  37858. M(a,d,f);
  37859. M(d,b,x);
  37860. S(b,e);
  37861. sel25519(a,b,r);
  37862. sel25519(c,d,r);
  37863. }
  37864. for (i = 0; i < 16; i++) {
  37865. x[i+16]=a[i];
  37866. x[i+32]=c[i];
  37867. x[i+48]=b[i];
  37868. x[i+64]=d[i];
  37869. }
  37870. var x32 = x.subarray(32);
  37871. var x16 = x.subarray(16);
  37872. inv25519(x32,x32);
  37873. M(x16,x16,x32);
  37874. pack25519(q,x16);
  37875. return 0;
  37876. }
  37877. function crypto_scalarmult_base(q, n) {
  37878. return crypto_scalarmult(q, n, _9);
  37879. }
  37880. function crypto_box_keypair(y, x) {
  37881. randombytes(x, 32);
  37882. return crypto_scalarmult_base(y, x);
  37883. }
  37884. function crypto_box_beforenm(k, y, x) {
  37885. var s = new Uint8Array(32);
  37886. crypto_scalarmult(s, x, y);
  37887. return crypto_core_hsalsa20(k, _0, s, sigma);
  37888. }
  37889. var crypto_box_afternm = crypto_secretbox;
  37890. var crypto_box_open_afternm = crypto_secretbox_open;
  37891. function crypto_box(c, m, d, n, y, x) {
  37892. var k = new Uint8Array(32);
  37893. crypto_box_beforenm(k, y, x);
  37894. return crypto_box_afternm(c, m, d, n, k);
  37895. }
  37896. function crypto_box_open(m, c, d, n, y, x) {
  37897. var k = new Uint8Array(32);
  37898. crypto_box_beforenm(k, y, x);
  37899. return crypto_box_open_afternm(m, c, d, n, k);
  37900. }
  37901. var K = [
  37902. 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
  37903. 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
  37904. 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
  37905. 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
  37906. 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
  37907. 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
  37908. 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
  37909. 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
  37910. 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
  37911. 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
  37912. 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
  37913. 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
  37914. 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
  37915. 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
  37916. 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
  37917. 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
  37918. 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
  37919. 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
  37920. 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
  37921. 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
  37922. 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
  37923. 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
  37924. 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
  37925. 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
  37926. 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
  37927. 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
  37928. 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
  37929. 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
  37930. 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
  37931. 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
  37932. 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
  37933. 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
  37934. 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
  37935. 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
  37936. 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
  37937. 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
  37938. 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
  37939. 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
  37940. 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
  37941. 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
  37942. ];
  37943. function crypto_hashblocks_hl(hh, hl, m, n) {
  37944. var wh = new Int32Array(16), wl = new Int32Array(16),
  37945. bh0, bh1, bh2, bh3, bh4, bh5, bh6, bh7,
  37946. bl0, bl1, bl2, bl3, bl4, bl5, bl6, bl7,
  37947. th, tl, i, j, h, l, a, b, c, d;
  37948. var ah0 = hh[0],
  37949. ah1 = hh[1],
  37950. ah2 = hh[2],
  37951. ah3 = hh[3],
  37952. ah4 = hh[4],
  37953. ah5 = hh[5],
  37954. ah6 = hh[6],
  37955. ah7 = hh[7],
  37956. al0 = hl[0],
  37957. al1 = hl[1],
  37958. al2 = hl[2],
  37959. al3 = hl[3],
  37960. al4 = hl[4],
  37961. al5 = hl[5],
  37962. al6 = hl[6],
  37963. al7 = hl[7];
  37964. var pos = 0;
  37965. while (n >= 128) {
  37966. for (i = 0; i < 16; i++) {
  37967. j = 8 * i + pos;
  37968. wh[i] = (m[j+0] << 24) | (m[j+1] << 16) | (m[j+2] << 8) | m[j+3];
  37969. wl[i] = (m[j+4] << 24) | (m[j+5] << 16) | (m[j+6] << 8) | m[j+7];
  37970. }
  37971. for (i = 0; i < 80; i++) {
  37972. bh0 = ah0;
  37973. bh1 = ah1;
  37974. bh2 = ah2;
  37975. bh3 = ah3;
  37976. bh4 = ah4;
  37977. bh5 = ah5;
  37978. bh6 = ah6;
  37979. bh7 = ah7;
  37980. bl0 = al0;
  37981. bl1 = al1;
  37982. bl2 = al2;
  37983. bl3 = al3;
  37984. bl4 = al4;
  37985. bl5 = al5;
  37986. bl6 = al6;
  37987. bl7 = al7;
  37988. // add
  37989. h = ah7;
  37990. l = al7;
  37991. a = l & 0xffff; b = l >>> 16;
  37992. c = h & 0xffff; d = h >>> 16;
  37993. // Sigma1
  37994. h = ((ah4 >>> 14) | (al4 << (32-14))) ^ ((ah4 >>> 18) | (al4 << (32-18))) ^ ((al4 >>> (41-32)) | (ah4 << (32-(41-32))));
  37995. l = ((al4 >>> 14) | (ah4 << (32-14))) ^ ((al4 >>> 18) | (ah4 << (32-18))) ^ ((ah4 >>> (41-32)) | (al4 << (32-(41-32))));
  37996. a += l & 0xffff; b += l >>> 16;
  37997. c += h & 0xffff; d += h >>> 16;
  37998. // Ch
  37999. h = (ah4 & ah5) ^ (~ah4 & ah6);
  38000. l = (al4 & al5) ^ (~al4 & al6);
  38001. a += l & 0xffff; b += l >>> 16;
  38002. c += h & 0xffff; d += h >>> 16;
  38003. // K
  38004. h = K[i*2];
  38005. l = K[i*2+1];
  38006. a += l & 0xffff; b += l >>> 16;
  38007. c += h & 0xffff; d += h >>> 16;
  38008. // w
  38009. h = wh[i%16];
  38010. l = wl[i%16];
  38011. a += l & 0xffff; b += l >>> 16;
  38012. c += h & 0xffff; d += h >>> 16;
  38013. b += a >>> 16;
  38014. c += b >>> 16;
  38015. d += c >>> 16;
  38016. th = c & 0xffff | d << 16;
  38017. tl = a & 0xffff | b << 16;
  38018. // add
  38019. h = th;
  38020. l = tl;
  38021. a = l & 0xffff; b = l >>> 16;
  38022. c = h & 0xffff; d = h >>> 16;
  38023. // Sigma0
  38024. h = ((ah0 >>> 28) | (al0 << (32-28))) ^ ((al0 >>> (34-32)) | (ah0 << (32-(34-32)))) ^ ((al0 >>> (39-32)) | (ah0 << (32-(39-32))));
  38025. l = ((al0 >>> 28) | (ah0 << (32-28))) ^ ((ah0 >>> (34-32)) | (al0 << (32-(34-32)))) ^ ((ah0 >>> (39-32)) | (al0 << (32-(39-32))));
  38026. a += l & 0xffff; b += l >>> 16;
  38027. c += h & 0xffff; d += h >>> 16;
  38028. // Maj
  38029. h = (ah0 & ah1) ^ (ah0 & ah2) ^ (ah1 & ah2);
  38030. l = (al0 & al1) ^ (al0 & al2) ^ (al1 & al2);
  38031. a += l & 0xffff; b += l >>> 16;
  38032. c += h & 0xffff; d += h >>> 16;
  38033. b += a >>> 16;
  38034. c += b >>> 16;
  38035. d += c >>> 16;
  38036. bh7 = (c & 0xffff) | (d << 16);
  38037. bl7 = (a & 0xffff) | (b << 16);
  38038. // add
  38039. h = bh3;
  38040. l = bl3;
  38041. a = l & 0xffff; b = l >>> 16;
  38042. c = h & 0xffff; d = h >>> 16;
  38043. h = th;
  38044. l = tl;
  38045. a += l & 0xffff; b += l >>> 16;
  38046. c += h & 0xffff; d += h >>> 16;
  38047. b += a >>> 16;
  38048. c += b >>> 16;
  38049. d += c >>> 16;
  38050. bh3 = (c & 0xffff) | (d << 16);
  38051. bl3 = (a & 0xffff) | (b << 16);
  38052. ah1 = bh0;
  38053. ah2 = bh1;
  38054. ah3 = bh2;
  38055. ah4 = bh3;
  38056. ah5 = bh4;
  38057. ah6 = bh5;
  38058. ah7 = bh6;
  38059. ah0 = bh7;
  38060. al1 = bl0;
  38061. al2 = bl1;
  38062. al3 = bl2;
  38063. al4 = bl3;
  38064. al5 = bl4;
  38065. al6 = bl5;
  38066. al7 = bl6;
  38067. al0 = bl7;
  38068. if (i%16 === 15) {
  38069. for (j = 0; j < 16; j++) {
  38070. // add
  38071. h = wh[j];
  38072. l = wl[j];
  38073. a = l & 0xffff; b = l >>> 16;
  38074. c = h & 0xffff; d = h >>> 16;
  38075. h = wh[(j+9)%16];
  38076. l = wl[(j+9)%16];
  38077. a += l & 0xffff; b += l >>> 16;
  38078. c += h & 0xffff; d += h >>> 16;
  38079. // sigma0
  38080. th = wh[(j+1)%16];
  38081. tl = wl[(j+1)%16];
  38082. h = ((th >>> 1) | (tl << (32-1))) ^ ((th >>> 8) | (tl << (32-8))) ^ (th >>> 7);
  38083. l = ((tl >>> 1) | (th << (32-1))) ^ ((tl >>> 8) | (th << (32-8))) ^ ((tl >>> 7) | (th << (32-7)));
  38084. a += l & 0xffff; b += l >>> 16;
  38085. c += h & 0xffff; d += h >>> 16;
  38086. // sigma1
  38087. th = wh[(j+14)%16];
  38088. tl = wl[(j+14)%16];
  38089. h = ((th >>> 19) | (tl << (32-19))) ^ ((tl >>> (61-32)) | (th << (32-(61-32)))) ^ (th >>> 6);
  38090. l = ((tl >>> 19) | (th << (32-19))) ^ ((th >>> (61-32)) | (tl << (32-(61-32)))) ^ ((tl >>> 6) | (th << (32-6)));
  38091. a += l & 0xffff; b += l >>> 16;
  38092. c += h & 0xffff; d += h >>> 16;
  38093. b += a >>> 16;
  38094. c += b >>> 16;
  38095. d += c >>> 16;
  38096. wh[j] = (c & 0xffff) | (d << 16);
  38097. wl[j] = (a & 0xffff) | (b << 16);
  38098. }
  38099. }
  38100. }
  38101. // add
  38102. h = ah0;
  38103. l = al0;
  38104. a = l & 0xffff; b = l >>> 16;
  38105. c = h & 0xffff; d = h >>> 16;
  38106. h = hh[0];
  38107. l = hl[0];
  38108. a += l & 0xffff; b += l >>> 16;
  38109. c += h & 0xffff; d += h >>> 16;
  38110. b += a >>> 16;
  38111. c += b >>> 16;
  38112. d += c >>> 16;
  38113. hh[0] = ah0 = (c & 0xffff) | (d << 16);
  38114. hl[0] = al0 = (a & 0xffff) | (b << 16);
  38115. h = ah1;
  38116. l = al1;
  38117. a = l & 0xffff; b = l >>> 16;
  38118. c = h & 0xffff; d = h >>> 16;
  38119. h = hh[1];
  38120. l = hl[1];
  38121. a += l & 0xffff; b += l >>> 16;
  38122. c += h & 0xffff; d += h >>> 16;
  38123. b += a >>> 16;
  38124. c += b >>> 16;
  38125. d += c >>> 16;
  38126. hh[1] = ah1 = (c & 0xffff) | (d << 16);
  38127. hl[1] = al1 = (a & 0xffff) | (b << 16);
  38128. h = ah2;
  38129. l = al2;
  38130. a = l & 0xffff; b = l >>> 16;
  38131. c = h & 0xffff; d = h >>> 16;
  38132. h = hh[2];
  38133. l = hl[2];
  38134. a += l & 0xffff; b += l >>> 16;
  38135. c += h & 0xffff; d += h >>> 16;
  38136. b += a >>> 16;
  38137. c += b >>> 16;
  38138. d += c >>> 16;
  38139. hh[2] = ah2 = (c & 0xffff) | (d << 16);
  38140. hl[2] = al2 = (a & 0xffff) | (b << 16);
  38141. h = ah3;
  38142. l = al3;
  38143. a = l & 0xffff; b = l >>> 16;
  38144. c = h & 0xffff; d = h >>> 16;
  38145. h = hh[3];
  38146. l = hl[3];
  38147. a += l & 0xffff; b += l >>> 16;
  38148. c += h & 0xffff; d += h >>> 16;
  38149. b += a >>> 16;
  38150. c += b >>> 16;
  38151. d += c >>> 16;
  38152. hh[3] = ah3 = (c & 0xffff) | (d << 16);
  38153. hl[3] = al3 = (a & 0xffff) | (b << 16);
  38154. h = ah4;
  38155. l = al4;
  38156. a = l & 0xffff; b = l >>> 16;
  38157. c = h & 0xffff; d = h >>> 16;
  38158. h = hh[4];
  38159. l = hl[4];
  38160. a += l & 0xffff; b += l >>> 16;
  38161. c += h & 0xffff; d += h >>> 16;
  38162. b += a >>> 16;
  38163. c += b >>> 16;
  38164. d += c >>> 16;
  38165. hh[4] = ah4 = (c & 0xffff) | (d << 16);
  38166. hl[4] = al4 = (a & 0xffff) | (b << 16);
  38167. h = ah5;
  38168. l = al5;
  38169. a = l & 0xffff; b = l >>> 16;
  38170. c = h & 0xffff; d = h >>> 16;
  38171. h = hh[5];
  38172. l = hl[5];
  38173. a += l & 0xffff; b += l >>> 16;
  38174. c += h & 0xffff; d += h >>> 16;
  38175. b += a >>> 16;
  38176. c += b >>> 16;
  38177. d += c >>> 16;
  38178. hh[5] = ah5 = (c & 0xffff) | (d << 16);
  38179. hl[5] = al5 = (a & 0xffff) | (b << 16);
  38180. h = ah6;
  38181. l = al6;
  38182. a = l & 0xffff; b = l >>> 16;
  38183. c = h & 0xffff; d = h >>> 16;
  38184. h = hh[6];
  38185. l = hl[6];
  38186. a += l & 0xffff; b += l >>> 16;
  38187. c += h & 0xffff; d += h >>> 16;
  38188. b += a >>> 16;
  38189. c += b >>> 16;
  38190. d += c >>> 16;
  38191. hh[6] = ah6 = (c & 0xffff) | (d << 16);
  38192. hl[6] = al6 = (a & 0xffff) | (b << 16);
  38193. h = ah7;
  38194. l = al7;
  38195. a = l & 0xffff; b = l >>> 16;
  38196. c = h & 0xffff; d = h >>> 16;
  38197. h = hh[7];
  38198. l = hl[7];
  38199. a += l & 0xffff; b += l >>> 16;
  38200. c += h & 0xffff; d += h >>> 16;
  38201. b += a >>> 16;
  38202. c += b >>> 16;
  38203. d += c >>> 16;
  38204. hh[7] = ah7 = (c & 0xffff) | (d << 16);
  38205. hl[7] = al7 = (a & 0xffff) | (b << 16);
  38206. pos += 128;
  38207. n -= 128;
  38208. }
  38209. return n;
  38210. }
  38211. function crypto_hash(out, m, n) {
  38212. var hh = new Int32Array(8),
  38213. hl = new Int32Array(8),
  38214. x = new Uint8Array(256),
  38215. i, b = n;
  38216. hh[0] = 0x6a09e667;
  38217. hh[1] = 0xbb67ae85;
  38218. hh[2] = 0x3c6ef372;
  38219. hh[3] = 0xa54ff53a;
  38220. hh[4] = 0x510e527f;
  38221. hh[5] = 0x9b05688c;
  38222. hh[6] = 0x1f83d9ab;
  38223. hh[7] = 0x5be0cd19;
  38224. hl[0] = 0xf3bcc908;
  38225. hl[1] = 0x84caa73b;
  38226. hl[2] = 0xfe94f82b;
  38227. hl[3] = 0x5f1d36f1;
  38228. hl[4] = 0xade682d1;
  38229. hl[5] = 0x2b3e6c1f;
  38230. hl[6] = 0xfb41bd6b;
  38231. hl[7] = 0x137e2179;
  38232. crypto_hashblocks_hl(hh, hl, m, n);
  38233. n %= 128;
  38234. for (i = 0; i < n; i++) x[i] = m[b-n+i];
  38235. x[n] = 128;
  38236. n = 256-128*(n<112?1:0);
  38237. x[n-9] = 0;
  38238. ts64(x, n-8, (b / 0x20000000) | 0, b << 3);
  38239. crypto_hashblocks_hl(hh, hl, x, n);
  38240. for (i = 0; i < 8; i++) ts64(out, 8*i, hh[i], hl[i]);
  38241. return 0;
  38242. }
  38243. function add(p, q) {
  38244. var a = gf(), b = gf(), c = gf(),
  38245. d = gf(), e = gf(), f = gf(),
  38246. g = gf(), h = gf(), t = gf();
  38247. Z(a, p[1], p[0]);
  38248. Z(t, q[1], q[0]);
  38249. M(a, a, t);
  38250. A(b, p[0], p[1]);
  38251. A(t, q[0], q[1]);
  38252. M(b, b, t);
  38253. M(c, p[3], q[3]);
  38254. M(c, c, D2);
  38255. M(d, p[2], q[2]);
  38256. A(d, d, d);
  38257. Z(e, b, a);
  38258. Z(f, d, c);
  38259. A(g, d, c);
  38260. A(h, b, a);
  38261. M(p[0], e, f);
  38262. M(p[1], h, g);
  38263. M(p[2], g, f);
  38264. M(p[3], e, h);
  38265. }
  38266. function cswap(p, q, b) {
  38267. var i;
  38268. for (i = 0; i < 4; i++) {
  38269. sel25519(p[i], q[i], b);
  38270. }
  38271. }
  38272. function pack(r, p) {
  38273. var tx = gf(), ty = gf(), zi = gf();
  38274. inv25519(zi, p[2]);
  38275. M(tx, p[0], zi);
  38276. M(ty, p[1], zi);
  38277. pack25519(r, ty);
  38278. r[31] ^= par25519(tx) << 7;
  38279. }
  38280. function scalarmult(p, q, s) {
  38281. var b, i;
  38282. set25519(p[0], gf0);
  38283. set25519(p[1], gf1);
  38284. set25519(p[2], gf1);
  38285. set25519(p[3], gf0);
  38286. for (i = 255; i >= 0; --i) {
  38287. b = (s[(i/8)|0] >> (i&7)) & 1;
  38288. cswap(p, q, b);
  38289. add(q, p);
  38290. add(p, p);
  38291. cswap(p, q, b);
  38292. }
  38293. }
  38294. function scalarbase(p, s) {
  38295. var q = [gf(), gf(), gf(), gf()];
  38296. set25519(q[0], X);
  38297. set25519(q[1], Y);
  38298. set25519(q[2], gf1);
  38299. M(q[3], X, Y);
  38300. scalarmult(p, q, s);
  38301. }
  38302. function crypto_sign_keypair(pk, sk, seeded) {
  38303. var d = new Uint8Array(64);
  38304. var p = [gf(), gf(), gf(), gf()];
  38305. var i;
  38306. if (!seeded) randombytes(sk, 32);
  38307. crypto_hash(d, sk, 32);
  38308. d[0] &= 248;
  38309. d[31] &= 127;
  38310. d[31] |= 64;
  38311. scalarbase(p, d);
  38312. pack(pk, p);
  38313. for (i = 0; i < 32; i++) sk[i+32] = pk[i];
  38314. return 0;
  38315. }
  38316. 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]);
  38317. function modL(r, x) {
  38318. var carry, i, j, k;
  38319. for (i = 63; i >= 32; --i) {
  38320. carry = 0;
  38321. for (j = i - 32, k = i - 12; j < k; ++j) {
  38322. x[j] += carry - 16 * x[i] * L[j - (i - 32)];
  38323. carry = (x[j] + 128) >> 8;
  38324. x[j] -= carry * 256;
  38325. }
  38326. x[j] += carry;
  38327. x[i] = 0;
  38328. }
  38329. carry = 0;
  38330. for (j = 0; j < 32; j++) {
  38331. x[j] += carry - (x[31] >> 4) * L[j];
  38332. carry = x[j] >> 8;
  38333. x[j] &= 255;
  38334. }
  38335. for (j = 0; j < 32; j++) x[j] -= carry * L[j];
  38336. for (i = 0; i < 32; i++) {
  38337. x[i+1] += x[i] >> 8;
  38338. r[i] = x[i] & 255;
  38339. }
  38340. }
  38341. function reduce(r) {
  38342. var x = new Float64Array(64), i;
  38343. for (i = 0; i < 64; i++) x[i] = r[i];
  38344. for (i = 0; i < 64; i++) r[i] = 0;
  38345. modL(r, x);
  38346. }
  38347. // Note: difference from C - smlen returned, not passed as argument.
  38348. function crypto_sign(sm, m, n, sk) {
  38349. var d = new Uint8Array(64), h = new Uint8Array(64), r = new Uint8Array(64);
  38350. var i, j, x = new Float64Array(64);
  38351. var p = [gf(), gf(), gf(), gf()];
  38352. crypto_hash(d, sk, 32);
  38353. d[0] &= 248;
  38354. d[31] &= 127;
  38355. d[31] |= 64;
  38356. var smlen = n + 64;
  38357. for (i = 0; i < n; i++) sm[64 + i] = m[i];
  38358. for (i = 0; i < 32; i++) sm[32 + i] = d[32 + i];
  38359. crypto_hash(r, sm.subarray(32), n+32);
  38360. reduce(r);
  38361. scalarbase(p, r);
  38362. pack(sm, p);
  38363. for (i = 32; i < 64; i++) sm[i] = sk[i];
  38364. crypto_hash(h, sm, n + 64);
  38365. reduce(h);
  38366. for (i = 0; i < 64; i++) x[i] = 0;
  38367. for (i = 0; i < 32; i++) x[i] = r[i];
  38368. for (i = 0; i < 32; i++) {
  38369. for (j = 0; j < 32; j++) {
  38370. x[i+j] += h[i] * d[j];
  38371. }
  38372. }
  38373. modL(sm.subarray(32), x);
  38374. return smlen;
  38375. }
  38376. function unpackneg(r, p) {
  38377. var t = gf(), chk = gf(), num = gf(),
  38378. den = gf(), den2 = gf(), den4 = gf(),
  38379. den6 = gf();
  38380. set25519(r[2], gf1);
  38381. unpack25519(r[1], p);
  38382. S(num, r[1]);
  38383. M(den, num, D);
  38384. Z(num, num, r[2]);
  38385. A(den, r[2], den);
  38386. S(den2, den);
  38387. S(den4, den2);
  38388. M(den6, den4, den2);
  38389. M(t, den6, num);
  38390. M(t, t, den);
  38391. pow2523(t, t);
  38392. M(t, t, num);
  38393. M(t, t, den);
  38394. M(t, t, den);
  38395. M(r[0], t, den);
  38396. S(chk, r[0]);
  38397. M(chk, chk, den);
  38398. if (neq25519(chk, num)) M(r[0], r[0], I);
  38399. S(chk, r[0]);
  38400. M(chk, chk, den);
  38401. if (neq25519(chk, num)) return -1;
  38402. if (par25519(r[0]) === (p[31]>>7)) Z(r[0], gf0, r[0]);
  38403. M(r[3], r[0], r[1]);
  38404. return 0;
  38405. }
  38406. function crypto_sign_open(m, sm, n, pk) {
  38407. var i, mlen;
  38408. var t = new Uint8Array(32), h = new Uint8Array(64);
  38409. var p = [gf(), gf(), gf(), gf()],
  38410. q = [gf(), gf(), gf(), gf()];
  38411. mlen = -1;
  38412. if (n < 64) return -1;
  38413. if (unpackneg(q, pk)) return -1;
  38414. for (i = 0; i < n; i++) m[i] = sm[i];
  38415. for (i = 0; i < 32; i++) m[i+32] = pk[i];
  38416. crypto_hash(h, m, n);
  38417. reduce(h);
  38418. scalarmult(p, q, h);
  38419. scalarbase(q, sm.subarray(32));
  38420. add(p, q);
  38421. pack(t, p);
  38422. n -= 64;
  38423. if (crypto_verify_32(sm, 0, t, 0)) {
  38424. for (i = 0; i < n; i++) m[i] = 0;
  38425. return -1;
  38426. }
  38427. for (i = 0; i < n; i++) m[i] = sm[i + 64];
  38428. mlen = n;
  38429. return mlen;
  38430. }
  38431. var crypto_secretbox_KEYBYTES = 32,
  38432. crypto_secretbox_NONCEBYTES = 24,
  38433. crypto_secretbox_ZEROBYTES = 32,
  38434. crypto_secretbox_BOXZEROBYTES = 16,
  38435. crypto_scalarmult_BYTES = 32,
  38436. crypto_scalarmult_SCALARBYTES = 32,
  38437. crypto_box_PUBLICKEYBYTES = 32,
  38438. crypto_box_SECRETKEYBYTES = 32,
  38439. crypto_box_BEFORENMBYTES = 32,
  38440. crypto_box_NONCEBYTES = crypto_secretbox_NONCEBYTES,
  38441. crypto_box_ZEROBYTES = crypto_secretbox_ZEROBYTES,
  38442. crypto_box_BOXZEROBYTES = crypto_secretbox_BOXZEROBYTES,
  38443. crypto_sign_BYTES = 64,
  38444. crypto_sign_PUBLICKEYBYTES = 32,
  38445. crypto_sign_SECRETKEYBYTES = 64,
  38446. crypto_sign_SEEDBYTES = 32,
  38447. crypto_hash_BYTES = 64;
  38448. nacl.lowlevel = {
  38449. crypto_core_hsalsa20: crypto_core_hsalsa20,
  38450. crypto_stream_xor: crypto_stream_xor,
  38451. crypto_stream: crypto_stream,
  38452. crypto_stream_salsa20_xor: crypto_stream_salsa20_xor,
  38453. crypto_stream_salsa20: crypto_stream_salsa20,
  38454. crypto_onetimeauth: crypto_onetimeauth,
  38455. crypto_onetimeauth_verify: crypto_onetimeauth_verify,
  38456. crypto_verify_16: crypto_verify_16,
  38457. crypto_verify_32: crypto_verify_32,
  38458. crypto_secretbox: crypto_secretbox,
  38459. crypto_secretbox_open: crypto_secretbox_open,
  38460. crypto_scalarmult: crypto_scalarmult,
  38461. crypto_scalarmult_base: crypto_scalarmult_base,
  38462. crypto_box_beforenm: crypto_box_beforenm,
  38463. crypto_box_afternm: crypto_box_afternm,
  38464. crypto_box: crypto_box,
  38465. crypto_box_open: crypto_box_open,
  38466. crypto_box_keypair: crypto_box_keypair,
  38467. crypto_hash: crypto_hash,
  38468. crypto_sign: crypto_sign,
  38469. crypto_sign_keypair: crypto_sign_keypair,
  38470. crypto_sign_open: crypto_sign_open,
  38471. crypto_secretbox_KEYBYTES: crypto_secretbox_KEYBYTES,
  38472. crypto_secretbox_NONCEBYTES: crypto_secretbox_NONCEBYTES,
  38473. crypto_secretbox_ZEROBYTES: crypto_secretbox_ZEROBYTES,
  38474. crypto_secretbox_BOXZEROBYTES: crypto_secretbox_BOXZEROBYTES,
  38475. crypto_scalarmult_BYTES: crypto_scalarmult_BYTES,
  38476. crypto_scalarmult_SCALARBYTES: crypto_scalarmult_SCALARBYTES,
  38477. crypto_box_PUBLICKEYBYTES: crypto_box_PUBLICKEYBYTES,
  38478. crypto_box_SECRETKEYBYTES: crypto_box_SECRETKEYBYTES,
  38479. crypto_box_BEFORENMBYTES: crypto_box_BEFORENMBYTES,
  38480. crypto_box_NONCEBYTES: crypto_box_NONCEBYTES,
  38481. crypto_box_ZEROBYTES: crypto_box_ZEROBYTES,
  38482. crypto_box_BOXZEROBYTES: crypto_box_BOXZEROBYTES,
  38483. crypto_sign_BYTES: crypto_sign_BYTES,
  38484. crypto_sign_PUBLICKEYBYTES: crypto_sign_PUBLICKEYBYTES,
  38485. crypto_sign_SECRETKEYBYTES: crypto_sign_SECRETKEYBYTES,
  38486. crypto_sign_SEEDBYTES: crypto_sign_SEEDBYTES,
  38487. crypto_hash_BYTES: crypto_hash_BYTES
  38488. };
  38489. /* High-level API */
  38490. function checkLengths(k, n) {
  38491. if (k.length !== crypto_secretbox_KEYBYTES) throw new Error('bad key size');
  38492. if (n.length !== crypto_secretbox_NONCEBYTES) throw new Error('bad nonce size');
  38493. }
  38494. function checkBoxLengths(pk, sk) {
  38495. if (pk.length !== crypto_box_PUBLICKEYBYTES) throw new Error('bad public key size');
  38496. if (sk.length !== crypto_box_SECRETKEYBYTES) throw new Error('bad secret key size');
  38497. }
  38498. function checkArrayTypes() {
  38499. for (var i = 0; i < arguments.length; i++) {
  38500. if (!(arguments[i] instanceof Uint8Array))
  38501. throw new TypeError('unexpected type, use Uint8Array');
  38502. }
  38503. }
  38504. function cleanup(arr) {
  38505. for (var i = 0; i < arr.length; i++) arr[i] = 0;
  38506. }
  38507. nacl.randomBytes = function(n) {
  38508. var b = new Uint8Array(n);
  38509. randombytes(b, n);
  38510. return b;
  38511. };
  38512. nacl.secretbox = function(msg, nonce, key) {
  38513. checkArrayTypes(msg, nonce, key);
  38514. checkLengths(key, nonce);
  38515. var m = new Uint8Array(crypto_secretbox_ZEROBYTES + msg.length);
  38516. var c = new Uint8Array(m.length);
  38517. for (var i = 0; i < msg.length; i++) m[i+crypto_secretbox_ZEROBYTES] = msg[i];
  38518. crypto_secretbox(c, m, m.length, nonce, key);
  38519. return c.subarray(crypto_secretbox_BOXZEROBYTES);
  38520. };
  38521. nacl.secretbox.open = function(box, nonce, key) {
  38522. checkArrayTypes(box, nonce, key);
  38523. checkLengths(key, nonce);
  38524. var c = new Uint8Array(crypto_secretbox_BOXZEROBYTES + box.length);
  38525. var m = new Uint8Array(c.length);
  38526. for (var i = 0; i < box.length; i++) c[i+crypto_secretbox_BOXZEROBYTES] = box[i];
  38527. if (c.length < 32) return null;
  38528. if (crypto_secretbox_open(m, c, c.length, nonce, key) !== 0) return null;
  38529. return m.subarray(crypto_secretbox_ZEROBYTES);
  38530. };
  38531. nacl.secretbox.keyLength = crypto_secretbox_KEYBYTES;
  38532. nacl.secretbox.nonceLength = crypto_secretbox_NONCEBYTES;
  38533. nacl.secretbox.overheadLength = crypto_secretbox_BOXZEROBYTES;
  38534. nacl.scalarMult = function(n, p) {
  38535. checkArrayTypes(n, p);
  38536. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  38537. if (p.length !== crypto_scalarmult_BYTES) throw new Error('bad p size');
  38538. var q = new Uint8Array(crypto_scalarmult_BYTES);
  38539. crypto_scalarmult(q, n, p);
  38540. return q;
  38541. };
  38542. nacl.scalarMult.base = function(n) {
  38543. checkArrayTypes(n);
  38544. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  38545. var q = new Uint8Array(crypto_scalarmult_BYTES);
  38546. crypto_scalarmult_base(q, n);
  38547. return q;
  38548. };
  38549. nacl.scalarMult.scalarLength = crypto_scalarmult_SCALARBYTES;
  38550. nacl.scalarMult.groupElementLength = crypto_scalarmult_BYTES;
  38551. nacl.box = function(msg, nonce, publicKey, secretKey) {
  38552. var k = nacl.box.before(publicKey, secretKey);
  38553. return nacl.secretbox(msg, nonce, k);
  38554. };
  38555. nacl.box.before = function(publicKey, secretKey) {
  38556. checkArrayTypes(publicKey, secretKey);
  38557. checkBoxLengths(publicKey, secretKey);
  38558. var k = new Uint8Array(crypto_box_BEFORENMBYTES);
  38559. crypto_box_beforenm(k, publicKey, secretKey);
  38560. return k;
  38561. };
  38562. nacl.box.after = nacl.secretbox;
  38563. nacl.box.open = function(msg, nonce, publicKey, secretKey) {
  38564. var k = nacl.box.before(publicKey, secretKey);
  38565. return nacl.secretbox.open(msg, nonce, k);
  38566. };
  38567. nacl.box.open.after = nacl.secretbox.open;
  38568. nacl.box.keyPair = function() {
  38569. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  38570. var sk = new Uint8Array(crypto_box_SECRETKEYBYTES);
  38571. crypto_box_keypair(pk, sk);
  38572. return {publicKey: pk, secretKey: sk};
  38573. };
  38574. nacl.box.keyPair.fromSecretKey = function(secretKey) {
  38575. checkArrayTypes(secretKey);
  38576. if (secretKey.length !== crypto_box_SECRETKEYBYTES)
  38577. throw new Error('bad secret key size');
  38578. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  38579. crypto_scalarmult_base(pk, secretKey);
  38580. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  38581. };
  38582. nacl.box.publicKeyLength = crypto_box_PUBLICKEYBYTES;
  38583. nacl.box.secretKeyLength = crypto_box_SECRETKEYBYTES;
  38584. nacl.box.sharedKeyLength = crypto_box_BEFORENMBYTES;
  38585. nacl.box.nonceLength = crypto_box_NONCEBYTES;
  38586. nacl.box.overheadLength = nacl.secretbox.overheadLength;
  38587. nacl.sign = function(msg, secretKey) {
  38588. checkArrayTypes(msg, secretKey);
  38589. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  38590. throw new Error('bad secret key size');
  38591. var signedMsg = new Uint8Array(crypto_sign_BYTES+msg.length);
  38592. crypto_sign(signedMsg, msg, msg.length, secretKey);
  38593. return signedMsg;
  38594. };
  38595. nacl.sign.open = function(signedMsg, publicKey) {
  38596. checkArrayTypes(signedMsg, publicKey);
  38597. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  38598. throw new Error('bad public key size');
  38599. var tmp = new Uint8Array(signedMsg.length);
  38600. var mlen = crypto_sign_open(tmp, signedMsg, signedMsg.length, publicKey);
  38601. if (mlen < 0) return null;
  38602. var m = new Uint8Array(mlen);
  38603. for (var i = 0; i < m.length; i++) m[i] = tmp[i];
  38604. return m;
  38605. };
  38606. nacl.sign.detached = function(msg, secretKey) {
  38607. var signedMsg = nacl.sign(msg, secretKey);
  38608. var sig = new Uint8Array(crypto_sign_BYTES);
  38609. for (var i = 0; i < sig.length; i++) sig[i] = signedMsg[i];
  38610. return sig;
  38611. };
  38612. nacl.sign.detached.verify = function(msg, sig, publicKey) {
  38613. checkArrayTypes(msg, sig, publicKey);
  38614. if (sig.length !== crypto_sign_BYTES)
  38615. throw new Error('bad signature size');
  38616. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  38617. throw new Error('bad public key size');
  38618. var sm = new Uint8Array(crypto_sign_BYTES + msg.length);
  38619. var m = new Uint8Array(crypto_sign_BYTES + msg.length);
  38620. var i;
  38621. for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i];
  38622. for (i = 0; i < msg.length; i++) sm[i+crypto_sign_BYTES] = msg[i];
  38623. return (crypto_sign_open(m, sm, sm.length, publicKey) >= 0);
  38624. };
  38625. nacl.sign.keyPair = function() {
  38626. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  38627. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  38628. crypto_sign_keypair(pk, sk);
  38629. return {publicKey: pk, secretKey: sk};
  38630. };
  38631. nacl.sign.keyPair.fromSecretKey = function(secretKey) {
  38632. checkArrayTypes(secretKey);
  38633. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  38634. throw new Error('bad secret key size');
  38635. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  38636. for (var i = 0; i < pk.length; i++) pk[i] = secretKey[32+i];
  38637. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  38638. };
  38639. nacl.sign.keyPair.fromSeed = function(seed) {
  38640. checkArrayTypes(seed);
  38641. if (seed.length !== crypto_sign_SEEDBYTES)
  38642. throw new Error('bad seed size');
  38643. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  38644. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  38645. for (var i = 0; i < 32; i++) sk[i] = seed[i];
  38646. crypto_sign_keypair(pk, sk, true);
  38647. return {publicKey: pk, secretKey: sk};
  38648. };
  38649. nacl.sign.publicKeyLength = crypto_sign_PUBLICKEYBYTES;
  38650. nacl.sign.secretKeyLength = crypto_sign_SECRETKEYBYTES;
  38651. nacl.sign.seedLength = crypto_sign_SEEDBYTES;
  38652. nacl.sign.signatureLength = crypto_sign_BYTES;
  38653. nacl.hash = function(msg) {
  38654. checkArrayTypes(msg);
  38655. var h = new Uint8Array(crypto_hash_BYTES);
  38656. crypto_hash(h, msg, msg.length);
  38657. return h;
  38658. };
  38659. nacl.hash.hashLength = crypto_hash_BYTES;
  38660. nacl.verify = function(x, y) {
  38661. checkArrayTypes(x, y);
  38662. // Zero length arguments are considered not equal.
  38663. if (x.length === 0 || y.length === 0) return false;
  38664. if (x.length !== y.length) return false;
  38665. return (vn(x, 0, y, 0, x.length) === 0) ? true : false;
  38666. };
  38667. nacl.setPRNG = function(fn) {
  38668. randombytes = fn;
  38669. };
  38670. (function() {
  38671. // Initialize PRNG if environment provides CSPRNG.
  38672. // If not, methods calling randombytes will throw.
  38673. var crypto = typeof self !== 'undefined' ? (self.crypto || self.msCrypto) : null;
  38674. if (crypto && crypto.getRandomValues) {
  38675. // Browsers.
  38676. var QUOTA = 65536;
  38677. nacl.setPRNG(function(x, n) {
  38678. var i, v = new Uint8Array(n);
  38679. for (i = 0; i < n; i += QUOTA) {
  38680. crypto.getRandomValues(v.subarray(i, i + Math.min(n - i, QUOTA)));
  38681. }
  38682. for (i = 0; i < n; i++) x[i] = v[i];
  38683. cleanup(v);
  38684. });
  38685. } else if (true) {
  38686. // Node.js.
  38687. crypto = __webpack_require__(3);
  38688. if (crypto && crypto.randomBytes) {
  38689. nacl.setPRNG(function(x, n) {
  38690. var i, v = crypto.randomBytes(n);
  38691. for (i = 0; i < n; i++) x[i] = v[i];
  38692. cleanup(v);
  38693. });
  38694. }
  38695. }
  38696. })();
  38697. })( true && module.exports ? module.exports : (self.nacl = self.nacl || {}));
  38698. /***/ }),
  38699. /* 1 */
  38700. /***/ (function(module, exports, __webpack_require__) {
  38701. // Written in 2014-2016 by Dmitry Chestnykh and Devi Mandiri.
  38702. // Public domain.
  38703. (function(root, f) {
  38704. 'use strict';
  38705. if ( true && module.exports) module.exports = f();
  38706. else if (root.nacl) root.nacl.util = f();
  38707. else {
  38708. root.nacl = {};
  38709. root.nacl.util = f();
  38710. }
  38711. }(this, function() {
  38712. 'use strict';
  38713. var util = {};
  38714. function validateBase64(s) {
  38715. if (!(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(s))) {
  38716. throw new TypeError('invalid encoding');
  38717. }
  38718. }
  38719. util.decodeUTF8 = function(s) {
  38720. if (typeof s !== 'string') throw new TypeError('expected string');
  38721. var i, d = unescape(encodeURIComponent(s)), b = new Uint8Array(d.length);
  38722. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  38723. return b;
  38724. };
  38725. util.encodeUTF8 = function(arr) {
  38726. var i, s = [];
  38727. for (i = 0; i < arr.length; i++) s.push(String.fromCharCode(arr[i]));
  38728. return decodeURIComponent(escape(s.join('')));
  38729. };
  38730. if (typeof atob === 'undefined') {
  38731. // Node.js
  38732. if (typeof Buffer.from !== 'undefined') {
  38733. // Node v6 and later
  38734. util.encodeBase64 = function (arr) { // v6 and later
  38735. return Buffer.from(arr).toString('base64');
  38736. };
  38737. util.decodeBase64 = function (s) {
  38738. validateBase64(s);
  38739. return new Uint8Array(Array.prototype.slice.call(Buffer.from(s, 'base64'), 0));
  38740. };
  38741. } else {
  38742. // Node earlier than v6
  38743. util.encodeBase64 = function (arr) { // v6 and later
  38744. return (new Buffer(arr)).toString('base64');
  38745. };
  38746. util.decodeBase64 = function(s) {
  38747. validateBase64(s);
  38748. return new Uint8Array(Array.prototype.slice.call(new Buffer(s, 'base64'), 0));
  38749. };
  38750. }
  38751. } else {
  38752. // Browsers
  38753. util.encodeBase64 = function(arr) {
  38754. var i, s = [], len = arr.length;
  38755. for (i = 0; i < len; i++) s.push(String.fromCharCode(arr[i]));
  38756. return btoa(s.join(''));
  38757. };
  38758. util.decodeBase64 = function(s) {
  38759. validateBase64(s);
  38760. var i, d = atob(s), b = new Uint8Array(d.length);
  38761. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  38762. return b;
  38763. };
  38764. }
  38765. return util;
  38766. }));
  38767. /***/ }),
  38768. /* 2 */
  38769. /***/ (function(module, exports, __webpack_require__) {
  38770. // required so we don't have to do require('pusher').default etc.
  38771. module.exports = __webpack_require__(4).default;
  38772. /***/ }),
  38773. /* 3 */
  38774. /***/ (function(module, exports) {
  38775. /* (ignored) */
  38776. /***/ }),
  38777. /* 4 */
  38778. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  38779. "use strict";
  38780. __webpack_require__.r(__webpack_exports__);
  38781. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_receiver_factory.ts
  38782. var ScriptReceiverFactory = (function () {
  38783. function ScriptReceiverFactory(prefix, name) {
  38784. this.lastId = 0;
  38785. this.prefix = prefix;
  38786. this.name = name;
  38787. }
  38788. ScriptReceiverFactory.prototype.create = function (callback) {
  38789. this.lastId++;
  38790. var number = this.lastId;
  38791. var id = this.prefix + number;
  38792. var name = this.name + "[" + number + "]";
  38793. var called = false;
  38794. var callbackWrapper = function () {
  38795. if (!called) {
  38796. callback.apply(null, arguments);
  38797. called = true;
  38798. }
  38799. };
  38800. this[number] = callbackWrapper;
  38801. return { number: number, id: id, name: name, callback: callbackWrapper };
  38802. };
  38803. ScriptReceiverFactory.prototype.remove = function (receiver) {
  38804. delete this[receiver.number];
  38805. };
  38806. return ScriptReceiverFactory;
  38807. }());
  38808. var ScriptReceivers = new ScriptReceiverFactory("_pusher_script_", "Pusher.ScriptReceivers");
  38809. // CONCATENATED MODULE: ./src/core/defaults.ts
  38810. var Defaults = {
  38811. VERSION: "5.0.3",
  38812. PROTOCOL: 7,
  38813. host: 'ws.pusherapp.com',
  38814. ws_port: 80,
  38815. wss_port: 443,
  38816. ws_path: '',
  38817. sockjs_host: 'sockjs.pusher.com',
  38818. sockjs_http_port: 80,
  38819. sockjs_https_port: 443,
  38820. sockjs_path: '/pusher',
  38821. stats_host: 'stats.pusher.com',
  38822. channel_auth_endpoint: '/pusher/auth',
  38823. channel_auth_transport: 'ajax',
  38824. activity_timeout: 120000,
  38825. pong_timeout: 30000,
  38826. unavailable_timeout: 10000,
  38827. cdn_http: "http://js.pusher.com",
  38828. cdn_https: "https://js.pusher.com",
  38829. dependency_suffix: ""
  38830. };
  38831. /* harmony default export */ var defaults = (Defaults);
  38832. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependency_loader.ts
  38833. var dependency_loader_DependencyLoader = (function () {
  38834. function DependencyLoader(options) {
  38835. this.options = options;
  38836. this.receivers = options.receivers || ScriptReceivers;
  38837. this.loading = {};
  38838. }
  38839. DependencyLoader.prototype.load = function (name, options, callback) {
  38840. var self = this;
  38841. if (self.loading[name] && self.loading[name].length > 0) {
  38842. self.loading[name].push(callback);
  38843. }
  38844. else {
  38845. self.loading[name] = [callback];
  38846. var request = runtime.createScriptRequest(self.getPath(name, options));
  38847. var receiver = self.receivers.create(function (error) {
  38848. self.receivers.remove(receiver);
  38849. if (self.loading[name]) {
  38850. var callbacks = self.loading[name];
  38851. delete self.loading[name];
  38852. var successCallback = function (wasSuccessful) {
  38853. if (!wasSuccessful) {
  38854. request.cleanup();
  38855. }
  38856. };
  38857. for (var i = 0; i < callbacks.length; i++) {
  38858. callbacks[i](error, successCallback);
  38859. }
  38860. }
  38861. });
  38862. request.send(receiver);
  38863. }
  38864. };
  38865. DependencyLoader.prototype.getRoot = function (options) {
  38866. var cdn;
  38867. var protocol = runtime.getDocument().location.protocol;
  38868. if ((options && options.useTLS) || protocol === "https:") {
  38869. cdn = this.options.cdn_https;
  38870. }
  38871. else {
  38872. cdn = this.options.cdn_http;
  38873. }
  38874. return cdn.replace(/\/*$/, "") + "/" + this.options.version;
  38875. };
  38876. DependencyLoader.prototype.getPath = function (name, options) {
  38877. return this.getRoot(options) + '/' + name + this.options.suffix + '.js';
  38878. };
  38879. ;
  38880. return DependencyLoader;
  38881. }());
  38882. /* harmony default export */ var dependency_loader = (dependency_loader_DependencyLoader);
  38883. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependencies.ts
  38884. var DependenciesReceivers = new ScriptReceiverFactory("_pusher_dependencies", "Pusher.DependenciesReceivers");
  38885. var Dependencies = new dependency_loader({
  38886. cdn_http: defaults.cdn_http,
  38887. cdn_https: defaults.cdn_https,
  38888. version: defaults.VERSION,
  38889. suffix: defaults.dependency_suffix,
  38890. receivers: DependenciesReceivers
  38891. });
  38892. // CONCATENATED MODULE: ./src/core/base64.ts
  38893. function encode(s) {
  38894. return btoa(utob(s));
  38895. }
  38896. var fromCharCode = String.fromCharCode;
  38897. var b64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
  38898. var b64tab = {};
  38899. for (var base64_i = 0, l = b64chars.length; base64_i < l; base64_i++) {
  38900. b64tab[b64chars.charAt(base64_i)] = base64_i;
  38901. }
  38902. var cb_utob = function (c) {
  38903. var cc = c.charCodeAt(0);
  38904. return cc < 0x80
  38905. ? c
  38906. : cc < 0x800
  38907. ? fromCharCode(0xc0 | (cc >>> 6)) + fromCharCode(0x80 | (cc & 0x3f))
  38908. : fromCharCode(0xe0 | ((cc >>> 12) & 0x0f)) +
  38909. fromCharCode(0x80 | ((cc >>> 6) & 0x3f)) +
  38910. fromCharCode(0x80 | (cc & 0x3f));
  38911. };
  38912. var utob = function (u) {
  38913. return u.replace(/[^\x00-\x7F]/g, cb_utob);
  38914. };
  38915. var cb_encode = function (ccc) {
  38916. var padlen = [0, 2, 1][ccc.length % 3];
  38917. var ord = (ccc.charCodeAt(0) << 16) |
  38918. ((ccc.length > 1 ? ccc.charCodeAt(1) : 0) << 8) |
  38919. (ccc.length > 2 ? ccc.charCodeAt(2) : 0);
  38920. var chars = [
  38921. b64chars.charAt(ord >>> 18),
  38922. b64chars.charAt((ord >>> 12) & 63),
  38923. padlen >= 2 ? '=' : b64chars.charAt((ord >>> 6) & 63),
  38924. padlen >= 1 ? '=' : b64chars.charAt(ord & 63)
  38925. ];
  38926. return chars.join('');
  38927. };
  38928. var btoa = window.btoa ||
  38929. function (b) {
  38930. return b.replace(/[\s\S]{1,3}/g, cb_encode);
  38931. };
  38932. // CONCATENATED MODULE: ./src/core/utils/timers/abstract_timer.ts
  38933. var Timer = (function () {
  38934. function Timer(set, clear, delay, callback) {
  38935. var _this = this;
  38936. this.clear = clear;
  38937. this.timer = set(function () {
  38938. if (_this.timer) {
  38939. _this.timer = callback(_this.timer);
  38940. }
  38941. }, delay);
  38942. }
  38943. Timer.prototype.isRunning = function () {
  38944. return this.timer !== null;
  38945. };
  38946. Timer.prototype.ensureAborted = function () {
  38947. if (this.timer) {
  38948. this.clear(this.timer);
  38949. this.timer = null;
  38950. }
  38951. };
  38952. return Timer;
  38953. }());
  38954. /* harmony default export */ var abstract_timer = (Timer);
  38955. // CONCATENATED MODULE: ./src/core/utils/timers/index.ts
  38956. var __extends = (undefined && undefined.__extends) || (function () {
  38957. var extendStatics = function (d, b) {
  38958. extendStatics = Object.setPrototypeOf ||
  38959. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  38960. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  38961. return extendStatics(d, b);
  38962. };
  38963. return function (d, b) {
  38964. extendStatics(d, b);
  38965. function __() { this.constructor = d; }
  38966. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  38967. };
  38968. })();
  38969. function timers_clearTimeout(timer) {
  38970. window.clearTimeout(timer);
  38971. }
  38972. function timers_clearInterval(timer) {
  38973. window.clearInterval(timer);
  38974. }
  38975. var OneOffTimer = (function (_super) {
  38976. __extends(OneOffTimer, _super);
  38977. function OneOffTimer(delay, callback) {
  38978. return _super.call(this, setTimeout, timers_clearTimeout, delay, function (timer) {
  38979. callback();
  38980. return null;
  38981. }) || this;
  38982. }
  38983. return OneOffTimer;
  38984. }(abstract_timer));
  38985. var PeriodicTimer = (function (_super) {
  38986. __extends(PeriodicTimer, _super);
  38987. function PeriodicTimer(delay, callback) {
  38988. return _super.call(this, setInterval, timers_clearInterval, delay, function (timer) {
  38989. callback();
  38990. return timer;
  38991. }) || this;
  38992. }
  38993. return PeriodicTimer;
  38994. }(abstract_timer));
  38995. // CONCATENATED MODULE: ./src/core/util.ts
  38996. var Util = {
  38997. now: function () {
  38998. if (Date.now) {
  38999. return Date.now();
  39000. }
  39001. else {
  39002. return new Date().valueOf();
  39003. }
  39004. },
  39005. defer: function (callback) {
  39006. return new OneOffTimer(0, callback);
  39007. },
  39008. method: function (name) {
  39009. var args = [];
  39010. for (var _i = 1; _i < arguments.length; _i++) {
  39011. args[_i - 1] = arguments[_i];
  39012. }
  39013. var boundArguments = Array.prototype.slice.call(arguments, 1);
  39014. return function (object) {
  39015. return object[name].apply(object, boundArguments.concat(arguments));
  39016. };
  39017. }
  39018. };
  39019. /* harmony default export */ var util = (Util);
  39020. // CONCATENATED MODULE: ./src/core/utils/collections.ts
  39021. function extend(target) {
  39022. var sources = [];
  39023. for (var _i = 1; _i < arguments.length; _i++) {
  39024. sources[_i - 1] = arguments[_i];
  39025. }
  39026. for (var i = 0; i < sources.length; i++) {
  39027. var extensions = sources[i];
  39028. for (var property in extensions) {
  39029. if (extensions[property] && extensions[property].constructor &&
  39030. extensions[property].constructor === Object) {
  39031. target[property] = extend(target[property] || {}, extensions[property]);
  39032. }
  39033. else {
  39034. target[property] = extensions[property];
  39035. }
  39036. }
  39037. }
  39038. return target;
  39039. }
  39040. function stringify() {
  39041. var m = ["Pusher"];
  39042. for (var i = 0; i < arguments.length; i++) {
  39043. if (typeof arguments[i] === "string") {
  39044. m.push(arguments[i]);
  39045. }
  39046. else {
  39047. m.push(safeJSONStringify(arguments[i]));
  39048. }
  39049. }
  39050. return m.join(" : ");
  39051. }
  39052. function arrayIndexOf(array, item) {
  39053. var nativeIndexOf = Array.prototype.indexOf;
  39054. if (array === null) {
  39055. return -1;
  39056. }
  39057. if (nativeIndexOf && array.indexOf === nativeIndexOf) {
  39058. return array.indexOf(item);
  39059. }
  39060. for (var i = 0, l = array.length; i < l; i++) {
  39061. if (array[i] === item) {
  39062. return i;
  39063. }
  39064. }
  39065. return -1;
  39066. }
  39067. function objectApply(object, f) {
  39068. for (var key in object) {
  39069. if (Object.prototype.hasOwnProperty.call(object, key)) {
  39070. f(object[key], key, object);
  39071. }
  39072. }
  39073. }
  39074. function keys(object) {
  39075. var keys = [];
  39076. objectApply(object, function (_, key) {
  39077. keys.push(key);
  39078. });
  39079. return keys;
  39080. }
  39081. function values(object) {
  39082. var values = [];
  39083. objectApply(object, function (value) {
  39084. values.push(value);
  39085. });
  39086. return values;
  39087. }
  39088. function apply(array, f, context) {
  39089. for (var i = 0; i < array.length; i++) {
  39090. f.call(context || window, array[i], i, array);
  39091. }
  39092. }
  39093. function map(array, f) {
  39094. var result = [];
  39095. for (var i = 0; i < array.length; i++) {
  39096. result.push(f(array[i], i, array, result));
  39097. }
  39098. return result;
  39099. }
  39100. function mapObject(object, f) {
  39101. var result = {};
  39102. objectApply(object, function (value, key) {
  39103. result[key] = f(value);
  39104. });
  39105. return result;
  39106. }
  39107. function filter(array, test) {
  39108. test = test || function (value) { return !!value; };
  39109. var result = [];
  39110. for (var i = 0; i < array.length; i++) {
  39111. if (test(array[i], i, array, result)) {
  39112. result.push(array[i]);
  39113. }
  39114. }
  39115. return result;
  39116. }
  39117. function filterObject(object, test) {
  39118. var result = {};
  39119. objectApply(object, function (value, key) {
  39120. if ((test && test(value, key, object, result)) || Boolean(value)) {
  39121. result[key] = value;
  39122. }
  39123. });
  39124. return result;
  39125. }
  39126. function flatten(object) {
  39127. var result = [];
  39128. objectApply(object, function (value, key) {
  39129. result.push([key, value]);
  39130. });
  39131. return result;
  39132. }
  39133. function any(array, test) {
  39134. for (var i = 0; i < array.length; i++) {
  39135. if (test(array[i], i, array)) {
  39136. return true;
  39137. }
  39138. }
  39139. return false;
  39140. }
  39141. function collections_all(array, test) {
  39142. for (var i = 0; i < array.length; i++) {
  39143. if (!test(array[i], i, array)) {
  39144. return false;
  39145. }
  39146. }
  39147. return true;
  39148. }
  39149. function encodeParamsObject(data) {
  39150. return mapObject(data, function (value) {
  39151. if (typeof value === "object") {
  39152. value = safeJSONStringify(value);
  39153. }
  39154. return encodeURIComponent(encode(value.toString()));
  39155. });
  39156. }
  39157. function buildQueryString(data) {
  39158. var params = filterObject(data, function (value) {
  39159. return value !== undefined;
  39160. });
  39161. var query = map(flatten(encodeParamsObject(params)), util.method("join", "=")).join("&");
  39162. return query;
  39163. }
  39164. function decycleObject(object) {
  39165. var objects = [], paths = [];
  39166. return (function derez(value, path) {
  39167. var i, name, nu;
  39168. switch (typeof value) {
  39169. case 'object':
  39170. if (!value) {
  39171. return null;
  39172. }
  39173. for (i = 0; i < objects.length; i += 1) {
  39174. if (objects[i] === value) {
  39175. return { $ref: paths[i] };
  39176. }
  39177. }
  39178. objects.push(value);
  39179. paths.push(path);
  39180. if (Object.prototype.toString.apply(value) === '[object Array]') {
  39181. nu = [];
  39182. for (i = 0; i < value.length; i += 1) {
  39183. nu[i] = derez(value[i], path + '[' + i + ']');
  39184. }
  39185. }
  39186. else {
  39187. nu = {};
  39188. for (name in value) {
  39189. if (Object.prototype.hasOwnProperty.call(value, name)) {
  39190. nu[name] = derez(value[name], path + '[' + JSON.stringify(name) + ']');
  39191. }
  39192. }
  39193. }
  39194. return nu;
  39195. case 'number':
  39196. case 'string':
  39197. case 'boolean':
  39198. return value;
  39199. }
  39200. }(object, '$'));
  39201. }
  39202. function safeJSONStringify(source) {
  39203. try {
  39204. return JSON.stringify(source);
  39205. }
  39206. catch (e) {
  39207. return JSON.stringify(decycleObject(source));
  39208. }
  39209. }
  39210. // CONCATENATED MODULE: ./src/core/logger.ts
  39211. var logger_Logger = (function () {
  39212. function Logger() {
  39213. this.globalLog = function (message) {
  39214. if (window.console && window.console.log) {
  39215. window.console.log(message);
  39216. }
  39217. };
  39218. }
  39219. Logger.prototype.debug = function () {
  39220. var args = [];
  39221. for (var _i = 0; _i < arguments.length; _i++) {
  39222. args[_i] = arguments[_i];
  39223. }
  39224. this.log(this.globalLog, args);
  39225. };
  39226. Logger.prototype.warn = function () {
  39227. var args = [];
  39228. for (var _i = 0; _i < arguments.length; _i++) {
  39229. args[_i] = arguments[_i];
  39230. }
  39231. this.log(this.globalLogWarn, args);
  39232. };
  39233. Logger.prototype.error = function () {
  39234. var args = [];
  39235. for (var _i = 0; _i < arguments.length; _i++) {
  39236. args[_i] = arguments[_i];
  39237. }
  39238. this.log(this.globalLogError, args);
  39239. };
  39240. Logger.prototype.globalLogWarn = function (message) {
  39241. if (window.console && window.console.warn) {
  39242. window.console.warn(message);
  39243. }
  39244. else {
  39245. this.globalLog(message);
  39246. }
  39247. };
  39248. Logger.prototype.globalLogError = function (message) {
  39249. if (window.console && window.console.error) {
  39250. window.console.error(message);
  39251. }
  39252. else {
  39253. this.globalLogWarn(message);
  39254. }
  39255. };
  39256. Logger.prototype.log = function (defaultLoggingFunction) {
  39257. var args = [];
  39258. for (var _i = 1; _i < arguments.length; _i++) {
  39259. args[_i - 1] = arguments[_i];
  39260. }
  39261. var message = stringify.apply(this, arguments);
  39262. if (core_pusher.log) {
  39263. core_pusher.log(message);
  39264. }
  39265. else if (core_pusher.logToConsole) {
  39266. var log = defaultLoggingFunction.bind(this);
  39267. log(message);
  39268. }
  39269. };
  39270. return Logger;
  39271. }());
  39272. /* harmony default export */ var logger = (new logger_Logger());
  39273. // CONCATENATED MODULE: ./src/core/utils/url_store.ts
  39274. var urlStore = {
  39275. baseUrl: "https://pusher.com",
  39276. urls: {
  39277. authenticationEndpoint: {
  39278. path: "/docs/authenticating_users",
  39279. },
  39280. javascriptQuickStart: {
  39281. path: "/docs/javascript_quick_start"
  39282. },
  39283. triggeringClientEvents: {
  39284. path: "/docs/client_api_guide/client_events#trigger-events"
  39285. }
  39286. }
  39287. };
  39288. var buildLogSuffix = function (key) {
  39289. var urlPrefix = "See:";
  39290. var urlObj = urlStore.urls[key];
  39291. if (!urlObj)
  39292. return "";
  39293. var url;
  39294. if (urlObj.fullUrl) {
  39295. url = urlObj.fullUrl;
  39296. }
  39297. else if (urlObj.path) {
  39298. url = urlStore.baseUrl + urlObj.path;
  39299. }
  39300. if (!url)
  39301. return "";
  39302. return urlPrefix + " " + url;
  39303. };
  39304. /* harmony default export */ var url_store = ({ buildLogSuffix: buildLogSuffix });
  39305. // CONCATENATED MODULE: ./src/runtimes/isomorphic/auth/xhr_auth.ts
  39306. var ajax = function (context, socketId, callback) {
  39307. var self = this, xhr;
  39308. xhr = runtime.createXHR();
  39309. xhr.open("POST", self.options.authEndpoint, true);
  39310. xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  39311. for (var headerName in this.authOptions.headers) {
  39312. xhr.setRequestHeader(headerName, this.authOptions.headers[headerName]);
  39313. }
  39314. xhr.onreadystatechange = function () {
  39315. if (xhr.readyState === 4) {
  39316. if (xhr.status === 200) {
  39317. var data, parsed = false;
  39318. try {
  39319. data = JSON.parse(xhr.responseText);
  39320. parsed = true;
  39321. }
  39322. catch (e) {
  39323. callback(true, 'JSON returned from auth endpoint was invalid, yet status code was 200. Data was: ' + xhr.responseText);
  39324. }
  39325. if (parsed) {
  39326. callback(false, data);
  39327. }
  39328. }
  39329. else {
  39330. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  39331. logger.error('Unable to retrieve auth string from auth endpoint - ' +
  39332. ("received status " + xhr.status + " from " + self.options.authEndpoint + ". ") +
  39333. ("Clients must be authenticated to join private or presence channels. " + suffix));
  39334. callback(true, xhr.status);
  39335. }
  39336. }
  39337. };
  39338. xhr.send(this.composeQuery(socketId));
  39339. return xhr;
  39340. };
  39341. /* harmony default export */ var xhr_auth = (ajax);
  39342. // CONCATENATED MODULE: ./src/runtimes/web/auth/jsonp_auth.ts
  39343. var jsonp = function (context, socketId, callback) {
  39344. if (this.authOptions.headers !== undefined) {
  39345. logger.warn('To send headers with the auth request, you must use AJAX, rather than JSONP.');
  39346. }
  39347. var callbackName = context.nextAuthCallbackID.toString();
  39348. context.nextAuthCallbackID++;
  39349. var document = context.getDocument();
  39350. var script = document.createElement("script");
  39351. context.auth_callbacks[callbackName] = function (data) {
  39352. callback(false, data);
  39353. };
  39354. var callback_name = "Pusher.auth_callbacks['" + callbackName + "']";
  39355. script.src = this.options.authEndpoint +
  39356. '?callback=' +
  39357. encodeURIComponent(callback_name) +
  39358. '&' +
  39359. this.composeQuery(socketId);
  39360. var head = document.getElementsByTagName("head")[0] || document.documentElement;
  39361. head.insertBefore(script, head.firstChild);
  39362. };
  39363. /* harmony default export */ var jsonp_auth = (jsonp);
  39364. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_request.ts
  39365. var ScriptRequest = (function () {
  39366. function ScriptRequest(src) {
  39367. this.src = src;
  39368. }
  39369. ScriptRequest.prototype.send = function (receiver) {
  39370. var self = this;
  39371. var errorString = "Error loading " + self.src;
  39372. self.script = document.createElement("script");
  39373. self.script.id = receiver.id;
  39374. self.script.src = self.src;
  39375. self.script.type = "text/javascript";
  39376. self.script.charset = "UTF-8";
  39377. if (self.script.addEventListener) {
  39378. self.script.onerror = function () {
  39379. receiver.callback(errorString);
  39380. };
  39381. self.script.onload = function () {
  39382. receiver.callback(null);
  39383. };
  39384. }
  39385. else {
  39386. self.script.onreadystatechange = function () {
  39387. if (self.script.readyState === 'loaded' ||
  39388. self.script.readyState === 'complete') {
  39389. receiver.callback(null);
  39390. }
  39391. };
  39392. }
  39393. if (self.script.async === undefined && document.attachEvent &&
  39394. /opera/i.test(navigator.userAgent)) {
  39395. self.errorScript = document.createElement("script");
  39396. self.errorScript.id = receiver.id + "_error";
  39397. self.errorScript.text = receiver.name + "('" + errorString + "');";
  39398. self.script.async = self.errorScript.async = false;
  39399. }
  39400. else {
  39401. self.script.async = true;
  39402. }
  39403. var head = document.getElementsByTagName('head')[0];
  39404. head.insertBefore(self.script, head.firstChild);
  39405. if (self.errorScript) {
  39406. head.insertBefore(self.errorScript, self.script.nextSibling);
  39407. }
  39408. };
  39409. ScriptRequest.prototype.cleanup = function () {
  39410. if (this.script) {
  39411. this.script.onload = this.script.onerror = null;
  39412. this.script.onreadystatechange = null;
  39413. }
  39414. if (this.script && this.script.parentNode) {
  39415. this.script.parentNode.removeChild(this.script);
  39416. }
  39417. if (this.errorScript && this.errorScript.parentNode) {
  39418. this.errorScript.parentNode.removeChild(this.errorScript);
  39419. }
  39420. this.script = null;
  39421. this.errorScript = null;
  39422. };
  39423. return ScriptRequest;
  39424. }());
  39425. /* harmony default export */ var script_request = (ScriptRequest);
  39426. // CONCATENATED MODULE: ./src/runtimes/web/dom/jsonp_request.ts
  39427. var jsonp_request_JSONPRequest = (function () {
  39428. function JSONPRequest(url, data) {
  39429. this.url = url;
  39430. this.data = data;
  39431. }
  39432. JSONPRequest.prototype.send = function (receiver) {
  39433. if (this.request) {
  39434. return;
  39435. }
  39436. var query = buildQueryString(this.data);
  39437. var url = this.url + "/" + receiver.number + "?" + query;
  39438. this.request = runtime.createScriptRequest(url);
  39439. this.request.send(receiver);
  39440. };
  39441. JSONPRequest.prototype.cleanup = function () {
  39442. if (this.request) {
  39443. this.request.cleanup();
  39444. }
  39445. };
  39446. return JSONPRequest;
  39447. }());
  39448. /* harmony default export */ var jsonp_request = (jsonp_request_JSONPRequest);
  39449. // CONCATENATED MODULE: ./src/runtimes/web/timeline/jsonp_timeline.ts
  39450. var getAgent = function (sender, useTLS) {
  39451. return function (data, callback) {
  39452. var scheme = "http" + (useTLS ? "s" : "") + "://";
  39453. var url = scheme + (sender.host || sender.options.host) + sender.options.path;
  39454. var request = runtime.createJSONPRequest(url, data);
  39455. var receiver = runtime.ScriptReceivers.create(function (error, result) {
  39456. ScriptReceivers.remove(receiver);
  39457. request.cleanup();
  39458. if (result && result.host) {
  39459. sender.host = result.host;
  39460. }
  39461. if (callback) {
  39462. callback(error, result);
  39463. }
  39464. });
  39465. request.send(receiver);
  39466. };
  39467. };
  39468. var jsonp_timeline_jsonp = {
  39469. name: 'jsonp',
  39470. getAgent: getAgent
  39471. };
  39472. /* harmony default export */ var jsonp_timeline = (jsonp_timeline_jsonp);
  39473. // CONCATENATED MODULE: ./src/core/transports/url_schemes.ts
  39474. function getGenericURL(baseScheme, params, path) {
  39475. var scheme = baseScheme + (params.useTLS ? "s" : "");
  39476. var host = params.useTLS ? params.hostTLS : params.hostNonTLS;
  39477. return scheme + "://" + host + path;
  39478. }
  39479. function getGenericPath(key, queryString) {
  39480. var path = "/app/" + key;
  39481. var query = "?protocol=" + defaults.PROTOCOL +
  39482. "&client=js" +
  39483. "&version=" + defaults.VERSION +
  39484. (queryString ? ("&" + queryString) : "");
  39485. return path + query;
  39486. }
  39487. var ws = {
  39488. getInitial: function (key, params) {
  39489. var path = (params.httpPath || "") + getGenericPath(key, "flash=false");
  39490. return getGenericURL("ws", params, path);
  39491. }
  39492. };
  39493. var http = {
  39494. getInitial: function (key, params) {
  39495. var path = (params.httpPath || "/pusher") + getGenericPath(key);
  39496. return getGenericURL("http", params, path);
  39497. }
  39498. };
  39499. var sockjs = {
  39500. getInitial: function (key, params) {
  39501. return getGenericURL("http", params, params.httpPath || "/pusher");
  39502. },
  39503. getPath: function (key, params) {
  39504. return getGenericPath(key);
  39505. }
  39506. };
  39507. // CONCATENATED MODULE: ./src/core/events/callback_registry.ts
  39508. var callback_registry_CallbackRegistry = (function () {
  39509. function CallbackRegistry() {
  39510. this._callbacks = {};
  39511. }
  39512. CallbackRegistry.prototype.get = function (name) {
  39513. return this._callbacks[prefix(name)];
  39514. };
  39515. CallbackRegistry.prototype.add = function (name, callback, context) {
  39516. var prefixedEventName = prefix(name);
  39517. this._callbacks[prefixedEventName] = this._callbacks[prefixedEventName] || [];
  39518. this._callbacks[prefixedEventName].push({
  39519. fn: callback,
  39520. context: context
  39521. });
  39522. };
  39523. CallbackRegistry.prototype.remove = function (name, callback, context) {
  39524. if (!name && !callback && !context) {
  39525. this._callbacks = {};
  39526. return;
  39527. }
  39528. var names = name ? [prefix(name)] : keys(this._callbacks);
  39529. if (callback || context) {
  39530. this.removeCallback(names, callback, context);
  39531. }
  39532. else {
  39533. this.removeAllCallbacks(names);
  39534. }
  39535. };
  39536. CallbackRegistry.prototype.removeCallback = function (names, callback, context) {
  39537. apply(names, function (name) {
  39538. this._callbacks[name] = filter(this._callbacks[name] || [], function (binding) {
  39539. return (callback && callback !== binding.fn) ||
  39540. (context && context !== binding.context);
  39541. });
  39542. if (this._callbacks[name].length === 0) {
  39543. delete this._callbacks[name];
  39544. }
  39545. }, this);
  39546. };
  39547. CallbackRegistry.prototype.removeAllCallbacks = function (names) {
  39548. apply(names, function (name) {
  39549. delete this._callbacks[name];
  39550. }, this);
  39551. };
  39552. return CallbackRegistry;
  39553. }());
  39554. /* harmony default export */ var callback_registry = (callback_registry_CallbackRegistry);
  39555. function prefix(name) {
  39556. return "_" + name;
  39557. }
  39558. // CONCATENATED MODULE: ./src/core/events/dispatcher.ts
  39559. var dispatcher_Dispatcher = (function () {
  39560. function Dispatcher(failThrough) {
  39561. this.callbacks = new callback_registry();
  39562. this.global_callbacks = [];
  39563. this.failThrough = failThrough;
  39564. }
  39565. Dispatcher.prototype.bind = function (eventName, callback, context) {
  39566. this.callbacks.add(eventName, callback, context);
  39567. return this;
  39568. };
  39569. Dispatcher.prototype.bind_global = function (callback) {
  39570. this.global_callbacks.push(callback);
  39571. return this;
  39572. };
  39573. Dispatcher.prototype.unbind = function (eventName, callback, context) {
  39574. this.callbacks.remove(eventName, callback, context);
  39575. return this;
  39576. };
  39577. Dispatcher.prototype.unbind_global = function (callback) {
  39578. if (!callback) {
  39579. this.global_callbacks = [];
  39580. return this;
  39581. }
  39582. this.global_callbacks = filter(this.global_callbacks || [], function (c) { return c !== callback; });
  39583. return this;
  39584. };
  39585. Dispatcher.prototype.unbind_all = function () {
  39586. this.unbind();
  39587. this.unbind_global();
  39588. return this;
  39589. };
  39590. Dispatcher.prototype.emit = function (eventName, data, metadata) {
  39591. for (var i = 0; i < this.global_callbacks.length; i++) {
  39592. this.global_callbacks[i](eventName, data);
  39593. }
  39594. var callbacks = this.callbacks.get(eventName);
  39595. var args = [];
  39596. if (metadata) {
  39597. args.push(data, metadata);
  39598. }
  39599. else if (data) {
  39600. args.push(data);
  39601. }
  39602. if (callbacks && callbacks.length > 0) {
  39603. for (var i = 0; i < callbacks.length; i++) {
  39604. callbacks[i].fn.apply(callbacks[i].context || window, args);
  39605. }
  39606. }
  39607. else if (this.failThrough) {
  39608. this.failThrough(eventName, data);
  39609. }
  39610. return this;
  39611. };
  39612. return Dispatcher;
  39613. }());
  39614. /* harmony default export */ var dispatcher = (dispatcher_Dispatcher);
  39615. // CONCATENATED MODULE: ./src/core/transports/transport_connection.ts
  39616. var transport_connection_extends = (undefined && undefined.__extends) || (function () {
  39617. var extendStatics = function (d, b) {
  39618. extendStatics = Object.setPrototypeOf ||
  39619. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  39620. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  39621. return extendStatics(d, b);
  39622. };
  39623. return function (d, b) {
  39624. extendStatics(d, b);
  39625. function __() { this.constructor = d; }
  39626. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  39627. };
  39628. })();
  39629. var transport_connection_TransportConnection = (function (_super) {
  39630. transport_connection_extends(TransportConnection, _super);
  39631. function TransportConnection(hooks, name, priority, key, options) {
  39632. var _this = _super.call(this) || this;
  39633. _this.initialize = runtime.transportConnectionInitializer;
  39634. _this.hooks = hooks;
  39635. _this.name = name;
  39636. _this.priority = priority;
  39637. _this.key = key;
  39638. _this.options = options;
  39639. _this.state = "new";
  39640. _this.timeline = options.timeline;
  39641. _this.activityTimeout = options.activityTimeout;
  39642. _this.id = _this.timeline.generateUniqueID();
  39643. return _this;
  39644. }
  39645. TransportConnection.prototype.handlesActivityChecks = function () {
  39646. return Boolean(this.hooks.handlesActivityChecks);
  39647. };
  39648. TransportConnection.prototype.supportsPing = function () {
  39649. return Boolean(this.hooks.supportsPing);
  39650. };
  39651. TransportConnection.prototype.connect = function () {
  39652. var _this = this;
  39653. if (this.socket || this.state !== "initialized") {
  39654. return false;
  39655. }
  39656. var url = this.hooks.urls.getInitial(this.key, this.options);
  39657. try {
  39658. this.socket = this.hooks.getSocket(url, this.options);
  39659. }
  39660. catch (e) {
  39661. util.defer(function () {
  39662. _this.onError(e);
  39663. _this.changeState("closed");
  39664. });
  39665. return false;
  39666. }
  39667. this.bindListeners();
  39668. logger.debug("Connecting", { transport: this.name, url: url });
  39669. this.changeState("connecting");
  39670. return true;
  39671. };
  39672. TransportConnection.prototype.close = function () {
  39673. if (this.socket) {
  39674. this.socket.close();
  39675. return true;
  39676. }
  39677. else {
  39678. return false;
  39679. }
  39680. };
  39681. TransportConnection.prototype.send = function (data) {
  39682. var _this = this;
  39683. if (this.state === "open") {
  39684. util.defer(function () {
  39685. if (_this.socket) {
  39686. _this.socket.send(data);
  39687. }
  39688. });
  39689. return true;
  39690. }
  39691. else {
  39692. return false;
  39693. }
  39694. };
  39695. TransportConnection.prototype.ping = function () {
  39696. if (this.state === "open" && this.supportsPing()) {
  39697. this.socket.ping();
  39698. }
  39699. };
  39700. TransportConnection.prototype.onOpen = function () {
  39701. if (this.hooks.beforeOpen) {
  39702. this.hooks.beforeOpen(this.socket, this.hooks.urls.getPath(this.key, this.options));
  39703. }
  39704. this.changeState("open");
  39705. this.socket.onopen = undefined;
  39706. };
  39707. TransportConnection.prototype.onError = function (error) {
  39708. this.emit("error", { type: 'WebSocketError', error: error });
  39709. this.timeline.error(this.buildTimelineMessage({ error: error.toString() }));
  39710. };
  39711. TransportConnection.prototype.onClose = function (closeEvent) {
  39712. if (closeEvent) {
  39713. this.changeState("closed", {
  39714. code: closeEvent.code,
  39715. reason: closeEvent.reason,
  39716. wasClean: closeEvent.wasClean
  39717. });
  39718. }
  39719. else {
  39720. this.changeState("closed");
  39721. }
  39722. this.unbindListeners();
  39723. this.socket = undefined;
  39724. };
  39725. TransportConnection.prototype.onMessage = function (message) {
  39726. this.emit("message", message);
  39727. };
  39728. TransportConnection.prototype.onActivity = function () {
  39729. this.emit("activity");
  39730. };
  39731. TransportConnection.prototype.bindListeners = function () {
  39732. var _this = this;
  39733. this.socket.onopen = function () {
  39734. _this.onOpen();
  39735. };
  39736. this.socket.onerror = function (error) {
  39737. _this.onError(error);
  39738. };
  39739. this.socket.onclose = function (closeEvent) {
  39740. _this.onClose(closeEvent);
  39741. };
  39742. this.socket.onmessage = function (message) {
  39743. _this.onMessage(message);
  39744. };
  39745. if (this.supportsPing()) {
  39746. this.socket.onactivity = function () { _this.onActivity(); };
  39747. }
  39748. };
  39749. TransportConnection.prototype.unbindListeners = function () {
  39750. if (this.socket) {
  39751. this.socket.onopen = undefined;
  39752. this.socket.onerror = undefined;
  39753. this.socket.onclose = undefined;
  39754. this.socket.onmessage = undefined;
  39755. if (this.supportsPing()) {
  39756. this.socket.onactivity = undefined;
  39757. }
  39758. }
  39759. };
  39760. TransportConnection.prototype.changeState = function (state, params) {
  39761. this.state = state;
  39762. this.timeline.info(this.buildTimelineMessage({
  39763. state: state,
  39764. params: params
  39765. }));
  39766. this.emit(state, params);
  39767. };
  39768. TransportConnection.prototype.buildTimelineMessage = function (message) {
  39769. return extend({ cid: this.id }, message);
  39770. };
  39771. return TransportConnection;
  39772. }(dispatcher));
  39773. /* harmony default export */ var transport_connection = (transport_connection_TransportConnection);
  39774. // CONCATENATED MODULE: ./src/core/transports/transport.ts
  39775. var transport_Transport = (function () {
  39776. function Transport(hooks) {
  39777. this.hooks = hooks;
  39778. }
  39779. Transport.prototype.isSupported = function (environment) {
  39780. return this.hooks.isSupported(environment);
  39781. };
  39782. Transport.prototype.createConnection = function (name, priority, key, options) {
  39783. return new transport_connection(this.hooks, name, priority, key, options);
  39784. };
  39785. return Transport;
  39786. }());
  39787. /* harmony default export */ var transports_transport = (transport_Transport);
  39788. // CONCATENATED MODULE: ./src/runtimes/isomorphic/transports/transports.ts
  39789. var WSTransport = new transports_transport({
  39790. urls: ws,
  39791. handlesActivityChecks: false,
  39792. supportsPing: false,
  39793. isInitialized: function () {
  39794. return Boolean(runtime.getWebSocketAPI());
  39795. },
  39796. isSupported: function () {
  39797. return Boolean(runtime.getWebSocketAPI());
  39798. },
  39799. getSocket: function (url) {
  39800. return runtime.createWebSocket(url);
  39801. }
  39802. });
  39803. var httpConfiguration = {
  39804. urls: http,
  39805. handlesActivityChecks: false,
  39806. supportsPing: true,
  39807. isInitialized: function () {
  39808. return true;
  39809. }
  39810. };
  39811. var streamingConfiguration = extend({ getSocket: function (url) {
  39812. return runtime.HTTPFactory.createStreamingSocket(url);
  39813. }
  39814. }, httpConfiguration);
  39815. var pollingConfiguration = extend({ getSocket: function (url) {
  39816. return runtime.HTTPFactory.createPollingSocket(url);
  39817. }
  39818. }, httpConfiguration);
  39819. var xhrConfiguration = {
  39820. isSupported: function () {
  39821. return runtime.isXHRSupported();
  39822. }
  39823. };
  39824. var XHRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xhrConfiguration));
  39825. var XHRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xhrConfiguration));
  39826. var Transports = {
  39827. ws: WSTransport,
  39828. xhr_streaming: XHRStreamingTransport,
  39829. xhr_polling: XHRPollingTransport
  39830. };
  39831. /* harmony default export */ var transports = (Transports);
  39832. // CONCATENATED MODULE: ./src/runtimes/web/transports/transports.ts
  39833. var SockJSTransport = new transports_transport({
  39834. file: "sockjs",
  39835. urls: sockjs,
  39836. handlesActivityChecks: true,
  39837. supportsPing: false,
  39838. isSupported: function () {
  39839. return true;
  39840. },
  39841. isInitialized: function () {
  39842. return window.SockJS !== undefined;
  39843. },
  39844. getSocket: function (url, options) {
  39845. return new window.SockJS(url, null, {
  39846. js_path: Dependencies.getPath("sockjs", {
  39847. useTLS: options.useTLS
  39848. }),
  39849. ignore_null_origin: options.ignoreNullOrigin
  39850. });
  39851. },
  39852. beforeOpen: function (socket, path) {
  39853. socket.send(JSON.stringify({
  39854. path: path
  39855. }));
  39856. }
  39857. });
  39858. var xdrConfiguration = {
  39859. isSupported: function (environment) {
  39860. var yes = runtime.isXDRSupported(environment.useTLS);
  39861. return yes;
  39862. }
  39863. };
  39864. var XDRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xdrConfiguration));
  39865. var XDRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xdrConfiguration));
  39866. transports.xdr_streaming = XDRStreamingTransport;
  39867. transports.xdr_polling = XDRPollingTransport;
  39868. transports.sockjs = SockJSTransport;
  39869. /* harmony default export */ var transports_transports = (transports);
  39870. // CONCATENATED MODULE: ./src/runtimes/web/net_info.ts
  39871. var net_info_extends = (undefined && undefined.__extends) || (function () {
  39872. var extendStatics = function (d, b) {
  39873. extendStatics = Object.setPrototypeOf ||
  39874. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  39875. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  39876. return extendStatics(d, b);
  39877. };
  39878. return function (d, b) {
  39879. extendStatics(d, b);
  39880. function __() { this.constructor = d; }
  39881. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  39882. };
  39883. })();
  39884. var NetInfo = (function (_super) {
  39885. net_info_extends(NetInfo, _super);
  39886. function NetInfo() {
  39887. var _this = _super.call(this) || this;
  39888. var self = _this;
  39889. if (window.addEventListener !== undefined) {
  39890. window.addEventListener("online", function () {
  39891. self.emit('online');
  39892. }, false);
  39893. window.addEventListener("offline", function () {
  39894. self.emit('offline');
  39895. }, false);
  39896. }
  39897. return _this;
  39898. }
  39899. NetInfo.prototype.isOnline = function () {
  39900. if (window.navigator.onLine === undefined) {
  39901. return true;
  39902. }
  39903. else {
  39904. return window.navigator.onLine;
  39905. }
  39906. };
  39907. return NetInfo;
  39908. }(dispatcher));
  39909. var net_info_Network = new NetInfo();
  39910. // CONCATENATED MODULE: ./src/core/transports/assistant_to_the_transport_manager.ts
  39911. var assistant_to_the_transport_manager_AssistantToTheTransportManager = (function () {
  39912. function AssistantToTheTransportManager(manager, transport, options) {
  39913. this.manager = manager;
  39914. this.transport = transport;
  39915. this.minPingDelay = options.minPingDelay;
  39916. this.maxPingDelay = options.maxPingDelay;
  39917. this.pingDelay = undefined;
  39918. }
  39919. AssistantToTheTransportManager.prototype.createConnection = function (name, priority, key, options) {
  39920. var _this = this;
  39921. options = extend({}, options, {
  39922. activityTimeout: this.pingDelay
  39923. });
  39924. var connection = this.transport.createConnection(name, priority, key, options);
  39925. var openTimestamp = null;
  39926. var onOpen = function () {
  39927. connection.unbind("open", onOpen);
  39928. connection.bind("closed", onClosed);
  39929. openTimestamp = util.now();
  39930. };
  39931. var onClosed = function (closeEvent) {
  39932. connection.unbind("closed", onClosed);
  39933. if (closeEvent.code === 1002 || closeEvent.code === 1003) {
  39934. _this.manager.reportDeath();
  39935. }
  39936. else if (!closeEvent.wasClean && openTimestamp) {
  39937. var lifespan = util.now() - openTimestamp;
  39938. if (lifespan < 2 * _this.maxPingDelay) {
  39939. _this.manager.reportDeath();
  39940. _this.pingDelay = Math.max(lifespan / 2, _this.minPingDelay);
  39941. }
  39942. }
  39943. };
  39944. connection.bind("open", onOpen);
  39945. return connection;
  39946. };
  39947. AssistantToTheTransportManager.prototype.isSupported = function (environment) {
  39948. return this.manager.isAlive() && this.transport.isSupported(environment);
  39949. };
  39950. return AssistantToTheTransportManager;
  39951. }());
  39952. /* harmony default export */ var assistant_to_the_transport_manager = (assistant_to_the_transport_manager_AssistantToTheTransportManager);
  39953. // CONCATENATED MODULE: ./src/core/connection/protocol/protocol.ts
  39954. var Protocol = {
  39955. decodeMessage: function (messageEvent) {
  39956. try {
  39957. var messageData = JSON.parse(messageEvent.data);
  39958. var pusherEventData = messageData.data;
  39959. if (typeof pusherEventData === 'string') {
  39960. try {
  39961. pusherEventData = JSON.parse(messageData.data);
  39962. }
  39963. catch (e) { }
  39964. }
  39965. var pusherEvent = {
  39966. event: messageData.event,
  39967. channel: messageData.channel,
  39968. data: pusherEventData,
  39969. };
  39970. if (messageData.user_id) {
  39971. pusherEvent.user_id = messageData.user_id;
  39972. }
  39973. return pusherEvent;
  39974. }
  39975. catch (e) {
  39976. throw { type: 'MessageParseError', error: e, data: messageEvent.data };
  39977. }
  39978. },
  39979. encodeMessage: function (event) {
  39980. return JSON.stringify(event);
  39981. },
  39982. processHandshake: function (messageEvent) {
  39983. var message = Protocol.decodeMessage(messageEvent);
  39984. if (message.event === "pusher:connection_established") {
  39985. if (!message.data.activity_timeout) {
  39986. throw "No activity timeout specified in handshake";
  39987. }
  39988. return {
  39989. action: "connected",
  39990. id: message.data.socket_id,
  39991. activityTimeout: message.data.activity_timeout * 1000
  39992. };
  39993. }
  39994. else if (message.event === "pusher:error") {
  39995. return {
  39996. action: this.getCloseAction(message.data),
  39997. error: this.getCloseError(message.data)
  39998. };
  39999. }
  40000. else {
  40001. throw "Invalid handshake";
  40002. }
  40003. },
  40004. getCloseAction: function (closeEvent) {
  40005. if (closeEvent.code < 4000) {
  40006. if (closeEvent.code >= 1002 && closeEvent.code <= 1004) {
  40007. return "backoff";
  40008. }
  40009. else {
  40010. return null;
  40011. }
  40012. }
  40013. else if (closeEvent.code === 4000) {
  40014. return "tls_only";
  40015. }
  40016. else if (closeEvent.code < 4100) {
  40017. return "refused";
  40018. }
  40019. else if (closeEvent.code < 4200) {
  40020. return "backoff";
  40021. }
  40022. else if (closeEvent.code < 4300) {
  40023. return "retry";
  40024. }
  40025. else {
  40026. return "refused";
  40027. }
  40028. },
  40029. getCloseError: function (closeEvent) {
  40030. if (closeEvent.code !== 1000 && closeEvent.code !== 1001) {
  40031. return {
  40032. type: 'PusherError',
  40033. data: {
  40034. code: closeEvent.code,
  40035. message: closeEvent.reason || closeEvent.message
  40036. }
  40037. };
  40038. }
  40039. else {
  40040. return null;
  40041. }
  40042. }
  40043. };
  40044. /* harmony default export */ var protocol_protocol = (Protocol);
  40045. // CONCATENATED MODULE: ./src/core/connection/connection.ts
  40046. var connection_extends = (undefined && undefined.__extends) || (function () {
  40047. var extendStatics = function (d, b) {
  40048. extendStatics = Object.setPrototypeOf ||
  40049. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40050. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40051. return extendStatics(d, b);
  40052. };
  40053. return function (d, b) {
  40054. extendStatics(d, b);
  40055. function __() { this.constructor = d; }
  40056. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40057. };
  40058. })();
  40059. var connection_Connection = (function (_super) {
  40060. connection_extends(Connection, _super);
  40061. function Connection(id, transport) {
  40062. var _this = _super.call(this) || this;
  40063. _this.id = id;
  40064. _this.transport = transport;
  40065. _this.activityTimeout = transport.activityTimeout;
  40066. _this.bindListeners();
  40067. return _this;
  40068. }
  40069. Connection.prototype.handlesActivityChecks = function () {
  40070. return this.transport.handlesActivityChecks();
  40071. };
  40072. Connection.prototype.send = function (data) {
  40073. return this.transport.send(data);
  40074. };
  40075. Connection.prototype.send_event = function (name, data, channel) {
  40076. var event = { event: name, data: data };
  40077. if (channel) {
  40078. event.channel = channel;
  40079. }
  40080. logger.debug('Event sent', event);
  40081. return this.send(protocol_protocol.encodeMessage(event));
  40082. };
  40083. Connection.prototype.ping = function () {
  40084. if (this.transport.supportsPing()) {
  40085. this.transport.ping();
  40086. }
  40087. else {
  40088. this.send_event('pusher:ping', {});
  40089. }
  40090. };
  40091. Connection.prototype.close = function () {
  40092. this.transport.close();
  40093. };
  40094. Connection.prototype.bindListeners = function () {
  40095. var _this = this;
  40096. var listeners = {
  40097. message: function (messageEvent) {
  40098. var pusherEvent;
  40099. try {
  40100. pusherEvent = protocol_protocol.decodeMessage(messageEvent);
  40101. }
  40102. catch (e) {
  40103. _this.emit('error', {
  40104. type: 'MessageParseError',
  40105. error: e,
  40106. data: messageEvent.data
  40107. });
  40108. }
  40109. if (pusherEvent !== undefined) {
  40110. logger.debug('Event recd', pusherEvent);
  40111. switch (pusherEvent.event) {
  40112. case 'pusher:error':
  40113. _this.emit('error', { type: 'PusherError', data: pusherEvent.data });
  40114. break;
  40115. case 'pusher:ping':
  40116. _this.emit("ping");
  40117. break;
  40118. case 'pusher:pong':
  40119. _this.emit("pong");
  40120. break;
  40121. }
  40122. _this.emit('message', pusherEvent);
  40123. }
  40124. },
  40125. activity: function () {
  40126. _this.emit("activity");
  40127. },
  40128. error: function (error) {
  40129. _this.emit("error", { type: "WebSocketError", error: error });
  40130. },
  40131. closed: function (closeEvent) {
  40132. unbindListeners();
  40133. if (closeEvent && closeEvent.code) {
  40134. _this.handleCloseEvent(closeEvent);
  40135. }
  40136. _this.transport = null;
  40137. _this.emit("closed");
  40138. }
  40139. };
  40140. var unbindListeners = function () {
  40141. objectApply(listeners, function (listener, event) {
  40142. _this.transport.unbind(event, listener);
  40143. });
  40144. };
  40145. objectApply(listeners, function (listener, event) {
  40146. _this.transport.bind(event, listener);
  40147. });
  40148. };
  40149. Connection.prototype.handleCloseEvent = function (closeEvent) {
  40150. var action = protocol_protocol.getCloseAction(closeEvent);
  40151. var error = protocol_protocol.getCloseError(closeEvent);
  40152. if (error) {
  40153. this.emit('error', error);
  40154. }
  40155. if (action) {
  40156. this.emit(action, { action: action, error: error });
  40157. }
  40158. };
  40159. return Connection;
  40160. }(dispatcher));
  40161. /* harmony default export */ var connection_connection = (connection_Connection);
  40162. // CONCATENATED MODULE: ./src/core/connection/handshake/index.ts
  40163. var handshake_Handshake = (function () {
  40164. function Handshake(transport, callback) {
  40165. this.transport = transport;
  40166. this.callback = callback;
  40167. this.bindListeners();
  40168. }
  40169. Handshake.prototype.close = function () {
  40170. this.unbindListeners();
  40171. this.transport.close();
  40172. };
  40173. Handshake.prototype.bindListeners = function () {
  40174. var _this = this;
  40175. this.onMessage = function (m) {
  40176. _this.unbindListeners();
  40177. var result;
  40178. try {
  40179. result = protocol_protocol.processHandshake(m);
  40180. }
  40181. catch (e) {
  40182. _this.finish("error", { error: e });
  40183. _this.transport.close();
  40184. return;
  40185. }
  40186. if (result.action === "connected") {
  40187. _this.finish("connected", {
  40188. connection: new connection_connection(result.id, _this.transport),
  40189. activityTimeout: result.activityTimeout
  40190. });
  40191. }
  40192. else {
  40193. _this.finish(result.action, { error: result.error });
  40194. _this.transport.close();
  40195. }
  40196. };
  40197. this.onClosed = function (closeEvent) {
  40198. _this.unbindListeners();
  40199. var action = protocol_protocol.getCloseAction(closeEvent) || "backoff";
  40200. var error = protocol_protocol.getCloseError(closeEvent);
  40201. _this.finish(action, { error: error });
  40202. };
  40203. this.transport.bind("message", this.onMessage);
  40204. this.transport.bind("closed", this.onClosed);
  40205. };
  40206. Handshake.prototype.unbindListeners = function () {
  40207. this.transport.unbind("message", this.onMessage);
  40208. this.transport.unbind("closed", this.onClosed);
  40209. };
  40210. Handshake.prototype.finish = function (action, params) {
  40211. this.callback(extend({ transport: this.transport, action: action }, params));
  40212. };
  40213. return Handshake;
  40214. }());
  40215. /* harmony default export */ var connection_handshake = (handshake_Handshake);
  40216. // CONCATENATED MODULE: ./src/core/auth/pusher_authorizer.ts
  40217. var pusher_authorizer_PusherAuthorizer = (function () {
  40218. function PusherAuthorizer(channel, options) {
  40219. this.channel = channel;
  40220. var authTransport = options.authTransport;
  40221. if (typeof runtime.getAuthorizers()[authTransport] === "undefined") {
  40222. throw "'" + authTransport + "' is not a recognized auth transport";
  40223. }
  40224. this.type = authTransport;
  40225. this.options = options;
  40226. this.authOptions = (options || {}).auth || {};
  40227. }
  40228. PusherAuthorizer.prototype.composeQuery = function (socketId) {
  40229. var query = 'socket_id=' + encodeURIComponent(socketId) +
  40230. '&channel_name=' + encodeURIComponent(this.channel.name);
  40231. for (var i in this.authOptions.params) {
  40232. query += "&" + encodeURIComponent(i) + "=" + encodeURIComponent(this.authOptions.params[i]);
  40233. }
  40234. return query;
  40235. };
  40236. PusherAuthorizer.prototype.authorize = function (socketId, callback) {
  40237. PusherAuthorizer.authorizers = PusherAuthorizer.authorizers || runtime.getAuthorizers();
  40238. return PusherAuthorizer.authorizers[this.type].call(this, runtime, socketId, callback);
  40239. };
  40240. return PusherAuthorizer;
  40241. }());
  40242. /* harmony default export */ var pusher_authorizer = (pusher_authorizer_PusherAuthorizer);
  40243. // CONCATENATED MODULE: ./src/core/timeline/timeline_sender.ts
  40244. var timeline_sender_TimelineSender = (function () {
  40245. function TimelineSender(timeline, options) {
  40246. this.timeline = timeline;
  40247. this.options = options || {};
  40248. }
  40249. TimelineSender.prototype.send = function (useTLS, callback) {
  40250. if (this.timeline.isEmpty()) {
  40251. return;
  40252. }
  40253. this.timeline.send(runtime.TimelineTransport.getAgent(this, useTLS), callback);
  40254. };
  40255. return TimelineSender;
  40256. }());
  40257. /* harmony default export */ var timeline_sender = (timeline_sender_TimelineSender);
  40258. // CONCATENATED MODULE: ./src/core/errors.ts
  40259. var errors_extends = (undefined && undefined.__extends) || (function () {
  40260. var extendStatics = function (d, b) {
  40261. extendStatics = Object.setPrototypeOf ||
  40262. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40263. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40264. return extendStatics(d, b);
  40265. };
  40266. return function (d, b) {
  40267. extendStatics(d, b);
  40268. function __() { this.constructor = d; }
  40269. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40270. };
  40271. })();
  40272. var BadEventName = (function (_super) {
  40273. errors_extends(BadEventName, _super);
  40274. function BadEventName(msg) {
  40275. var _newTarget = this.constructor;
  40276. var _this = _super.call(this, msg) || this;
  40277. Object.setPrototypeOf(_this, _newTarget.prototype);
  40278. return _this;
  40279. }
  40280. return BadEventName;
  40281. }(Error));
  40282. var RequestTimedOut = (function (_super) {
  40283. errors_extends(RequestTimedOut, _super);
  40284. function RequestTimedOut(msg) {
  40285. var _newTarget = this.constructor;
  40286. var _this = _super.call(this, msg) || this;
  40287. Object.setPrototypeOf(_this, _newTarget.prototype);
  40288. return _this;
  40289. }
  40290. return RequestTimedOut;
  40291. }(Error));
  40292. var TransportPriorityTooLow = (function (_super) {
  40293. errors_extends(TransportPriorityTooLow, _super);
  40294. function TransportPriorityTooLow(msg) {
  40295. var _newTarget = this.constructor;
  40296. var _this = _super.call(this, msg) || this;
  40297. Object.setPrototypeOf(_this, _newTarget.prototype);
  40298. return _this;
  40299. }
  40300. return TransportPriorityTooLow;
  40301. }(Error));
  40302. var TransportClosed = (function (_super) {
  40303. errors_extends(TransportClosed, _super);
  40304. function TransportClosed(msg) {
  40305. var _newTarget = this.constructor;
  40306. var _this = _super.call(this, msg) || this;
  40307. Object.setPrototypeOf(_this, _newTarget.prototype);
  40308. return _this;
  40309. }
  40310. return TransportClosed;
  40311. }(Error));
  40312. var UnsupportedFeature = (function (_super) {
  40313. errors_extends(UnsupportedFeature, _super);
  40314. function UnsupportedFeature(msg) {
  40315. var _newTarget = this.constructor;
  40316. var _this = _super.call(this, msg) || this;
  40317. Object.setPrototypeOf(_this, _newTarget.prototype);
  40318. return _this;
  40319. }
  40320. return UnsupportedFeature;
  40321. }(Error));
  40322. var UnsupportedTransport = (function (_super) {
  40323. errors_extends(UnsupportedTransport, _super);
  40324. function UnsupportedTransport(msg) {
  40325. var _newTarget = this.constructor;
  40326. var _this = _super.call(this, msg) || this;
  40327. Object.setPrototypeOf(_this, _newTarget.prototype);
  40328. return _this;
  40329. }
  40330. return UnsupportedTransport;
  40331. }(Error));
  40332. var UnsupportedStrategy = (function (_super) {
  40333. errors_extends(UnsupportedStrategy, _super);
  40334. function UnsupportedStrategy(msg) {
  40335. var _newTarget = this.constructor;
  40336. var _this = _super.call(this, msg) || this;
  40337. Object.setPrototypeOf(_this, _newTarget.prototype);
  40338. return _this;
  40339. }
  40340. return UnsupportedStrategy;
  40341. }(Error));
  40342. // CONCATENATED MODULE: ./src/core/channels/channel.ts
  40343. var channel_extends = (undefined && undefined.__extends) || (function () {
  40344. var extendStatics = function (d, b) {
  40345. extendStatics = Object.setPrototypeOf ||
  40346. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40347. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40348. return extendStatics(d, b);
  40349. };
  40350. return function (d, b) {
  40351. extendStatics(d, b);
  40352. function __() { this.constructor = d; }
  40353. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40354. };
  40355. })();
  40356. var channel_Channel = (function (_super) {
  40357. channel_extends(Channel, _super);
  40358. function Channel(name, pusher) {
  40359. var _this = _super.call(this, function (event, data) {
  40360. logger.debug('No callbacks on ' + name + ' for ' + event);
  40361. }) || this;
  40362. _this.name = name;
  40363. _this.pusher = pusher;
  40364. _this.subscribed = false;
  40365. _this.subscriptionPending = false;
  40366. _this.subscriptionCancelled = false;
  40367. return _this;
  40368. }
  40369. Channel.prototype.authorize = function (socketId, callback) {
  40370. return callback(false, {});
  40371. };
  40372. Channel.prototype.trigger = function (event, data) {
  40373. if (event.indexOf("client-") !== 0) {
  40374. throw new BadEventName("Event '" + event + "' does not start with 'client-'");
  40375. }
  40376. if (!this.subscribed) {
  40377. var suffix = url_store.buildLogSuffix("triggeringClientEvents");
  40378. logger.warn("Client event triggered before channel 'subscription_succeeded' event . " + suffix);
  40379. }
  40380. return this.pusher.send_event(event, data, this.name);
  40381. };
  40382. Channel.prototype.disconnect = function () {
  40383. this.subscribed = false;
  40384. this.subscriptionPending = false;
  40385. };
  40386. Channel.prototype.handleEvent = function (event) {
  40387. var eventName = event.event;
  40388. var data = event.data;
  40389. if (eventName === "pusher_internal:subscription_succeeded") {
  40390. this.handleSubscriptionSucceededEvent(event);
  40391. }
  40392. else if (eventName.indexOf("pusher_internal:") !== 0) {
  40393. var metadata = {};
  40394. this.emit(eventName, data, metadata);
  40395. }
  40396. };
  40397. Channel.prototype.handleSubscriptionSucceededEvent = function (event) {
  40398. this.subscriptionPending = false;
  40399. this.subscribed = true;
  40400. if (this.subscriptionCancelled) {
  40401. this.pusher.unsubscribe(this.name);
  40402. }
  40403. else {
  40404. this.emit("pusher:subscription_succeeded", event.data);
  40405. }
  40406. };
  40407. Channel.prototype.subscribe = function () {
  40408. var _this = this;
  40409. if (this.subscribed) {
  40410. return;
  40411. }
  40412. this.subscriptionPending = true;
  40413. this.subscriptionCancelled = false;
  40414. this.authorize(this.pusher.connection.socket_id, function (error, data) {
  40415. if (error) {
  40416. logger.error(data);
  40417. _this.emit('pusher:subscription_error', data);
  40418. }
  40419. else {
  40420. _this.pusher.send_event('pusher:subscribe', {
  40421. auth: data.auth,
  40422. channel_data: data.channel_data,
  40423. channel: _this.name
  40424. });
  40425. }
  40426. });
  40427. };
  40428. Channel.prototype.unsubscribe = function () {
  40429. this.subscribed = false;
  40430. this.pusher.send_event('pusher:unsubscribe', {
  40431. channel: this.name
  40432. });
  40433. };
  40434. Channel.prototype.cancelSubscription = function () {
  40435. this.subscriptionCancelled = true;
  40436. };
  40437. Channel.prototype.reinstateSubscription = function () {
  40438. this.subscriptionCancelled = false;
  40439. };
  40440. return Channel;
  40441. }(dispatcher));
  40442. /* harmony default export */ var channels_channel = (channel_Channel);
  40443. // CONCATENATED MODULE: ./src/core/channels/private_channel.ts
  40444. var private_channel_extends = (undefined && undefined.__extends) || (function () {
  40445. var extendStatics = function (d, b) {
  40446. extendStatics = Object.setPrototypeOf ||
  40447. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40448. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40449. return extendStatics(d, b);
  40450. };
  40451. return function (d, b) {
  40452. extendStatics(d, b);
  40453. function __() { this.constructor = d; }
  40454. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40455. };
  40456. })();
  40457. var private_channel_PrivateChannel = (function (_super) {
  40458. private_channel_extends(PrivateChannel, _super);
  40459. function PrivateChannel() {
  40460. return _super !== null && _super.apply(this, arguments) || this;
  40461. }
  40462. PrivateChannel.prototype.authorize = function (socketId, callback) {
  40463. var authorizer = factory.createAuthorizer(this, this.pusher.config);
  40464. return authorizer.authorize(socketId, callback);
  40465. };
  40466. return PrivateChannel;
  40467. }(channels_channel));
  40468. /* harmony default export */ var private_channel = (private_channel_PrivateChannel);
  40469. // CONCATENATED MODULE: ./src/core/channels/members.ts
  40470. var members_Members = (function () {
  40471. function Members() {
  40472. this.reset();
  40473. }
  40474. Members.prototype.get = function (id) {
  40475. if (Object.prototype.hasOwnProperty.call(this.members, id)) {
  40476. return {
  40477. id: id,
  40478. info: this.members[id]
  40479. };
  40480. }
  40481. else {
  40482. return null;
  40483. }
  40484. };
  40485. Members.prototype.each = function (callback) {
  40486. var _this = this;
  40487. objectApply(this.members, function (member, id) {
  40488. callback(_this.get(id));
  40489. });
  40490. };
  40491. Members.prototype.setMyID = function (id) {
  40492. this.myID = id;
  40493. };
  40494. Members.prototype.onSubscription = function (subscriptionData) {
  40495. this.members = subscriptionData.presence.hash;
  40496. this.count = subscriptionData.presence.count;
  40497. this.me = this.get(this.myID);
  40498. };
  40499. Members.prototype.addMember = function (memberData) {
  40500. if (this.get(memberData.user_id) === null) {
  40501. this.count++;
  40502. }
  40503. this.members[memberData.user_id] = memberData.user_info;
  40504. return this.get(memberData.user_id);
  40505. };
  40506. Members.prototype.removeMember = function (memberData) {
  40507. var member = this.get(memberData.user_id);
  40508. if (member) {
  40509. delete this.members[memberData.user_id];
  40510. this.count--;
  40511. }
  40512. return member;
  40513. };
  40514. Members.prototype.reset = function () {
  40515. this.members = {};
  40516. this.count = 0;
  40517. this.myID = null;
  40518. this.me = null;
  40519. };
  40520. return Members;
  40521. }());
  40522. /* harmony default export */ var members = (members_Members);
  40523. // CONCATENATED MODULE: ./src/core/channels/presence_channel.ts
  40524. var presence_channel_extends = (undefined && undefined.__extends) || (function () {
  40525. var extendStatics = function (d, b) {
  40526. extendStatics = Object.setPrototypeOf ||
  40527. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40528. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40529. return extendStatics(d, b);
  40530. };
  40531. return function (d, b) {
  40532. extendStatics(d, b);
  40533. function __() { this.constructor = d; }
  40534. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40535. };
  40536. })();
  40537. var presence_channel_PresenceChannel = (function (_super) {
  40538. presence_channel_extends(PresenceChannel, _super);
  40539. function PresenceChannel(name, pusher) {
  40540. var _this = _super.call(this, name, pusher) || this;
  40541. _this.members = new members();
  40542. return _this;
  40543. }
  40544. PresenceChannel.prototype.authorize = function (socketId, callback) {
  40545. var _this = this;
  40546. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  40547. if (!error) {
  40548. if (authData.channel_data === undefined) {
  40549. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  40550. logger.error("Invalid auth response for channel '" + _this.name + "'," +
  40551. ("expected 'channel_data' field. " + suffix));
  40552. callback("Invalid auth response");
  40553. return;
  40554. }
  40555. var channelData = JSON.parse(authData.channel_data);
  40556. _this.members.setMyID(channelData.user_id);
  40557. }
  40558. callback(error, authData);
  40559. });
  40560. };
  40561. PresenceChannel.prototype.handleEvent = function (event) {
  40562. var eventName = event.event;
  40563. if (eventName.indexOf("pusher_internal:") === 0) {
  40564. this.handleInternalEvent(event);
  40565. }
  40566. else {
  40567. var data = event.data;
  40568. var metadata = {};
  40569. if (event.user_id) {
  40570. metadata.user_id = event.user_id;
  40571. }
  40572. this.emit(eventName, data, metadata);
  40573. }
  40574. };
  40575. PresenceChannel.prototype.handleInternalEvent = function (event) {
  40576. var eventName = event.event;
  40577. var data = event.data;
  40578. switch (eventName) {
  40579. case "pusher_internal:subscription_succeeded":
  40580. this.handleSubscriptionSucceededEvent(event);
  40581. break;
  40582. case "pusher_internal:member_added":
  40583. var addedMember = this.members.addMember(data);
  40584. this.emit('pusher:member_added', addedMember);
  40585. break;
  40586. case "pusher_internal:member_removed":
  40587. var removedMember = this.members.removeMember(data);
  40588. if (removedMember) {
  40589. this.emit('pusher:member_removed', removedMember);
  40590. }
  40591. break;
  40592. }
  40593. };
  40594. PresenceChannel.prototype.handleSubscriptionSucceededEvent = function (event) {
  40595. this.subscriptionPending = false;
  40596. this.subscribed = true;
  40597. if (this.subscriptionCancelled) {
  40598. this.pusher.unsubscribe(this.name);
  40599. }
  40600. else {
  40601. this.members.onSubscription(event.data);
  40602. this.emit("pusher:subscription_succeeded", this.members);
  40603. }
  40604. };
  40605. PresenceChannel.prototype.disconnect = function () {
  40606. this.members.reset();
  40607. _super.prototype.disconnect.call(this);
  40608. };
  40609. return PresenceChannel;
  40610. }(private_channel));
  40611. /* harmony default export */ var presence_channel = (presence_channel_PresenceChannel);
  40612. // EXTERNAL MODULE: ./node_modules/tweetnacl/nacl-fast.js
  40613. var nacl_fast = __webpack_require__(0);
  40614. // EXTERNAL MODULE: ./node_modules/tweetnacl-util/nacl-util.js
  40615. var nacl_util = __webpack_require__(1);
  40616. // CONCATENATED MODULE: ./src/core/channels/encrypted_channel.ts
  40617. var encrypted_channel_extends = (undefined && undefined.__extends) || (function () {
  40618. var extendStatics = function (d, b) {
  40619. extendStatics = Object.setPrototypeOf ||
  40620. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40621. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40622. return extendStatics(d, b);
  40623. };
  40624. return function (d, b) {
  40625. extendStatics(d, b);
  40626. function __() { this.constructor = d; }
  40627. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40628. };
  40629. })();
  40630. var encrypted_channel_EncryptedChannel = (function (_super) {
  40631. encrypted_channel_extends(EncryptedChannel, _super);
  40632. function EncryptedChannel() {
  40633. var _this = _super !== null && _super.apply(this, arguments) || this;
  40634. _this.key = null;
  40635. return _this;
  40636. }
  40637. EncryptedChannel.prototype.authorize = function (socketId, callback) {
  40638. var _this = this;
  40639. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  40640. if (error) {
  40641. callback(true, authData);
  40642. return;
  40643. }
  40644. var sharedSecret = authData["shared_secret"];
  40645. if (!sharedSecret) {
  40646. var errorMsg = "No shared_secret key in auth payload for encrypted channel: " + _this.name;
  40647. callback(true, errorMsg);
  40648. return;
  40649. }
  40650. _this.key = Object(nacl_util["decodeBase64"])(sharedSecret);
  40651. delete authData["shared_secret"];
  40652. callback(false, authData);
  40653. });
  40654. };
  40655. EncryptedChannel.prototype.trigger = function (event, data) {
  40656. throw new UnsupportedFeature('Client events are not currently supported for encrypted channels');
  40657. };
  40658. EncryptedChannel.prototype.handleEvent = function (event) {
  40659. var eventName = event.event;
  40660. var data = event.data;
  40661. if (eventName.indexOf("pusher_internal:") === 0 || eventName.indexOf("pusher:") === 0) {
  40662. _super.prototype.handleEvent.call(this, event);
  40663. return;
  40664. }
  40665. this.handleEncryptedEvent(eventName, data);
  40666. };
  40667. EncryptedChannel.prototype.handleEncryptedEvent = function (event, data) {
  40668. var _this = this;
  40669. if (!this.key) {
  40670. logger.debug('Received encrypted event before key has been retrieved from the authEndpoint');
  40671. return;
  40672. }
  40673. if (!data.ciphertext || !data.nonce) {
  40674. logger.error('Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: ' + data);
  40675. return;
  40676. }
  40677. var cipherText = Object(nacl_util["decodeBase64"])(data.ciphertext);
  40678. if (cipherText.length < nacl_fast["secretbox"].overheadLength) {
  40679. logger.error("Expected encrypted event ciphertext length to be " + nacl_fast["secretbox"].overheadLength + ", got: " + cipherText.length);
  40680. return;
  40681. }
  40682. var nonce = Object(nacl_util["decodeBase64"])(data.nonce);
  40683. if (nonce.length < nacl_fast["secretbox"].nonceLength) {
  40684. logger.error("Expected encrypted event nonce length to be " + nacl_fast["secretbox"].nonceLength + ", got: " + nonce.length);
  40685. return;
  40686. }
  40687. var bytes = nacl_fast["secretbox"].open(cipherText, nonce, this.key);
  40688. if (bytes === null) {
  40689. logger.debug('Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint...');
  40690. this.authorize(this.pusher.connection.socket_id, function (error, authData) {
  40691. if (error) {
  40692. logger.error("Failed to make a request to the authEndpoint: " + authData + ". Unable to fetch new key, so dropping encrypted event");
  40693. return;
  40694. }
  40695. bytes = nacl_fast["secretbox"].open(cipherText, nonce, _this.key);
  40696. if (bytes === null) {
  40697. logger.error("Failed to decrypt event with new key. Dropping encrypted event");
  40698. return;
  40699. }
  40700. _this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  40701. return;
  40702. });
  40703. return;
  40704. }
  40705. this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  40706. };
  40707. EncryptedChannel.prototype.emitJSON = function (eventName, data) {
  40708. try {
  40709. this.emit(eventName, JSON.parse(data));
  40710. }
  40711. catch (e) {
  40712. this.emit(eventName, data);
  40713. }
  40714. return this;
  40715. };
  40716. return EncryptedChannel;
  40717. }(private_channel));
  40718. /* harmony default export */ var encrypted_channel = (encrypted_channel_EncryptedChannel);
  40719. // CONCATENATED MODULE: ./src/core/connection/connection_manager.ts
  40720. var connection_manager_extends = (undefined && undefined.__extends) || (function () {
  40721. var extendStatics = function (d, b) {
  40722. extendStatics = Object.setPrototypeOf ||
  40723. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40724. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40725. return extendStatics(d, b);
  40726. };
  40727. return function (d, b) {
  40728. extendStatics(d, b);
  40729. function __() { this.constructor = d; }
  40730. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40731. };
  40732. })();
  40733. var connection_manager_ConnectionManager = (function (_super) {
  40734. connection_manager_extends(ConnectionManager, _super);
  40735. function ConnectionManager(key, options) {
  40736. var _this = _super.call(this) || this;
  40737. _this.key = key;
  40738. _this.options = options || {};
  40739. _this.state = "initialized";
  40740. _this.connection = null;
  40741. _this.usingTLS = !!options.useTLS;
  40742. _this.timeline = _this.options.timeline;
  40743. _this.errorCallbacks = _this.buildErrorCallbacks();
  40744. _this.connectionCallbacks = _this.buildConnectionCallbacks(_this.errorCallbacks);
  40745. _this.handshakeCallbacks = _this.buildHandshakeCallbacks(_this.errorCallbacks);
  40746. var Network = runtime.getNetwork();
  40747. Network.bind("online", function () {
  40748. _this.timeline.info({ netinfo: "online" });
  40749. if (_this.state === "connecting" || _this.state === "unavailable") {
  40750. _this.retryIn(0);
  40751. }
  40752. });
  40753. Network.bind("offline", function () {
  40754. _this.timeline.info({ netinfo: "offline" });
  40755. if (_this.connection) {
  40756. _this.sendActivityCheck();
  40757. }
  40758. });
  40759. _this.updateStrategy();
  40760. return _this;
  40761. }
  40762. ConnectionManager.prototype.connect = function () {
  40763. if (this.connection || this.runner) {
  40764. return;
  40765. }
  40766. if (!this.strategy.isSupported()) {
  40767. this.updateState("failed");
  40768. return;
  40769. }
  40770. this.updateState("connecting");
  40771. this.startConnecting();
  40772. this.setUnavailableTimer();
  40773. };
  40774. ;
  40775. ConnectionManager.prototype.send = function (data) {
  40776. if (this.connection) {
  40777. return this.connection.send(data);
  40778. }
  40779. else {
  40780. return false;
  40781. }
  40782. };
  40783. ;
  40784. ConnectionManager.prototype.send_event = function (name, data, channel) {
  40785. if (this.connection) {
  40786. return this.connection.send_event(name, data, channel);
  40787. }
  40788. else {
  40789. return false;
  40790. }
  40791. };
  40792. ;
  40793. ConnectionManager.prototype.disconnect = function () {
  40794. this.disconnectInternally();
  40795. this.updateState("disconnected");
  40796. };
  40797. ;
  40798. ConnectionManager.prototype.isUsingTLS = function () {
  40799. return this.usingTLS;
  40800. };
  40801. ;
  40802. ConnectionManager.prototype.startConnecting = function () {
  40803. var _this = this;
  40804. var callback = function (error, handshake) {
  40805. if (error) {
  40806. _this.runner = _this.strategy.connect(0, callback);
  40807. }
  40808. else {
  40809. if (handshake.action === "error") {
  40810. _this.emit("error", { type: "HandshakeError", error: handshake.error });
  40811. _this.timeline.error({ handshakeError: handshake.error });
  40812. }
  40813. else {
  40814. _this.abortConnecting();
  40815. _this.handshakeCallbacks[handshake.action](handshake);
  40816. }
  40817. }
  40818. };
  40819. this.runner = this.strategy.connect(0, callback);
  40820. };
  40821. ;
  40822. ConnectionManager.prototype.abortConnecting = function () {
  40823. if (this.runner) {
  40824. this.runner.abort();
  40825. this.runner = null;
  40826. }
  40827. };
  40828. ;
  40829. ConnectionManager.prototype.disconnectInternally = function () {
  40830. this.abortConnecting();
  40831. this.clearRetryTimer();
  40832. this.clearUnavailableTimer();
  40833. if (this.connection) {
  40834. var connection = this.abandonConnection();
  40835. connection.close();
  40836. }
  40837. };
  40838. ;
  40839. ConnectionManager.prototype.updateStrategy = function () {
  40840. this.strategy = this.options.getStrategy({
  40841. key: this.key,
  40842. timeline: this.timeline,
  40843. useTLS: this.usingTLS
  40844. });
  40845. };
  40846. ;
  40847. ConnectionManager.prototype.retryIn = function (delay) {
  40848. var _this = this;
  40849. this.timeline.info({ action: "retry", delay: delay });
  40850. if (delay > 0) {
  40851. this.emit("connecting_in", Math.round(delay / 1000));
  40852. }
  40853. this.retryTimer = new OneOffTimer(delay || 0, function () {
  40854. _this.disconnectInternally();
  40855. _this.connect();
  40856. });
  40857. };
  40858. ;
  40859. ConnectionManager.prototype.clearRetryTimer = function () {
  40860. if (this.retryTimer) {
  40861. this.retryTimer.ensureAborted();
  40862. this.retryTimer = null;
  40863. }
  40864. };
  40865. ;
  40866. ConnectionManager.prototype.setUnavailableTimer = function () {
  40867. var _this = this;
  40868. this.unavailableTimer = new OneOffTimer(this.options.unavailableTimeout, function () {
  40869. _this.updateState("unavailable");
  40870. });
  40871. };
  40872. ;
  40873. ConnectionManager.prototype.clearUnavailableTimer = function () {
  40874. if (this.unavailableTimer) {
  40875. this.unavailableTimer.ensureAborted();
  40876. }
  40877. };
  40878. ;
  40879. ConnectionManager.prototype.sendActivityCheck = function () {
  40880. var _this = this;
  40881. this.stopActivityCheck();
  40882. this.connection.ping();
  40883. this.activityTimer = new OneOffTimer(this.options.pongTimeout, function () {
  40884. _this.timeline.error({ pong_timed_out: _this.options.pongTimeout });
  40885. _this.retryIn(0);
  40886. });
  40887. };
  40888. ;
  40889. ConnectionManager.prototype.resetActivityCheck = function () {
  40890. var _this = this;
  40891. this.stopActivityCheck();
  40892. if (this.connection && !this.connection.handlesActivityChecks()) {
  40893. this.activityTimer = new OneOffTimer(this.activityTimeout, function () {
  40894. _this.sendActivityCheck();
  40895. });
  40896. }
  40897. };
  40898. ;
  40899. ConnectionManager.prototype.stopActivityCheck = function () {
  40900. if (this.activityTimer) {
  40901. this.activityTimer.ensureAborted();
  40902. }
  40903. };
  40904. ;
  40905. ConnectionManager.prototype.buildConnectionCallbacks = function (errorCallbacks) {
  40906. var _this = this;
  40907. return extend({}, errorCallbacks, {
  40908. message: function (message) {
  40909. _this.resetActivityCheck();
  40910. _this.emit('message', message);
  40911. },
  40912. ping: function () {
  40913. _this.send_event('pusher:pong', {});
  40914. },
  40915. activity: function () {
  40916. _this.resetActivityCheck();
  40917. },
  40918. error: function (error) {
  40919. _this.emit("error", { type: "WebSocketError", error: error });
  40920. },
  40921. closed: function () {
  40922. _this.abandonConnection();
  40923. if (_this.shouldRetry()) {
  40924. _this.retryIn(1000);
  40925. }
  40926. }
  40927. });
  40928. };
  40929. ;
  40930. ConnectionManager.prototype.buildHandshakeCallbacks = function (errorCallbacks) {
  40931. var _this = this;
  40932. return extend({}, errorCallbacks, {
  40933. connected: function (handshake) {
  40934. _this.activityTimeout = Math.min(_this.options.activityTimeout, handshake.activityTimeout, handshake.connection.activityTimeout || Infinity);
  40935. _this.clearUnavailableTimer();
  40936. _this.setConnection(handshake.connection);
  40937. _this.socket_id = _this.connection.id;
  40938. _this.updateState("connected", { socket_id: _this.socket_id });
  40939. }
  40940. });
  40941. };
  40942. ;
  40943. ConnectionManager.prototype.buildErrorCallbacks = function () {
  40944. var _this = this;
  40945. var withErrorEmitted = function (callback) {
  40946. return function (result) {
  40947. if (result.error) {
  40948. _this.emit("error", { type: "WebSocketError", error: result.error });
  40949. }
  40950. callback(result);
  40951. };
  40952. };
  40953. return {
  40954. tls_only: withErrorEmitted(function () {
  40955. _this.usingTLS = true;
  40956. _this.updateStrategy();
  40957. _this.retryIn(0);
  40958. }),
  40959. refused: withErrorEmitted(function () {
  40960. _this.disconnect();
  40961. }),
  40962. backoff: withErrorEmitted(function () {
  40963. _this.retryIn(1000);
  40964. }),
  40965. retry: withErrorEmitted(function () {
  40966. _this.retryIn(0);
  40967. })
  40968. };
  40969. };
  40970. ;
  40971. ConnectionManager.prototype.setConnection = function (connection) {
  40972. this.connection = connection;
  40973. for (var event in this.connectionCallbacks) {
  40974. this.connection.bind(event, this.connectionCallbacks[event]);
  40975. }
  40976. this.resetActivityCheck();
  40977. };
  40978. ;
  40979. ConnectionManager.prototype.abandonConnection = function () {
  40980. if (!this.connection) {
  40981. return;
  40982. }
  40983. this.stopActivityCheck();
  40984. for (var event in this.connectionCallbacks) {
  40985. this.connection.unbind(event, this.connectionCallbacks[event]);
  40986. }
  40987. var connection = this.connection;
  40988. this.connection = null;
  40989. return connection;
  40990. };
  40991. ConnectionManager.prototype.updateState = function (newState, data) {
  40992. var previousState = this.state;
  40993. this.state = newState;
  40994. if (previousState !== newState) {
  40995. var newStateDescription = newState;
  40996. if (newStateDescription === "connected") {
  40997. newStateDescription += " with new socket ID " + data.socket_id;
  40998. }
  40999. logger.debug('State changed', previousState + ' -> ' + newStateDescription);
  41000. this.timeline.info({ state: newState, params: data });
  41001. this.emit('state_change', { previous: previousState, current: newState });
  41002. this.emit(newState, data);
  41003. }
  41004. };
  41005. ConnectionManager.prototype.shouldRetry = function () {
  41006. return this.state === "connecting" || this.state === "connected";
  41007. };
  41008. return ConnectionManager;
  41009. }(dispatcher));
  41010. /* harmony default export */ var connection_manager = (connection_manager_ConnectionManager);
  41011. // CONCATENATED MODULE: ./src/core/channels/channels.ts
  41012. var channels_Channels = (function () {
  41013. function Channels() {
  41014. this.channels = {};
  41015. }
  41016. Channels.prototype.add = function (name, pusher) {
  41017. if (!this.channels[name]) {
  41018. this.channels[name] = createChannel(name, pusher);
  41019. }
  41020. return this.channels[name];
  41021. };
  41022. Channels.prototype.all = function () {
  41023. return values(this.channels);
  41024. };
  41025. Channels.prototype.find = function (name) {
  41026. return this.channels[name];
  41027. };
  41028. Channels.prototype.remove = function (name) {
  41029. var channel = this.channels[name];
  41030. delete this.channels[name];
  41031. return channel;
  41032. };
  41033. Channels.prototype.disconnect = function () {
  41034. objectApply(this.channels, function (channel) {
  41035. channel.disconnect();
  41036. });
  41037. };
  41038. return Channels;
  41039. }());
  41040. /* harmony default export */ var channels = (channels_Channels);
  41041. function createChannel(name, pusher) {
  41042. if (name.indexOf('private-encrypted-') === 0) {
  41043. if (false) { var errorMsg; }
  41044. return factory.createEncryptedChannel(name, pusher);
  41045. }
  41046. else if (name.indexOf('private-') === 0) {
  41047. return factory.createPrivateChannel(name, pusher);
  41048. }
  41049. else if (name.indexOf('presence-') === 0) {
  41050. return factory.createPresenceChannel(name, pusher);
  41051. }
  41052. else {
  41053. return factory.createChannel(name, pusher);
  41054. }
  41055. }
  41056. // CONCATENATED MODULE: ./src/core/utils/factory.ts
  41057. var Factory = {
  41058. createChannels: function () {
  41059. return new channels();
  41060. },
  41061. createConnectionManager: function (key, options) {
  41062. return new connection_manager(key, options);
  41063. },
  41064. createChannel: function (name, pusher) {
  41065. return new channels_channel(name, pusher);
  41066. },
  41067. createPrivateChannel: function (name, pusher) {
  41068. return new private_channel(name, pusher);
  41069. },
  41070. createPresenceChannel: function (name, pusher) {
  41071. return new presence_channel(name, pusher);
  41072. },
  41073. createEncryptedChannel: function (name, pusher) {
  41074. return new encrypted_channel(name, pusher);
  41075. },
  41076. createTimelineSender: function (timeline, options) {
  41077. return new timeline_sender(timeline, options);
  41078. },
  41079. createAuthorizer: function (channel, options) {
  41080. if (options.authorizer) {
  41081. return options.authorizer(channel, options);
  41082. }
  41083. return new pusher_authorizer(channel, options);
  41084. },
  41085. createHandshake: function (transport, callback) {
  41086. return new connection_handshake(transport, callback);
  41087. },
  41088. createAssistantToTheTransportManager: function (manager, transport, options) {
  41089. return new assistant_to_the_transport_manager(manager, transport, options);
  41090. }
  41091. };
  41092. /* harmony default export */ var factory = (Factory);
  41093. // CONCATENATED MODULE: ./src/core/transports/transport_manager.ts
  41094. var transport_manager_TransportManager = (function () {
  41095. function TransportManager(options) {
  41096. this.options = options || {};
  41097. this.livesLeft = this.options.lives || Infinity;
  41098. }
  41099. TransportManager.prototype.getAssistant = function (transport) {
  41100. return factory.createAssistantToTheTransportManager(this, transport, {
  41101. minPingDelay: this.options.minPingDelay,
  41102. maxPingDelay: this.options.maxPingDelay
  41103. });
  41104. };
  41105. TransportManager.prototype.isAlive = function () {
  41106. return this.livesLeft > 0;
  41107. };
  41108. TransportManager.prototype.reportDeath = function () {
  41109. this.livesLeft -= 1;
  41110. };
  41111. return TransportManager;
  41112. }());
  41113. /* harmony default export */ var transport_manager = (transport_manager_TransportManager);
  41114. // CONCATENATED MODULE: ./src/core/strategies/sequential_strategy.ts
  41115. var sequential_strategy_SequentialStrategy = (function () {
  41116. function SequentialStrategy(strategies, options) {
  41117. this.strategies = strategies;
  41118. this.loop = Boolean(options.loop);
  41119. this.failFast = Boolean(options.failFast);
  41120. this.timeout = options.timeout;
  41121. this.timeoutLimit = options.timeoutLimit;
  41122. }
  41123. SequentialStrategy.prototype.isSupported = function () {
  41124. return any(this.strategies, util.method("isSupported"));
  41125. };
  41126. SequentialStrategy.prototype.connect = function (minPriority, callback) {
  41127. var _this = this;
  41128. var strategies = this.strategies;
  41129. var current = 0;
  41130. var timeout = this.timeout;
  41131. var runner = null;
  41132. var tryNextStrategy = function (error, handshake) {
  41133. if (handshake) {
  41134. callback(null, handshake);
  41135. }
  41136. else {
  41137. current = current + 1;
  41138. if (_this.loop) {
  41139. current = current % strategies.length;
  41140. }
  41141. if (current < strategies.length) {
  41142. if (timeout) {
  41143. timeout = timeout * 2;
  41144. if (_this.timeoutLimit) {
  41145. timeout = Math.min(timeout, _this.timeoutLimit);
  41146. }
  41147. }
  41148. runner = _this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: _this.failFast }, tryNextStrategy);
  41149. }
  41150. else {
  41151. callback(true);
  41152. }
  41153. }
  41154. };
  41155. runner = this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: this.failFast }, tryNextStrategy);
  41156. return {
  41157. abort: function () {
  41158. runner.abort();
  41159. },
  41160. forceMinPriority: function (p) {
  41161. minPriority = p;
  41162. if (runner) {
  41163. runner.forceMinPriority(p);
  41164. }
  41165. }
  41166. };
  41167. };
  41168. SequentialStrategy.prototype.tryStrategy = function (strategy, minPriority, options, callback) {
  41169. var timer = null;
  41170. var runner = null;
  41171. if (options.timeout > 0) {
  41172. timer = new OneOffTimer(options.timeout, function () {
  41173. runner.abort();
  41174. callback(true);
  41175. });
  41176. }
  41177. runner = strategy.connect(minPriority, function (error, handshake) {
  41178. if (error && timer && timer.isRunning() && !options.failFast) {
  41179. return;
  41180. }
  41181. if (timer) {
  41182. timer.ensureAborted();
  41183. }
  41184. callback(error, handshake);
  41185. });
  41186. return {
  41187. abort: function () {
  41188. if (timer) {
  41189. timer.ensureAborted();
  41190. }
  41191. runner.abort();
  41192. },
  41193. forceMinPriority: function (p) {
  41194. runner.forceMinPriority(p);
  41195. }
  41196. };
  41197. };
  41198. return SequentialStrategy;
  41199. }());
  41200. /* harmony default export */ var sequential_strategy = (sequential_strategy_SequentialStrategy);
  41201. // CONCATENATED MODULE: ./src/core/strategies/best_connected_ever_strategy.ts
  41202. var best_connected_ever_strategy_BestConnectedEverStrategy = (function () {
  41203. function BestConnectedEverStrategy(strategies) {
  41204. this.strategies = strategies;
  41205. }
  41206. BestConnectedEverStrategy.prototype.isSupported = function () {
  41207. return any(this.strategies, util.method("isSupported"));
  41208. };
  41209. BestConnectedEverStrategy.prototype.connect = function (minPriority, callback) {
  41210. return connect(this.strategies, minPriority, function (i, runners) {
  41211. return function (error, handshake) {
  41212. runners[i].error = error;
  41213. if (error) {
  41214. if (allRunnersFailed(runners)) {
  41215. callback(true);
  41216. }
  41217. return;
  41218. }
  41219. apply(runners, function (runner) {
  41220. runner.forceMinPriority(handshake.transport.priority);
  41221. });
  41222. callback(null, handshake);
  41223. };
  41224. });
  41225. };
  41226. return BestConnectedEverStrategy;
  41227. }());
  41228. /* harmony default export */ var best_connected_ever_strategy = (best_connected_ever_strategy_BestConnectedEverStrategy);
  41229. function connect(strategies, minPriority, callbackBuilder) {
  41230. var runners = map(strategies, function (strategy, i, _, rs) {
  41231. return strategy.connect(minPriority, callbackBuilder(i, rs));
  41232. });
  41233. return {
  41234. abort: function () {
  41235. apply(runners, abortRunner);
  41236. },
  41237. forceMinPriority: function (p) {
  41238. apply(runners, function (runner) {
  41239. runner.forceMinPriority(p);
  41240. });
  41241. }
  41242. };
  41243. }
  41244. function allRunnersFailed(runners) {
  41245. return collections_all(runners, function (runner) {
  41246. return Boolean(runner.error);
  41247. });
  41248. }
  41249. function abortRunner(runner) {
  41250. if (!runner.error && !runner.aborted) {
  41251. runner.abort();
  41252. runner.aborted = true;
  41253. }
  41254. }
  41255. // CONCATENATED MODULE: ./src/core/strategies/cached_strategy.ts
  41256. var cached_strategy_CachedStrategy = (function () {
  41257. function CachedStrategy(strategy, transports, options) {
  41258. this.strategy = strategy;
  41259. this.transports = transports;
  41260. this.ttl = options.ttl || 1800 * 1000;
  41261. this.usingTLS = options.useTLS;
  41262. this.timeline = options.timeline;
  41263. }
  41264. CachedStrategy.prototype.isSupported = function () {
  41265. return this.strategy.isSupported();
  41266. };
  41267. CachedStrategy.prototype.connect = function (minPriority, callback) {
  41268. var usingTLS = this.usingTLS;
  41269. var info = fetchTransportCache(usingTLS);
  41270. var strategies = [this.strategy];
  41271. if (info && info.timestamp + this.ttl >= util.now()) {
  41272. var transport = this.transports[info.transport];
  41273. if (transport) {
  41274. this.timeline.info({
  41275. cached: true,
  41276. transport: info.transport,
  41277. latency: info.latency
  41278. });
  41279. strategies.push(new sequential_strategy([transport], {
  41280. timeout: info.latency * 2 + 1000,
  41281. failFast: true
  41282. }));
  41283. }
  41284. }
  41285. var startTimestamp = util.now();
  41286. var runner = strategies.pop().connect(minPriority, function cb(error, handshake) {
  41287. if (error) {
  41288. flushTransportCache(usingTLS);
  41289. if (strategies.length > 0) {
  41290. startTimestamp = util.now();
  41291. runner = strategies.pop().connect(minPriority, cb);
  41292. }
  41293. else {
  41294. callback(error);
  41295. }
  41296. }
  41297. else {
  41298. storeTransportCache(usingTLS, handshake.transport.name, util.now() - startTimestamp);
  41299. callback(null, handshake);
  41300. }
  41301. });
  41302. return {
  41303. abort: function () {
  41304. runner.abort();
  41305. },
  41306. forceMinPriority: function (p) {
  41307. minPriority = p;
  41308. if (runner) {
  41309. runner.forceMinPriority(p);
  41310. }
  41311. }
  41312. };
  41313. };
  41314. return CachedStrategy;
  41315. }());
  41316. /* harmony default export */ var cached_strategy = (cached_strategy_CachedStrategy);
  41317. function getTransportCacheKey(usingTLS) {
  41318. return "pusherTransport" + (usingTLS ? "TLS" : "NonTLS");
  41319. }
  41320. function fetchTransportCache(usingTLS) {
  41321. var storage = runtime.getLocalStorage();
  41322. if (storage) {
  41323. try {
  41324. var serializedCache = storage[getTransportCacheKey(usingTLS)];
  41325. if (serializedCache) {
  41326. return JSON.parse(serializedCache);
  41327. }
  41328. }
  41329. catch (e) {
  41330. flushTransportCache(usingTLS);
  41331. }
  41332. }
  41333. return null;
  41334. }
  41335. function storeTransportCache(usingTLS, transport, latency) {
  41336. var storage = runtime.getLocalStorage();
  41337. if (storage) {
  41338. try {
  41339. storage[getTransportCacheKey(usingTLS)] = safeJSONStringify({
  41340. timestamp: util.now(),
  41341. transport: transport,
  41342. latency: latency
  41343. });
  41344. }
  41345. catch (e) {
  41346. }
  41347. }
  41348. }
  41349. function flushTransportCache(usingTLS) {
  41350. var storage = runtime.getLocalStorage();
  41351. if (storage) {
  41352. try {
  41353. delete storage[getTransportCacheKey(usingTLS)];
  41354. }
  41355. catch (e) {
  41356. }
  41357. }
  41358. }
  41359. // CONCATENATED MODULE: ./src/core/strategies/delayed_strategy.ts
  41360. var delayed_strategy_DelayedStrategy = (function () {
  41361. function DelayedStrategy(strategy, _a) {
  41362. var number = _a.delay;
  41363. this.strategy = strategy;
  41364. this.options = { delay: number };
  41365. }
  41366. DelayedStrategy.prototype.isSupported = function () {
  41367. return this.strategy.isSupported();
  41368. };
  41369. DelayedStrategy.prototype.connect = function (minPriority, callback) {
  41370. var strategy = this.strategy;
  41371. var runner;
  41372. var timer = new OneOffTimer(this.options.delay, function () {
  41373. runner = strategy.connect(minPriority, callback);
  41374. });
  41375. return {
  41376. abort: function () {
  41377. timer.ensureAborted();
  41378. if (runner) {
  41379. runner.abort();
  41380. }
  41381. },
  41382. forceMinPriority: function (p) {
  41383. minPriority = p;
  41384. if (runner) {
  41385. runner.forceMinPriority(p);
  41386. }
  41387. }
  41388. };
  41389. };
  41390. return DelayedStrategy;
  41391. }());
  41392. /* harmony default export */ var delayed_strategy = (delayed_strategy_DelayedStrategy);
  41393. // CONCATENATED MODULE: ./src/core/strategies/if_strategy.ts
  41394. var IfStrategy = (function () {
  41395. function IfStrategy(test, trueBranch, falseBranch) {
  41396. this.test = test;
  41397. this.trueBranch = trueBranch;
  41398. this.falseBranch = falseBranch;
  41399. }
  41400. IfStrategy.prototype.isSupported = function () {
  41401. var branch = this.test() ? this.trueBranch : this.falseBranch;
  41402. return branch.isSupported();
  41403. };
  41404. IfStrategy.prototype.connect = function (minPriority, callback) {
  41405. var branch = this.test() ? this.trueBranch : this.falseBranch;
  41406. return branch.connect(minPriority, callback);
  41407. };
  41408. return IfStrategy;
  41409. }());
  41410. /* harmony default export */ var if_strategy = (IfStrategy);
  41411. // CONCATENATED MODULE: ./src/core/strategies/first_connected_strategy.ts
  41412. var FirstConnectedStrategy = (function () {
  41413. function FirstConnectedStrategy(strategy) {
  41414. this.strategy = strategy;
  41415. }
  41416. FirstConnectedStrategy.prototype.isSupported = function () {
  41417. return this.strategy.isSupported();
  41418. };
  41419. FirstConnectedStrategy.prototype.connect = function (minPriority, callback) {
  41420. var runner = this.strategy.connect(minPriority, function (error, handshake) {
  41421. if (handshake) {
  41422. runner.abort();
  41423. }
  41424. callback(error, handshake);
  41425. });
  41426. return runner;
  41427. };
  41428. return FirstConnectedStrategy;
  41429. }());
  41430. /* harmony default export */ var first_connected_strategy = (FirstConnectedStrategy);
  41431. // CONCATENATED MODULE: ./src/runtimes/web/default_strategy.ts
  41432. function testSupportsStrategy(strategy) {
  41433. return function () {
  41434. return strategy.isSupported();
  41435. };
  41436. }
  41437. var getDefaultStrategy = function (config, defineTransport) {
  41438. var definedTransports = {};
  41439. function defineTransportStrategy(name, type, priority, options, manager) {
  41440. var transport = defineTransport(config, name, type, priority, options, manager);
  41441. definedTransports[name] = transport;
  41442. return transport;
  41443. }
  41444. var ws_options = {
  41445. hostNonTLS: config.wsHost + ":" + config.wsPort,
  41446. hostTLS: config.wsHost + ":" + config.wssPort,
  41447. httpPath: config.wsPath
  41448. };
  41449. var wss_options = extend({}, ws_options, {
  41450. useTLS: true
  41451. });
  41452. var sockjs_options = {
  41453. hostNonTLS: config.httpHost + ":" + config.httpPort,
  41454. hostTLS: config.httpHost + ":" + config.httpsPort,
  41455. httpPath: config.httpPath
  41456. };
  41457. var timeouts = {
  41458. loop: true,
  41459. timeout: 15000,
  41460. timeoutLimit: 60000
  41461. };
  41462. var ws_manager = new transport_manager({
  41463. lives: 2,
  41464. minPingDelay: 10000,
  41465. maxPingDelay: config.activity_timeout
  41466. });
  41467. var streaming_manager = new transport_manager({
  41468. lives: 2,
  41469. minPingDelay: 10000,
  41470. maxPingDelay: config.activity_timeout
  41471. });
  41472. var ws_transport = defineTransportStrategy("ws", "ws", 3, ws_options, ws_manager);
  41473. var wss_transport = defineTransportStrategy("wss", "ws", 3, wss_options, ws_manager);
  41474. var sockjs_transport = defineTransportStrategy("sockjs", "sockjs", 1, sockjs_options);
  41475. var xhr_streaming_transport = defineTransportStrategy("xhr_streaming", "xhr_streaming", 1, sockjs_options, streaming_manager);
  41476. var xdr_streaming_transport = defineTransportStrategy("xdr_streaming", "xdr_streaming", 1, sockjs_options, streaming_manager);
  41477. var xhr_polling_transport = defineTransportStrategy("xhr_polling", "xhr_polling", 1, sockjs_options);
  41478. var xdr_polling_transport = defineTransportStrategy("xdr_polling", "xdr_polling", 1, sockjs_options);
  41479. var ws_loop = new sequential_strategy([ws_transport], timeouts);
  41480. var wss_loop = new sequential_strategy([wss_transport], timeouts);
  41481. var sockjs_loop = new sequential_strategy([sockjs_transport], timeouts);
  41482. var streaming_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_streaming_transport), xhr_streaming_transport, xdr_streaming_transport)], timeouts);
  41483. var polling_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_polling_transport), xhr_polling_transport, xdr_polling_transport)], timeouts);
  41484. 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);
  41485. var http_fallback_loop = new if_strategy(testSupportsStrategy(http_loop), http_loop, sockjs_loop);
  41486. var wsStrategy;
  41487. if (config.useTLS) {
  41488. wsStrategy = new best_connected_ever_strategy([ws_loop, new delayed_strategy(http_fallback_loop, { delay: 2000 })]);
  41489. }
  41490. else {
  41491. wsStrategy = new best_connected_ever_strategy([
  41492. ws_loop,
  41493. new delayed_strategy(wss_loop, { delay: 2000 }),
  41494. new delayed_strategy(http_fallback_loop, { delay: 5000 })
  41495. ]);
  41496. }
  41497. return new cached_strategy(new first_connected_strategy(new if_strategy(testSupportsStrategy(ws_transport), wsStrategy, http_fallback_loop)), definedTransports, {
  41498. ttl: 1800000,
  41499. timeline: config.timeline,
  41500. useTLS: config.useTLS
  41501. });
  41502. };
  41503. /* harmony default export */ var default_strategy = (getDefaultStrategy);
  41504. // CONCATENATED MODULE: ./src/runtimes/web/transports/transport_connection_initializer.ts
  41505. /* harmony default export */ var transport_connection_initializer = (function () {
  41506. var self = this;
  41507. self.timeline.info(self.buildTimelineMessage({
  41508. transport: self.name + (self.options.useTLS ? "s" : "")
  41509. }));
  41510. if (self.hooks.isInitialized()) {
  41511. self.changeState("initialized");
  41512. }
  41513. else if (self.hooks.file) {
  41514. self.changeState("initializing");
  41515. Dependencies.load(self.hooks.file, { useTLS: self.options.useTLS }, function (error, callback) {
  41516. if (self.hooks.isInitialized()) {
  41517. self.changeState("initialized");
  41518. callback(true);
  41519. }
  41520. else {
  41521. if (error) {
  41522. self.onError(error);
  41523. }
  41524. self.onClose();
  41525. callback(false);
  41526. }
  41527. });
  41528. }
  41529. else {
  41530. self.onClose();
  41531. }
  41532. });
  41533. // CONCATENATED MODULE: ./src/runtimes/web/http/http_xdomain_request.ts
  41534. var http_xdomain_request_hooks = {
  41535. getRequest: function (socket) {
  41536. var xdr = new window.XDomainRequest();
  41537. xdr.ontimeout = function () {
  41538. socket.emit("error", new RequestTimedOut());
  41539. socket.close();
  41540. };
  41541. xdr.onerror = function (e) {
  41542. socket.emit("error", e);
  41543. socket.close();
  41544. };
  41545. xdr.onprogress = function () {
  41546. if (xdr.responseText && xdr.responseText.length > 0) {
  41547. socket.onChunk(200, xdr.responseText);
  41548. }
  41549. };
  41550. xdr.onload = function () {
  41551. if (xdr.responseText && xdr.responseText.length > 0) {
  41552. socket.onChunk(200, xdr.responseText);
  41553. }
  41554. socket.emit("finished", 200);
  41555. socket.close();
  41556. };
  41557. return xdr;
  41558. },
  41559. abortRequest: function (xdr) {
  41560. xdr.ontimeout = xdr.onerror = xdr.onprogress = xdr.onload = null;
  41561. xdr.abort();
  41562. }
  41563. };
  41564. /* harmony default export */ var http_xdomain_request = (http_xdomain_request_hooks);
  41565. // CONCATENATED MODULE: ./src/core/http/http_request.ts
  41566. var http_request_extends = (undefined && undefined.__extends) || (function () {
  41567. var extendStatics = function (d, b) {
  41568. extendStatics = Object.setPrototypeOf ||
  41569. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41570. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41571. return extendStatics(d, b);
  41572. };
  41573. return function (d, b) {
  41574. extendStatics(d, b);
  41575. function __() { this.constructor = d; }
  41576. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41577. };
  41578. })();
  41579. var MAX_BUFFER_LENGTH = 256 * 1024;
  41580. var http_request_HTTPRequest = (function (_super) {
  41581. http_request_extends(HTTPRequest, _super);
  41582. function HTTPRequest(hooks, method, url) {
  41583. var _this = _super.call(this) || this;
  41584. _this.hooks = hooks;
  41585. _this.method = method;
  41586. _this.url = url;
  41587. return _this;
  41588. }
  41589. HTTPRequest.prototype.start = function (payload) {
  41590. var _this = this;
  41591. this.position = 0;
  41592. this.xhr = this.hooks.getRequest(this);
  41593. this.unloader = function () {
  41594. _this.close();
  41595. };
  41596. runtime.addUnloadListener(this.unloader);
  41597. this.xhr.open(this.method, this.url, true);
  41598. if (this.xhr.setRequestHeader) {
  41599. this.xhr.setRequestHeader("Content-Type", "application/json");
  41600. }
  41601. this.xhr.send(payload);
  41602. };
  41603. HTTPRequest.prototype.close = function () {
  41604. if (this.unloader) {
  41605. runtime.removeUnloadListener(this.unloader);
  41606. this.unloader = null;
  41607. }
  41608. if (this.xhr) {
  41609. this.hooks.abortRequest(this.xhr);
  41610. this.xhr = null;
  41611. }
  41612. };
  41613. HTTPRequest.prototype.onChunk = function (status, data) {
  41614. while (true) {
  41615. var chunk = this.advanceBuffer(data);
  41616. if (chunk) {
  41617. this.emit("chunk", { status: status, data: chunk });
  41618. }
  41619. else {
  41620. break;
  41621. }
  41622. }
  41623. if (this.isBufferTooLong(data)) {
  41624. this.emit("buffer_too_long");
  41625. }
  41626. };
  41627. HTTPRequest.prototype.advanceBuffer = function (buffer) {
  41628. var unreadData = buffer.slice(this.position);
  41629. var endOfLinePosition = unreadData.indexOf("\n");
  41630. if (endOfLinePosition !== -1) {
  41631. this.position += endOfLinePosition + 1;
  41632. return unreadData.slice(0, endOfLinePosition);
  41633. }
  41634. else {
  41635. return null;
  41636. }
  41637. };
  41638. HTTPRequest.prototype.isBufferTooLong = function (buffer) {
  41639. return this.position === buffer.length && buffer.length > MAX_BUFFER_LENGTH;
  41640. };
  41641. return HTTPRequest;
  41642. }(dispatcher));
  41643. /* harmony default export */ var http_request = (http_request_HTTPRequest);
  41644. // CONCATENATED MODULE: ./src/core/http/state.ts
  41645. var State;
  41646. (function (State) {
  41647. State[State["CONNECTING"] = 0] = "CONNECTING";
  41648. State[State["OPEN"] = 1] = "OPEN";
  41649. State[State["CLOSED"] = 3] = "CLOSED";
  41650. })(State || (State = {}));
  41651. /* harmony default export */ var state = (State);
  41652. // CONCATENATED MODULE: ./src/core/http/http_socket.ts
  41653. var autoIncrement = 1;
  41654. var http_socket_HTTPSocket = (function () {
  41655. function HTTPSocket(hooks, url) {
  41656. this.hooks = hooks;
  41657. this.session = randomNumber(1000) + "/" + randomString(8);
  41658. this.location = getLocation(url);
  41659. this.readyState = state.CONNECTING;
  41660. this.openStream();
  41661. }
  41662. HTTPSocket.prototype.send = function (payload) {
  41663. return this.sendRaw(JSON.stringify([payload]));
  41664. };
  41665. HTTPSocket.prototype.ping = function () {
  41666. this.hooks.sendHeartbeat(this);
  41667. };
  41668. HTTPSocket.prototype.close = function (code, reason) {
  41669. this.onClose(code, reason, true);
  41670. };
  41671. HTTPSocket.prototype.sendRaw = function (payload) {
  41672. if (this.readyState === state.OPEN) {
  41673. try {
  41674. runtime.createSocketRequest("POST", getUniqueURL(getSendURL(this.location, this.session))).start(payload);
  41675. return true;
  41676. }
  41677. catch (e) {
  41678. return false;
  41679. }
  41680. }
  41681. else {
  41682. return false;
  41683. }
  41684. };
  41685. HTTPSocket.prototype.reconnect = function () {
  41686. this.closeStream();
  41687. this.openStream();
  41688. };
  41689. ;
  41690. HTTPSocket.prototype.onClose = function (code, reason, wasClean) {
  41691. this.closeStream();
  41692. this.readyState = state.CLOSED;
  41693. if (this.onclose) {
  41694. this.onclose({
  41695. code: code,
  41696. reason: reason,
  41697. wasClean: wasClean
  41698. });
  41699. }
  41700. };
  41701. HTTPSocket.prototype.onChunk = function (chunk) {
  41702. if (chunk.status !== 200) {
  41703. return;
  41704. }
  41705. if (this.readyState === state.OPEN) {
  41706. this.onActivity();
  41707. }
  41708. var payload;
  41709. var type = chunk.data.slice(0, 1);
  41710. switch (type) {
  41711. case 'o':
  41712. payload = JSON.parse(chunk.data.slice(1) || '{}');
  41713. this.onOpen(payload);
  41714. break;
  41715. case 'a':
  41716. payload = JSON.parse(chunk.data.slice(1) || '[]');
  41717. for (var i = 0; i < payload.length; i++) {
  41718. this.onEvent(payload[i]);
  41719. }
  41720. break;
  41721. case 'm':
  41722. payload = JSON.parse(chunk.data.slice(1) || 'null');
  41723. this.onEvent(payload);
  41724. break;
  41725. case 'h':
  41726. this.hooks.onHeartbeat(this);
  41727. break;
  41728. case 'c':
  41729. payload = JSON.parse(chunk.data.slice(1) || '[]');
  41730. this.onClose(payload[0], payload[1], true);
  41731. break;
  41732. }
  41733. };
  41734. HTTPSocket.prototype.onOpen = function (options) {
  41735. if (this.readyState === state.CONNECTING) {
  41736. if (options && options.hostname) {
  41737. this.location.base = replaceHost(this.location.base, options.hostname);
  41738. }
  41739. this.readyState = state.OPEN;
  41740. if (this.onopen) {
  41741. this.onopen();
  41742. }
  41743. }
  41744. else {
  41745. this.onClose(1006, "Server lost session", true);
  41746. }
  41747. };
  41748. HTTPSocket.prototype.onEvent = function (event) {
  41749. if (this.readyState === state.OPEN && this.onmessage) {
  41750. this.onmessage({ data: event });
  41751. }
  41752. };
  41753. HTTPSocket.prototype.onActivity = function () {
  41754. if (this.onactivity) {
  41755. this.onactivity();
  41756. }
  41757. };
  41758. HTTPSocket.prototype.onError = function (error) {
  41759. if (this.onerror) {
  41760. this.onerror(error);
  41761. }
  41762. };
  41763. HTTPSocket.prototype.openStream = function () {
  41764. var _this = this;
  41765. this.stream = runtime.createSocketRequest("POST", getUniqueURL(this.hooks.getReceiveURL(this.location, this.session)));
  41766. this.stream.bind("chunk", function (chunk) {
  41767. _this.onChunk(chunk);
  41768. });
  41769. this.stream.bind("finished", function (status) {
  41770. _this.hooks.onFinished(_this, status);
  41771. });
  41772. this.stream.bind("buffer_too_long", function () {
  41773. _this.reconnect();
  41774. });
  41775. try {
  41776. this.stream.start();
  41777. }
  41778. catch (error) {
  41779. util.defer(function () {
  41780. _this.onError(error);
  41781. _this.onClose(1006, "Could not start streaming", false);
  41782. });
  41783. }
  41784. };
  41785. HTTPSocket.prototype.closeStream = function () {
  41786. if (this.stream) {
  41787. this.stream.unbind_all();
  41788. this.stream.close();
  41789. this.stream = null;
  41790. }
  41791. };
  41792. return HTTPSocket;
  41793. }());
  41794. function getLocation(url) {
  41795. var parts = /([^\?]*)\/*(\??.*)/.exec(url);
  41796. return {
  41797. base: parts[1],
  41798. queryString: parts[2]
  41799. };
  41800. }
  41801. function getSendURL(url, session) {
  41802. return url.base + "/" + session + "/xhr_send";
  41803. }
  41804. function getUniqueURL(url) {
  41805. var separator = (url.indexOf('?') === -1) ? "?" : "&";
  41806. return url + separator + "t=" + (+new Date()) + "&n=" + autoIncrement++;
  41807. }
  41808. function replaceHost(url, hostname) {
  41809. var urlParts = /(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(url);
  41810. return urlParts[1] + hostname + urlParts[3];
  41811. }
  41812. function randomNumber(max) {
  41813. return Math.floor(Math.random() * max);
  41814. }
  41815. function randomString(length) {
  41816. var result = [];
  41817. for (var i = 0; i < length; i++) {
  41818. result.push(randomNumber(32).toString(32));
  41819. }
  41820. return result.join('');
  41821. }
  41822. /* harmony default export */ var http_socket = (http_socket_HTTPSocket);
  41823. // CONCATENATED MODULE: ./src/core/http/http_streaming_socket.ts
  41824. var http_streaming_socket_hooks = {
  41825. getReceiveURL: function (url, session) {
  41826. return url.base + "/" + session + "/xhr_streaming" + url.queryString;
  41827. },
  41828. onHeartbeat: function (socket) {
  41829. socket.sendRaw("[]");
  41830. },
  41831. sendHeartbeat: function (socket) {
  41832. socket.sendRaw("[]");
  41833. },
  41834. onFinished: function (socket, status) {
  41835. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  41836. }
  41837. };
  41838. /* harmony default export */ var http_streaming_socket = (http_streaming_socket_hooks);
  41839. // CONCATENATED MODULE: ./src/core/http/http_polling_socket.ts
  41840. var http_polling_socket_hooks = {
  41841. getReceiveURL: function (url, session) {
  41842. return url.base + "/" + session + "/xhr" + url.queryString;
  41843. },
  41844. onHeartbeat: function () {
  41845. },
  41846. sendHeartbeat: function (socket) {
  41847. socket.sendRaw("[]");
  41848. },
  41849. onFinished: function (socket, status) {
  41850. if (status === 200) {
  41851. socket.reconnect();
  41852. }
  41853. else {
  41854. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  41855. }
  41856. }
  41857. };
  41858. /* harmony default export */ var http_polling_socket = (http_polling_socket_hooks);
  41859. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http_xhr_request.ts
  41860. var http_xhr_request_hooks = {
  41861. getRequest: function (socket) {
  41862. var Constructor = runtime.getXHRAPI();
  41863. var xhr = new Constructor();
  41864. xhr.onreadystatechange = xhr.onprogress = function () {
  41865. switch (xhr.readyState) {
  41866. case 3:
  41867. if (xhr.responseText && xhr.responseText.length > 0) {
  41868. socket.onChunk(xhr.status, xhr.responseText);
  41869. }
  41870. break;
  41871. case 4:
  41872. if (xhr.responseText && xhr.responseText.length > 0) {
  41873. socket.onChunk(xhr.status, xhr.responseText);
  41874. }
  41875. socket.emit("finished", xhr.status);
  41876. socket.close();
  41877. break;
  41878. }
  41879. };
  41880. return xhr;
  41881. },
  41882. abortRequest: function (xhr) {
  41883. xhr.onreadystatechange = null;
  41884. xhr.abort();
  41885. }
  41886. };
  41887. /* harmony default export */ var http_xhr_request = (http_xhr_request_hooks);
  41888. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http.ts
  41889. var HTTP = {
  41890. createStreamingSocket: function (url) {
  41891. return this.createSocket(http_streaming_socket, url);
  41892. },
  41893. createPollingSocket: function (url) {
  41894. return this.createSocket(http_polling_socket, url);
  41895. },
  41896. createSocket: function (hooks, url) {
  41897. return new http_socket(hooks, url);
  41898. },
  41899. createXHR: function (method, url) {
  41900. return this.createRequest(http_xhr_request, method, url);
  41901. },
  41902. createRequest: function (hooks, method, url) {
  41903. return new http_request(hooks, method, url);
  41904. }
  41905. };
  41906. /* harmony default export */ var http_http = (HTTP);
  41907. // CONCATENATED MODULE: ./src/runtimes/web/http/http.ts
  41908. http_http.createXDR = function (method, url) {
  41909. return this.createRequest(http_xdomain_request, method, url);
  41910. };
  41911. /* harmony default export */ var web_http_http = (http_http);
  41912. // CONCATENATED MODULE: ./src/runtimes/web/runtime.ts
  41913. var Runtime = {
  41914. nextAuthCallbackID: 1,
  41915. auth_callbacks: {},
  41916. ScriptReceivers: ScriptReceivers,
  41917. DependenciesReceivers: DependenciesReceivers,
  41918. getDefaultStrategy: default_strategy,
  41919. Transports: transports_transports,
  41920. transportConnectionInitializer: transport_connection_initializer,
  41921. HTTPFactory: web_http_http,
  41922. TimelineTransport: jsonp_timeline,
  41923. getXHRAPI: function () {
  41924. return window.XMLHttpRequest;
  41925. },
  41926. getWebSocketAPI: function () {
  41927. return window.WebSocket || window.MozWebSocket;
  41928. },
  41929. setup: function (PusherClass) {
  41930. var _this = this;
  41931. window.Pusher = PusherClass;
  41932. var initializeOnDocumentBody = function () {
  41933. _this.onDocumentBody(PusherClass.ready);
  41934. };
  41935. if (!window.JSON) {
  41936. Dependencies.load("json2", {}, initializeOnDocumentBody);
  41937. }
  41938. else {
  41939. initializeOnDocumentBody();
  41940. }
  41941. },
  41942. getDocument: function () {
  41943. return document;
  41944. },
  41945. getProtocol: function () {
  41946. return this.getDocument().location.protocol;
  41947. },
  41948. getAuthorizers: function () {
  41949. return { ajax: xhr_auth, jsonp: jsonp_auth };
  41950. },
  41951. onDocumentBody: function (callback) {
  41952. var _this = this;
  41953. if (document.body) {
  41954. callback();
  41955. }
  41956. else {
  41957. setTimeout(function () {
  41958. _this.onDocumentBody(callback);
  41959. }, 0);
  41960. }
  41961. },
  41962. createJSONPRequest: function (url, data) {
  41963. return new jsonp_request(url, data);
  41964. },
  41965. createScriptRequest: function (src) {
  41966. return new script_request(src);
  41967. },
  41968. getLocalStorage: function () {
  41969. try {
  41970. return window.localStorage;
  41971. }
  41972. catch (e) {
  41973. return undefined;
  41974. }
  41975. },
  41976. createXHR: function () {
  41977. if (this.getXHRAPI()) {
  41978. return this.createXMLHttpRequest();
  41979. }
  41980. else {
  41981. return this.createMicrosoftXHR();
  41982. }
  41983. },
  41984. createXMLHttpRequest: function () {
  41985. var Constructor = this.getXHRAPI();
  41986. return new Constructor();
  41987. },
  41988. createMicrosoftXHR: function () {
  41989. return new ActiveXObject("Microsoft.XMLHTTP");
  41990. },
  41991. getNetwork: function () {
  41992. return net_info_Network;
  41993. },
  41994. createWebSocket: function (url) {
  41995. var Constructor = this.getWebSocketAPI();
  41996. return new Constructor(url);
  41997. },
  41998. createSocketRequest: function (method, url) {
  41999. if (this.isXHRSupported()) {
  42000. return this.HTTPFactory.createXHR(method, url);
  42001. }
  42002. else if (this.isXDRSupported(url.indexOf("https:") === 0)) {
  42003. return this.HTTPFactory.createXDR(method, url);
  42004. }
  42005. else {
  42006. throw "Cross-origin HTTP requests are not supported";
  42007. }
  42008. },
  42009. isXHRSupported: function () {
  42010. var Constructor = this.getXHRAPI();
  42011. return Boolean(Constructor) && (new Constructor()).withCredentials !== undefined;
  42012. },
  42013. isXDRSupported: function (useTLS) {
  42014. var protocol = useTLS ? "https:" : "http:";
  42015. var documentProtocol = this.getProtocol();
  42016. return Boolean((window['XDomainRequest'])) && documentProtocol === protocol;
  42017. },
  42018. addUnloadListener: function (listener) {
  42019. if (window.addEventListener !== undefined) {
  42020. window.addEventListener("unload", listener, false);
  42021. }
  42022. else if (window.attachEvent !== undefined) {
  42023. window.attachEvent("onunload", listener);
  42024. }
  42025. },
  42026. removeUnloadListener: function (listener) {
  42027. if (window.addEventListener !== undefined) {
  42028. window.removeEventListener("unload", listener, false);
  42029. }
  42030. else if (window.detachEvent !== undefined) {
  42031. window.detachEvent("onunload", listener);
  42032. }
  42033. }
  42034. };
  42035. /* harmony default export */ var runtime = (Runtime);
  42036. // CONCATENATED MODULE: ./src/core/timeline/level.ts
  42037. var TimelineLevel;
  42038. (function (TimelineLevel) {
  42039. TimelineLevel[TimelineLevel["ERROR"] = 3] = "ERROR";
  42040. TimelineLevel[TimelineLevel["INFO"] = 6] = "INFO";
  42041. TimelineLevel[TimelineLevel["DEBUG"] = 7] = "DEBUG";
  42042. })(TimelineLevel || (TimelineLevel = {}));
  42043. /* harmony default export */ var timeline_level = (TimelineLevel);
  42044. // CONCATENATED MODULE: ./src/core/timeline/timeline.ts
  42045. var timeline_Timeline = (function () {
  42046. function Timeline(key, session, options) {
  42047. this.key = key;
  42048. this.session = session;
  42049. this.events = [];
  42050. this.options = options || {};
  42051. this.sent = 0;
  42052. this.uniqueID = 0;
  42053. }
  42054. Timeline.prototype.log = function (level, event) {
  42055. if (level <= this.options.level) {
  42056. this.events.push(extend({}, event, { timestamp: util.now() }));
  42057. if (this.options.limit && this.events.length > this.options.limit) {
  42058. this.events.shift();
  42059. }
  42060. }
  42061. };
  42062. Timeline.prototype.error = function (event) {
  42063. this.log(timeline_level.ERROR, event);
  42064. };
  42065. Timeline.prototype.info = function (event) {
  42066. this.log(timeline_level.INFO, event);
  42067. };
  42068. Timeline.prototype.debug = function (event) {
  42069. this.log(timeline_level.DEBUG, event);
  42070. };
  42071. Timeline.prototype.isEmpty = function () {
  42072. return this.events.length === 0;
  42073. };
  42074. Timeline.prototype.send = function (sendfn, callback) {
  42075. var _this = this;
  42076. var data = extend({
  42077. session: this.session,
  42078. bundle: this.sent + 1,
  42079. key: this.key,
  42080. lib: "js",
  42081. version: this.options.version,
  42082. cluster: this.options.cluster,
  42083. features: this.options.features,
  42084. timeline: this.events
  42085. }, this.options.params);
  42086. this.events = [];
  42087. sendfn(data, function (error, result) {
  42088. if (!error) {
  42089. _this.sent++;
  42090. }
  42091. if (callback) {
  42092. callback(error, result);
  42093. }
  42094. });
  42095. return true;
  42096. };
  42097. Timeline.prototype.generateUniqueID = function () {
  42098. this.uniqueID++;
  42099. return this.uniqueID;
  42100. };
  42101. return Timeline;
  42102. }());
  42103. /* harmony default export */ var timeline_timeline = (timeline_Timeline);
  42104. // CONCATENATED MODULE: ./src/core/strategies/transport_strategy.ts
  42105. var transport_strategy_TransportStrategy = (function () {
  42106. function TransportStrategy(name, priority, transport, options) {
  42107. this.name = name;
  42108. this.priority = priority;
  42109. this.transport = transport;
  42110. this.options = options || {};
  42111. }
  42112. TransportStrategy.prototype.isSupported = function () {
  42113. return this.transport.isSupported({
  42114. useTLS: this.options.useTLS
  42115. });
  42116. };
  42117. TransportStrategy.prototype.connect = function (minPriority, callback) {
  42118. var _this = this;
  42119. if (!this.isSupported()) {
  42120. return failAttempt(new UnsupportedStrategy(), callback);
  42121. }
  42122. else if (this.priority < minPriority) {
  42123. return failAttempt(new TransportPriorityTooLow(), callback);
  42124. }
  42125. var connected = false;
  42126. var transport = this.transport.createConnection(this.name, this.priority, this.options.key, this.options);
  42127. var handshake = null;
  42128. var onInitialized = function () {
  42129. transport.unbind("initialized", onInitialized);
  42130. transport.connect();
  42131. };
  42132. var onOpen = function () {
  42133. handshake = factory.createHandshake(transport, function (result) {
  42134. connected = true;
  42135. unbindListeners();
  42136. callback(null, result);
  42137. });
  42138. };
  42139. var onError = function (error) {
  42140. unbindListeners();
  42141. callback(error);
  42142. };
  42143. var onClosed = function () {
  42144. unbindListeners();
  42145. var serializedTransport;
  42146. serializedTransport = safeJSONStringify(transport);
  42147. callback(new TransportClosed(serializedTransport));
  42148. };
  42149. var unbindListeners = function () {
  42150. transport.unbind("initialized", onInitialized);
  42151. transport.unbind("open", onOpen);
  42152. transport.unbind("error", onError);
  42153. transport.unbind("closed", onClosed);
  42154. };
  42155. transport.bind("initialized", onInitialized);
  42156. transport.bind("open", onOpen);
  42157. transport.bind("error", onError);
  42158. transport.bind("closed", onClosed);
  42159. transport.initialize();
  42160. return {
  42161. abort: function () {
  42162. if (connected) {
  42163. return;
  42164. }
  42165. unbindListeners();
  42166. if (handshake) {
  42167. handshake.close();
  42168. }
  42169. else {
  42170. transport.close();
  42171. }
  42172. },
  42173. forceMinPriority: function (p) {
  42174. if (connected) {
  42175. return;
  42176. }
  42177. if (_this.priority < p) {
  42178. if (handshake) {
  42179. handshake.close();
  42180. }
  42181. else {
  42182. transport.close();
  42183. }
  42184. }
  42185. }
  42186. };
  42187. };
  42188. return TransportStrategy;
  42189. }());
  42190. /* harmony default export */ var transport_strategy = (transport_strategy_TransportStrategy);
  42191. function failAttempt(error, callback) {
  42192. util.defer(function () {
  42193. callback(error);
  42194. });
  42195. return {
  42196. abort: function () { },
  42197. forceMinPriority: function () { }
  42198. };
  42199. }
  42200. // CONCATENATED MODULE: ./src/core/strategies/strategy_builder.ts
  42201. var strategy_builder_Transports = runtime.Transports;
  42202. var strategy_builder_defineTransport = function (config, name, type, priority, options, manager) {
  42203. var transportClass = strategy_builder_Transports[type];
  42204. if (!transportClass) {
  42205. throw new UnsupportedTransport(type);
  42206. }
  42207. var enabled = (!config.enabledTransports ||
  42208. arrayIndexOf(config.enabledTransports, name) !== -1) &&
  42209. (!config.disabledTransports ||
  42210. arrayIndexOf(config.disabledTransports, name) === -1);
  42211. var transport;
  42212. if (enabled) {
  42213. transport = new transport_strategy(name, priority, manager ? manager.getAssistant(transportClass) : transportClass, extend({
  42214. key: config.key,
  42215. useTLS: config.useTLS,
  42216. timeline: config.timeline,
  42217. ignoreNullOrigin: config.ignoreNullOrigin
  42218. }, options));
  42219. }
  42220. else {
  42221. transport = strategy_builder_UnsupportedStrategy;
  42222. }
  42223. return transport;
  42224. };
  42225. var strategy_builder_UnsupportedStrategy = {
  42226. isSupported: function () {
  42227. return false;
  42228. },
  42229. connect: function (_, callback) {
  42230. var deferred = util.defer(function () {
  42231. callback(new UnsupportedStrategy());
  42232. });
  42233. return {
  42234. abort: function () {
  42235. deferred.ensureAborted();
  42236. },
  42237. forceMinPriority: function () { }
  42238. };
  42239. }
  42240. };
  42241. // CONCATENATED MODULE: ./src/core/config.ts
  42242. var getGlobalConfig = function () {
  42243. return {
  42244. wsHost: defaults.host,
  42245. wsPort: defaults.ws_port,
  42246. wssPort: defaults.wss_port,
  42247. wsPath: defaults.ws_path,
  42248. httpHost: defaults.sockjs_host,
  42249. httpPort: defaults.sockjs_http_port,
  42250. httpsPort: defaults.sockjs_https_port,
  42251. httpPath: defaults.sockjs_path,
  42252. statsHost: defaults.stats_host,
  42253. authEndpoint: defaults.channel_auth_endpoint,
  42254. authTransport: defaults.channel_auth_transport,
  42255. activity_timeout: defaults.activity_timeout,
  42256. pong_timeout: defaults.pong_timeout,
  42257. unavailable_timeout: defaults.unavailable_timeout
  42258. };
  42259. };
  42260. var getClusterConfig = function (clusterName) {
  42261. return {
  42262. wsHost: 'ws-' + clusterName + '.pusher.com',
  42263. httpHost: 'sockjs-' + clusterName + '.pusher.com'
  42264. };
  42265. };
  42266. // CONCATENATED MODULE: ./src/core/pusher.ts
  42267. var pusher_Pusher = (function () {
  42268. function Pusher(app_key, options) {
  42269. var _this = this;
  42270. checkAppKey(app_key);
  42271. options = options || {};
  42272. if (!options.cluster && !(options.wsHost || options.httpHost)) {
  42273. var suffix = url_store.buildLogSuffix('javascriptQuickStart');
  42274. logger.warn("You should always specify a cluster when connecting. " + suffix);
  42275. }
  42276. this.key = app_key;
  42277. this.config = extend(getGlobalConfig(), options.cluster ? getClusterConfig(options.cluster) : {}, options);
  42278. this.channels = factory.createChannels();
  42279. this.global_emitter = new dispatcher();
  42280. this.sessionID = Math.floor(Math.random() * 1000000000);
  42281. this.timeline = new timeline_timeline(this.key, this.sessionID, {
  42282. cluster: this.config.cluster,
  42283. features: Pusher.getClientFeatures(),
  42284. params: this.config.timelineParams || {},
  42285. limit: 50,
  42286. level: timeline_level.INFO,
  42287. version: defaults.VERSION
  42288. });
  42289. if (!this.config.disableStats) {
  42290. this.timelineSender = factory.createTimelineSender(this.timeline, {
  42291. host: this.config.statsHost,
  42292. path: '/timeline/v2/' + runtime.TimelineTransport.name
  42293. });
  42294. }
  42295. var getStrategy = function (options) {
  42296. var config = extend({}, _this.config, options);
  42297. return runtime.getDefaultStrategy(config, strategy_builder_defineTransport);
  42298. };
  42299. this.connection = factory.createConnectionManager(this.key, extend({
  42300. getStrategy: getStrategy,
  42301. timeline: this.timeline,
  42302. activityTimeout: this.config.activity_timeout,
  42303. pongTimeout: this.config.pong_timeout,
  42304. unavailableTimeout: this.config.unavailable_timeout
  42305. }, this.config, { useTLS: this.shouldUseTLS() }));
  42306. this.connection.bind('connected', function () {
  42307. _this.subscribeAll();
  42308. if (_this.timelineSender) {
  42309. _this.timelineSender.send(_this.connection.isUsingTLS());
  42310. }
  42311. });
  42312. this.connection.bind('message', function (event) {
  42313. var eventName = event.event;
  42314. var internal = eventName.indexOf('pusher_internal:') === 0;
  42315. if (event.channel) {
  42316. var channel = _this.channel(event.channel);
  42317. if (channel) {
  42318. channel.handleEvent(event);
  42319. }
  42320. }
  42321. if (!internal) {
  42322. _this.global_emitter.emit(event.event, event.data);
  42323. }
  42324. });
  42325. this.connection.bind('connecting', function () {
  42326. _this.channels.disconnect();
  42327. });
  42328. this.connection.bind('disconnected', function () {
  42329. _this.channels.disconnect();
  42330. });
  42331. this.connection.bind('error', function (err) {
  42332. logger.warn(err);
  42333. });
  42334. Pusher.instances.push(this);
  42335. this.timeline.info({ instances: Pusher.instances.length });
  42336. if (Pusher.isReady) {
  42337. this.connect();
  42338. }
  42339. }
  42340. Pusher.ready = function () {
  42341. Pusher.isReady = true;
  42342. for (var i = 0, l = Pusher.instances.length; i < l; i++) {
  42343. Pusher.instances[i].connect();
  42344. }
  42345. };
  42346. Pusher.getClientFeatures = function () {
  42347. return keys(filterObject({ ws: runtime.Transports.ws }, function (t) {
  42348. return t.isSupported({});
  42349. }));
  42350. };
  42351. Pusher.prototype.channel = function (name) {
  42352. return this.channels.find(name);
  42353. };
  42354. Pusher.prototype.allChannels = function () {
  42355. return this.channels.all();
  42356. };
  42357. Pusher.prototype.connect = function () {
  42358. this.connection.connect();
  42359. if (this.timelineSender) {
  42360. if (!this.timelineSenderTimer) {
  42361. var usingTLS = this.connection.isUsingTLS();
  42362. var timelineSender = this.timelineSender;
  42363. this.timelineSenderTimer = new PeriodicTimer(60000, function () {
  42364. timelineSender.send(usingTLS);
  42365. });
  42366. }
  42367. }
  42368. };
  42369. Pusher.prototype.disconnect = function () {
  42370. this.connection.disconnect();
  42371. if (this.timelineSenderTimer) {
  42372. this.timelineSenderTimer.ensureAborted();
  42373. this.timelineSenderTimer = null;
  42374. }
  42375. };
  42376. Pusher.prototype.bind = function (event_name, callback, context) {
  42377. this.global_emitter.bind(event_name, callback, context);
  42378. return this;
  42379. };
  42380. Pusher.prototype.unbind = function (event_name, callback, context) {
  42381. this.global_emitter.unbind(event_name, callback, context);
  42382. return this;
  42383. };
  42384. Pusher.prototype.bind_global = function (callback) {
  42385. this.global_emitter.bind_global(callback);
  42386. return this;
  42387. };
  42388. Pusher.prototype.unbind_global = function (callback) {
  42389. this.global_emitter.unbind_global(callback);
  42390. return this;
  42391. };
  42392. Pusher.prototype.unbind_all = function (callback) {
  42393. this.global_emitter.unbind_all();
  42394. return this;
  42395. };
  42396. Pusher.prototype.subscribeAll = function () {
  42397. var channelName;
  42398. for (channelName in this.channels.channels) {
  42399. if (this.channels.channels.hasOwnProperty(channelName)) {
  42400. this.subscribe(channelName);
  42401. }
  42402. }
  42403. };
  42404. Pusher.prototype.subscribe = function (channel_name) {
  42405. var channel = this.channels.add(channel_name, this);
  42406. if (channel.subscriptionPending && channel.subscriptionCancelled) {
  42407. channel.reinstateSubscription();
  42408. }
  42409. else if (!channel.subscriptionPending &&
  42410. this.connection.state === 'connected') {
  42411. channel.subscribe();
  42412. }
  42413. return channel;
  42414. };
  42415. Pusher.prototype.unsubscribe = function (channel_name) {
  42416. var channel = this.channels.find(channel_name);
  42417. if (channel && channel.subscriptionPending) {
  42418. channel.cancelSubscription();
  42419. }
  42420. else {
  42421. channel = this.channels.remove(channel_name);
  42422. if (channel && this.connection.state === 'connected') {
  42423. channel.unsubscribe();
  42424. }
  42425. }
  42426. };
  42427. Pusher.prototype.send_event = function (event_name, data, channel) {
  42428. return this.connection.send_event(event_name, data, channel);
  42429. };
  42430. Pusher.prototype.shouldUseTLS = function () {
  42431. if (runtime.getProtocol() === 'https:') {
  42432. return true;
  42433. }
  42434. else if (this.config.forceTLS === true) {
  42435. return true;
  42436. }
  42437. else {
  42438. return Boolean(this.config.encrypted);
  42439. }
  42440. };
  42441. Pusher.instances = [];
  42442. Pusher.isReady = false;
  42443. Pusher.logToConsole = false;
  42444. Pusher.Runtime = runtime;
  42445. Pusher.ScriptReceivers = runtime.ScriptReceivers;
  42446. Pusher.DependenciesReceivers = runtime.DependenciesReceivers;
  42447. Pusher.auth_callbacks = runtime.auth_callbacks;
  42448. return Pusher;
  42449. }());
  42450. /* harmony default export */ var core_pusher = __webpack_exports__["default"] = (pusher_Pusher);
  42451. function checkAppKey(key) {
  42452. if (key === null || key === undefined) {
  42453. throw 'You must pass your app key when you instantiate Pusher.';
  42454. }
  42455. }
  42456. runtime.setup(pusher_Pusher);
  42457. /***/ })
  42458. /******/ ]);
  42459. });
  42460. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../buffer/index.js */ "./node_modules/buffer/index.js").Buffer))
  42461. /***/ }),
  42462. /***/ "./node_modules/setimmediate/setImmediate.js":
  42463. /*!***************************************************!*\
  42464. !*** ./node_modules/setimmediate/setImmediate.js ***!
  42465. \***************************************************/
  42466. /*! no static exports found */
  42467. /***/ (function(module, exports, __webpack_require__) {
  42468. /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
  42469. "use strict";
  42470. if (global.setImmediate) {
  42471. return;
  42472. }
  42473. var nextHandle = 1; // Spec says greater than zero
  42474. var tasksByHandle = {};
  42475. var currentlyRunningATask = false;
  42476. var doc = global.document;
  42477. var registerImmediate;
  42478. function setImmediate(callback) {
  42479. // Callback can either be a function or a string
  42480. if (typeof callback !== "function") {
  42481. callback = new Function("" + callback);
  42482. }
  42483. // Copy function arguments
  42484. var args = new Array(arguments.length - 1);
  42485. for (var i = 0; i < args.length; i++) {
  42486. args[i] = arguments[i + 1];
  42487. }
  42488. // Store and register the task
  42489. var task = { callback: callback, args: args };
  42490. tasksByHandle[nextHandle] = task;
  42491. registerImmediate(nextHandle);
  42492. return nextHandle++;
  42493. }
  42494. function clearImmediate(handle) {
  42495. delete tasksByHandle[handle];
  42496. }
  42497. function run(task) {
  42498. var callback = task.callback;
  42499. var args = task.args;
  42500. switch (args.length) {
  42501. case 0:
  42502. callback();
  42503. break;
  42504. case 1:
  42505. callback(args[0]);
  42506. break;
  42507. case 2:
  42508. callback(args[0], args[1]);
  42509. break;
  42510. case 3:
  42511. callback(args[0], args[1], args[2]);
  42512. break;
  42513. default:
  42514. callback.apply(undefined, args);
  42515. break;
  42516. }
  42517. }
  42518. function runIfPresent(handle) {
  42519. // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
  42520. // So if we're currently running a task, we'll need to delay this invocation.
  42521. if (currentlyRunningATask) {
  42522. // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
  42523. // "too much recursion" error.
  42524. setTimeout(runIfPresent, 0, handle);
  42525. } else {
  42526. var task = tasksByHandle[handle];
  42527. if (task) {
  42528. currentlyRunningATask = true;
  42529. try {
  42530. run(task);
  42531. } finally {
  42532. clearImmediate(handle);
  42533. currentlyRunningATask = false;
  42534. }
  42535. }
  42536. }
  42537. }
  42538. function installNextTickImplementation() {
  42539. registerImmediate = function(handle) {
  42540. process.nextTick(function () { runIfPresent(handle); });
  42541. };
  42542. }
  42543. function canUsePostMessage() {
  42544. // The test against `importScripts` prevents this implementation from being installed inside a web worker,
  42545. // where `global.postMessage` means something completely different and can't be used for this purpose.
  42546. if (global.postMessage && !global.importScripts) {
  42547. var postMessageIsAsynchronous = true;
  42548. var oldOnMessage = global.onmessage;
  42549. global.onmessage = function() {
  42550. postMessageIsAsynchronous = false;
  42551. };
  42552. global.postMessage("", "*");
  42553. global.onmessage = oldOnMessage;
  42554. return postMessageIsAsynchronous;
  42555. }
  42556. }
  42557. function installPostMessageImplementation() {
  42558. // Installs an event handler on `global` for the `message` event: see
  42559. // * https://developer.mozilla.org/en/DOM/window.postMessage
  42560. // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
  42561. var messagePrefix = "setImmediate$" + Math.random() + "$";
  42562. var onGlobalMessage = function(event) {
  42563. if (event.source === global &&
  42564. typeof event.data === "string" &&
  42565. event.data.indexOf(messagePrefix) === 0) {
  42566. runIfPresent(+event.data.slice(messagePrefix.length));
  42567. }
  42568. };
  42569. if (global.addEventListener) {
  42570. global.addEventListener("message", onGlobalMessage, false);
  42571. } else {
  42572. global.attachEvent("onmessage", onGlobalMessage);
  42573. }
  42574. registerImmediate = function(handle) {
  42575. global.postMessage(messagePrefix + handle, "*");
  42576. };
  42577. }
  42578. function installMessageChannelImplementation() {
  42579. var channel = new MessageChannel();
  42580. channel.port1.onmessage = function(event) {
  42581. var handle = event.data;
  42582. runIfPresent(handle);
  42583. };
  42584. registerImmediate = function(handle) {
  42585. channel.port2.postMessage(handle);
  42586. };
  42587. }
  42588. function installReadyStateChangeImplementation() {
  42589. var html = doc.documentElement;
  42590. registerImmediate = function(handle) {
  42591. // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
  42592. // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
  42593. var script = doc.createElement("script");
  42594. script.onreadystatechange = function () {
  42595. runIfPresent(handle);
  42596. script.onreadystatechange = null;
  42597. html.removeChild(script);
  42598. script = null;
  42599. };
  42600. html.appendChild(script);
  42601. };
  42602. }
  42603. function installSetTimeoutImplementation() {
  42604. registerImmediate = function(handle) {
  42605. setTimeout(runIfPresent, 0, handle);
  42606. };
  42607. }
  42608. // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
  42609. var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
  42610. attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
  42611. // Don't get fooled by e.g. browserify environments.
  42612. if ({}.toString.call(global.process) === "[object process]") {
  42613. // For Node.js before 0.9
  42614. installNextTickImplementation();
  42615. } else if (canUsePostMessage()) {
  42616. // For non-IE10 modern browsers
  42617. installPostMessageImplementation();
  42618. } else if (global.MessageChannel) {
  42619. // For web workers, where supported
  42620. installMessageChannelImplementation();
  42621. } else if (doc && "onreadystatechange" in doc.createElement("script")) {
  42622. // For IE 6–8
  42623. installReadyStateChangeImplementation();
  42624. } else {
  42625. // For older browsers
  42626. installSetTimeoutImplementation();
  42627. }
  42628. attachTo.setImmediate = setImmediate;
  42629. attachTo.clearImmediate = clearImmediate;
  42630. }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
  42631. /* 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")))
  42632. /***/ }),
  42633. /***/ "./node_modules/timers-browserify/main.js":
  42634. /*!************************************************!*\
  42635. !*** ./node_modules/timers-browserify/main.js ***!
  42636. \************************************************/
  42637. /*! no static exports found */
  42638. /***/ (function(module, exports, __webpack_require__) {
  42639. /* WEBPACK VAR INJECTION */(function(global) {var scope = (typeof global !== "undefined" && global) ||
  42640. (typeof self !== "undefined" && self) ||
  42641. window;
  42642. var apply = Function.prototype.apply;
  42643. // DOM APIs, for completeness
  42644. exports.setTimeout = function() {
  42645. return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);
  42646. };
  42647. exports.setInterval = function() {
  42648. return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);
  42649. };
  42650. exports.clearTimeout =
  42651. exports.clearInterval = function(timeout) {
  42652. if (timeout) {
  42653. timeout.close();
  42654. }
  42655. };
  42656. function Timeout(id, clearFn) {
  42657. this._id = id;
  42658. this._clearFn = clearFn;
  42659. }
  42660. Timeout.prototype.unref = Timeout.prototype.ref = function() {};
  42661. Timeout.prototype.close = function() {
  42662. this._clearFn.call(scope, this._id);
  42663. };
  42664. // Does not start the time, just sets up the members needed.
  42665. exports.enroll = function(item, msecs) {
  42666. clearTimeout(item._idleTimeoutId);
  42667. item._idleTimeout = msecs;
  42668. };
  42669. exports.unenroll = function(item) {
  42670. clearTimeout(item._idleTimeoutId);
  42671. item._idleTimeout = -1;
  42672. };
  42673. exports._unrefActive = exports.active = function(item) {
  42674. clearTimeout(item._idleTimeoutId);
  42675. var msecs = item._idleTimeout;
  42676. if (msecs >= 0) {
  42677. item._idleTimeoutId = setTimeout(function onTimeout() {
  42678. if (item._onTimeout)
  42679. item._onTimeout();
  42680. }, msecs);
  42681. }
  42682. };
  42683. // setimmediate attaches itself to the global object
  42684. __webpack_require__(/*! setimmediate */ "./node_modules/setimmediate/setImmediate.js");
  42685. // On some exotic environments, it's not clear which object `setimmediate` was
  42686. // able to install onto. Search each possibility in the same order as the
  42687. // `setimmediate` library.
  42688. exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) ||
  42689. (typeof global !== "undefined" && global.setImmediate) ||
  42690. (this && this.setImmediate);
  42691. exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||
  42692. (typeof global !== "undefined" && global.clearImmediate) ||
  42693. (this && this.clearImmediate);
  42694. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  42695. /***/ }),
  42696. /***/ "./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&":
  42697. /*!*******************************************************************************************************************************************************************************************************************!*\
  42698. !*** ./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& ***!
  42699. \*******************************************************************************************************************************************************************************************************************/
  42700. /*! exports provided: render, staticRenderFns */
  42701. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  42702. "use strict";
  42703. __webpack_require__.r(__webpack_exports__);
  42704. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  42705. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  42706. var render = function() {
  42707. var _vm = this
  42708. var _h = _vm.$createElement
  42709. var _c = _vm._self._c || _h
  42710. return _vm._m(0)
  42711. }
  42712. var staticRenderFns = [
  42713. function() {
  42714. var _vm = this
  42715. var _h = _vm.$createElement
  42716. var _c = _vm._self._c || _h
  42717. return _c("div", { staticClass: "container" }, [
  42718. _c("div", { staticClass: "row justify-content-center" }, [
  42719. _c("div", { staticClass: "col-md-8" }, [
  42720. _c("div", { staticClass: "card" }, [
  42721. _c("div", { staticClass: "card-header" }, [
  42722. _vm._v("Example Component")
  42723. ]),
  42724. _vm._v(" "),
  42725. _c("div", { staticClass: "card-body" }, [
  42726. _vm._v(
  42727. "\n I'm an example component.\n "
  42728. )
  42729. ])
  42730. ])
  42731. ])
  42732. ])
  42733. ])
  42734. }
  42735. ]
  42736. render._withStripped = true
  42737. /***/ }),
  42738. /***/ "./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&":
  42739. /*!************************************************************************************************************************************************************************************************************!*\
  42740. !*** ./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& ***!
  42741. \************************************************************************************************************************************************************************************************************/
  42742. /*! exports provided: render, staticRenderFns */
  42743. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  42744. "use strict";
  42745. __webpack_require__.r(__webpack_exports__);
  42746. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  42747. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  42748. var render = function() {
  42749. var _vm = this
  42750. var _h = _vm.$createElement
  42751. var _c = _vm._self._c || _h
  42752. return _c(
  42753. "div",
  42754. [
  42755. _c(
  42756. "modal",
  42757. {
  42758. attrs: {
  42759. id: "asseteditModal",
  42760. tabindex: "-1",
  42761. role: "dialog",
  42762. "aria-labelledby": "asseteditModalLabel"
  42763. }
  42764. },
  42765. [
  42766. _c(
  42767. "h5",
  42768. {
  42769. staticClass: "modal-title",
  42770. attrs: { slot: "header", id: "asseteditModalLabel" },
  42771. slot: "header"
  42772. },
  42773. [_vm._v("\n Edit Work Order Information\n ")]
  42774. ),
  42775. _vm._v(" "),
  42776. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  42777. _c("div", { staticClass: "form-group" }, [
  42778. _c("label", { attrs: { for: "manufacturer" } }, [
  42779. _vm._v("Manufacturer")
  42780. ]),
  42781. _vm._v(" "),
  42782. _c("input", {
  42783. directives: [
  42784. {
  42785. name: "model",
  42786. rawName: "v-model.lazy",
  42787. value: _vm.data.pcmanu,
  42788. expression: "data.pcmanu",
  42789. modifiers: { lazy: true }
  42790. }
  42791. ],
  42792. staticClass: "form-control",
  42793. attrs: {
  42794. type: "text",
  42795. name: "manufacturer",
  42796. id: "manufacturer"
  42797. },
  42798. domProps: { value: _vm.data.pcmanu },
  42799. on: {
  42800. change: function($event) {
  42801. return _vm.$set(_vm.data, "pcmanu", $event.target.value)
  42802. }
  42803. }
  42804. })
  42805. ]),
  42806. _vm._v(" "),
  42807. _c("div", { staticClass: "form-group" }, [
  42808. _c("label", { attrs: { for: "make" } }, [_vm._v("Make")]),
  42809. _vm._v(" "),
  42810. _c("input", {
  42811. directives: [
  42812. {
  42813. name: "model",
  42814. rawName: "v-model.lazy",
  42815. value: _vm.data.pcmake,
  42816. expression: "data.pcmake",
  42817. modifiers: { lazy: true }
  42818. }
  42819. ],
  42820. staticClass: "form-control",
  42821. attrs: { type: "text", name: "make", id: "make" },
  42822. domProps: { value: _vm.data.pcmake },
  42823. on: {
  42824. change: function($event) {
  42825. return _vm.$set(_vm.data, "pcmake", $event.target.value)
  42826. }
  42827. }
  42828. })
  42829. ]),
  42830. _vm._v(" "),
  42831. _c("div", { staticClass: "form-group" }, [
  42832. _c("label", { attrs: { for: "nickname" } }, [_vm._v("Nickname")]),
  42833. _vm._v(" "),
  42834. _c("input", {
  42835. directives: [
  42836. {
  42837. name: "model",
  42838. rawName: "v-model.lazy",
  42839. value: _vm.data.pcnickname,
  42840. expression: "data.pcnickname",
  42841. modifiers: { lazy: true }
  42842. }
  42843. ],
  42844. staticClass: "form-control",
  42845. attrs: { type: "text", name: "nickname", id: "nickname" },
  42846. domProps: { value: _vm.data.pcnickname },
  42847. on: {
  42848. change: function($event) {
  42849. return _vm.$set(_vm.data, "pcnickname", $event.target.value)
  42850. }
  42851. }
  42852. })
  42853. ]),
  42854. _vm._v(" "),
  42855. _c("div", { staticClass: "form-group" }, [
  42856. _c("label", { attrs: { for: "os" } }, [_vm._v("OS")]),
  42857. _vm._v(" "),
  42858. _c("input", {
  42859. directives: [
  42860. {
  42861. name: "model",
  42862. rawName: "v-model.lazy",
  42863. value: _vm.pcextra[2],
  42864. expression: "pcextra[2]",
  42865. modifiers: { lazy: true }
  42866. }
  42867. ],
  42868. staticClass: "form-control",
  42869. attrs: { type: "text", name: "os", id: "os" },
  42870. domProps: { value: _vm.pcextra[2] },
  42871. on: {
  42872. change: function($event) {
  42873. return _vm.$set(_vm.pcextra, 2, $event.target.value)
  42874. }
  42875. }
  42876. })
  42877. ]),
  42878. _vm._v(" "),
  42879. _c("div", { staticClass: "form-group" }, [
  42880. _c("label", { attrs: { for: "serial" } }, [
  42881. _vm._v("Serial Number")
  42882. ]),
  42883. _vm._v(" "),
  42884. _c("input", {
  42885. directives: [
  42886. {
  42887. name: "model",
  42888. rawName: "v-model.lazy",
  42889. value: _vm.pcextra[104],
  42890. expression: "pcextra[104]",
  42891. modifiers: { lazy: true }
  42892. }
  42893. ],
  42894. staticClass: "form-control",
  42895. attrs: { type: "text", id: "serial", name: "serial" },
  42896. domProps: { value: _vm.pcextra[104] },
  42897. on: {
  42898. change: function($event) {
  42899. return _vm.$set(_vm.pcextra, 104, $event.target.value)
  42900. }
  42901. }
  42902. })
  42903. ]),
  42904. _vm._v(" "),
  42905. _c("div", { staticClass: "form-group" }, [
  42906. _c("label", { attrs: { for: "cpu" } }, [_vm._v("CPU")]),
  42907. _vm._v(" "),
  42908. _c("input", {
  42909. directives: [
  42910. {
  42911. name: "model",
  42912. rawName: "v-model.lazy",
  42913. value: _vm.pcextra[101],
  42914. expression: "pcextra[101]",
  42915. modifiers: { lazy: true }
  42916. }
  42917. ],
  42918. staticClass: "form-control",
  42919. attrs: { type: "text", id: "cpu", name: "cpu" },
  42920. domProps: { value: _vm.pcextra[101] },
  42921. on: {
  42922. change: function($event) {
  42923. return _vm.$set(_vm.pcextra, 101, $event.target.value)
  42924. }
  42925. }
  42926. })
  42927. ]),
  42928. _vm._v(" "),
  42929. _c("div", { staticClass: "form-group" }, [
  42930. _c("label", { attrs: { for: "ram" } }, [_vm._v("RAM")]),
  42931. _vm._v(" "),
  42932. _c("input", {
  42933. directives: [
  42934. {
  42935. name: "model",
  42936. rawName: "v-model.lazy",
  42937. value: _vm.pcextra[100],
  42938. expression: "pcextra[100]",
  42939. modifiers: { lazy: true }
  42940. }
  42941. ],
  42942. staticClass: "form-control",
  42943. attrs: { type: "text", name: "ram", id: "ram" },
  42944. domProps: { value: _vm.pcextra[100] },
  42945. on: {
  42946. change: function($event) {
  42947. return _vm.$set(_vm.pcextra, 100, $event.target.value)
  42948. }
  42949. }
  42950. })
  42951. ]),
  42952. _vm._v(" "),
  42953. _c("div", { staticClass: "form-group" }, [
  42954. _c("label", { attrs: { for: "graphics" } }, [_vm._v("Graphics")]),
  42955. _vm._v(" "),
  42956. _c("input", {
  42957. directives: [
  42958. {
  42959. name: "model",
  42960. rawName: "v-model.lazy",
  42961. value: _vm.pcextra[4],
  42962. expression: "pcextra[4]",
  42963. modifiers: { lazy: true }
  42964. }
  42965. ],
  42966. staticClass: "form-control",
  42967. attrs: { type: "text", name: "graphics", id: "grapics" },
  42968. domProps: { value: _vm.pcextra[4] },
  42969. on: {
  42970. change: function($event) {
  42971. return _vm.$set(_vm.pcextra, 4, $event.target.value)
  42972. }
  42973. }
  42974. })
  42975. ])
  42976. ]),
  42977. _vm._v(" "),
  42978. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  42979. _c(
  42980. "button",
  42981. {
  42982. staticClass: "btn btn-secondary",
  42983. attrs: { type: "button", "data-dismiss": "modal" }
  42984. },
  42985. [_vm._v("Close")]
  42986. ),
  42987. _vm._v(" "),
  42988. _c(
  42989. "button",
  42990. {
  42991. staticClass: "btn btn-primary",
  42992. attrs: { type: "button" },
  42993. on: {
  42994. click: function($event) {
  42995. return _vm.updateAsset()
  42996. }
  42997. }
  42998. },
  42999. [_vm._v("Save")]
  43000. )
  43001. ])
  43002. ]
  43003. ),
  43004. _vm._v(" "),
  43005. _c("h4", { staticClass: "text-center" }, [
  43006. _vm._v(
  43007. _vm._s(this.data.pcmanu) + " " + _vm._s(this.data.pcmake) + " - "
  43008. ),
  43009. _c("small", { staticClass: "text-muted" }, [
  43010. _vm._v(_vm._s(this.data.pcnickname))
  43011. ])
  43012. ]),
  43013. _vm._v(" "),
  43014. _c("p", [_vm._v("OS: " + _vm._s(this.pcextra[2]))]),
  43015. _vm._v(" "),
  43016. _c("p", [_vm._v("S/N: " + _vm._s(this.pcextra[104]))]),
  43017. _vm._v(" "),
  43018. _c("p", [_vm._v("CPU: " + _vm._s(this.pcextra[101]))]),
  43019. _vm._v(" "),
  43020. _c("p", [_vm._v("RAM: " + _vm._s(this.pcextra[100]))]),
  43021. _vm._v(" "),
  43022. _c("p", [_vm._v("Graphics: " + _vm._s(this.pcextra[4]))]),
  43023. _vm._v(" "),
  43024. _c(
  43025. "button",
  43026. {
  43027. staticClass: "btn btn-primary",
  43028. attrs: {
  43029. type: "button",
  43030. "data-toggle": "modal",
  43031. "data-target": "#asseteditModal"
  43032. }
  43033. },
  43034. [_vm._v("Edit")]
  43035. )
  43036. ],
  43037. 1
  43038. )
  43039. }
  43040. var staticRenderFns = []
  43041. render._withStripped = true
  43042. /***/ }),
  43043. /***/ "./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&":
  43044. /*!*************************************************************************************************************************************************************************************************************!*\
  43045. !*** ./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& ***!
  43046. \*************************************************************************************************************************************************************************************************************/
  43047. /*! exports provided: render, staticRenderFns */
  43048. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43049. "use strict";
  43050. __webpack_require__.r(__webpack_exports__);
  43051. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43052. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43053. var render = function() {
  43054. var _vm = this
  43055. var _h = _vm.$createElement
  43056. var _c = _vm._self._c || _h
  43057. return _c(
  43058. "div",
  43059. { staticClass: "bg-lightgray m-1 p-2 border rounded container-fluid" },
  43060. [
  43061. _c(
  43062. "modal",
  43063. {
  43064. attrs: {
  43065. id: "credential" + this.data.credid + "editModal",
  43066. tabindex: "-1",
  43067. role: "dialog",
  43068. "aria-labelledby": "credential" + _vm.data.credid + "editModalLabel"
  43069. }
  43070. },
  43071. [
  43072. _c(
  43073. "h5",
  43074. {
  43075. staticClass: "modal-title",
  43076. attrs: { slot: "header", id: "credentialeditModalLabel" },
  43077. slot: "header"
  43078. },
  43079. [_vm._v("\r\n Edit Credential\r\n ")]
  43080. ),
  43081. _vm._v(" "),
  43082. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43083. _c("div", { staticClass: "form-group" }, [
  43084. _c("label", { attrs: { for: "newusername" } }, [
  43085. _vm._v("Username")
  43086. ]),
  43087. _vm._v(" "),
  43088. _c("input", {
  43089. directives: [
  43090. {
  43091. name: "model",
  43092. rawName: "v-model.lazy",
  43093. value: _vm.data.creduser,
  43094. expression: "data.creduser",
  43095. modifiers: { lazy: true }
  43096. }
  43097. ],
  43098. staticClass: "form-control credential",
  43099. attrs: {
  43100. type: "text",
  43101. name: "newusername" + _vm.data.credid,
  43102. id: "newusername" + _vm.data.credid
  43103. },
  43104. domProps: { value: _vm.data.creduser },
  43105. on: {
  43106. change: function($event) {
  43107. return _vm.$set(_vm.data, "creduser", $event.target.value)
  43108. }
  43109. }
  43110. })
  43111. ]),
  43112. _vm._v(" "),
  43113. _c("div", { staticClass: "form-group" }, [
  43114. _c("label", { attrs: { for: "newpassword" } }, [
  43115. _vm._v("Password")
  43116. ]),
  43117. _vm._v(" "),
  43118. _c("input", {
  43119. directives: [
  43120. {
  43121. name: "model",
  43122. rawName: "v-model.lazy",
  43123. value: _vm.data.credpass,
  43124. expression: "data.credpass",
  43125. modifiers: { lazy: true }
  43126. }
  43127. ],
  43128. ref: "newpassword" + _vm.data.credid,
  43129. staticClass: "form-control credential",
  43130. attrs: {
  43131. type: "text",
  43132. name: "newpassword" + _vm.data.credid,
  43133. id: "newpassword" + _vm.data.credid
  43134. },
  43135. domProps: { value: _vm.data.credpass },
  43136. on: {
  43137. change: function($event) {
  43138. return _vm.$set(_vm.data, "credpass", $event.target.value)
  43139. }
  43140. }
  43141. }),
  43142. _vm._v(" "),
  43143. _c(
  43144. "button",
  43145. {
  43146. staticClass: "btn btn-secondary",
  43147. attrs: { type: "button" },
  43148. on: {
  43149. click: function($event) {
  43150. return _vm.getRandomPassword(_vm.data.credid)
  43151. }
  43152. }
  43153. },
  43154. [_vm._v("Generate Random")]
  43155. )
  43156. ]),
  43157. _vm._v(" "),
  43158. _c("div", { staticClass: "form-group" })
  43159. ]),
  43160. _vm._v(" "),
  43161. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43162. _c(
  43163. "button",
  43164. {
  43165. staticClass: "btn btn-secondary",
  43166. attrs: { type: "button", "data-dismiss": "modal" }
  43167. },
  43168. [_vm._v("Close")]
  43169. ),
  43170. _vm._v(" "),
  43171. _c(
  43172. "button",
  43173. {
  43174. staticClass: "btn btn-primary",
  43175. attrs: { type: "button" },
  43176. on: {
  43177. click: function($event) {
  43178. return _vm.updateCredential()
  43179. }
  43180. }
  43181. },
  43182. [_vm._v("Save")]
  43183. )
  43184. ])
  43185. ]
  43186. ),
  43187. _vm._v(" "),
  43188. _c("div", { staticClass: "row no-gutters" }, [
  43189. _c("div", { staticClass: "h5 col-3 text-left" }, [
  43190. _vm._v(_vm._s(this.data.creddesc))
  43191. ]),
  43192. _vm._v(" "),
  43193. _c("div", { staticClass: "col-9 text-right" }, [
  43194. _vm._v(_vm._s(this.data.creddate))
  43195. ])
  43196. ]),
  43197. _vm._v(" "),
  43198. _c("div", { staticClass: "row" }, [
  43199. _c("div", { staticClass: "col-lg-9" }, [
  43200. _c("div", [
  43201. _vm._m(0),
  43202. _vm._v(" "),
  43203. _c("input", {
  43204. staticClass: "border-0 credential",
  43205. attrs: {
  43206. type: "text",
  43207. id: "username" + this.data.credid,
  43208. readonly: ""
  43209. },
  43210. domProps: { value: this.data.creduser }
  43211. }),
  43212. _vm._v(" "),
  43213. _c(
  43214. "button",
  43215. {
  43216. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  43217. attrs: {
  43218. id: "btn-username" + this.data.credid,
  43219. "data-clipboard-target": "#username" + this.data.credid
  43220. }
  43221. },
  43222. [_c("i", { staticClass: "far fa-clone" })]
  43223. )
  43224. ]),
  43225. _vm._v(" "),
  43226. _c("div", [
  43227. _vm._m(1),
  43228. _vm._v(" "),
  43229. _c("input", {
  43230. staticClass: "border-0 credential",
  43231. attrs: {
  43232. type: "text",
  43233. id: "password" + this.data.credid,
  43234. readonly: ""
  43235. },
  43236. domProps: { value: this.data.credpass }
  43237. }),
  43238. _vm._v(" "),
  43239. _c(
  43240. "button",
  43241. {
  43242. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  43243. attrs: {
  43244. id: "btn-password" + this.data.credid,
  43245. "data-clipboard-target": "#password" + this.data.credid
  43246. }
  43247. },
  43248. [_c("i", { staticClass: "far fa-clone" })]
  43249. )
  43250. ])
  43251. ]),
  43252. _vm._v(" "),
  43253. _c(
  43254. "div",
  43255. {
  43256. staticClass: "btn-group col-lg-2 align-self-end w-25 w-lg-auto",
  43257. attrs: { role: "group", "aria-label": "Edit and Delete" }
  43258. },
  43259. [
  43260. _c(
  43261. "button",
  43262. {
  43263. staticClass: "btn btn-sm btn-secondary p-lg-1",
  43264. attrs: {
  43265. type: "button",
  43266. "data-toggle": "modal",
  43267. "data-target": "#credential" + this.data.credid + "editModal"
  43268. }
  43269. },
  43270. [_c("i", { staticClass: "fas fa-fw fa-edit" })]
  43271. ),
  43272. _vm._v(" "),
  43273. _vm._m(2)
  43274. ]
  43275. )
  43276. ])
  43277. ],
  43278. 1
  43279. )
  43280. }
  43281. var staticRenderFns = [
  43282. function() {
  43283. var _vm = this
  43284. var _h = _vm.$createElement
  43285. var _c = _vm._self._c || _h
  43286. return _c("label", { attrs: { for: "username" } }, [
  43287. _c("i", { staticClass: "fas fa-fw fa-user" })
  43288. ])
  43289. },
  43290. function() {
  43291. var _vm = this
  43292. var _h = _vm.$createElement
  43293. var _c = _vm._self._c || _h
  43294. return _c("label", { attrs: { for: "password" } }, [
  43295. _c("i", { staticClass: "fas fa-fw fa-key" })
  43296. ])
  43297. },
  43298. function() {
  43299. var _vm = this
  43300. var _h = _vm.$createElement
  43301. var _c = _vm._self._c || _h
  43302. return _c(
  43303. "button",
  43304. {
  43305. staticClass: "btn btn-sm btn-danger p-lg-1",
  43306. attrs: { type: "button" }
  43307. },
  43308. [_c("i", { staticClass: "fas fa-fw fa-trash-alt" })]
  43309. )
  43310. }
  43311. ]
  43312. render._withStripped = true
  43313. /***/ }),
  43314. /***/ "./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&":
  43315. /*!************************************************************************************************************************************************************************************************************!*\
  43316. !*** ./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& ***!
  43317. \************************************************************************************************************************************************************************************************************/
  43318. /*! exports provided: render, staticRenderFns */
  43319. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43320. "use strict";
  43321. __webpack_require__.r(__webpack_exports__);
  43322. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43323. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43324. var render = function() {
  43325. var _vm = this
  43326. var _h = _vm.$createElement
  43327. var _c = _vm._self._c || _h
  43328. return _c(
  43329. "ul",
  43330. { staticClass: "list-unstyled" },
  43331. _vm._l(_vm.errorList, function(error) {
  43332. return _c("li", { key: error, staticClass: "text-danger" }, [
  43333. _vm._v(" " + _vm._s(error) + " ")
  43334. ])
  43335. }),
  43336. 0
  43337. )
  43338. }
  43339. var staticRenderFns = []
  43340. render._withStripped = true
  43341. /***/ }),
  43342. /***/ "./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&":
  43343. /*!********************************************************************************************************************************************************************************************************!*\
  43344. !*** ./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& ***!
  43345. \********************************************************************************************************************************************************************************************************/
  43346. /*! exports provided: render, staticRenderFns */
  43347. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43348. "use strict";
  43349. __webpack_require__.r(__webpack_exports__);
  43350. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43351. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43352. var render = function() {
  43353. var _vm = this
  43354. var _h = _vm.$createElement
  43355. var _c = _vm._self._c || _h
  43356. return _c("div", { staticClass: "modal fade" }, [
  43357. _c(
  43358. "div",
  43359. { staticClass: "modal-dialog modal-lg", attrs: { role: "document" } },
  43360. [
  43361. _c("div", { staticClass: "modal-content" }, [
  43362. _c(
  43363. "div",
  43364. { staticClass: "modal-header" },
  43365. [_vm._m(0), _vm._v(" "), _vm._t("header")],
  43366. 2
  43367. ),
  43368. _vm._v(" "),
  43369. _c("div", { staticClass: "modal-body" }, [_vm._t("body")], 2),
  43370. _vm._v(" "),
  43371. _c("div", { staticClass: "modal-footer" }, [_vm._t("footer")], 2)
  43372. ])
  43373. ]
  43374. )
  43375. ])
  43376. }
  43377. var staticRenderFns = [
  43378. function() {
  43379. var _vm = this
  43380. var _h = _vm.$createElement
  43381. var _c = _vm._self._c || _h
  43382. return _c(
  43383. "button",
  43384. {
  43385. staticClass: "close",
  43386. attrs: {
  43387. type: "button",
  43388. "data-dismiss": "modal",
  43389. "aria-label": "Close"
  43390. }
  43391. },
  43392. [_c("span", { attrs: { "aria-hidden": "true" } }, [_vm._v("×")])]
  43393. )
  43394. }
  43395. ]
  43396. render._withStripped = true
  43397. /***/ }),
  43398. /***/ "./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&":
  43399. /*!********************************************************************************************************************************************************************************************************!*\
  43400. !*** ./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& ***!
  43401. \********************************************************************************************************************************************************************************************************/
  43402. /*! exports provided: render, staticRenderFns */
  43403. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43404. "use strict";
  43405. __webpack_require__.r(__webpack_exports__);
  43406. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43407. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43408. var render = function() {
  43409. var _vm = this
  43410. var _h = _vm.$createElement
  43411. var _c = _vm._self._c || _h
  43412. return _c(
  43413. "ul",
  43414. { staticClass: "list-unstyled" },
  43415. _vm._l(this.notes, function(note) {
  43416. return _c(
  43417. "li",
  43418. { key: note.noteid, staticClass: "row no-gutters mb-2" },
  43419. [
  43420. _c(
  43421. "modal",
  43422. {
  43423. attrs: {
  43424. id: "note" + note.noteid + "editModal",
  43425. tabindex: "-1",
  43426. role: "dialog",
  43427. "aria-labelledby": "note" + note.noteid + "editModalLabel"
  43428. }
  43429. },
  43430. [
  43431. _c(
  43432. "h5",
  43433. {
  43434. staticClass: "modal-title",
  43435. attrs: {
  43436. slot: "header",
  43437. id: "note" + note.noteid + "editModalLabel"
  43438. },
  43439. slot: "header"
  43440. },
  43441. [_vm._v("\n Edit Note\n ")]
  43442. ),
  43443. _vm._v(" "),
  43444. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43445. _c("div", { staticClass: "form-group" }, [
  43446. _c("label", { attrs: { for: "content" } }, [
  43447. _vm._v("Content")
  43448. ]),
  43449. _vm._v(" "),
  43450. _c("textarea", {
  43451. directives: [
  43452. {
  43453. name: "model",
  43454. rawName: "v-model",
  43455. value: note.thenote,
  43456. expression: "note.thenote"
  43457. }
  43458. ],
  43459. staticClass: "form-control",
  43460. attrs: {
  43461. name: "content" + note.noteid,
  43462. id: "content" + note.noteid
  43463. },
  43464. domProps: { value: note.thenote },
  43465. on: {
  43466. input: function($event) {
  43467. if ($event.target.composing) {
  43468. return
  43469. }
  43470. _vm.$set(note, "thenote", $event.target.value)
  43471. }
  43472. }
  43473. })
  43474. ])
  43475. ]),
  43476. _vm._v(" "),
  43477. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43478. _c(
  43479. "button",
  43480. {
  43481. staticClass: "btn btn-secondary",
  43482. attrs: { type: "button", "data-dismiss": "modal" }
  43483. },
  43484. [_vm._v("Close")]
  43485. ),
  43486. _vm._v(" "),
  43487. _c(
  43488. "button",
  43489. {
  43490. staticClass: "btn btn-primary",
  43491. attrs: { type: "button" },
  43492. on: {
  43493. click: function($event) {
  43494. return _vm.updateNote(note.noteid)
  43495. }
  43496. }
  43497. },
  43498. [_vm._v("Save")]
  43499. )
  43500. ])
  43501. ]
  43502. ),
  43503. _vm._v(" "),
  43504. _c("div", { staticClass: "col-md-1 d-flex flex-column mx-md-3" }, [
  43505. _c("div", { staticClass: "text-center p-0 m-0" }, [
  43506. _vm._v(_vm._s(note.noteuser))
  43507. ]),
  43508. _vm._v(" "),
  43509. _c(
  43510. "div",
  43511. { staticClass: "text-muted text-small text-center p-0 m-0" },
  43512. [_vm._v(_vm._s(_vm.getHRDate(note.notetime)))]
  43513. ),
  43514. _vm._v(" "),
  43515. _c(
  43516. "div",
  43517. { staticClass: "btn-group justify-content-center p-0 m-0" },
  43518. [
  43519. _vm.authusername === note.noteuser ||
  43520. _vm.authusername === "admin"
  43521. ? [
  43522. _c(
  43523. "button",
  43524. {
  43525. staticClass: "btn btn-sm btn-primary m-1",
  43526. attrs: {
  43527. "data-toggle": "modal",
  43528. "data-target": "#note" + note.noteid + "editModal"
  43529. }
  43530. },
  43531. [_c("i", { staticClass: "fas fa-fw fa-edit" })]
  43532. ),
  43533. _vm._v(" "),
  43534. _vm._m(0, true),
  43535. _vm._v(" "),
  43536. _vm._m(1, true)
  43537. ]
  43538. : _vm._e()
  43539. ],
  43540. 2
  43541. )
  43542. ]),
  43543. _vm._v(" "),
  43544. _c("div", { staticClass: "col-md-10" }, [
  43545. _c("div", { staticClass: "card m-2" }, [
  43546. _c("div", { staticClass: "card-body p-2" }, [
  43547. _vm._v(
  43548. "\n " +
  43549. _vm._s(note.thenote) +
  43550. "\n "
  43551. )
  43552. ])
  43553. ])
  43554. ])
  43555. ],
  43556. 1
  43557. )
  43558. }),
  43559. 0
  43560. )
  43561. }
  43562. var staticRenderFns = [
  43563. function() {
  43564. var _vm = this
  43565. var _h = _vm.$createElement
  43566. var _c = _vm._self._c || _h
  43567. return _c("button", { staticClass: "btn btn-sm btn-danger m-1" }, [
  43568. _c("i", { staticClass: "fas fa-fw fa-trash-alt" })
  43569. ])
  43570. },
  43571. function() {
  43572. var _vm = this
  43573. var _h = _vm.$createElement
  43574. var _c = _vm._self._c || _h
  43575. return _c("button", { staticClass: "btn btn-sm btn-primary m-1" }, [
  43576. _c("i", { staticClass: "fa fa-fw fa-random" })
  43577. ])
  43578. }
  43579. ]
  43580. render._withStripped = true
  43581. /***/ }),
  43582. /***/ "./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&":
  43583. /*!********************************************************************************************************************************************************************************************************************!*\
  43584. !*** ./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& ***!
  43585. \********************************************************************************************************************************************************************************************************************/
  43586. /*! exports provided: render, staticRenderFns */
  43587. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43588. "use strict";
  43589. __webpack_require__.r(__webpack_exports__);
  43590. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43591. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43592. var render = function() {
  43593. var _vm = this
  43594. var _h = _vm.$createElement
  43595. var _c = _vm._self._c || _h
  43596. return _c(
  43597. "modal",
  43598. {
  43599. attrs: {
  43600. id: _vm.id,
  43601. tabindex: "-1",
  43602. role: "dialog",
  43603. "aria-labelledby": _vm.id + "Label"
  43604. }
  43605. },
  43606. [
  43607. _c(
  43608. "h5",
  43609. {
  43610. staticClass: "modal-title",
  43611. attrs: { slot: "header", id: _vm.id + "Label" },
  43612. slot: "header"
  43613. },
  43614. [_vm._v("\r\n Edit Work Order Information\r\n ")]
  43615. ),
  43616. _vm._v(" "),
  43617. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43618. _c(
  43619. "div",
  43620. { staticClass: "form-group" },
  43621. [
  43622. _c("label", { attrs: { for: "probdesc" } }, [
  43623. _vm._v("Problem Description")
  43624. ]),
  43625. _vm._v(" "),
  43626. _c("textarea", {
  43627. directives: [
  43628. {
  43629. name: "model",
  43630. rawName: "v-model",
  43631. value: _vm.data.probdesc,
  43632. expression: "data.probdesc"
  43633. }
  43634. ],
  43635. class: {
  43636. "form-control": true,
  43637. "is-invalid": _vm.errors.probdesc
  43638. },
  43639. attrs: { id: "probdesc", name: "probdesc" },
  43640. domProps: { value: _vm.data.probdesc },
  43641. on: {
  43642. input: function($event) {
  43643. if ($event.target.composing) {
  43644. return
  43645. }
  43646. _vm.$set(_vm.data, "probdesc", $event.target.value)
  43647. }
  43648. }
  43649. }),
  43650. _vm._v(" "),
  43651. _c("errorlist", { attrs: { errors: _vm.errors.probdesc } })
  43652. ],
  43653. 1
  43654. ),
  43655. _vm._v(" "),
  43656. _c(
  43657. "div",
  43658. { staticClass: "form-group" },
  43659. [
  43660. _c("label", { attrs: { for: "suggested" } }, [
  43661. _vm._v("Suggested Solution")
  43662. ]),
  43663. _vm._v(" "),
  43664. _c("textarea", {
  43665. directives: [
  43666. {
  43667. name: "model",
  43668. rawName: "v-model",
  43669. value: _vm.data.suggested,
  43670. expression: "data.suggested"
  43671. }
  43672. ],
  43673. class: {
  43674. "form-control": true,
  43675. "is-invalid": _vm.errors.suggested
  43676. },
  43677. attrs: { id: "suggested", name: "suggested" },
  43678. domProps: { value: _vm.data.suggested },
  43679. on: {
  43680. input: function($event) {
  43681. if ($event.target.composing) {
  43682. return
  43683. }
  43684. _vm.$set(_vm.data, "suggested", $event.target.value)
  43685. }
  43686. }
  43687. }),
  43688. _vm._v(" "),
  43689. _c("errorlist", { attrs: { errors: _vm.errors.suggested } })
  43690. ],
  43691. 1
  43692. ),
  43693. _vm._v(" "),
  43694. _c("div", { staticClass: "form-group" }, [
  43695. _c("label", { attrs: { for: "storelist" } }, [_vm._v("Store")]),
  43696. _vm._v(" "),
  43697. _vm.storeList
  43698. ? _c(
  43699. "select",
  43700. {
  43701. directives: [
  43702. {
  43703. name: "model",
  43704. rawName: "v-model",
  43705. value: _vm.data.storeid,
  43706. expression: "data.storeid"
  43707. }
  43708. ],
  43709. staticClass: "form-control",
  43710. attrs: { name: "storelist", id: "storelist" },
  43711. on: {
  43712. change: function($event) {
  43713. var $$selectedVal = Array.prototype.filter
  43714. .call($event.target.options, function(o) {
  43715. return o.selected
  43716. })
  43717. .map(function(o) {
  43718. var val = "_value" in o ? o._value : o.value
  43719. return val
  43720. })
  43721. _vm.$set(
  43722. _vm.data,
  43723. "storeid",
  43724. $event.target.multiple
  43725. ? $$selectedVal
  43726. : $$selectedVal[0]
  43727. )
  43728. }
  43729. }
  43730. },
  43731. _vm._l(_vm.storeList, function(store) {
  43732. return _c(
  43733. "option",
  43734. { key: store.storeid, domProps: { value: store.storeid } },
  43735. [
  43736. _vm._v(
  43737. "\r\n " +
  43738. _vm._s(store.storesname) +
  43739. "\r\n "
  43740. )
  43741. ]
  43742. )
  43743. }),
  43744. 0
  43745. )
  43746. : _vm._e()
  43747. ])
  43748. ]),
  43749. _vm._v(" "),
  43750. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43751. _c(
  43752. "button",
  43753. {
  43754. staticClass: "btn btn-secondary",
  43755. attrs: { type: "button", "data-dismiss": "modal" }
  43756. },
  43757. [_vm._v("Close")]
  43758. ),
  43759. _vm._v(" "),
  43760. _c(
  43761. "button",
  43762. {
  43763. staticClass: "btn btn-primary",
  43764. attrs: { type: "button" },
  43765. on: {
  43766. click: function($event) {
  43767. return _vm.updateWorkOrder()
  43768. }
  43769. }
  43770. },
  43771. [_vm._v("Save")]
  43772. )
  43773. ])
  43774. ]
  43775. )
  43776. }
  43777. var staticRenderFns = []
  43778. render._withStripped = true
  43779. /***/ }),
  43780. /***/ "./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&":
  43781. /*!*********************************************************************************************************************************************************************************************************!*\
  43782. !*** ./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& ***!
  43783. \*********************************************************************************************************************************************************************************************************/
  43784. /*! exports provided: render, staticRenderFns */
  43785. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43786. "use strict";
  43787. __webpack_require__.r(__webpack_exports__);
  43788. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43789. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43790. var render = function() {
  43791. var _vm = this
  43792. var _h = _vm.$createElement
  43793. var _c = _vm._self._c || _h
  43794. return _c(
  43795. "div",
  43796. [
  43797. _c("woinfo-edit-modal", {
  43798. attrs: {
  43799. "modal-id": "workordereditModal",
  43800. "populate-with": this.data,
  43801. "store-list": this.storeList
  43802. }
  43803. }),
  43804. _vm._v(" "),
  43805. _c("p", [
  43806. _c("i", { staticClass: "fas fa-fw fa-info-circle" }),
  43807. _vm._v(" "),
  43808. _c("span", { domProps: { textContent: _vm._s(this.data.probdesc) } })
  43809. ]),
  43810. _vm._v(" "),
  43811. _c("p", [
  43812. _c("i", { staticClass: "far fa-fw fa-lightbulb" }),
  43813. _vm._v(" "),
  43814. _c("span", { domProps: { textContent: _vm._s(this.data.suggested) } })
  43815. ]),
  43816. _vm._v(" "),
  43817. _c("p", [
  43818. _c("i", { staticClass: "fas fa-fw fa-paste" }),
  43819. _vm._v(" "),
  43820. _c("span", { domProps: { textContent: _vm._s(this.data.woid) } })
  43821. ]),
  43822. _vm._v(" "),
  43823. _c("p", [
  43824. _c("i", { staticClass: "fas fa-fw fa-building" }),
  43825. _vm._v(" "),
  43826. this.storeList
  43827. ? _c("span", [
  43828. _vm._v(_vm._s(this.storeList[this.data.storeid].storesname))
  43829. ])
  43830. : _vm._e()
  43831. ]),
  43832. _vm._v(" "),
  43833. _c("p", [
  43834. _c("i", { staticClass: "fas fa-fw fa-sign-in-alt" }),
  43835. _vm._v(" "),
  43836. _c(
  43837. "span",
  43838. {
  43839. staticClass: "dashed-underline",
  43840. attrs: {
  43841. "data-toggle": "tooltip",
  43842. "data-placement": "bottom",
  43843. title: this.getHRDate(this.data.dropdate)
  43844. }
  43845. },
  43846. [
  43847. _vm._v(
  43848. "\n " +
  43849. _vm._s(Math.floor(this.daysSinceToday(this.data.dropdate))) +
  43850. " days ago\n "
  43851. )
  43852. ]
  43853. )
  43854. ]),
  43855. _vm._v(" "),
  43856. _c("p", [
  43857. _c("i", { staticClass: "fas fa-sign-out-alt" }),
  43858. _vm._v(" "),
  43859. !this.isZero(this.data.pickupdate)
  43860. ? _c(
  43861. "span",
  43862. {
  43863. staticClass: "dashed-underline",
  43864. attrs: {
  43865. "data-toggle": "tooltip",
  43866. "data-placement": "bottom",
  43867. title: this.getHRDate(this.data.pickupdate)
  43868. }
  43869. },
  43870. [
  43871. _vm._v(
  43872. "\n " +
  43873. _vm._s(
  43874. Math.floor(this.daysSinceToday(this.data.pickupdate))
  43875. ) +
  43876. " days ago\n "
  43877. )
  43878. ]
  43879. )
  43880. : _vm._e()
  43881. ]),
  43882. _vm._v(" "),
  43883. _c(
  43884. "button",
  43885. {
  43886. staticClass: "btn btn-primary",
  43887. attrs: {
  43888. type: "button",
  43889. "data-toggle": "modal",
  43890. "data-target": "#workordereditModal"
  43891. }
  43892. },
  43893. [_vm._v("Edit")]
  43894. )
  43895. ],
  43896. 1
  43897. )
  43898. }
  43899. var staticRenderFns = []
  43900. render._withStripped = true
  43901. /***/ }),
  43902. /***/ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js":
  43903. /*!********************************************************************!*\
  43904. !*** ./node_modules/vue-loader/lib/runtime/componentNormalizer.js ***!
  43905. \********************************************************************/
  43906. /*! exports provided: default */
  43907. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43908. "use strict";
  43909. __webpack_require__.r(__webpack_exports__);
  43910. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeComponent; });
  43911. /* globals __VUE_SSR_CONTEXT__ */
  43912. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  43913. // This module is a runtime utility for cleaner component module output and will
  43914. // be included in the final webpack user bundle.
  43915. function normalizeComponent (
  43916. scriptExports,
  43917. render,
  43918. staticRenderFns,
  43919. functionalTemplate,
  43920. injectStyles,
  43921. scopeId,
  43922. moduleIdentifier, /* server only */
  43923. shadowMode /* vue-cli only */
  43924. ) {
  43925. // Vue.extend constructor export interop
  43926. var options = typeof scriptExports === 'function'
  43927. ? scriptExports.options
  43928. : scriptExports
  43929. // render functions
  43930. if (render) {
  43931. options.render = render
  43932. options.staticRenderFns = staticRenderFns
  43933. options._compiled = true
  43934. }
  43935. // functional template
  43936. if (functionalTemplate) {
  43937. options.functional = true
  43938. }
  43939. // scopedId
  43940. if (scopeId) {
  43941. options._scopeId = 'data-v-' + scopeId
  43942. }
  43943. var hook
  43944. if (moduleIdentifier) { // server build
  43945. hook = function (context) {
  43946. // 2.3 injection
  43947. context =
  43948. context || // cached call
  43949. (this.$vnode && this.$vnode.ssrContext) || // stateful
  43950. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  43951. // 2.2 with runInNewContext: true
  43952. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  43953. context = __VUE_SSR_CONTEXT__
  43954. }
  43955. // inject component styles
  43956. if (injectStyles) {
  43957. injectStyles.call(this, context)
  43958. }
  43959. // register component module identifier for async chunk inferrence
  43960. if (context && context._registeredComponents) {
  43961. context._registeredComponents.add(moduleIdentifier)
  43962. }
  43963. }
  43964. // used by ssr in case component is cached and beforeCreate
  43965. // never gets called
  43966. options._ssrRegister = hook
  43967. } else if (injectStyles) {
  43968. hook = shadowMode
  43969. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  43970. : injectStyles
  43971. }
  43972. if (hook) {
  43973. if (options.functional) {
  43974. // for template-only hot-reload because in that case the render fn doesn't
  43975. // go through the normalizer
  43976. options._injectStyles = hook
  43977. // register for functioal component in vue file
  43978. var originalRender = options.render
  43979. options.render = function renderWithStyleInjection (h, context) {
  43980. hook.call(context)
  43981. return originalRender(h, context)
  43982. }
  43983. } else {
  43984. // inject component registration as beforeCreate hook
  43985. var existing = options.beforeCreate
  43986. options.beforeCreate = existing
  43987. ? [].concat(existing, hook)
  43988. : [hook]
  43989. }
  43990. }
  43991. return {
  43992. exports: scriptExports,
  43993. options: options
  43994. }
  43995. }
  43996. /***/ }),
  43997. /***/ "./node_modules/vue/dist/vue.common.dev.js":
  43998. /*!*************************************************!*\
  43999. !*** ./node_modules/vue/dist/vue.common.dev.js ***!
  44000. \*************************************************/
  44001. /*! no static exports found */
  44002. /***/ (function(module, exports, __webpack_require__) {
  44003. "use strict";
  44004. /* WEBPACK VAR INJECTION */(function(global, setImmediate) {/*!
  44005. * Vue.js v2.6.11
  44006. * (c) 2014-2019 Evan You
  44007. * Released under the MIT License.
  44008. */
  44009. /* */
  44010. var emptyObject = Object.freeze({});
  44011. // These helpers produce better VM code in JS engines due to their
  44012. // explicitness and function inlining.
  44013. function isUndef (v) {
  44014. return v === undefined || v === null
  44015. }
  44016. function isDef (v) {
  44017. return v !== undefined && v !== null
  44018. }
  44019. function isTrue (v) {
  44020. return v === true
  44021. }
  44022. function isFalse (v) {
  44023. return v === false
  44024. }
  44025. /**
  44026. * Check if value is primitive.
  44027. */
  44028. function isPrimitive (value) {
  44029. return (
  44030. typeof value === 'string' ||
  44031. typeof value === 'number' ||
  44032. // $flow-disable-line
  44033. typeof value === 'symbol' ||
  44034. typeof value === 'boolean'
  44035. )
  44036. }
  44037. /**
  44038. * Quick object check - this is primarily used to tell
  44039. * Objects from primitive values when we know the value
  44040. * is a JSON-compliant type.
  44041. */
  44042. function isObject (obj) {
  44043. return obj !== null && typeof obj === 'object'
  44044. }
  44045. /**
  44046. * Get the raw type string of a value, e.g., [object Object].
  44047. */
  44048. var _toString = Object.prototype.toString;
  44049. function toRawType (value) {
  44050. return _toString.call(value).slice(8, -1)
  44051. }
  44052. /**
  44053. * Strict object type check. Only returns true
  44054. * for plain JavaScript objects.
  44055. */
  44056. function isPlainObject (obj) {
  44057. return _toString.call(obj) === '[object Object]'
  44058. }
  44059. function isRegExp (v) {
  44060. return _toString.call(v) === '[object RegExp]'
  44061. }
  44062. /**
  44063. * Check if val is a valid array index.
  44064. */
  44065. function isValidArrayIndex (val) {
  44066. var n = parseFloat(String(val));
  44067. return n >= 0 && Math.floor(n) === n && isFinite(val)
  44068. }
  44069. function isPromise (val) {
  44070. return (
  44071. isDef(val) &&
  44072. typeof val.then === 'function' &&
  44073. typeof val.catch === 'function'
  44074. )
  44075. }
  44076. /**
  44077. * Convert a value to a string that is actually rendered.
  44078. */
  44079. function toString (val) {
  44080. return val == null
  44081. ? ''
  44082. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  44083. ? JSON.stringify(val, null, 2)
  44084. : String(val)
  44085. }
  44086. /**
  44087. * Convert an input value to a number for persistence.
  44088. * If the conversion fails, return original string.
  44089. */
  44090. function toNumber (val) {
  44091. var n = parseFloat(val);
  44092. return isNaN(n) ? val : n
  44093. }
  44094. /**
  44095. * Make a map and return a function for checking if a key
  44096. * is in that map.
  44097. */
  44098. function makeMap (
  44099. str,
  44100. expectsLowerCase
  44101. ) {
  44102. var map = Object.create(null);
  44103. var list = str.split(',');
  44104. for (var i = 0; i < list.length; i++) {
  44105. map[list[i]] = true;
  44106. }
  44107. return expectsLowerCase
  44108. ? function (val) { return map[val.toLowerCase()]; }
  44109. : function (val) { return map[val]; }
  44110. }
  44111. /**
  44112. * Check if a tag is a built-in tag.
  44113. */
  44114. var isBuiltInTag = makeMap('slot,component', true);
  44115. /**
  44116. * Check if an attribute is a reserved attribute.
  44117. */
  44118. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  44119. /**
  44120. * Remove an item from an array.
  44121. */
  44122. function remove (arr, item) {
  44123. if (arr.length) {
  44124. var index = arr.indexOf(item);
  44125. if (index > -1) {
  44126. return arr.splice(index, 1)
  44127. }
  44128. }
  44129. }
  44130. /**
  44131. * Check whether an object has the property.
  44132. */
  44133. var hasOwnProperty = Object.prototype.hasOwnProperty;
  44134. function hasOwn (obj, key) {
  44135. return hasOwnProperty.call(obj, key)
  44136. }
  44137. /**
  44138. * Create a cached version of a pure function.
  44139. */
  44140. function cached (fn) {
  44141. var cache = Object.create(null);
  44142. return (function cachedFn (str) {
  44143. var hit = cache[str];
  44144. return hit || (cache[str] = fn(str))
  44145. })
  44146. }
  44147. /**
  44148. * Camelize a hyphen-delimited string.
  44149. */
  44150. var camelizeRE = /-(\w)/g;
  44151. var camelize = cached(function (str) {
  44152. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  44153. });
  44154. /**
  44155. * Capitalize a string.
  44156. */
  44157. var capitalize = cached(function (str) {
  44158. return str.charAt(0).toUpperCase() + str.slice(1)
  44159. });
  44160. /**
  44161. * Hyphenate a camelCase string.
  44162. */
  44163. var hyphenateRE = /\B([A-Z])/g;
  44164. var hyphenate = cached(function (str) {
  44165. return str.replace(hyphenateRE, '-$1').toLowerCase()
  44166. });
  44167. /**
  44168. * Simple bind polyfill for environments that do not support it,
  44169. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  44170. * since native bind is now performant enough in most browsers.
  44171. * But removing it would mean breaking code that was able to run in
  44172. * PhantomJS 1.x, so this must be kept for backward compatibility.
  44173. */
  44174. /* istanbul ignore next */
  44175. function polyfillBind (fn, ctx) {
  44176. function boundFn (a) {
  44177. var l = arguments.length;
  44178. return l
  44179. ? l > 1
  44180. ? fn.apply(ctx, arguments)
  44181. : fn.call(ctx, a)
  44182. : fn.call(ctx)
  44183. }
  44184. boundFn._length = fn.length;
  44185. return boundFn
  44186. }
  44187. function nativeBind (fn, ctx) {
  44188. return fn.bind(ctx)
  44189. }
  44190. var bind = Function.prototype.bind
  44191. ? nativeBind
  44192. : polyfillBind;
  44193. /**
  44194. * Convert an Array-like object to a real Array.
  44195. */
  44196. function toArray (list, start) {
  44197. start = start || 0;
  44198. var i = list.length - start;
  44199. var ret = new Array(i);
  44200. while (i--) {
  44201. ret[i] = list[i + start];
  44202. }
  44203. return ret
  44204. }
  44205. /**
  44206. * Mix properties into target object.
  44207. */
  44208. function extend (to, _from) {
  44209. for (var key in _from) {
  44210. to[key] = _from[key];
  44211. }
  44212. return to
  44213. }
  44214. /**
  44215. * Merge an Array of Objects into a single Object.
  44216. */
  44217. function toObject (arr) {
  44218. var res = {};
  44219. for (var i = 0; i < arr.length; i++) {
  44220. if (arr[i]) {
  44221. extend(res, arr[i]);
  44222. }
  44223. }
  44224. return res
  44225. }
  44226. /* eslint-disable no-unused-vars */
  44227. /**
  44228. * Perform no operation.
  44229. * Stubbing args to make Flow happy without leaving useless transpiled code
  44230. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  44231. */
  44232. function noop (a, b, c) {}
  44233. /**
  44234. * Always return false.
  44235. */
  44236. var no = function (a, b, c) { return false; };
  44237. /* eslint-enable no-unused-vars */
  44238. /**
  44239. * Return the same value.
  44240. */
  44241. var identity = function (_) { return _; };
  44242. /**
  44243. * Generate a string containing static keys from compiler modules.
  44244. */
  44245. function genStaticKeys (modules) {
  44246. return modules.reduce(function (keys, m) {
  44247. return keys.concat(m.staticKeys || [])
  44248. }, []).join(',')
  44249. }
  44250. /**
  44251. * Check if two values are loosely equal - that is,
  44252. * if they are plain objects, do they have the same shape?
  44253. */
  44254. function looseEqual (a, b) {
  44255. if (a === b) { return true }
  44256. var isObjectA = isObject(a);
  44257. var isObjectB = isObject(b);
  44258. if (isObjectA && isObjectB) {
  44259. try {
  44260. var isArrayA = Array.isArray(a);
  44261. var isArrayB = Array.isArray(b);
  44262. if (isArrayA && isArrayB) {
  44263. return a.length === b.length && a.every(function (e, i) {
  44264. return looseEqual(e, b[i])
  44265. })
  44266. } else if (a instanceof Date && b instanceof Date) {
  44267. return a.getTime() === b.getTime()
  44268. } else if (!isArrayA && !isArrayB) {
  44269. var keysA = Object.keys(a);
  44270. var keysB = Object.keys(b);
  44271. return keysA.length === keysB.length && keysA.every(function (key) {
  44272. return looseEqual(a[key], b[key])
  44273. })
  44274. } else {
  44275. /* istanbul ignore next */
  44276. return false
  44277. }
  44278. } catch (e) {
  44279. /* istanbul ignore next */
  44280. return false
  44281. }
  44282. } else if (!isObjectA && !isObjectB) {
  44283. return String(a) === String(b)
  44284. } else {
  44285. return false
  44286. }
  44287. }
  44288. /**
  44289. * Return the first index at which a loosely equal value can be
  44290. * found in the array (if value is a plain object, the array must
  44291. * contain an object of the same shape), or -1 if it is not present.
  44292. */
  44293. function looseIndexOf (arr, val) {
  44294. for (var i = 0; i < arr.length; i++) {
  44295. if (looseEqual(arr[i], val)) { return i }
  44296. }
  44297. return -1
  44298. }
  44299. /**
  44300. * Ensure a function is called only once.
  44301. */
  44302. function once (fn) {
  44303. var called = false;
  44304. return function () {
  44305. if (!called) {
  44306. called = true;
  44307. fn.apply(this, arguments);
  44308. }
  44309. }
  44310. }
  44311. var SSR_ATTR = 'data-server-rendered';
  44312. var ASSET_TYPES = [
  44313. 'component',
  44314. 'directive',
  44315. 'filter'
  44316. ];
  44317. var LIFECYCLE_HOOKS = [
  44318. 'beforeCreate',
  44319. 'created',
  44320. 'beforeMount',
  44321. 'mounted',
  44322. 'beforeUpdate',
  44323. 'updated',
  44324. 'beforeDestroy',
  44325. 'destroyed',
  44326. 'activated',
  44327. 'deactivated',
  44328. 'errorCaptured',
  44329. 'serverPrefetch'
  44330. ];
  44331. /* */
  44332. var config = ({
  44333. /**
  44334. * Option merge strategies (used in core/util/options)
  44335. */
  44336. // $flow-disable-line
  44337. optionMergeStrategies: Object.create(null),
  44338. /**
  44339. * Whether to suppress warnings.
  44340. */
  44341. silent: false,
  44342. /**
  44343. * Show production mode tip message on boot?
  44344. */
  44345. productionTip: "development" !== 'production',
  44346. /**
  44347. * Whether to enable devtools
  44348. */
  44349. devtools: "development" !== 'production',
  44350. /**
  44351. * Whether to record perf
  44352. */
  44353. performance: false,
  44354. /**
  44355. * Error handler for watcher errors
  44356. */
  44357. errorHandler: null,
  44358. /**
  44359. * Warn handler for watcher warns
  44360. */
  44361. warnHandler: null,
  44362. /**
  44363. * Ignore certain custom elements
  44364. */
  44365. ignoredElements: [],
  44366. /**
  44367. * Custom user key aliases for v-on
  44368. */
  44369. // $flow-disable-line
  44370. keyCodes: Object.create(null),
  44371. /**
  44372. * Check if a tag is reserved so that it cannot be registered as a
  44373. * component. This is platform-dependent and may be overwritten.
  44374. */
  44375. isReservedTag: no,
  44376. /**
  44377. * Check if an attribute is reserved so that it cannot be used as a component
  44378. * prop. This is platform-dependent and may be overwritten.
  44379. */
  44380. isReservedAttr: no,
  44381. /**
  44382. * Check if a tag is an unknown element.
  44383. * Platform-dependent.
  44384. */
  44385. isUnknownElement: no,
  44386. /**
  44387. * Get the namespace of an element
  44388. */
  44389. getTagNamespace: noop,
  44390. /**
  44391. * Parse the real tag name for the specific platform.
  44392. */
  44393. parsePlatformTagName: identity,
  44394. /**
  44395. * Check if an attribute must be bound using property, e.g. value
  44396. * Platform-dependent.
  44397. */
  44398. mustUseProp: no,
  44399. /**
  44400. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  44401. * This will significantly reduce performance if set to false.
  44402. */
  44403. async: true,
  44404. /**
  44405. * Exposed for legacy reasons
  44406. */
  44407. _lifecycleHooks: LIFECYCLE_HOOKS
  44408. });
  44409. /* */
  44410. /**
  44411. * unicode letters used for parsing html tags, component names and property paths.
  44412. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  44413. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  44414. */
  44415. 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/;
  44416. /**
  44417. * Check if a string starts with $ or _
  44418. */
  44419. function isReserved (str) {
  44420. var c = (str + '').charCodeAt(0);
  44421. return c === 0x24 || c === 0x5F
  44422. }
  44423. /**
  44424. * Define a property.
  44425. */
  44426. function def (obj, key, val, enumerable) {
  44427. Object.defineProperty(obj, key, {
  44428. value: val,
  44429. enumerable: !!enumerable,
  44430. writable: true,
  44431. configurable: true
  44432. });
  44433. }
  44434. /**
  44435. * Parse simple path.
  44436. */
  44437. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  44438. function parsePath (path) {
  44439. if (bailRE.test(path)) {
  44440. return
  44441. }
  44442. var segments = path.split('.');
  44443. return function (obj) {
  44444. for (var i = 0; i < segments.length; i++) {
  44445. if (!obj) { return }
  44446. obj = obj[segments[i]];
  44447. }
  44448. return obj
  44449. }
  44450. }
  44451. /* */
  44452. // can we use __proto__?
  44453. var hasProto = '__proto__' in {};
  44454. // Browser environment sniffing
  44455. var inBrowser = typeof window !== 'undefined';
  44456. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  44457. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  44458. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  44459. var isIE = UA && /msie|trident/.test(UA);
  44460. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  44461. var isEdge = UA && UA.indexOf('edge/') > 0;
  44462. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  44463. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  44464. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  44465. var isPhantomJS = UA && /phantomjs/.test(UA);
  44466. var isFF = UA && UA.match(/firefox\/(\d+)/);
  44467. // Firefox has a "watch" function on Object.prototype...
  44468. var nativeWatch = ({}).watch;
  44469. var supportsPassive = false;
  44470. if (inBrowser) {
  44471. try {
  44472. var opts = {};
  44473. Object.defineProperty(opts, 'passive', ({
  44474. get: function get () {
  44475. /* istanbul ignore next */
  44476. supportsPassive = true;
  44477. }
  44478. })); // https://github.com/facebook/flow/issues/285
  44479. window.addEventListener('test-passive', null, opts);
  44480. } catch (e) {}
  44481. }
  44482. // this needs to be lazy-evaled because vue may be required before
  44483. // vue-server-renderer can set VUE_ENV
  44484. var _isServer;
  44485. var isServerRendering = function () {
  44486. if (_isServer === undefined) {
  44487. /* istanbul ignore if */
  44488. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  44489. // detect presence of vue-server-renderer and avoid
  44490. // Webpack shimming the process
  44491. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  44492. } else {
  44493. _isServer = false;
  44494. }
  44495. }
  44496. return _isServer
  44497. };
  44498. // detect devtools
  44499. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  44500. /* istanbul ignore next */
  44501. function isNative (Ctor) {
  44502. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  44503. }
  44504. var hasSymbol =
  44505. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  44506. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  44507. var _Set;
  44508. /* istanbul ignore if */ // $flow-disable-line
  44509. if (typeof Set !== 'undefined' && isNative(Set)) {
  44510. // use native Set when available.
  44511. _Set = Set;
  44512. } else {
  44513. // a non-standard Set polyfill that only works with primitive keys.
  44514. _Set = /*@__PURE__*/(function () {
  44515. function Set () {
  44516. this.set = Object.create(null);
  44517. }
  44518. Set.prototype.has = function has (key) {
  44519. return this.set[key] === true
  44520. };
  44521. Set.prototype.add = function add (key) {
  44522. this.set[key] = true;
  44523. };
  44524. Set.prototype.clear = function clear () {
  44525. this.set = Object.create(null);
  44526. };
  44527. return Set;
  44528. }());
  44529. }
  44530. /* */
  44531. var warn = noop;
  44532. var tip = noop;
  44533. var generateComponentTrace = (noop); // work around flow check
  44534. var formatComponentName = (noop);
  44535. {
  44536. var hasConsole = typeof console !== 'undefined';
  44537. var classifyRE = /(?:^|[-_])(\w)/g;
  44538. var classify = function (str) { return str
  44539. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  44540. .replace(/[-_]/g, ''); };
  44541. warn = function (msg, vm) {
  44542. var trace = vm ? generateComponentTrace(vm) : '';
  44543. if (config.warnHandler) {
  44544. config.warnHandler.call(null, msg, vm, trace);
  44545. } else if (hasConsole && (!config.silent)) {
  44546. console.error(("[Vue warn]: " + msg + trace));
  44547. }
  44548. };
  44549. tip = function (msg, vm) {
  44550. if (hasConsole && (!config.silent)) {
  44551. console.warn("[Vue tip]: " + msg + (
  44552. vm ? generateComponentTrace(vm) : ''
  44553. ));
  44554. }
  44555. };
  44556. formatComponentName = function (vm, includeFile) {
  44557. if (vm.$root === vm) {
  44558. return '<Root>'
  44559. }
  44560. var options = typeof vm === 'function' && vm.cid != null
  44561. ? vm.options
  44562. : vm._isVue
  44563. ? vm.$options || vm.constructor.options
  44564. : vm;
  44565. var name = options.name || options._componentTag;
  44566. var file = options.__file;
  44567. if (!name && file) {
  44568. var match = file.match(/([^/\\]+)\.vue$/);
  44569. name = match && match[1];
  44570. }
  44571. return (
  44572. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  44573. (file && includeFile !== false ? (" at " + file) : '')
  44574. )
  44575. };
  44576. var repeat = function (str, n) {
  44577. var res = '';
  44578. while (n) {
  44579. if (n % 2 === 1) { res += str; }
  44580. if (n > 1) { str += str; }
  44581. n >>= 1;
  44582. }
  44583. return res
  44584. };
  44585. generateComponentTrace = function (vm) {
  44586. if (vm._isVue && vm.$parent) {
  44587. var tree = [];
  44588. var currentRecursiveSequence = 0;
  44589. while (vm) {
  44590. if (tree.length > 0) {
  44591. var last = tree[tree.length - 1];
  44592. if (last.constructor === vm.constructor) {
  44593. currentRecursiveSequence++;
  44594. vm = vm.$parent;
  44595. continue
  44596. } else if (currentRecursiveSequence > 0) {
  44597. tree[tree.length - 1] = [last, currentRecursiveSequence];
  44598. currentRecursiveSequence = 0;
  44599. }
  44600. }
  44601. tree.push(vm);
  44602. vm = vm.$parent;
  44603. }
  44604. return '\n\nfound in\n\n' + tree
  44605. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  44606. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  44607. : formatComponentName(vm))); })
  44608. .join('\n')
  44609. } else {
  44610. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  44611. }
  44612. };
  44613. }
  44614. /* */
  44615. var uid = 0;
  44616. /**
  44617. * A dep is an observable that can have multiple
  44618. * directives subscribing to it.
  44619. */
  44620. var Dep = function Dep () {
  44621. this.id = uid++;
  44622. this.subs = [];
  44623. };
  44624. Dep.prototype.addSub = function addSub (sub) {
  44625. this.subs.push(sub);
  44626. };
  44627. Dep.prototype.removeSub = function removeSub (sub) {
  44628. remove(this.subs, sub);
  44629. };
  44630. Dep.prototype.depend = function depend () {
  44631. if (Dep.target) {
  44632. Dep.target.addDep(this);
  44633. }
  44634. };
  44635. Dep.prototype.notify = function notify () {
  44636. // stabilize the subscriber list first
  44637. var subs = this.subs.slice();
  44638. if (!config.async) {
  44639. // subs aren't sorted in scheduler if not running async
  44640. // we need to sort them now to make sure they fire in correct
  44641. // order
  44642. subs.sort(function (a, b) { return a.id - b.id; });
  44643. }
  44644. for (var i = 0, l = subs.length; i < l; i++) {
  44645. subs[i].update();
  44646. }
  44647. };
  44648. // The current target watcher being evaluated.
  44649. // This is globally unique because only one watcher
  44650. // can be evaluated at a time.
  44651. Dep.target = null;
  44652. var targetStack = [];
  44653. function pushTarget (target) {
  44654. targetStack.push(target);
  44655. Dep.target = target;
  44656. }
  44657. function popTarget () {
  44658. targetStack.pop();
  44659. Dep.target = targetStack[targetStack.length - 1];
  44660. }
  44661. /* */
  44662. var VNode = function VNode (
  44663. tag,
  44664. data,
  44665. children,
  44666. text,
  44667. elm,
  44668. context,
  44669. componentOptions,
  44670. asyncFactory
  44671. ) {
  44672. this.tag = tag;
  44673. this.data = data;
  44674. this.children = children;
  44675. this.text = text;
  44676. this.elm = elm;
  44677. this.ns = undefined;
  44678. this.context = context;
  44679. this.fnContext = undefined;
  44680. this.fnOptions = undefined;
  44681. this.fnScopeId = undefined;
  44682. this.key = data && data.key;
  44683. this.componentOptions = componentOptions;
  44684. this.componentInstance = undefined;
  44685. this.parent = undefined;
  44686. this.raw = false;
  44687. this.isStatic = false;
  44688. this.isRootInsert = true;
  44689. this.isComment = false;
  44690. this.isCloned = false;
  44691. this.isOnce = false;
  44692. this.asyncFactory = asyncFactory;
  44693. this.asyncMeta = undefined;
  44694. this.isAsyncPlaceholder = false;
  44695. };
  44696. var prototypeAccessors = { child: { configurable: true } };
  44697. // DEPRECATED: alias for componentInstance for backwards compat.
  44698. /* istanbul ignore next */
  44699. prototypeAccessors.child.get = function () {
  44700. return this.componentInstance
  44701. };
  44702. Object.defineProperties( VNode.prototype, prototypeAccessors );
  44703. var createEmptyVNode = function (text) {
  44704. if ( text === void 0 ) text = '';
  44705. var node = new VNode();
  44706. node.text = text;
  44707. node.isComment = true;
  44708. return node
  44709. };
  44710. function createTextVNode (val) {
  44711. return new VNode(undefined, undefined, undefined, String(val))
  44712. }
  44713. // optimized shallow clone
  44714. // used for static nodes and slot nodes because they may be reused across
  44715. // multiple renders, cloning them avoids errors when DOM manipulations rely
  44716. // on their elm reference.
  44717. function cloneVNode (vnode) {
  44718. var cloned = new VNode(
  44719. vnode.tag,
  44720. vnode.data,
  44721. // #7975
  44722. // clone children array to avoid mutating original in case of cloning
  44723. // a child.
  44724. vnode.children && vnode.children.slice(),
  44725. vnode.text,
  44726. vnode.elm,
  44727. vnode.context,
  44728. vnode.componentOptions,
  44729. vnode.asyncFactory
  44730. );
  44731. cloned.ns = vnode.ns;
  44732. cloned.isStatic = vnode.isStatic;
  44733. cloned.key = vnode.key;
  44734. cloned.isComment = vnode.isComment;
  44735. cloned.fnContext = vnode.fnContext;
  44736. cloned.fnOptions = vnode.fnOptions;
  44737. cloned.fnScopeId = vnode.fnScopeId;
  44738. cloned.asyncMeta = vnode.asyncMeta;
  44739. cloned.isCloned = true;
  44740. return cloned
  44741. }
  44742. /*
  44743. * not type checking this file because flow doesn't play well with
  44744. * dynamically accessing methods on Array prototype
  44745. */
  44746. var arrayProto = Array.prototype;
  44747. var arrayMethods = Object.create(arrayProto);
  44748. var methodsToPatch = [
  44749. 'push',
  44750. 'pop',
  44751. 'shift',
  44752. 'unshift',
  44753. 'splice',
  44754. 'sort',
  44755. 'reverse'
  44756. ];
  44757. /**
  44758. * Intercept mutating methods and emit events
  44759. */
  44760. methodsToPatch.forEach(function (method) {
  44761. // cache original method
  44762. var original = arrayProto[method];
  44763. def(arrayMethods, method, function mutator () {
  44764. var args = [], len = arguments.length;
  44765. while ( len-- ) args[ len ] = arguments[ len ];
  44766. var result = original.apply(this, args);
  44767. var ob = this.__ob__;
  44768. var inserted;
  44769. switch (method) {
  44770. case 'push':
  44771. case 'unshift':
  44772. inserted = args;
  44773. break
  44774. case 'splice':
  44775. inserted = args.slice(2);
  44776. break
  44777. }
  44778. if (inserted) { ob.observeArray(inserted); }
  44779. // notify change
  44780. ob.dep.notify();
  44781. return result
  44782. });
  44783. });
  44784. /* */
  44785. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  44786. /**
  44787. * In some cases we may want to disable observation inside a component's
  44788. * update computation.
  44789. */
  44790. var shouldObserve = true;
  44791. function toggleObserving (value) {
  44792. shouldObserve = value;
  44793. }
  44794. /**
  44795. * Observer class that is attached to each observed
  44796. * object. Once attached, the observer converts the target
  44797. * object's property keys into getter/setters that
  44798. * collect dependencies and dispatch updates.
  44799. */
  44800. var Observer = function Observer (value) {
  44801. this.value = value;
  44802. this.dep = new Dep();
  44803. this.vmCount = 0;
  44804. def(value, '__ob__', this);
  44805. if (Array.isArray(value)) {
  44806. if (hasProto) {
  44807. protoAugment(value, arrayMethods);
  44808. } else {
  44809. copyAugment(value, arrayMethods, arrayKeys);
  44810. }
  44811. this.observeArray(value);
  44812. } else {
  44813. this.walk(value);
  44814. }
  44815. };
  44816. /**
  44817. * Walk through all properties and convert them into
  44818. * getter/setters. This method should only be called when
  44819. * value type is Object.
  44820. */
  44821. Observer.prototype.walk = function walk (obj) {
  44822. var keys = Object.keys(obj);
  44823. for (var i = 0; i < keys.length; i++) {
  44824. defineReactive$$1(obj, keys[i]);
  44825. }
  44826. };
  44827. /**
  44828. * Observe a list of Array items.
  44829. */
  44830. Observer.prototype.observeArray = function observeArray (items) {
  44831. for (var i = 0, l = items.length; i < l; i++) {
  44832. observe(items[i]);
  44833. }
  44834. };
  44835. // helpers
  44836. /**
  44837. * Augment a target Object or Array by intercepting
  44838. * the prototype chain using __proto__
  44839. */
  44840. function protoAugment (target, src) {
  44841. /* eslint-disable no-proto */
  44842. target.__proto__ = src;
  44843. /* eslint-enable no-proto */
  44844. }
  44845. /**
  44846. * Augment a target Object or Array by defining
  44847. * hidden properties.
  44848. */
  44849. /* istanbul ignore next */
  44850. function copyAugment (target, src, keys) {
  44851. for (var i = 0, l = keys.length; i < l; i++) {
  44852. var key = keys[i];
  44853. def(target, key, src[key]);
  44854. }
  44855. }
  44856. /**
  44857. * Attempt to create an observer instance for a value,
  44858. * returns the new observer if successfully observed,
  44859. * or the existing observer if the value already has one.
  44860. */
  44861. function observe (value, asRootData) {
  44862. if (!isObject(value) || value instanceof VNode) {
  44863. return
  44864. }
  44865. var ob;
  44866. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  44867. ob = value.__ob__;
  44868. } else if (
  44869. shouldObserve &&
  44870. !isServerRendering() &&
  44871. (Array.isArray(value) || isPlainObject(value)) &&
  44872. Object.isExtensible(value) &&
  44873. !value._isVue
  44874. ) {
  44875. ob = new Observer(value);
  44876. }
  44877. if (asRootData && ob) {
  44878. ob.vmCount++;
  44879. }
  44880. return ob
  44881. }
  44882. /**
  44883. * Define a reactive property on an Object.
  44884. */
  44885. function defineReactive$$1 (
  44886. obj,
  44887. key,
  44888. val,
  44889. customSetter,
  44890. shallow
  44891. ) {
  44892. var dep = new Dep();
  44893. var property = Object.getOwnPropertyDescriptor(obj, key);
  44894. if (property && property.configurable === false) {
  44895. return
  44896. }
  44897. // cater for pre-defined getter/setters
  44898. var getter = property && property.get;
  44899. var setter = property && property.set;
  44900. if ((!getter || setter) && arguments.length === 2) {
  44901. val = obj[key];
  44902. }
  44903. var childOb = !shallow && observe(val);
  44904. Object.defineProperty(obj, key, {
  44905. enumerable: true,
  44906. configurable: true,
  44907. get: function reactiveGetter () {
  44908. var value = getter ? getter.call(obj) : val;
  44909. if (Dep.target) {
  44910. dep.depend();
  44911. if (childOb) {
  44912. childOb.dep.depend();
  44913. if (Array.isArray(value)) {
  44914. dependArray(value);
  44915. }
  44916. }
  44917. }
  44918. return value
  44919. },
  44920. set: function reactiveSetter (newVal) {
  44921. var value = getter ? getter.call(obj) : val;
  44922. /* eslint-disable no-self-compare */
  44923. if (newVal === value || (newVal !== newVal && value !== value)) {
  44924. return
  44925. }
  44926. /* eslint-enable no-self-compare */
  44927. if (customSetter) {
  44928. customSetter();
  44929. }
  44930. // #7981: for accessor properties without setter
  44931. if (getter && !setter) { return }
  44932. if (setter) {
  44933. setter.call(obj, newVal);
  44934. } else {
  44935. val = newVal;
  44936. }
  44937. childOb = !shallow && observe(newVal);
  44938. dep.notify();
  44939. }
  44940. });
  44941. }
  44942. /**
  44943. * Set a property on an object. Adds the new property and
  44944. * triggers change notification if the property doesn't
  44945. * already exist.
  44946. */
  44947. function set (target, key, val) {
  44948. if (isUndef(target) || isPrimitive(target)
  44949. ) {
  44950. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  44951. }
  44952. if (Array.isArray(target) && isValidArrayIndex(key)) {
  44953. target.length = Math.max(target.length, key);
  44954. target.splice(key, 1, val);
  44955. return val
  44956. }
  44957. if (key in target && !(key in Object.prototype)) {
  44958. target[key] = val;
  44959. return val
  44960. }
  44961. var ob = (target).__ob__;
  44962. if (target._isVue || (ob && ob.vmCount)) {
  44963. warn(
  44964. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  44965. 'at runtime - declare it upfront in the data option.'
  44966. );
  44967. return val
  44968. }
  44969. if (!ob) {
  44970. target[key] = val;
  44971. return val
  44972. }
  44973. defineReactive$$1(ob.value, key, val);
  44974. ob.dep.notify();
  44975. return val
  44976. }
  44977. /**
  44978. * Delete a property and trigger change if necessary.
  44979. */
  44980. function del (target, key) {
  44981. if (isUndef(target) || isPrimitive(target)
  44982. ) {
  44983. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  44984. }
  44985. if (Array.isArray(target) && isValidArrayIndex(key)) {
  44986. target.splice(key, 1);
  44987. return
  44988. }
  44989. var ob = (target).__ob__;
  44990. if (target._isVue || (ob && ob.vmCount)) {
  44991. warn(
  44992. 'Avoid deleting properties on a Vue instance or its root $data ' +
  44993. '- just set it to null.'
  44994. );
  44995. return
  44996. }
  44997. if (!hasOwn(target, key)) {
  44998. return
  44999. }
  45000. delete target[key];
  45001. if (!ob) {
  45002. return
  45003. }
  45004. ob.dep.notify();
  45005. }
  45006. /**
  45007. * Collect dependencies on array elements when the array is touched, since
  45008. * we cannot intercept array element access like property getters.
  45009. */
  45010. function dependArray (value) {
  45011. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  45012. e = value[i];
  45013. e && e.__ob__ && e.__ob__.dep.depend();
  45014. if (Array.isArray(e)) {
  45015. dependArray(e);
  45016. }
  45017. }
  45018. }
  45019. /* */
  45020. /**
  45021. * Option overwriting strategies are functions that handle
  45022. * how to merge a parent option value and a child option
  45023. * value into the final value.
  45024. */
  45025. var strats = config.optionMergeStrategies;
  45026. /**
  45027. * Options with restrictions
  45028. */
  45029. {
  45030. strats.el = strats.propsData = function (parent, child, vm, key) {
  45031. if (!vm) {
  45032. warn(
  45033. "option \"" + key + "\" can only be used during instance " +
  45034. 'creation with the `new` keyword.'
  45035. );
  45036. }
  45037. return defaultStrat(parent, child)
  45038. };
  45039. }
  45040. /**
  45041. * Helper that recursively merges two data objects together.
  45042. */
  45043. function mergeData (to, from) {
  45044. if (!from) { return to }
  45045. var key, toVal, fromVal;
  45046. var keys = hasSymbol
  45047. ? Reflect.ownKeys(from)
  45048. : Object.keys(from);
  45049. for (var i = 0; i < keys.length; i++) {
  45050. key = keys[i];
  45051. // in case the object is already observed...
  45052. if (key === '__ob__') { continue }
  45053. toVal = to[key];
  45054. fromVal = from[key];
  45055. if (!hasOwn(to, key)) {
  45056. set(to, key, fromVal);
  45057. } else if (
  45058. toVal !== fromVal &&
  45059. isPlainObject(toVal) &&
  45060. isPlainObject(fromVal)
  45061. ) {
  45062. mergeData(toVal, fromVal);
  45063. }
  45064. }
  45065. return to
  45066. }
  45067. /**
  45068. * Data
  45069. */
  45070. function mergeDataOrFn (
  45071. parentVal,
  45072. childVal,
  45073. vm
  45074. ) {
  45075. if (!vm) {
  45076. // in a Vue.extend merge, both should be functions
  45077. if (!childVal) {
  45078. return parentVal
  45079. }
  45080. if (!parentVal) {
  45081. return childVal
  45082. }
  45083. // when parentVal & childVal are both present,
  45084. // we need to return a function that returns the
  45085. // merged result of both functions... no need to
  45086. // check if parentVal is a function here because
  45087. // it has to be a function to pass previous merges.
  45088. return function mergedDataFn () {
  45089. return mergeData(
  45090. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  45091. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  45092. )
  45093. }
  45094. } else {
  45095. return function mergedInstanceDataFn () {
  45096. // instance merge
  45097. var instanceData = typeof childVal === 'function'
  45098. ? childVal.call(vm, vm)
  45099. : childVal;
  45100. var defaultData = typeof parentVal === 'function'
  45101. ? parentVal.call(vm, vm)
  45102. : parentVal;
  45103. if (instanceData) {
  45104. return mergeData(instanceData, defaultData)
  45105. } else {
  45106. return defaultData
  45107. }
  45108. }
  45109. }
  45110. }
  45111. strats.data = function (
  45112. parentVal,
  45113. childVal,
  45114. vm
  45115. ) {
  45116. if (!vm) {
  45117. if (childVal && typeof childVal !== 'function') {
  45118. warn(
  45119. 'The "data" option should be a function ' +
  45120. 'that returns a per-instance value in component ' +
  45121. 'definitions.',
  45122. vm
  45123. );
  45124. return parentVal
  45125. }
  45126. return mergeDataOrFn(parentVal, childVal)
  45127. }
  45128. return mergeDataOrFn(parentVal, childVal, vm)
  45129. };
  45130. /**
  45131. * Hooks and props are merged as arrays.
  45132. */
  45133. function mergeHook (
  45134. parentVal,
  45135. childVal
  45136. ) {
  45137. var res = childVal
  45138. ? parentVal
  45139. ? parentVal.concat(childVal)
  45140. : Array.isArray(childVal)
  45141. ? childVal
  45142. : [childVal]
  45143. : parentVal;
  45144. return res
  45145. ? dedupeHooks(res)
  45146. : res
  45147. }
  45148. function dedupeHooks (hooks) {
  45149. var res = [];
  45150. for (var i = 0; i < hooks.length; i++) {
  45151. if (res.indexOf(hooks[i]) === -1) {
  45152. res.push(hooks[i]);
  45153. }
  45154. }
  45155. return res
  45156. }
  45157. LIFECYCLE_HOOKS.forEach(function (hook) {
  45158. strats[hook] = mergeHook;
  45159. });
  45160. /**
  45161. * Assets
  45162. *
  45163. * When a vm is present (instance creation), we need to do
  45164. * a three-way merge between constructor options, instance
  45165. * options and parent options.
  45166. */
  45167. function mergeAssets (
  45168. parentVal,
  45169. childVal,
  45170. vm,
  45171. key
  45172. ) {
  45173. var res = Object.create(parentVal || null);
  45174. if (childVal) {
  45175. assertObjectType(key, childVal, vm);
  45176. return extend(res, childVal)
  45177. } else {
  45178. return res
  45179. }
  45180. }
  45181. ASSET_TYPES.forEach(function (type) {
  45182. strats[type + 's'] = mergeAssets;
  45183. });
  45184. /**
  45185. * Watchers.
  45186. *
  45187. * Watchers hashes should not overwrite one
  45188. * another, so we merge them as arrays.
  45189. */
  45190. strats.watch = function (
  45191. parentVal,
  45192. childVal,
  45193. vm,
  45194. key
  45195. ) {
  45196. // work around Firefox's Object.prototype.watch...
  45197. if (parentVal === nativeWatch) { parentVal = undefined; }
  45198. if (childVal === nativeWatch) { childVal = undefined; }
  45199. /* istanbul ignore if */
  45200. if (!childVal) { return Object.create(parentVal || null) }
  45201. {
  45202. assertObjectType(key, childVal, vm);
  45203. }
  45204. if (!parentVal) { return childVal }
  45205. var ret = {};
  45206. extend(ret, parentVal);
  45207. for (var key$1 in childVal) {
  45208. var parent = ret[key$1];
  45209. var child = childVal[key$1];
  45210. if (parent && !Array.isArray(parent)) {
  45211. parent = [parent];
  45212. }
  45213. ret[key$1] = parent
  45214. ? parent.concat(child)
  45215. : Array.isArray(child) ? child : [child];
  45216. }
  45217. return ret
  45218. };
  45219. /**
  45220. * Other object hashes.
  45221. */
  45222. strats.props =
  45223. strats.methods =
  45224. strats.inject =
  45225. strats.computed = function (
  45226. parentVal,
  45227. childVal,
  45228. vm,
  45229. key
  45230. ) {
  45231. if (childVal && "development" !== 'production') {
  45232. assertObjectType(key, childVal, vm);
  45233. }
  45234. if (!parentVal) { return childVal }
  45235. var ret = Object.create(null);
  45236. extend(ret, parentVal);
  45237. if (childVal) { extend(ret, childVal); }
  45238. return ret
  45239. };
  45240. strats.provide = mergeDataOrFn;
  45241. /**
  45242. * Default strategy.
  45243. */
  45244. var defaultStrat = function (parentVal, childVal) {
  45245. return childVal === undefined
  45246. ? parentVal
  45247. : childVal
  45248. };
  45249. /**
  45250. * Validate component names
  45251. */
  45252. function checkComponents (options) {
  45253. for (var key in options.components) {
  45254. validateComponentName(key);
  45255. }
  45256. }
  45257. function validateComponentName (name) {
  45258. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  45259. warn(
  45260. 'Invalid component name: "' + name + '". Component names ' +
  45261. 'should conform to valid custom element name in html5 specification.'
  45262. );
  45263. }
  45264. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  45265. warn(
  45266. 'Do not use built-in or reserved HTML elements as component ' +
  45267. 'id: ' + name
  45268. );
  45269. }
  45270. }
  45271. /**
  45272. * Ensure all props option syntax are normalized into the
  45273. * Object-based format.
  45274. */
  45275. function normalizeProps (options, vm) {
  45276. var props = options.props;
  45277. if (!props) { return }
  45278. var res = {};
  45279. var i, val, name;
  45280. if (Array.isArray(props)) {
  45281. i = props.length;
  45282. while (i--) {
  45283. val = props[i];
  45284. if (typeof val === 'string') {
  45285. name = camelize(val);
  45286. res[name] = { type: null };
  45287. } else {
  45288. warn('props must be strings when using array syntax.');
  45289. }
  45290. }
  45291. } else if (isPlainObject(props)) {
  45292. for (var key in props) {
  45293. val = props[key];
  45294. name = camelize(key);
  45295. res[name] = isPlainObject(val)
  45296. ? val
  45297. : { type: val };
  45298. }
  45299. } else {
  45300. warn(
  45301. "Invalid value for option \"props\": expected an Array or an Object, " +
  45302. "but got " + (toRawType(props)) + ".",
  45303. vm
  45304. );
  45305. }
  45306. options.props = res;
  45307. }
  45308. /**
  45309. * Normalize all injections into Object-based format
  45310. */
  45311. function normalizeInject (options, vm) {
  45312. var inject = options.inject;
  45313. if (!inject) { return }
  45314. var normalized = options.inject = {};
  45315. if (Array.isArray(inject)) {
  45316. for (var i = 0; i < inject.length; i++) {
  45317. normalized[inject[i]] = { from: inject[i] };
  45318. }
  45319. } else if (isPlainObject(inject)) {
  45320. for (var key in inject) {
  45321. var val = inject[key];
  45322. normalized[key] = isPlainObject(val)
  45323. ? extend({ from: key }, val)
  45324. : { from: val };
  45325. }
  45326. } else {
  45327. warn(
  45328. "Invalid value for option \"inject\": expected an Array or an Object, " +
  45329. "but got " + (toRawType(inject)) + ".",
  45330. vm
  45331. );
  45332. }
  45333. }
  45334. /**
  45335. * Normalize raw function directives into object format.
  45336. */
  45337. function normalizeDirectives (options) {
  45338. var dirs = options.directives;
  45339. if (dirs) {
  45340. for (var key in dirs) {
  45341. var def$$1 = dirs[key];
  45342. if (typeof def$$1 === 'function') {
  45343. dirs[key] = { bind: def$$1, update: def$$1 };
  45344. }
  45345. }
  45346. }
  45347. }
  45348. function assertObjectType (name, value, vm) {
  45349. if (!isPlainObject(value)) {
  45350. warn(
  45351. "Invalid value for option \"" + name + "\": expected an Object, " +
  45352. "but got " + (toRawType(value)) + ".",
  45353. vm
  45354. );
  45355. }
  45356. }
  45357. /**
  45358. * Merge two option objects into a new one.
  45359. * Core utility used in both instantiation and inheritance.
  45360. */
  45361. function mergeOptions (
  45362. parent,
  45363. child,
  45364. vm
  45365. ) {
  45366. {
  45367. checkComponents(child);
  45368. }
  45369. if (typeof child === 'function') {
  45370. child = child.options;
  45371. }
  45372. normalizeProps(child, vm);
  45373. normalizeInject(child, vm);
  45374. normalizeDirectives(child);
  45375. // Apply extends and mixins on the child options,
  45376. // but only if it is a raw options object that isn't
  45377. // the result of another mergeOptions call.
  45378. // Only merged options has the _base property.
  45379. if (!child._base) {
  45380. if (child.extends) {
  45381. parent = mergeOptions(parent, child.extends, vm);
  45382. }
  45383. if (child.mixins) {
  45384. for (var i = 0, l = child.mixins.length; i < l; i++) {
  45385. parent = mergeOptions(parent, child.mixins[i], vm);
  45386. }
  45387. }
  45388. }
  45389. var options = {};
  45390. var key;
  45391. for (key in parent) {
  45392. mergeField(key);
  45393. }
  45394. for (key in child) {
  45395. if (!hasOwn(parent, key)) {
  45396. mergeField(key);
  45397. }
  45398. }
  45399. function mergeField (key) {
  45400. var strat = strats[key] || defaultStrat;
  45401. options[key] = strat(parent[key], child[key], vm, key);
  45402. }
  45403. return options
  45404. }
  45405. /**
  45406. * Resolve an asset.
  45407. * This function is used because child instances need access
  45408. * to assets defined in its ancestor chain.
  45409. */
  45410. function resolveAsset (
  45411. options,
  45412. type,
  45413. id,
  45414. warnMissing
  45415. ) {
  45416. /* istanbul ignore if */
  45417. if (typeof id !== 'string') {
  45418. return
  45419. }
  45420. var assets = options[type];
  45421. // check local registration variations first
  45422. if (hasOwn(assets, id)) { return assets[id] }
  45423. var camelizedId = camelize(id);
  45424. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  45425. var PascalCaseId = capitalize(camelizedId);
  45426. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  45427. // fallback to prototype chain
  45428. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  45429. if (warnMissing && !res) {
  45430. warn(
  45431. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  45432. options
  45433. );
  45434. }
  45435. return res
  45436. }
  45437. /* */
  45438. function validateProp (
  45439. key,
  45440. propOptions,
  45441. propsData,
  45442. vm
  45443. ) {
  45444. var prop = propOptions[key];
  45445. var absent = !hasOwn(propsData, key);
  45446. var value = propsData[key];
  45447. // boolean casting
  45448. var booleanIndex = getTypeIndex(Boolean, prop.type);
  45449. if (booleanIndex > -1) {
  45450. if (absent && !hasOwn(prop, 'default')) {
  45451. value = false;
  45452. } else if (value === '' || value === hyphenate(key)) {
  45453. // only cast empty string / same name to boolean if
  45454. // boolean has higher priority
  45455. var stringIndex = getTypeIndex(String, prop.type);
  45456. if (stringIndex < 0 || booleanIndex < stringIndex) {
  45457. value = true;
  45458. }
  45459. }
  45460. }
  45461. // check default value
  45462. if (value === undefined) {
  45463. value = getPropDefaultValue(vm, prop, key);
  45464. // since the default value is a fresh copy,
  45465. // make sure to observe it.
  45466. var prevShouldObserve = shouldObserve;
  45467. toggleObserving(true);
  45468. observe(value);
  45469. toggleObserving(prevShouldObserve);
  45470. }
  45471. {
  45472. assertProp(prop, key, value, vm, absent);
  45473. }
  45474. return value
  45475. }
  45476. /**
  45477. * Get the default value of a prop.
  45478. */
  45479. function getPropDefaultValue (vm, prop, key) {
  45480. // no default, return undefined
  45481. if (!hasOwn(prop, 'default')) {
  45482. return undefined
  45483. }
  45484. var def = prop.default;
  45485. // warn against non-factory defaults for Object & Array
  45486. if (isObject(def)) {
  45487. warn(
  45488. 'Invalid default value for prop "' + key + '": ' +
  45489. 'Props with type Object/Array must use a factory function ' +
  45490. 'to return the default value.',
  45491. vm
  45492. );
  45493. }
  45494. // the raw prop value was also undefined from previous render,
  45495. // return previous default value to avoid unnecessary watcher trigger
  45496. if (vm && vm.$options.propsData &&
  45497. vm.$options.propsData[key] === undefined &&
  45498. vm._props[key] !== undefined
  45499. ) {
  45500. return vm._props[key]
  45501. }
  45502. // call factory function for non-Function types
  45503. // a value is Function if its prototype is function even across different execution context
  45504. return typeof def === 'function' && getType(prop.type) !== 'Function'
  45505. ? def.call(vm)
  45506. : def
  45507. }
  45508. /**
  45509. * Assert whether a prop is valid.
  45510. */
  45511. function assertProp (
  45512. prop,
  45513. name,
  45514. value,
  45515. vm,
  45516. absent
  45517. ) {
  45518. if (prop.required && absent) {
  45519. warn(
  45520. 'Missing required prop: "' + name + '"',
  45521. vm
  45522. );
  45523. return
  45524. }
  45525. if (value == null && !prop.required) {
  45526. return
  45527. }
  45528. var type = prop.type;
  45529. var valid = !type || type === true;
  45530. var expectedTypes = [];
  45531. if (type) {
  45532. if (!Array.isArray(type)) {
  45533. type = [type];
  45534. }
  45535. for (var i = 0; i < type.length && !valid; i++) {
  45536. var assertedType = assertType(value, type[i]);
  45537. expectedTypes.push(assertedType.expectedType || '');
  45538. valid = assertedType.valid;
  45539. }
  45540. }
  45541. if (!valid) {
  45542. warn(
  45543. getInvalidTypeMessage(name, value, expectedTypes),
  45544. vm
  45545. );
  45546. return
  45547. }
  45548. var validator = prop.validator;
  45549. if (validator) {
  45550. if (!validator(value)) {
  45551. warn(
  45552. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  45553. vm
  45554. );
  45555. }
  45556. }
  45557. }
  45558. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  45559. function assertType (value, type) {
  45560. var valid;
  45561. var expectedType = getType(type);
  45562. if (simpleCheckRE.test(expectedType)) {
  45563. var t = typeof value;
  45564. valid = t === expectedType.toLowerCase();
  45565. // for primitive wrapper objects
  45566. if (!valid && t === 'object') {
  45567. valid = value instanceof type;
  45568. }
  45569. } else if (expectedType === 'Object') {
  45570. valid = isPlainObject(value);
  45571. } else if (expectedType === 'Array') {
  45572. valid = Array.isArray(value);
  45573. } else {
  45574. valid = value instanceof type;
  45575. }
  45576. return {
  45577. valid: valid,
  45578. expectedType: expectedType
  45579. }
  45580. }
  45581. /**
  45582. * Use function string name to check built-in types,
  45583. * because a simple equality check will fail when running
  45584. * across different vms / iframes.
  45585. */
  45586. function getType (fn) {
  45587. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  45588. return match ? match[1] : ''
  45589. }
  45590. function isSameType (a, b) {
  45591. return getType(a) === getType(b)
  45592. }
  45593. function getTypeIndex (type, expectedTypes) {
  45594. if (!Array.isArray(expectedTypes)) {
  45595. return isSameType(expectedTypes, type) ? 0 : -1
  45596. }
  45597. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  45598. if (isSameType(expectedTypes[i], type)) {
  45599. return i
  45600. }
  45601. }
  45602. return -1
  45603. }
  45604. function getInvalidTypeMessage (name, value, expectedTypes) {
  45605. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  45606. " Expected " + (expectedTypes.map(capitalize).join(', '));
  45607. var expectedType = expectedTypes[0];
  45608. var receivedType = toRawType(value);
  45609. var expectedValue = styleValue(value, expectedType);
  45610. var receivedValue = styleValue(value, receivedType);
  45611. // check if we need to specify expected value
  45612. if (expectedTypes.length === 1 &&
  45613. isExplicable(expectedType) &&
  45614. !isBoolean(expectedType, receivedType)) {
  45615. message += " with value " + expectedValue;
  45616. }
  45617. message += ", got " + receivedType + " ";
  45618. // check if we need to specify received value
  45619. if (isExplicable(receivedType)) {
  45620. message += "with value " + receivedValue + ".";
  45621. }
  45622. return message
  45623. }
  45624. function styleValue (value, type) {
  45625. if (type === 'String') {
  45626. return ("\"" + value + "\"")
  45627. } else if (type === 'Number') {
  45628. return ("" + (Number(value)))
  45629. } else {
  45630. return ("" + value)
  45631. }
  45632. }
  45633. function isExplicable (value) {
  45634. var explicitTypes = ['string', 'number', 'boolean'];
  45635. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  45636. }
  45637. function isBoolean () {
  45638. var args = [], len = arguments.length;
  45639. while ( len-- ) args[ len ] = arguments[ len ];
  45640. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  45641. }
  45642. /* */
  45643. function handleError (err, vm, info) {
  45644. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  45645. // See: https://github.com/vuejs/vuex/issues/1505
  45646. pushTarget();
  45647. try {
  45648. if (vm) {
  45649. var cur = vm;
  45650. while ((cur = cur.$parent)) {
  45651. var hooks = cur.$options.errorCaptured;
  45652. if (hooks) {
  45653. for (var i = 0; i < hooks.length; i++) {
  45654. try {
  45655. var capture = hooks[i].call(cur, err, vm, info) === false;
  45656. if (capture) { return }
  45657. } catch (e) {
  45658. globalHandleError(e, cur, 'errorCaptured hook');
  45659. }
  45660. }
  45661. }
  45662. }
  45663. }
  45664. globalHandleError(err, vm, info);
  45665. } finally {
  45666. popTarget();
  45667. }
  45668. }
  45669. function invokeWithErrorHandling (
  45670. handler,
  45671. context,
  45672. args,
  45673. vm,
  45674. info
  45675. ) {
  45676. var res;
  45677. try {
  45678. res = args ? handler.apply(context, args) : handler.call(context);
  45679. if (res && !res._isVue && isPromise(res) && !res._handled) {
  45680. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  45681. // issue #9511
  45682. // avoid catch triggering multiple times when nested calls
  45683. res._handled = true;
  45684. }
  45685. } catch (e) {
  45686. handleError(e, vm, info);
  45687. }
  45688. return res
  45689. }
  45690. function globalHandleError (err, vm, info) {
  45691. if (config.errorHandler) {
  45692. try {
  45693. return config.errorHandler.call(null, err, vm, info)
  45694. } catch (e) {
  45695. // if the user intentionally throws the original error in the handler,
  45696. // do not log it twice
  45697. if (e !== err) {
  45698. logError(e, null, 'config.errorHandler');
  45699. }
  45700. }
  45701. }
  45702. logError(err, vm, info);
  45703. }
  45704. function logError (err, vm, info) {
  45705. {
  45706. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  45707. }
  45708. /* istanbul ignore else */
  45709. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  45710. console.error(err);
  45711. } else {
  45712. throw err
  45713. }
  45714. }
  45715. /* */
  45716. var isUsingMicroTask = false;
  45717. var callbacks = [];
  45718. var pending = false;
  45719. function flushCallbacks () {
  45720. pending = false;
  45721. var copies = callbacks.slice(0);
  45722. callbacks.length = 0;
  45723. for (var i = 0; i < copies.length; i++) {
  45724. copies[i]();
  45725. }
  45726. }
  45727. // Here we have async deferring wrappers using microtasks.
  45728. // In 2.5 we used (macro) tasks (in combination with microtasks).
  45729. // However, it has subtle problems when state is changed right before repaint
  45730. // (e.g. #6813, out-in transitions).
  45731. // Also, using (macro) tasks in event handler would cause some weird behaviors
  45732. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  45733. // So we now use microtasks everywhere, again.
  45734. // A major drawback of this tradeoff is that there are some scenarios
  45735. // where microtasks have too high a priority and fire in between supposedly
  45736. // sequential events (e.g. #4521, #6690, which have workarounds)
  45737. // or even between bubbling of the same event (#6566).
  45738. var timerFunc;
  45739. // The nextTick behavior leverages the microtask queue, which can be accessed
  45740. // via either native Promise.then or MutationObserver.
  45741. // MutationObserver has wider support, however it is seriously bugged in
  45742. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  45743. // completely stops working after triggering a few times... so, if native
  45744. // Promise is available, we will use it:
  45745. /* istanbul ignore next, $flow-disable-line */
  45746. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  45747. var p = Promise.resolve();
  45748. timerFunc = function () {
  45749. p.then(flushCallbacks);
  45750. // In problematic UIWebViews, Promise.then doesn't completely break, but
  45751. // it can get stuck in a weird state where callbacks are pushed into the
  45752. // microtask queue but the queue isn't being flushed, until the browser
  45753. // needs to do some other work, e.g. handle a timer. Therefore we can
  45754. // "force" the microtask queue to be flushed by adding an empty timer.
  45755. if (isIOS) { setTimeout(noop); }
  45756. };
  45757. isUsingMicroTask = true;
  45758. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  45759. isNative(MutationObserver) ||
  45760. // PhantomJS and iOS 7.x
  45761. MutationObserver.toString() === '[object MutationObserverConstructor]'
  45762. )) {
  45763. // Use MutationObserver where native Promise is not available,
  45764. // e.g. PhantomJS, iOS7, Android 4.4
  45765. // (#6466 MutationObserver is unreliable in IE11)
  45766. var counter = 1;
  45767. var observer = new MutationObserver(flushCallbacks);
  45768. var textNode = document.createTextNode(String(counter));
  45769. observer.observe(textNode, {
  45770. characterData: true
  45771. });
  45772. timerFunc = function () {
  45773. counter = (counter + 1) % 2;
  45774. textNode.data = String(counter);
  45775. };
  45776. isUsingMicroTask = true;
  45777. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  45778. // Fallback to setImmediate.
  45779. // Technically it leverages the (macro) task queue,
  45780. // but it is still a better choice than setTimeout.
  45781. timerFunc = function () {
  45782. setImmediate(flushCallbacks);
  45783. };
  45784. } else {
  45785. // Fallback to setTimeout.
  45786. timerFunc = function () {
  45787. setTimeout(flushCallbacks, 0);
  45788. };
  45789. }
  45790. function nextTick (cb, ctx) {
  45791. var _resolve;
  45792. callbacks.push(function () {
  45793. if (cb) {
  45794. try {
  45795. cb.call(ctx);
  45796. } catch (e) {
  45797. handleError(e, ctx, 'nextTick');
  45798. }
  45799. } else if (_resolve) {
  45800. _resolve(ctx);
  45801. }
  45802. });
  45803. if (!pending) {
  45804. pending = true;
  45805. timerFunc();
  45806. }
  45807. // $flow-disable-line
  45808. if (!cb && typeof Promise !== 'undefined') {
  45809. return new Promise(function (resolve) {
  45810. _resolve = resolve;
  45811. })
  45812. }
  45813. }
  45814. /* */
  45815. var mark;
  45816. var measure;
  45817. {
  45818. var perf = inBrowser && window.performance;
  45819. /* istanbul ignore if */
  45820. if (
  45821. perf &&
  45822. perf.mark &&
  45823. perf.measure &&
  45824. perf.clearMarks &&
  45825. perf.clearMeasures
  45826. ) {
  45827. mark = function (tag) { return perf.mark(tag); };
  45828. measure = function (name, startTag, endTag) {
  45829. perf.measure(name, startTag, endTag);
  45830. perf.clearMarks(startTag);
  45831. perf.clearMarks(endTag);
  45832. // perf.clearMeasures(name)
  45833. };
  45834. }
  45835. }
  45836. /* not type checking this file because flow doesn't play well with Proxy */
  45837. var initProxy;
  45838. {
  45839. var allowedGlobals = makeMap(
  45840. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  45841. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  45842. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  45843. 'require' // for Webpack/Browserify
  45844. );
  45845. var warnNonPresent = function (target, key) {
  45846. warn(
  45847. "Property or method \"" + key + "\" is not defined on the instance but " +
  45848. 'referenced during render. Make sure that this property is reactive, ' +
  45849. 'either in the data option, or for class-based components, by ' +
  45850. 'initializing the property. ' +
  45851. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  45852. target
  45853. );
  45854. };
  45855. var warnReservedPrefix = function (target, key) {
  45856. warn(
  45857. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  45858. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  45859. 'prevent conflicts with Vue internals. ' +
  45860. 'See: https://vuejs.org/v2/api/#data',
  45861. target
  45862. );
  45863. };
  45864. var hasProxy =
  45865. typeof Proxy !== 'undefined' && isNative(Proxy);
  45866. if (hasProxy) {
  45867. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  45868. config.keyCodes = new Proxy(config.keyCodes, {
  45869. set: function set (target, key, value) {
  45870. if (isBuiltInModifier(key)) {
  45871. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  45872. return false
  45873. } else {
  45874. target[key] = value;
  45875. return true
  45876. }
  45877. }
  45878. });
  45879. }
  45880. var hasHandler = {
  45881. has: function has (target, key) {
  45882. var has = key in target;
  45883. var isAllowed = allowedGlobals(key) ||
  45884. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  45885. if (!has && !isAllowed) {
  45886. if (key in target.$data) { warnReservedPrefix(target, key); }
  45887. else { warnNonPresent(target, key); }
  45888. }
  45889. return has || !isAllowed
  45890. }
  45891. };
  45892. var getHandler = {
  45893. get: function get (target, key) {
  45894. if (typeof key === 'string' && !(key in target)) {
  45895. if (key in target.$data) { warnReservedPrefix(target, key); }
  45896. else { warnNonPresent(target, key); }
  45897. }
  45898. return target[key]
  45899. }
  45900. };
  45901. initProxy = function initProxy (vm) {
  45902. if (hasProxy) {
  45903. // determine which proxy handler to use
  45904. var options = vm.$options;
  45905. var handlers = options.render && options.render._withStripped
  45906. ? getHandler
  45907. : hasHandler;
  45908. vm._renderProxy = new Proxy(vm, handlers);
  45909. } else {
  45910. vm._renderProxy = vm;
  45911. }
  45912. };
  45913. }
  45914. /* */
  45915. var seenObjects = new _Set();
  45916. /**
  45917. * Recursively traverse an object to evoke all converted
  45918. * getters, so that every nested property inside the object
  45919. * is collected as a "deep" dependency.
  45920. */
  45921. function traverse (val) {
  45922. _traverse(val, seenObjects);
  45923. seenObjects.clear();
  45924. }
  45925. function _traverse (val, seen) {
  45926. var i, keys;
  45927. var isA = Array.isArray(val);
  45928. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  45929. return
  45930. }
  45931. if (val.__ob__) {
  45932. var depId = val.__ob__.dep.id;
  45933. if (seen.has(depId)) {
  45934. return
  45935. }
  45936. seen.add(depId);
  45937. }
  45938. if (isA) {
  45939. i = val.length;
  45940. while (i--) { _traverse(val[i], seen); }
  45941. } else {
  45942. keys = Object.keys(val);
  45943. i = keys.length;
  45944. while (i--) { _traverse(val[keys[i]], seen); }
  45945. }
  45946. }
  45947. /* */
  45948. var normalizeEvent = cached(function (name) {
  45949. var passive = name.charAt(0) === '&';
  45950. name = passive ? name.slice(1) : name;
  45951. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  45952. name = once$$1 ? name.slice(1) : name;
  45953. var capture = name.charAt(0) === '!';
  45954. name = capture ? name.slice(1) : name;
  45955. return {
  45956. name: name,
  45957. once: once$$1,
  45958. capture: capture,
  45959. passive: passive
  45960. }
  45961. });
  45962. function createFnInvoker (fns, vm) {
  45963. function invoker () {
  45964. var arguments$1 = arguments;
  45965. var fns = invoker.fns;
  45966. if (Array.isArray(fns)) {
  45967. var cloned = fns.slice();
  45968. for (var i = 0; i < cloned.length; i++) {
  45969. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  45970. }
  45971. } else {
  45972. // return handler return value for single handlers
  45973. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  45974. }
  45975. }
  45976. invoker.fns = fns;
  45977. return invoker
  45978. }
  45979. function updateListeners (
  45980. on,
  45981. oldOn,
  45982. add,
  45983. remove$$1,
  45984. createOnceHandler,
  45985. vm
  45986. ) {
  45987. var name, def$$1, cur, old, event;
  45988. for (name in on) {
  45989. def$$1 = cur = on[name];
  45990. old = oldOn[name];
  45991. event = normalizeEvent(name);
  45992. if (isUndef(cur)) {
  45993. warn(
  45994. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  45995. vm
  45996. );
  45997. } else if (isUndef(old)) {
  45998. if (isUndef(cur.fns)) {
  45999. cur = on[name] = createFnInvoker(cur, vm);
  46000. }
  46001. if (isTrue(event.once)) {
  46002. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  46003. }
  46004. add(event.name, cur, event.capture, event.passive, event.params);
  46005. } else if (cur !== old) {
  46006. old.fns = cur;
  46007. on[name] = old;
  46008. }
  46009. }
  46010. for (name in oldOn) {
  46011. if (isUndef(on[name])) {
  46012. event = normalizeEvent(name);
  46013. remove$$1(event.name, oldOn[name], event.capture);
  46014. }
  46015. }
  46016. }
  46017. /* */
  46018. function mergeVNodeHook (def, hookKey, hook) {
  46019. if (def instanceof VNode) {
  46020. def = def.data.hook || (def.data.hook = {});
  46021. }
  46022. var invoker;
  46023. var oldHook = def[hookKey];
  46024. function wrappedHook () {
  46025. hook.apply(this, arguments);
  46026. // important: remove merged hook to ensure it's called only once
  46027. // and prevent memory leak
  46028. remove(invoker.fns, wrappedHook);
  46029. }
  46030. if (isUndef(oldHook)) {
  46031. // no existing hook
  46032. invoker = createFnInvoker([wrappedHook]);
  46033. } else {
  46034. /* istanbul ignore if */
  46035. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  46036. // already a merged invoker
  46037. invoker = oldHook;
  46038. invoker.fns.push(wrappedHook);
  46039. } else {
  46040. // existing plain hook
  46041. invoker = createFnInvoker([oldHook, wrappedHook]);
  46042. }
  46043. }
  46044. invoker.merged = true;
  46045. def[hookKey] = invoker;
  46046. }
  46047. /* */
  46048. function extractPropsFromVNodeData (
  46049. data,
  46050. Ctor,
  46051. tag
  46052. ) {
  46053. // we are only extracting raw values here.
  46054. // validation and default values are handled in the child
  46055. // component itself.
  46056. var propOptions = Ctor.options.props;
  46057. if (isUndef(propOptions)) {
  46058. return
  46059. }
  46060. var res = {};
  46061. var attrs = data.attrs;
  46062. var props = data.props;
  46063. if (isDef(attrs) || isDef(props)) {
  46064. for (var key in propOptions) {
  46065. var altKey = hyphenate(key);
  46066. {
  46067. var keyInLowerCase = key.toLowerCase();
  46068. if (
  46069. key !== keyInLowerCase &&
  46070. attrs && hasOwn(attrs, keyInLowerCase)
  46071. ) {
  46072. tip(
  46073. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  46074. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  46075. " \"" + key + "\". " +
  46076. "Note that HTML attributes are case-insensitive and camelCased " +
  46077. "props need to use their kebab-case equivalents when using in-DOM " +
  46078. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  46079. );
  46080. }
  46081. }
  46082. checkProp(res, props, key, altKey, true) ||
  46083. checkProp(res, attrs, key, altKey, false);
  46084. }
  46085. }
  46086. return res
  46087. }
  46088. function checkProp (
  46089. res,
  46090. hash,
  46091. key,
  46092. altKey,
  46093. preserve
  46094. ) {
  46095. if (isDef(hash)) {
  46096. if (hasOwn(hash, key)) {
  46097. res[key] = hash[key];
  46098. if (!preserve) {
  46099. delete hash[key];
  46100. }
  46101. return true
  46102. } else if (hasOwn(hash, altKey)) {
  46103. res[key] = hash[altKey];
  46104. if (!preserve) {
  46105. delete hash[altKey];
  46106. }
  46107. return true
  46108. }
  46109. }
  46110. return false
  46111. }
  46112. /* */
  46113. // The template compiler attempts to minimize the need for normalization by
  46114. // statically analyzing the template at compile time.
  46115. //
  46116. // For plain HTML markup, normalization can be completely skipped because the
  46117. // generated render function is guaranteed to return Array<VNode>. There are
  46118. // two cases where extra normalization is needed:
  46119. // 1. When the children contains components - because a functional component
  46120. // may return an Array instead of a single root. In this case, just a simple
  46121. // normalization is needed - if any child is an Array, we flatten the whole
  46122. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  46123. // because functional components already normalize their own children.
  46124. function simpleNormalizeChildren (children) {
  46125. for (var i = 0; i < children.length; i++) {
  46126. if (Array.isArray(children[i])) {
  46127. return Array.prototype.concat.apply([], children)
  46128. }
  46129. }
  46130. return children
  46131. }
  46132. // 2. When the children contains constructs that always generated nested Arrays,
  46133. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  46134. // with hand-written render functions / JSX. In such cases a full normalization
  46135. // is needed to cater to all possible types of children values.
  46136. function normalizeChildren (children) {
  46137. return isPrimitive(children)
  46138. ? [createTextVNode(children)]
  46139. : Array.isArray(children)
  46140. ? normalizeArrayChildren(children)
  46141. : undefined
  46142. }
  46143. function isTextNode (node) {
  46144. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  46145. }
  46146. function normalizeArrayChildren (children, nestedIndex) {
  46147. var res = [];
  46148. var i, c, lastIndex, last;
  46149. for (i = 0; i < children.length; i++) {
  46150. c = children[i];
  46151. if (isUndef(c) || typeof c === 'boolean') { continue }
  46152. lastIndex = res.length - 1;
  46153. last = res[lastIndex];
  46154. // nested
  46155. if (Array.isArray(c)) {
  46156. if (c.length > 0) {
  46157. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  46158. // merge adjacent text nodes
  46159. if (isTextNode(c[0]) && isTextNode(last)) {
  46160. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  46161. c.shift();
  46162. }
  46163. res.push.apply(res, c);
  46164. }
  46165. } else if (isPrimitive(c)) {
  46166. if (isTextNode(last)) {
  46167. // merge adjacent text nodes
  46168. // this is necessary for SSR hydration because text nodes are
  46169. // essentially merged when rendered to HTML strings
  46170. res[lastIndex] = createTextVNode(last.text + c);
  46171. } else if (c !== '') {
  46172. // convert primitive to vnode
  46173. res.push(createTextVNode(c));
  46174. }
  46175. } else {
  46176. if (isTextNode(c) && isTextNode(last)) {
  46177. // merge adjacent text nodes
  46178. res[lastIndex] = createTextVNode(last.text + c.text);
  46179. } else {
  46180. // default key for nested array children (likely generated by v-for)
  46181. if (isTrue(children._isVList) &&
  46182. isDef(c.tag) &&
  46183. isUndef(c.key) &&
  46184. isDef(nestedIndex)) {
  46185. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  46186. }
  46187. res.push(c);
  46188. }
  46189. }
  46190. }
  46191. return res
  46192. }
  46193. /* */
  46194. function initProvide (vm) {
  46195. var provide = vm.$options.provide;
  46196. if (provide) {
  46197. vm._provided = typeof provide === 'function'
  46198. ? provide.call(vm)
  46199. : provide;
  46200. }
  46201. }
  46202. function initInjections (vm) {
  46203. var result = resolveInject(vm.$options.inject, vm);
  46204. if (result) {
  46205. toggleObserving(false);
  46206. Object.keys(result).forEach(function (key) {
  46207. /* istanbul ignore else */
  46208. {
  46209. defineReactive$$1(vm, key, result[key], function () {
  46210. warn(
  46211. "Avoid mutating an injected value directly since the changes will be " +
  46212. "overwritten whenever the provided component re-renders. " +
  46213. "injection being mutated: \"" + key + "\"",
  46214. vm
  46215. );
  46216. });
  46217. }
  46218. });
  46219. toggleObserving(true);
  46220. }
  46221. }
  46222. function resolveInject (inject, vm) {
  46223. if (inject) {
  46224. // inject is :any because flow is not smart enough to figure out cached
  46225. var result = Object.create(null);
  46226. var keys = hasSymbol
  46227. ? Reflect.ownKeys(inject)
  46228. : Object.keys(inject);
  46229. for (var i = 0; i < keys.length; i++) {
  46230. var key = keys[i];
  46231. // #6574 in case the inject object is observed...
  46232. if (key === '__ob__') { continue }
  46233. var provideKey = inject[key].from;
  46234. var source = vm;
  46235. while (source) {
  46236. if (source._provided && hasOwn(source._provided, provideKey)) {
  46237. result[key] = source._provided[provideKey];
  46238. break
  46239. }
  46240. source = source.$parent;
  46241. }
  46242. if (!source) {
  46243. if ('default' in inject[key]) {
  46244. var provideDefault = inject[key].default;
  46245. result[key] = typeof provideDefault === 'function'
  46246. ? provideDefault.call(vm)
  46247. : provideDefault;
  46248. } else {
  46249. warn(("Injection \"" + key + "\" not found"), vm);
  46250. }
  46251. }
  46252. }
  46253. return result
  46254. }
  46255. }
  46256. /* */
  46257. /**
  46258. * Runtime helper for resolving raw children VNodes into a slot object.
  46259. */
  46260. function resolveSlots (
  46261. children,
  46262. context
  46263. ) {
  46264. if (!children || !children.length) {
  46265. return {}
  46266. }
  46267. var slots = {};
  46268. for (var i = 0, l = children.length; i < l; i++) {
  46269. var child = children[i];
  46270. var data = child.data;
  46271. // remove slot attribute if the node is resolved as a Vue slot node
  46272. if (data && data.attrs && data.attrs.slot) {
  46273. delete data.attrs.slot;
  46274. }
  46275. // named slots should only be respected if the vnode was rendered in the
  46276. // same context.
  46277. if ((child.context === context || child.fnContext === context) &&
  46278. data && data.slot != null
  46279. ) {
  46280. var name = data.slot;
  46281. var slot = (slots[name] || (slots[name] = []));
  46282. if (child.tag === 'template') {
  46283. slot.push.apply(slot, child.children || []);
  46284. } else {
  46285. slot.push(child);
  46286. }
  46287. } else {
  46288. (slots.default || (slots.default = [])).push(child);
  46289. }
  46290. }
  46291. // ignore slots that contains only whitespace
  46292. for (var name$1 in slots) {
  46293. if (slots[name$1].every(isWhitespace)) {
  46294. delete slots[name$1];
  46295. }
  46296. }
  46297. return slots
  46298. }
  46299. function isWhitespace (node) {
  46300. return (node.isComment && !node.asyncFactory) || node.text === ' '
  46301. }
  46302. /* */
  46303. function normalizeScopedSlots (
  46304. slots,
  46305. normalSlots,
  46306. prevSlots
  46307. ) {
  46308. var res;
  46309. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  46310. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  46311. var key = slots && slots.$key;
  46312. if (!slots) {
  46313. res = {};
  46314. } else if (slots._normalized) {
  46315. // fast path 1: child component re-render only, parent did not change
  46316. return slots._normalized
  46317. } else if (
  46318. isStable &&
  46319. prevSlots &&
  46320. prevSlots !== emptyObject &&
  46321. key === prevSlots.$key &&
  46322. !hasNormalSlots &&
  46323. !prevSlots.$hasNormal
  46324. ) {
  46325. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  46326. // only need to normalize once
  46327. return prevSlots
  46328. } else {
  46329. res = {};
  46330. for (var key$1 in slots) {
  46331. if (slots[key$1] && key$1[0] !== '$') {
  46332. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  46333. }
  46334. }
  46335. }
  46336. // expose normal slots on scopedSlots
  46337. for (var key$2 in normalSlots) {
  46338. if (!(key$2 in res)) {
  46339. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  46340. }
  46341. }
  46342. // avoriaz seems to mock a non-extensible $scopedSlots object
  46343. // and when that is passed down this would cause an error
  46344. if (slots && Object.isExtensible(slots)) {
  46345. (slots)._normalized = res;
  46346. }
  46347. def(res, '$stable', isStable);
  46348. def(res, '$key', key);
  46349. def(res, '$hasNormal', hasNormalSlots);
  46350. return res
  46351. }
  46352. function normalizeScopedSlot(normalSlots, key, fn) {
  46353. var normalized = function () {
  46354. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  46355. res = res && typeof res === 'object' && !Array.isArray(res)
  46356. ? [res] // single vnode
  46357. : normalizeChildren(res);
  46358. return res && (
  46359. res.length === 0 ||
  46360. (res.length === 1 && res[0].isComment) // #9658
  46361. ) ? undefined
  46362. : res
  46363. };
  46364. // this is a slot using the new v-slot syntax without scope. although it is
  46365. // compiled as a scoped slot, render fn users would expect it to be present
  46366. // on this.$slots because the usage is semantically a normal slot.
  46367. if (fn.proxy) {
  46368. Object.defineProperty(normalSlots, key, {
  46369. get: normalized,
  46370. enumerable: true,
  46371. configurable: true
  46372. });
  46373. }
  46374. return normalized
  46375. }
  46376. function proxyNormalSlot(slots, key) {
  46377. return function () { return slots[key]; }
  46378. }
  46379. /* */
  46380. /**
  46381. * Runtime helper for rendering v-for lists.
  46382. */
  46383. function renderList (
  46384. val,
  46385. render
  46386. ) {
  46387. var ret, i, l, keys, key;
  46388. if (Array.isArray(val) || typeof val === 'string') {
  46389. ret = new Array(val.length);
  46390. for (i = 0, l = val.length; i < l; i++) {
  46391. ret[i] = render(val[i], i);
  46392. }
  46393. } else if (typeof val === 'number') {
  46394. ret = new Array(val);
  46395. for (i = 0; i < val; i++) {
  46396. ret[i] = render(i + 1, i);
  46397. }
  46398. } else if (isObject(val)) {
  46399. if (hasSymbol && val[Symbol.iterator]) {
  46400. ret = [];
  46401. var iterator = val[Symbol.iterator]();
  46402. var result = iterator.next();
  46403. while (!result.done) {
  46404. ret.push(render(result.value, ret.length));
  46405. result = iterator.next();
  46406. }
  46407. } else {
  46408. keys = Object.keys(val);
  46409. ret = new Array(keys.length);
  46410. for (i = 0, l = keys.length; i < l; i++) {
  46411. key = keys[i];
  46412. ret[i] = render(val[key], key, i);
  46413. }
  46414. }
  46415. }
  46416. if (!isDef(ret)) {
  46417. ret = [];
  46418. }
  46419. (ret)._isVList = true;
  46420. return ret
  46421. }
  46422. /* */
  46423. /**
  46424. * Runtime helper for rendering <slot>
  46425. */
  46426. function renderSlot (
  46427. name,
  46428. fallback,
  46429. props,
  46430. bindObject
  46431. ) {
  46432. var scopedSlotFn = this.$scopedSlots[name];
  46433. var nodes;
  46434. if (scopedSlotFn) { // scoped slot
  46435. props = props || {};
  46436. if (bindObject) {
  46437. if (!isObject(bindObject)) {
  46438. warn(
  46439. 'slot v-bind without argument expects an Object',
  46440. this
  46441. );
  46442. }
  46443. props = extend(extend({}, bindObject), props);
  46444. }
  46445. nodes = scopedSlotFn(props) || fallback;
  46446. } else {
  46447. nodes = this.$slots[name] || fallback;
  46448. }
  46449. var target = props && props.slot;
  46450. if (target) {
  46451. return this.$createElement('template', { slot: target }, nodes)
  46452. } else {
  46453. return nodes
  46454. }
  46455. }
  46456. /* */
  46457. /**
  46458. * Runtime helper for resolving filters
  46459. */
  46460. function resolveFilter (id) {
  46461. return resolveAsset(this.$options, 'filters', id, true) || identity
  46462. }
  46463. /* */
  46464. function isKeyNotMatch (expect, actual) {
  46465. if (Array.isArray(expect)) {
  46466. return expect.indexOf(actual) === -1
  46467. } else {
  46468. return expect !== actual
  46469. }
  46470. }
  46471. /**
  46472. * Runtime helper for checking keyCodes from config.
  46473. * exposed as Vue.prototype._k
  46474. * passing in eventKeyName as last argument separately for backwards compat
  46475. */
  46476. function checkKeyCodes (
  46477. eventKeyCode,
  46478. key,
  46479. builtInKeyCode,
  46480. eventKeyName,
  46481. builtInKeyName
  46482. ) {
  46483. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  46484. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  46485. return isKeyNotMatch(builtInKeyName, eventKeyName)
  46486. } else if (mappedKeyCode) {
  46487. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  46488. } else if (eventKeyName) {
  46489. return hyphenate(eventKeyName) !== key
  46490. }
  46491. }
  46492. /* */
  46493. /**
  46494. * Runtime helper for merging v-bind="object" into a VNode's data.
  46495. */
  46496. function bindObjectProps (
  46497. data,
  46498. tag,
  46499. value,
  46500. asProp,
  46501. isSync
  46502. ) {
  46503. if (value) {
  46504. if (!isObject(value)) {
  46505. warn(
  46506. 'v-bind without argument expects an Object or Array value',
  46507. this
  46508. );
  46509. } else {
  46510. if (Array.isArray(value)) {
  46511. value = toObject(value);
  46512. }
  46513. var hash;
  46514. var loop = function ( key ) {
  46515. if (
  46516. key === 'class' ||
  46517. key === 'style' ||
  46518. isReservedAttribute(key)
  46519. ) {
  46520. hash = data;
  46521. } else {
  46522. var type = data.attrs && data.attrs.type;
  46523. hash = asProp || config.mustUseProp(tag, type, key)
  46524. ? data.domProps || (data.domProps = {})
  46525. : data.attrs || (data.attrs = {});
  46526. }
  46527. var camelizedKey = camelize(key);
  46528. var hyphenatedKey = hyphenate(key);
  46529. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  46530. hash[key] = value[key];
  46531. if (isSync) {
  46532. var on = data.on || (data.on = {});
  46533. on[("update:" + key)] = function ($event) {
  46534. value[key] = $event;
  46535. };
  46536. }
  46537. }
  46538. };
  46539. for (var key in value) loop( key );
  46540. }
  46541. }
  46542. return data
  46543. }
  46544. /* */
  46545. /**
  46546. * Runtime helper for rendering static trees.
  46547. */
  46548. function renderStatic (
  46549. index,
  46550. isInFor
  46551. ) {
  46552. var cached = this._staticTrees || (this._staticTrees = []);
  46553. var tree = cached[index];
  46554. // if has already-rendered static tree and not inside v-for,
  46555. // we can reuse the same tree.
  46556. if (tree && !isInFor) {
  46557. return tree
  46558. }
  46559. // otherwise, render a fresh tree.
  46560. tree = cached[index] = this.$options.staticRenderFns[index].call(
  46561. this._renderProxy,
  46562. null,
  46563. this // for render fns generated for functional component templates
  46564. );
  46565. markStatic(tree, ("__static__" + index), false);
  46566. return tree
  46567. }
  46568. /**
  46569. * Runtime helper for v-once.
  46570. * Effectively it means marking the node as static with a unique key.
  46571. */
  46572. function markOnce (
  46573. tree,
  46574. index,
  46575. key
  46576. ) {
  46577. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  46578. return tree
  46579. }
  46580. function markStatic (
  46581. tree,
  46582. key,
  46583. isOnce
  46584. ) {
  46585. if (Array.isArray(tree)) {
  46586. for (var i = 0; i < tree.length; i++) {
  46587. if (tree[i] && typeof tree[i] !== 'string') {
  46588. markStaticNode(tree[i], (key + "_" + i), isOnce);
  46589. }
  46590. }
  46591. } else {
  46592. markStaticNode(tree, key, isOnce);
  46593. }
  46594. }
  46595. function markStaticNode (node, key, isOnce) {
  46596. node.isStatic = true;
  46597. node.key = key;
  46598. node.isOnce = isOnce;
  46599. }
  46600. /* */
  46601. function bindObjectListeners (data, value) {
  46602. if (value) {
  46603. if (!isPlainObject(value)) {
  46604. warn(
  46605. 'v-on without argument expects an Object value',
  46606. this
  46607. );
  46608. } else {
  46609. var on = data.on = data.on ? extend({}, data.on) : {};
  46610. for (var key in value) {
  46611. var existing = on[key];
  46612. var ours = value[key];
  46613. on[key] = existing ? [].concat(existing, ours) : ours;
  46614. }
  46615. }
  46616. }
  46617. return data
  46618. }
  46619. /* */
  46620. function resolveScopedSlots (
  46621. fns, // see flow/vnode
  46622. res,
  46623. // the following are added in 2.6
  46624. hasDynamicKeys,
  46625. contentHashKey
  46626. ) {
  46627. res = res || { $stable: !hasDynamicKeys };
  46628. for (var i = 0; i < fns.length; i++) {
  46629. var slot = fns[i];
  46630. if (Array.isArray(slot)) {
  46631. resolveScopedSlots(slot, res, hasDynamicKeys);
  46632. } else if (slot) {
  46633. // marker for reverse proxying v-slot without scope on this.$slots
  46634. if (slot.proxy) {
  46635. slot.fn.proxy = true;
  46636. }
  46637. res[slot.key] = slot.fn;
  46638. }
  46639. }
  46640. if (contentHashKey) {
  46641. (res).$key = contentHashKey;
  46642. }
  46643. return res
  46644. }
  46645. /* */
  46646. function bindDynamicKeys (baseObj, values) {
  46647. for (var i = 0; i < values.length; i += 2) {
  46648. var key = values[i];
  46649. if (typeof key === 'string' && key) {
  46650. baseObj[values[i]] = values[i + 1];
  46651. } else if (key !== '' && key !== null) {
  46652. // null is a special value for explicitly removing a binding
  46653. warn(
  46654. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  46655. this
  46656. );
  46657. }
  46658. }
  46659. return baseObj
  46660. }
  46661. // helper to dynamically append modifier runtime markers to event names.
  46662. // ensure only append when value is already string, otherwise it will be cast
  46663. // to string and cause the type check to miss.
  46664. function prependModifier (value, symbol) {
  46665. return typeof value === 'string' ? symbol + value : value
  46666. }
  46667. /* */
  46668. function installRenderHelpers (target) {
  46669. target._o = markOnce;
  46670. target._n = toNumber;
  46671. target._s = toString;
  46672. target._l = renderList;
  46673. target._t = renderSlot;
  46674. target._q = looseEqual;
  46675. target._i = looseIndexOf;
  46676. target._m = renderStatic;
  46677. target._f = resolveFilter;
  46678. target._k = checkKeyCodes;
  46679. target._b = bindObjectProps;
  46680. target._v = createTextVNode;
  46681. target._e = createEmptyVNode;
  46682. target._u = resolveScopedSlots;
  46683. target._g = bindObjectListeners;
  46684. target._d = bindDynamicKeys;
  46685. target._p = prependModifier;
  46686. }
  46687. /* */
  46688. function FunctionalRenderContext (
  46689. data,
  46690. props,
  46691. children,
  46692. parent,
  46693. Ctor
  46694. ) {
  46695. var this$1 = this;
  46696. var options = Ctor.options;
  46697. // ensure the createElement function in functional components
  46698. // gets a unique context - this is necessary for correct named slot check
  46699. var contextVm;
  46700. if (hasOwn(parent, '_uid')) {
  46701. contextVm = Object.create(parent);
  46702. // $flow-disable-line
  46703. contextVm._original = parent;
  46704. } else {
  46705. // the context vm passed in is a functional context as well.
  46706. // in this case we want to make sure we are able to get a hold to the
  46707. // real context instance.
  46708. contextVm = parent;
  46709. // $flow-disable-line
  46710. parent = parent._original;
  46711. }
  46712. var isCompiled = isTrue(options._compiled);
  46713. var needNormalization = !isCompiled;
  46714. this.data = data;
  46715. this.props = props;
  46716. this.children = children;
  46717. this.parent = parent;
  46718. this.listeners = data.on || emptyObject;
  46719. this.injections = resolveInject(options.inject, parent);
  46720. this.slots = function () {
  46721. if (!this$1.$slots) {
  46722. normalizeScopedSlots(
  46723. data.scopedSlots,
  46724. this$1.$slots = resolveSlots(children, parent)
  46725. );
  46726. }
  46727. return this$1.$slots
  46728. };
  46729. Object.defineProperty(this, 'scopedSlots', ({
  46730. enumerable: true,
  46731. get: function get () {
  46732. return normalizeScopedSlots(data.scopedSlots, this.slots())
  46733. }
  46734. }));
  46735. // support for compiled functional template
  46736. if (isCompiled) {
  46737. // exposing $options for renderStatic()
  46738. this.$options = options;
  46739. // pre-resolve slots for renderSlot()
  46740. this.$slots = this.slots();
  46741. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  46742. }
  46743. if (options._scopeId) {
  46744. this._c = function (a, b, c, d) {
  46745. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  46746. if (vnode && !Array.isArray(vnode)) {
  46747. vnode.fnScopeId = options._scopeId;
  46748. vnode.fnContext = parent;
  46749. }
  46750. return vnode
  46751. };
  46752. } else {
  46753. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  46754. }
  46755. }
  46756. installRenderHelpers(FunctionalRenderContext.prototype);
  46757. function createFunctionalComponent (
  46758. Ctor,
  46759. propsData,
  46760. data,
  46761. contextVm,
  46762. children
  46763. ) {
  46764. var options = Ctor.options;
  46765. var props = {};
  46766. var propOptions = options.props;
  46767. if (isDef(propOptions)) {
  46768. for (var key in propOptions) {
  46769. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  46770. }
  46771. } else {
  46772. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  46773. if (isDef(data.props)) { mergeProps(props, data.props); }
  46774. }
  46775. var renderContext = new FunctionalRenderContext(
  46776. data,
  46777. props,
  46778. children,
  46779. contextVm,
  46780. Ctor
  46781. );
  46782. var vnode = options.render.call(null, renderContext._c, renderContext);
  46783. if (vnode instanceof VNode) {
  46784. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  46785. } else if (Array.isArray(vnode)) {
  46786. var vnodes = normalizeChildren(vnode) || [];
  46787. var res = new Array(vnodes.length);
  46788. for (var i = 0; i < vnodes.length; i++) {
  46789. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  46790. }
  46791. return res
  46792. }
  46793. }
  46794. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  46795. // #7817 clone node before setting fnContext, otherwise if the node is reused
  46796. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  46797. // that should not be matched to match.
  46798. var clone = cloneVNode(vnode);
  46799. clone.fnContext = contextVm;
  46800. clone.fnOptions = options;
  46801. {
  46802. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  46803. }
  46804. if (data.slot) {
  46805. (clone.data || (clone.data = {})).slot = data.slot;
  46806. }
  46807. return clone
  46808. }
  46809. function mergeProps (to, from) {
  46810. for (var key in from) {
  46811. to[camelize(key)] = from[key];
  46812. }
  46813. }
  46814. /* */
  46815. /* */
  46816. /* */
  46817. /* */
  46818. // inline hooks to be invoked on component VNodes during patch
  46819. var componentVNodeHooks = {
  46820. init: function init (vnode, hydrating) {
  46821. if (
  46822. vnode.componentInstance &&
  46823. !vnode.componentInstance._isDestroyed &&
  46824. vnode.data.keepAlive
  46825. ) {
  46826. // kept-alive components, treat as a patch
  46827. var mountedNode = vnode; // work around flow
  46828. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  46829. } else {
  46830. var child = vnode.componentInstance = createComponentInstanceForVnode(
  46831. vnode,
  46832. activeInstance
  46833. );
  46834. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  46835. }
  46836. },
  46837. prepatch: function prepatch (oldVnode, vnode) {
  46838. var options = vnode.componentOptions;
  46839. var child = vnode.componentInstance = oldVnode.componentInstance;
  46840. updateChildComponent(
  46841. child,
  46842. options.propsData, // updated props
  46843. options.listeners, // updated listeners
  46844. vnode, // new parent vnode
  46845. options.children // new children
  46846. );
  46847. },
  46848. insert: function insert (vnode) {
  46849. var context = vnode.context;
  46850. var componentInstance = vnode.componentInstance;
  46851. if (!componentInstance._isMounted) {
  46852. componentInstance._isMounted = true;
  46853. callHook(componentInstance, 'mounted');
  46854. }
  46855. if (vnode.data.keepAlive) {
  46856. if (context._isMounted) {
  46857. // vue-router#1212
  46858. // During updates, a kept-alive component's child components may
  46859. // change, so directly walking the tree here may call activated hooks
  46860. // on incorrect children. Instead we push them into a queue which will
  46861. // be processed after the whole patch process ended.
  46862. queueActivatedComponent(componentInstance);
  46863. } else {
  46864. activateChildComponent(componentInstance, true /* direct */);
  46865. }
  46866. }
  46867. },
  46868. destroy: function destroy (vnode) {
  46869. var componentInstance = vnode.componentInstance;
  46870. if (!componentInstance._isDestroyed) {
  46871. if (!vnode.data.keepAlive) {
  46872. componentInstance.$destroy();
  46873. } else {
  46874. deactivateChildComponent(componentInstance, true /* direct */);
  46875. }
  46876. }
  46877. }
  46878. };
  46879. var hooksToMerge = Object.keys(componentVNodeHooks);
  46880. function createComponent (
  46881. Ctor,
  46882. data,
  46883. context,
  46884. children,
  46885. tag
  46886. ) {
  46887. if (isUndef(Ctor)) {
  46888. return
  46889. }
  46890. var baseCtor = context.$options._base;
  46891. // plain options object: turn it into a constructor
  46892. if (isObject(Ctor)) {
  46893. Ctor = baseCtor.extend(Ctor);
  46894. }
  46895. // if at this stage it's not a constructor or an async component factory,
  46896. // reject.
  46897. if (typeof Ctor !== 'function') {
  46898. {
  46899. warn(("Invalid Component definition: " + (String(Ctor))), context);
  46900. }
  46901. return
  46902. }
  46903. // async component
  46904. var asyncFactory;
  46905. if (isUndef(Ctor.cid)) {
  46906. asyncFactory = Ctor;
  46907. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  46908. if (Ctor === undefined) {
  46909. // return a placeholder node for async component, which is rendered
  46910. // as a comment node but preserves all the raw information for the node.
  46911. // the information will be used for async server-rendering and hydration.
  46912. return createAsyncPlaceholder(
  46913. asyncFactory,
  46914. data,
  46915. context,
  46916. children,
  46917. tag
  46918. )
  46919. }
  46920. }
  46921. data = data || {};
  46922. // resolve constructor options in case global mixins are applied after
  46923. // component constructor creation
  46924. resolveConstructorOptions(Ctor);
  46925. // transform component v-model data into props & events
  46926. if (isDef(data.model)) {
  46927. transformModel(Ctor.options, data);
  46928. }
  46929. // extract props
  46930. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  46931. // functional component
  46932. if (isTrue(Ctor.options.functional)) {
  46933. return createFunctionalComponent(Ctor, propsData, data, context, children)
  46934. }
  46935. // extract listeners, since these needs to be treated as
  46936. // child component listeners instead of DOM listeners
  46937. var listeners = data.on;
  46938. // replace with listeners with .native modifier
  46939. // so it gets processed during parent component patch.
  46940. data.on = data.nativeOn;
  46941. if (isTrue(Ctor.options.abstract)) {
  46942. // abstract components do not keep anything
  46943. // other than props & listeners & slot
  46944. // work around flow
  46945. var slot = data.slot;
  46946. data = {};
  46947. if (slot) {
  46948. data.slot = slot;
  46949. }
  46950. }
  46951. // install component management hooks onto the placeholder node
  46952. installComponentHooks(data);
  46953. // return a placeholder vnode
  46954. var name = Ctor.options.name || tag;
  46955. var vnode = new VNode(
  46956. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  46957. data, undefined, undefined, undefined, context,
  46958. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  46959. asyncFactory
  46960. );
  46961. return vnode
  46962. }
  46963. function createComponentInstanceForVnode (
  46964. vnode, // we know it's MountedComponentVNode but flow doesn't
  46965. parent // activeInstance in lifecycle state
  46966. ) {
  46967. var options = {
  46968. _isComponent: true,
  46969. _parentVnode: vnode,
  46970. parent: parent
  46971. };
  46972. // check inline-template render functions
  46973. var inlineTemplate = vnode.data.inlineTemplate;
  46974. if (isDef(inlineTemplate)) {
  46975. options.render = inlineTemplate.render;
  46976. options.staticRenderFns = inlineTemplate.staticRenderFns;
  46977. }
  46978. return new vnode.componentOptions.Ctor(options)
  46979. }
  46980. function installComponentHooks (data) {
  46981. var hooks = data.hook || (data.hook = {});
  46982. for (var i = 0; i < hooksToMerge.length; i++) {
  46983. var key = hooksToMerge[i];
  46984. var existing = hooks[key];
  46985. var toMerge = componentVNodeHooks[key];
  46986. if (existing !== toMerge && !(existing && existing._merged)) {
  46987. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  46988. }
  46989. }
  46990. }
  46991. function mergeHook$1 (f1, f2) {
  46992. var merged = function (a, b) {
  46993. // flow complains about extra args which is why we use any
  46994. f1(a, b);
  46995. f2(a, b);
  46996. };
  46997. merged._merged = true;
  46998. return merged
  46999. }
  47000. // transform component v-model info (value and callback) into
  47001. // prop and event handler respectively.
  47002. function transformModel (options, data) {
  47003. var prop = (options.model && options.model.prop) || 'value';
  47004. var event = (options.model && options.model.event) || 'input'
  47005. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  47006. var on = data.on || (data.on = {});
  47007. var existing = on[event];
  47008. var callback = data.model.callback;
  47009. if (isDef(existing)) {
  47010. if (
  47011. Array.isArray(existing)
  47012. ? existing.indexOf(callback) === -1
  47013. : existing !== callback
  47014. ) {
  47015. on[event] = [callback].concat(existing);
  47016. }
  47017. } else {
  47018. on[event] = callback;
  47019. }
  47020. }
  47021. /* */
  47022. var SIMPLE_NORMALIZE = 1;
  47023. var ALWAYS_NORMALIZE = 2;
  47024. // wrapper function for providing a more flexible interface
  47025. // without getting yelled at by flow
  47026. function createElement (
  47027. context,
  47028. tag,
  47029. data,
  47030. children,
  47031. normalizationType,
  47032. alwaysNormalize
  47033. ) {
  47034. if (Array.isArray(data) || isPrimitive(data)) {
  47035. normalizationType = children;
  47036. children = data;
  47037. data = undefined;
  47038. }
  47039. if (isTrue(alwaysNormalize)) {
  47040. normalizationType = ALWAYS_NORMALIZE;
  47041. }
  47042. return _createElement(context, tag, data, children, normalizationType)
  47043. }
  47044. function _createElement (
  47045. context,
  47046. tag,
  47047. data,
  47048. children,
  47049. normalizationType
  47050. ) {
  47051. if (isDef(data) && isDef((data).__ob__)) {
  47052. warn(
  47053. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  47054. 'Always create fresh vnode data objects in each render!',
  47055. context
  47056. );
  47057. return createEmptyVNode()
  47058. }
  47059. // object syntax in v-bind
  47060. if (isDef(data) && isDef(data.is)) {
  47061. tag = data.is;
  47062. }
  47063. if (!tag) {
  47064. // in case of component :is set to falsy value
  47065. return createEmptyVNode()
  47066. }
  47067. // warn against non-primitive key
  47068. if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  47069. ) {
  47070. {
  47071. warn(
  47072. 'Avoid using non-primitive value as key, ' +
  47073. 'use string/number value instead.',
  47074. context
  47075. );
  47076. }
  47077. }
  47078. // support single function children as default scoped slot
  47079. if (Array.isArray(children) &&
  47080. typeof children[0] === 'function'
  47081. ) {
  47082. data = data || {};
  47083. data.scopedSlots = { default: children[0] };
  47084. children.length = 0;
  47085. }
  47086. if (normalizationType === ALWAYS_NORMALIZE) {
  47087. children = normalizeChildren(children);
  47088. } else if (normalizationType === SIMPLE_NORMALIZE) {
  47089. children = simpleNormalizeChildren(children);
  47090. }
  47091. var vnode, ns;
  47092. if (typeof tag === 'string') {
  47093. var Ctor;
  47094. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  47095. if (config.isReservedTag(tag)) {
  47096. // platform built-in elements
  47097. if (isDef(data) && isDef(data.nativeOn)) {
  47098. warn(
  47099. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  47100. context
  47101. );
  47102. }
  47103. vnode = new VNode(
  47104. config.parsePlatformTagName(tag), data, children,
  47105. undefined, undefined, context
  47106. );
  47107. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  47108. // component
  47109. vnode = createComponent(Ctor, data, context, children, tag);
  47110. } else {
  47111. // unknown or unlisted namespaced elements
  47112. // check at runtime because it may get assigned a namespace when its
  47113. // parent normalizes children
  47114. vnode = new VNode(
  47115. tag, data, children,
  47116. undefined, undefined, context
  47117. );
  47118. }
  47119. } else {
  47120. // direct component options / constructor
  47121. vnode = createComponent(tag, data, context, children);
  47122. }
  47123. if (Array.isArray(vnode)) {
  47124. return vnode
  47125. } else if (isDef(vnode)) {
  47126. if (isDef(ns)) { applyNS(vnode, ns); }
  47127. if (isDef(data)) { registerDeepBindings(data); }
  47128. return vnode
  47129. } else {
  47130. return createEmptyVNode()
  47131. }
  47132. }
  47133. function applyNS (vnode, ns, force) {
  47134. vnode.ns = ns;
  47135. if (vnode.tag === 'foreignObject') {
  47136. // use default namespace inside foreignObject
  47137. ns = undefined;
  47138. force = true;
  47139. }
  47140. if (isDef(vnode.children)) {
  47141. for (var i = 0, l = vnode.children.length; i < l; i++) {
  47142. var child = vnode.children[i];
  47143. if (isDef(child.tag) && (
  47144. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  47145. applyNS(child, ns, force);
  47146. }
  47147. }
  47148. }
  47149. }
  47150. // ref #5318
  47151. // necessary to ensure parent re-render when deep bindings like :style and
  47152. // :class are used on slot nodes
  47153. function registerDeepBindings (data) {
  47154. if (isObject(data.style)) {
  47155. traverse(data.style);
  47156. }
  47157. if (isObject(data.class)) {
  47158. traverse(data.class);
  47159. }
  47160. }
  47161. /* */
  47162. function initRender (vm) {
  47163. vm._vnode = null; // the root of the child tree
  47164. vm._staticTrees = null; // v-once cached trees
  47165. var options = vm.$options;
  47166. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  47167. var renderContext = parentVnode && parentVnode.context;
  47168. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  47169. vm.$scopedSlots = emptyObject;
  47170. // bind the createElement fn to this instance
  47171. // so that we get proper render context inside it.
  47172. // args order: tag, data, children, normalizationType, alwaysNormalize
  47173. // internal version is used by render functions compiled from templates
  47174. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  47175. // normalization is always applied for the public version, used in
  47176. // user-written render functions.
  47177. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  47178. // $attrs & $listeners are exposed for easier HOC creation.
  47179. // they need to be reactive so that HOCs using them are always updated
  47180. var parentData = parentVnode && parentVnode.data;
  47181. /* istanbul ignore else */
  47182. {
  47183. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  47184. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  47185. }, true);
  47186. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  47187. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  47188. }, true);
  47189. }
  47190. }
  47191. var currentRenderingInstance = null;
  47192. function renderMixin (Vue) {
  47193. // install runtime convenience helpers
  47194. installRenderHelpers(Vue.prototype);
  47195. Vue.prototype.$nextTick = function (fn) {
  47196. return nextTick(fn, this)
  47197. };
  47198. Vue.prototype._render = function () {
  47199. var vm = this;
  47200. var ref = vm.$options;
  47201. var render = ref.render;
  47202. var _parentVnode = ref._parentVnode;
  47203. if (_parentVnode) {
  47204. vm.$scopedSlots = normalizeScopedSlots(
  47205. _parentVnode.data.scopedSlots,
  47206. vm.$slots,
  47207. vm.$scopedSlots
  47208. );
  47209. }
  47210. // set parent vnode. this allows render functions to have access
  47211. // to the data on the placeholder node.
  47212. vm.$vnode = _parentVnode;
  47213. // render self
  47214. var vnode;
  47215. try {
  47216. // There's no need to maintain a stack because all render fns are called
  47217. // separately from one another. Nested component's render fns are called
  47218. // when parent component is patched.
  47219. currentRenderingInstance = vm;
  47220. vnode = render.call(vm._renderProxy, vm.$createElement);
  47221. } catch (e) {
  47222. handleError(e, vm, "render");
  47223. // return error render result,
  47224. // or previous vnode to prevent render error causing blank component
  47225. /* istanbul ignore else */
  47226. if (vm.$options.renderError) {
  47227. try {
  47228. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  47229. } catch (e) {
  47230. handleError(e, vm, "renderError");
  47231. vnode = vm._vnode;
  47232. }
  47233. } else {
  47234. vnode = vm._vnode;
  47235. }
  47236. } finally {
  47237. currentRenderingInstance = null;
  47238. }
  47239. // if the returned array contains only a single node, allow it
  47240. if (Array.isArray(vnode) && vnode.length === 1) {
  47241. vnode = vnode[0];
  47242. }
  47243. // return empty vnode in case the render function errored out
  47244. if (!(vnode instanceof VNode)) {
  47245. if (Array.isArray(vnode)) {
  47246. warn(
  47247. 'Multiple root nodes returned from render function. Render function ' +
  47248. 'should return a single root node.',
  47249. vm
  47250. );
  47251. }
  47252. vnode = createEmptyVNode();
  47253. }
  47254. // set parent
  47255. vnode.parent = _parentVnode;
  47256. return vnode
  47257. };
  47258. }
  47259. /* */
  47260. function ensureCtor (comp, base) {
  47261. if (
  47262. comp.__esModule ||
  47263. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  47264. ) {
  47265. comp = comp.default;
  47266. }
  47267. return isObject(comp)
  47268. ? base.extend(comp)
  47269. : comp
  47270. }
  47271. function createAsyncPlaceholder (
  47272. factory,
  47273. data,
  47274. context,
  47275. children,
  47276. tag
  47277. ) {
  47278. var node = createEmptyVNode();
  47279. node.asyncFactory = factory;
  47280. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  47281. return node
  47282. }
  47283. function resolveAsyncComponent (
  47284. factory,
  47285. baseCtor
  47286. ) {
  47287. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  47288. return factory.errorComp
  47289. }
  47290. if (isDef(factory.resolved)) {
  47291. return factory.resolved
  47292. }
  47293. var owner = currentRenderingInstance;
  47294. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  47295. // already pending
  47296. factory.owners.push(owner);
  47297. }
  47298. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  47299. return factory.loadingComp
  47300. }
  47301. if (owner && !isDef(factory.owners)) {
  47302. var owners = factory.owners = [owner];
  47303. var sync = true;
  47304. var timerLoading = null;
  47305. var timerTimeout = null
  47306. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  47307. var forceRender = function (renderCompleted) {
  47308. for (var i = 0, l = owners.length; i < l; i++) {
  47309. (owners[i]).$forceUpdate();
  47310. }
  47311. if (renderCompleted) {
  47312. owners.length = 0;
  47313. if (timerLoading !== null) {
  47314. clearTimeout(timerLoading);
  47315. timerLoading = null;
  47316. }
  47317. if (timerTimeout !== null) {
  47318. clearTimeout(timerTimeout);
  47319. timerTimeout = null;
  47320. }
  47321. }
  47322. };
  47323. var resolve = once(function (res) {
  47324. // cache resolved
  47325. factory.resolved = ensureCtor(res, baseCtor);
  47326. // invoke callbacks only if this is not a synchronous resolve
  47327. // (async resolves are shimmed as synchronous during SSR)
  47328. if (!sync) {
  47329. forceRender(true);
  47330. } else {
  47331. owners.length = 0;
  47332. }
  47333. });
  47334. var reject = once(function (reason) {
  47335. warn(
  47336. "Failed to resolve async component: " + (String(factory)) +
  47337. (reason ? ("\nReason: " + reason) : '')
  47338. );
  47339. if (isDef(factory.errorComp)) {
  47340. factory.error = true;
  47341. forceRender(true);
  47342. }
  47343. });
  47344. var res = factory(resolve, reject);
  47345. if (isObject(res)) {
  47346. if (isPromise(res)) {
  47347. // () => Promise
  47348. if (isUndef(factory.resolved)) {
  47349. res.then(resolve, reject);
  47350. }
  47351. } else if (isPromise(res.component)) {
  47352. res.component.then(resolve, reject);
  47353. if (isDef(res.error)) {
  47354. factory.errorComp = ensureCtor(res.error, baseCtor);
  47355. }
  47356. if (isDef(res.loading)) {
  47357. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  47358. if (res.delay === 0) {
  47359. factory.loading = true;
  47360. } else {
  47361. timerLoading = setTimeout(function () {
  47362. timerLoading = null;
  47363. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  47364. factory.loading = true;
  47365. forceRender(false);
  47366. }
  47367. }, res.delay || 200);
  47368. }
  47369. }
  47370. if (isDef(res.timeout)) {
  47371. timerTimeout = setTimeout(function () {
  47372. timerTimeout = null;
  47373. if (isUndef(factory.resolved)) {
  47374. reject(
  47375. "timeout (" + (res.timeout) + "ms)"
  47376. );
  47377. }
  47378. }, res.timeout);
  47379. }
  47380. }
  47381. }
  47382. sync = false;
  47383. // return in case resolved synchronously
  47384. return factory.loading
  47385. ? factory.loadingComp
  47386. : factory.resolved
  47387. }
  47388. }
  47389. /* */
  47390. function isAsyncPlaceholder (node) {
  47391. return node.isComment && node.asyncFactory
  47392. }
  47393. /* */
  47394. function getFirstComponentChild (children) {
  47395. if (Array.isArray(children)) {
  47396. for (var i = 0; i < children.length; i++) {
  47397. var c = children[i];
  47398. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  47399. return c
  47400. }
  47401. }
  47402. }
  47403. }
  47404. /* */
  47405. /* */
  47406. function initEvents (vm) {
  47407. vm._events = Object.create(null);
  47408. vm._hasHookEvent = false;
  47409. // init parent attached events
  47410. var listeners = vm.$options._parentListeners;
  47411. if (listeners) {
  47412. updateComponentListeners(vm, listeners);
  47413. }
  47414. }
  47415. var target;
  47416. function add (event, fn) {
  47417. target.$on(event, fn);
  47418. }
  47419. function remove$1 (event, fn) {
  47420. target.$off(event, fn);
  47421. }
  47422. function createOnceHandler (event, fn) {
  47423. var _target = target;
  47424. return function onceHandler () {
  47425. var res = fn.apply(null, arguments);
  47426. if (res !== null) {
  47427. _target.$off(event, onceHandler);
  47428. }
  47429. }
  47430. }
  47431. function updateComponentListeners (
  47432. vm,
  47433. listeners,
  47434. oldListeners
  47435. ) {
  47436. target = vm;
  47437. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  47438. target = undefined;
  47439. }
  47440. function eventsMixin (Vue) {
  47441. var hookRE = /^hook:/;
  47442. Vue.prototype.$on = function (event, fn) {
  47443. var vm = this;
  47444. if (Array.isArray(event)) {
  47445. for (var i = 0, l = event.length; i < l; i++) {
  47446. vm.$on(event[i], fn);
  47447. }
  47448. } else {
  47449. (vm._events[event] || (vm._events[event] = [])).push(fn);
  47450. // optimize hook:event cost by using a boolean flag marked at registration
  47451. // instead of a hash lookup
  47452. if (hookRE.test(event)) {
  47453. vm._hasHookEvent = true;
  47454. }
  47455. }
  47456. return vm
  47457. };
  47458. Vue.prototype.$once = function (event, fn) {
  47459. var vm = this;
  47460. function on () {
  47461. vm.$off(event, on);
  47462. fn.apply(vm, arguments);
  47463. }
  47464. on.fn = fn;
  47465. vm.$on(event, on);
  47466. return vm
  47467. };
  47468. Vue.prototype.$off = function (event, fn) {
  47469. var vm = this;
  47470. // all
  47471. if (!arguments.length) {
  47472. vm._events = Object.create(null);
  47473. return vm
  47474. }
  47475. // array of events
  47476. if (Array.isArray(event)) {
  47477. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  47478. vm.$off(event[i$1], fn);
  47479. }
  47480. return vm
  47481. }
  47482. // specific event
  47483. var cbs = vm._events[event];
  47484. if (!cbs) {
  47485. return vm
  47486. }
  47487. if (!fn) {
  47488. vm._events[event] = null;
  47489. return vm
  47490. }
  47491. // specific handler
  47492. var cb;
  47493. var i = cbs.length;
  47494. while (i--) {
  47495. cb = cbs[i];
  47496. if (cb === fn || cb.fn === fn) {
  47497. cbs.splice(i, 1);
  47498. break
  47499. }
  47500. }
  47501. return vm
  47502. };
  47503. Vue.prototype.$emit = function (event) {
  47504. var vm = this;
  47505. {
  47506. var lowerCaseEvent = event.toLowerCase();
  47507. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  47508. tip(
  47509. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  47510. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  47511. "Note that HTML attributes are case-insensitive and you cannot use " +
  47512. "v-on to listen to camelCase events when using in-DOM templates. " +
  47513. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  47514. );
  47515. }
  47516. }
  47517. var cbs = vm._events[event];
  47518. if (cbs) {
  47519. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  47520. var args = toArray(arguments, 1);
  47521. var info = "event handler for \"" + event + "\"";
  47522. for (var i = 0, l = cbs.length; i < l; i++) {
  47523. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  47524. }
  47525. }
  47526. return vm
  47527. };
  47528. }
  47529. /* */
  47530. var activeInstance = null;
  47531. var isUpdatingChildComponent = false;
  47532. function setActiveInstance(vm) {
  47533. var prevActiveInstance = activeInstance;
  47534. activeInstance = vm;
  47535. return function () {
  47536. activeInstance = prevActiveInstance;
  47537. }
  47538. }
  47539. function initLifecycle (vm) {
  47540. var options = vm.$options;
  47541. // locate first non-abstract parent
  47542. var parent = options.parent;
  47543. if (parent && !options.abstract) {
  47544. while (parent.$options.abstract && parent.$parent) {
  47545. parent = parent.$parent;
  47546. }
  47547. parent.$children.push(vm);
  47548. }
  47549. vm.$parent = parent;
  47550. vm.$root = parent ? parent.$root : vm;
  47551. vm.$children = [];
  47552. vm.$refs = {};
  47553. vm._watcher = null;
  47554. vm._inactive = null;
  47555. vm._directInactive = false;
  47556. vm._isMounted = false;
  47557. vm._isDestroyed = false;
  47558. vm._isBeingDestroyed = false;
  47559. }
  47560. function lifecycleMixin (Vue) {
  47561. Vue.prototype._update = function (vnode, hydrating) {
  47562. var vm = this;
  47563. var prevEl = vm.$el;
  47564. var prevVnode = vm._vnode;
  47565. var restoreActiveInstance = setActiveInstance(vm);
  47566. vm._vnode = vnode;
  47567. // Vue.prototype.__patch__ is injected in entry points
  47568. // based on the rendering backend used.
  47569. if (!prevVnode) {
  47570. // initial render
  47571. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  47572. } else {
  47573. // updates
  47574. vm.$el = vm.__patch__(prevVnode, vnode);
  47575. }
  47576. restoreActiveInstance();
  47577. // update __vue__ reference
  47578. if (prevEl) {
  47579. prevEl.__vue__ = null;
  47580. }
  47581. if (vm.$el) {
  47582. vm.$el.__vue__ = vm;
  47583. }
  47584. // if parent is an HOC, update its $el as well
  47585. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  47586. vm.$parent.$el = vm.$el;
  47587. }
  47588. // updated hook is called by the scheduler to ensure that children are
  47589. // updated in a parent's updated hook.
  47590. };
  47591. Vue.prototype.$forceUpdate = function () {
  47592. var vm = this;
  47593. if (vm._watcher) {
  47594. vm._watcher.update();
  47595. }
  47596. };
  47597. Vue.prototype.$destroy = function () {
  47598. var vm = this;
  47599. if (vm._isBeingDestroyed) {
  47600. return
  47601. }
  47602. callHook(vm, 'beforeDestroy');
  47603. vm._isBeingDestroyed = true;
  47604. // remove self from parent
  47605. var parent = vm.$parent;
  47606. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  47607. remove(parent.$children, vm);
  47608. }
  47609. // teardown watchers
  47610. if (vm._watcher) {
  47611. vm._watcher.teardown();
  47612. }
  47613. var i = vm._watchers.length;
  47614. while (i--) {
  47615. vm._watchers[i].teardown();
  47616. }
  47617. // remove reference from data ob
  47618. // frozen object may not have observer.
  47619. if (vm._data.__ob__) {
  47620. vm._data.__ob__.vmCount--;
  47621. }
  47622. // call the last hook...
  47623. vm._isDestroyed = true;
  47624. // invoke destroy hooks on current rendered tree
  47625. vm.__patch__(vm._vnode, null);
  47626. // fire destroyed hook
  47627. callHook(vm, 'destroyed');
  47628. // turn off all instance listeners.
  47629. vm.$off();
  47630. // remove __vue__ reference
  47631. if (vm.$el) {
  47632. vm.$el.__vue__ = null;
  47633. }
  47634. // release circular reference (#6759)
  47635. if (vm.$vnode) {
  47636. vm.$vnode.parent = null;
  47637. }
  47638. };
  47639. }
  47640. function mountComponent (
  47641. vm,
  47642. el,
  47643. hydrating
  47644. ) {
  47645. vm.$el = el;
  47646. if (!vm.$options.render) {
  47647. vm.$options.render = createEmptyVNode;
  47648. {
  47649. /* istanbul ignore if */
  47650. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  47651. vm.$options.el || el) {
  47652. warn(
  47653. 'You are using the runtime-only build of Vue where the template ' +
  47654. 'compiler is not available. Either pre-compile the templates into ' +
  47655. 'render functions, or use the compiler-included build.',
  47656. vm
  47657. );
  47658. } else {
  47659. warn(
  47660. 'Failed to mount component: template or render function not defined.',
  47661. vm
  47662. );
  47663. }
  47664. }
  47665. }
  47666. callHook(vm, 'beforeMount');
  47667. var updateComponent;
  47668. /* istanbul ignore if */
  47669. if (config.performance && mark) {
  47670. updateComponent = function () {
  47671. var name = vm._name;
  47672. var id = vm._uid;
  47673. var startTag = "vue-perf-start:" + id;
  47674. var endTag = "vue-perf-end:" + id;
  47675. mark(startTag);
  47676. var vnode = vm._render();
  47677. mark(endTag);
  47678. measure(("vue " + name + " render"), startTag, endTag);
  47679. mark(startTag);
  47680. vm._update(vnode, hydrating);
  47681. mark(endTag);
  47682. measure(("vue " + name + " patch"), startTag, endTag);
  47683. };
  47684. } else {
  47685. updateComponent = function () {
  47686. vm._update(vm._render(), hydrating);
  47687. };
  47688. }
  47689. // we set this to vm._watcher inside the watcher's constructor
  47690. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  47691. // component's mounted hook), which relies on vm._watcher being already defined
  47692. new Watcher(vm, updateComponent, noop, {
  47693. before: function before () {
  47694. if (vm._isMounted && !vm._isDestroyed) {
  47695. callHook(vm, 'beforeUpdate');
  47696. }
  47697. }
  47698. }, true /* isRenderWatcher */);
  47699. hydrating = false;
  47700. // manually mounted instance, call mounted on self
  47701. // mounted is called for render-created child components in its inserted hook
  47702. if (vm.$vnode == null) {
  47703. vm._isMounted = true;
  47704. callHook(vm, 'mounted');
  47705. }
  47706. return vm
  47707. }
  47708. function updateChildComponent (
  47709. vm,
  47710. propsData,
  47711. listeners,
  47712. parentVnode,
  47713. renderChildren
  47714. ) {
  47715. {
  47716. isUpdatingChildComponent = true;
  47717. }
  47718. // determine whether component has slot children
  47719. // we need to do this before overwriting $options._renderChildren.
  47720. // check if there are dynamic scopedSlots (hand-written or compiled but with
  47721. // dynamic slot names). Static scoped slots compiled from template has the
  47722. // "$stable" marker.
  47723. var newScopedSlots = parentVnode.data.scopedSlots;
  47724. var oldScopedSlots = vm.$scopedSlots;
  47725. var hasDynamicScopedSlot = !!(
  47726. (newScopedSlots && !newScopedSlots.$stable) ||
  47727. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  47728. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  47729. );
  47730. // Any static slot children from the parent may have changed during parent's
  47731. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  47732. // update is necessary to ensure correctness.
  47733. var needsForceUpdate = !!(
  47734. renderChildren || // has new static slots
  47735. vm.$options._renderChildren || // has old static slots
  47736. hasDynamicScopedSlot
  47737. );
  47738. vm.$options._parentVnode = parentVnode;
  47739. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  47740. if (vm._vnode) { // update child tree's parent
  47741. vm._vnode.parent = parentVnode;
  47742. }
  47743. vm.$options._renderChildren = renderChildren;
  47744. // update $attrs and $listeners hash
  47745. // these are also reactive so they may trigger child update if the child
  47746. // used them during render
  47747. vm.$attrs = parentVnode.data.attrs || emptyObject;
  47748. vm.$listeners = listeners || emptyObject;
  47749. // update props
  47750. if (propsData && vm.$options.props) {
  47751. toggleObserving(false);
  47752. var props = vm._props;
  47753. var propKeys = vm.$options._propKeys || [];
  47754. for (var i = 0; i < propKeys.length; i++) {
  47755. var key = propKeys[i];
  47756. var propOptions = vm.$options.props; // wtf flow?
  47757. props[key] = validateProp(key, propOptions, propsData, vm);
  47758. }
  47759. toggleObserving(true);
  47760. // keep a copy of raw propsData
  47761. vm.$options.propsData = propsData;
  47762. }
  47763. // update listeners
  47764. listeners = listeners || emptyObject;
  47765. var oldListeners = vm.$options._parentListeners;
  47766. vm.$options._parentListeners = listeners;
  47767. updateComponentListeners(vm, listeners, oldListeners);
  47768. // resolve slots + force update if has children
  47769. if (needsForceUpdate) {
  47770. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  47771. vm.$forceUpdate();
  47772. }
  47773. {
  47774. isUpdatingChildComponent = false;
  47775. }
  47776. }
  47777. function isInInactiveTree (vm) {
  47778. while (vm && (vm = vm.$parent)) {
  47779. if (vm._inactive) { return true }
  47780. }
  47781. return false
  47782. }
  47783. function activateChildComponent (vm, direct) {
  47784. if (direct) {
  47785. vm._directInactive = false;
  47786. if (isInInactiveTree(vm)) {
  47787. return
  47788. }
  47789. } else if (vm._directInactive) {
  47790. return
  47791. }
  47792. if (vm._inactive || vm._inactive === null) {
  47793. vm._inactive = false;
  47794. for (var i = 0; i < vm.$children.length; i++) {
  47795. activateChildComponent(vm.$children[i]);
  47796. }
  47797. callHook(vm, 'activated');
  47798. }
  47799. }
  47800. function deactivateChildComponent (vm, direct) {
  47801. if (direct) {
  47802. vm._directInactive = true;
  47803. if (isInInactiveTree(vm)) {
  47804. return
  47805. }
  47806. }
  47807. if (!vm._inactive) {
  47808. vm._inactive = true;
  47809. for (var i = 0; i < vm.$children.length; i++) {
  47810. deactivateChildComponent(vm.$children[i]);
  47811. }
  47812. callHook(vm, 'deactivated');
  47813. }
  47814. }
  47815. function callHook (vm, hook) {
  47816. // #7573 disable dep collection when invoking lifecycle hooks
  47817. pushTarget();
  47818. var handlers = vm.$options[hook];
  47819. var info = hook + " hook";
  47820. if (handlers) {
  47821. for (var i = 0, j = handlers.length; i < j; i++) {
  47822. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  47823. }
  47824. }
  47825. if (vm._hasHookEvent) {
  47826. vm.$emit('hook:' + hook);
  47827. }
  47828. popTarget();
  47829. }
  47830. /* */
  47831. var MAX_UPDATE_COUNT = 100;
  47832. var queue = [];
  47833. var activatedChildren = [];
  47834. var has = {};
  47835. var circular = {};
  47836. var waiting = false;
  47837. var flushing = false;
  47838. var index = 0;
  47839. /**
  47840. * Reset the scheduler's state.
  47841. */
  47842. function resetSchedulerState () {
  47843. index = queue.length = activatedChildren.length = 0;
  47844. has = {};
  47845. {
  47846. circular = {};
  47847. }
  47848. waiting = flushing = false;
  47849. }
  47850. // Async edge case #6566 requires saving the timestamp when event listeners are
  47851. // attached. However, calling performance.now() has a perf overhead especially
  47852. // if the page has thousands of event listeners. Instead, we take a timestamp
  47853. // every time the scheduler flushes and use that for all event listeners
  47854. // attached during that flush.
  47855. var currentFlushTimestamp = 0;
  47856. // Async edge case fix requires storing an event listener's attach timestamp.
  47857. var getNow = Date.now;
  47858. // Determine what event timestamp the browser is using. Annoyingly, the
  47859. // timestamp can either be hi-res (relative to page load) or low-res
  47860. // (relative to UNIX epoch), so in order to compare time we have to use the
  47861. // same timestamp type when saving the flush timestamp.
  47862. // All IE versions use low-res event timestamps, and have problematic clock
  47863. // implementations (#9632)
  47864. if (inBrowser && !isIE) {
  47865. var performance = window.performance;
  47866. if (
  47867. performance &&
  47868. typeof performance.now === 'function' &&
  47869. getNow() > document.createEvent('Event').timeStamp
  47870. ) {
  47871. // if the event timestamp, although evaluated AFTER the Date.now(), is
  47872. // smaller than it, it means the event is using a hi-res timestamp,
  47873. // and we need to use the hi-res version for event listener timestamps as
  47874. // well.
  47875. getNow = function () { return performance.now(); };
  47876. }
  47877. }
  47878. /**
  47879. * Flush both queues and run the watchers.
  47880. */
  47881. function flushSchedulerQueue () {
  47882. currentFlushTimestamp = getNow();
  47883. flushing = true;
  47884. var watcher, id;
  47885. // Sort queue before flush.
  47886. // This ensures that:
  47887. // 1. Components are updated from parent to child. (because parent is always
  47888. // created before the child)
  47889. // 2. A component's user watchers are run before its render watcher (because
  47890. // user watchers are created before the render watcher)
  47891. // 3. If a component is destroyed during a parent component's watcher run,
  47892. // its watchers can be skipped.
  47893. queue.sort(function (a, b) { return a.id - b.id; });
  47894. // do not cache length because more watchers might be pushed
  47895. // as we run existing watchers
  47896. for (index = 0; index < queue.length; index++) {
  47897. watcher = queue[index];
  47898. if (watcher.before) {
  47899. watcher.before();
  47900. }
  47901. id = watcher.id;
  47902. has[id] = null;
  47903. watcher.run();
  47904. // in dev build, check and stop circular updates.
  47905. if (has[id] != null) {
  47906. circular[id] = (circular[id] || 0) + 1;
  47907. if (circular[id] > MAX_UPDATE_COUNT) {
  47908. warn(
  47909. 'You may have an infinite update loop ' + (
  47910. watcher.user
  47911. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  47912. : "in a component render function."
  47913. ),
  47914. watcher.vm
  47915. );
  47916. break
  47917. }
  47918. }
  47919. }
  47920. // keep copies of post queues before resetting state
  47921. var activatedQueue = activatedChildren.slice();
  47922. var updatedQueue = queue.slice();
  47923. resetSchedulerState();
  47924. // call component updated and activated hooks
  47925. callActivatedHooks(activatedQueue);
  47926. callUpdatedHooks(updatedQueue);
  47927. // devtool hook
  47928. /* istanbul ignore if */
  47929. if (devtools && config.devtools) {
  47930. devtools.emit('flush');
  47931. }
  47932. }
  47933. function callUpdatedHooks (queue) {
  47934. var i = queue.length;
  47935. while (i--) {
  47936. var watcher = queue[i];
  47937. var vm = watcher.vm;
  47938. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  47939. callHook(vm, 'updated');
  47940. }
  47941. }
  47942. }
  47943. /**
  47944. * Queue a kept-alive component that was activated during patch.
  47945. * The queue will be processed after the entire tree has been patched.
  47946. */
  47947. function queueActivatedComponent (vm) {
  47948. // setting _inactive to false here so that a render function can
  47949. // rely on checking whether it's in an inactive tree (e.g. router-view)
  47950. vm._inactive = false;
  47951. activatedChildren.push(vm);
  47952. }
  47953. function callActivatedHooks (queue) {
  47954. for (var i = 0; i < queue.length; i++) {
  47955. queue[i]._inactive = true;
  47956. activateChildComponent(queue[i], true /* true */);
  47957. }
  47958. }
  47959. /**
  47960. * Push a watcher into the watcher queue.
  47961. * Jobs with duplicate IDs will be skipped unless it's
  47962. * pushed when the queue is being flushed.
  47963. */
  47964. function queueWatcher (watcher) {
  47965. var id = watcher.id;
  47966. if (has[id] == null) {
  47967. has[id] = true;
  47968. if (!flushing) {
  47969. queue.push(watcher);
  47970. } else {
  47971. // if already flushing, splice the watcher based on its id
  47972. // if already past its id, it will be run next immediately.
  47973. var i = queue.length - 1;
  47974. while (i > index && queue[i].id > watcher.id) {
  47975. i--;
  47976. }
  47977. queue.splice(i + 1, 0, watcher);
  47978. }
  47979. // queue the flush
  47980. if (!waiting) {
  47981. waiting = true;
  47982. if (!config.async) {
  47983. flushSchedulerQueue();
  47984. return
  47985. }
  47986. nextTick(flushSchedulerQueue);
  47987. }
  47988. }
  47989. }
  47990. /* */
  47991. var uid$2 = 0;
  47992. /**
  47993. * A watcher parses an expression, collects dependencies,
  47994. * and fires callback when the expression value changes.
  47995. * This is used for both the $watch() api and directives.
  47996. */
  47997. var Watcher = function Watcher (
  47998. vm,
  47999. expOrFn,
  48000. cb,
  48001. options,
  48002. isRenderWatcher
  48003. ) {
  48004. this.vm = vm;
  48005. if (isRenderWatcher) {
  48006. vm._watcher = this;
  48007. }
  48008. vm._watchers.push(this);
  48009. // options
  48010. if (options) {
  48011. this.deep = !!options.deep;
  48012. this.user = !!options.user;
  48013. this.lazy = !!options.lazy;
  48014. this.sync = !!options.sync;
  48015. this.before = options.before;
  48016. } else {
  48017. this.deep = this.user = this.lazy = this.sync = false;
  48018. }
  48019. this.cb = cb;
  48020. this.id = ++uid$2; // uid for batching
  48021. this.active = true;
  48022. this.dirty = this.lazy; // for lazy watchers
  48023. this.deps = [];
  48024. this.newDeps = [];
  48025. this.depIds = new _Set();
  48026. this.newDepIds = new _Set();
  48027. this.expression = expOrFn.toString();
  48028. // parse expression for getter
  48029. if (typeof expOrFn === 'function') {
  48030. this.getter = expOrFn;
  48031. } else {
  48032. this.getter = parsePath(expOrFn);
  48033. if (!this.getter) {
  48034. this.getter = noop;
  48035. warn(
  48036. "Failed watching path: \"" + expOrFn + "\" " +
  48037. 'Watcher only accepts simple dot-delimited paths. ' +
  48038. 'For full control, use a function instead.',
  48039. vm
  48040. );
  48041. }
  48042. }
  48043. this.value = this.lazy
  48044. ? undefined
  48045. : this.get();
  48046. };
  48047. /**
  48048. * Evaluate the getter, and re-collect dependencies.
  48049. */
  48050. Watcher.prototype.get = function get () {
  48051. pushTarget(this);
  48052. var value;
  48053. var vm = this.vm;
  48054. try {
  48055. value = this.getter.call(vm, vm);
  48056. } catch (e) {
  48057. if (this.user) {
  48058. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  48059. } else {
  48060. throw e
  48061. }
  48062. } finally {
  48063. // "touch" every property so they are all tracked as
  48064. // dependencies for deep watching
  48065. if (this.deep) {
  48066. traverse(value);
  48067. }
  48068. popTarget();
  48069. this.cleanupDeps();
  48070. }
  48071. return value
  48072. };
  48073. /**
  48074. * Add a dependency to this directive.
  48075. */
  48076. Watcher.prototype.addDep = function addDep (dep) {
  48077. var id = dep.id;
  48078. if (!this.newDepIds.has(id)) {
  48079. this.newDepIds.add(id);
  48080. this.newDeps.push(dep);
  48081. if (!this.depIds.has(id)) {
  48082. dep.addSub(this);
  48083. }
  48084. }
  48085. };
  48086. /**
  48087. * Clean up for dependency collection.
  48088. */
  48089. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  48090. var i = this.deps.length;
  48091. while (i--) {
  48092. var dep = this.deps[i];
  48093. if (!this.newDepIds.has(dep.id)) {
  48094. dep.removeSub(this);
  48095. }
  48096. }
  48097. var tmp = this.depIds;
  48098. this.depIds = this.newDepIds;
  48099. this.newDepIds = tmp;
  48100. this.newDepIds.clear();
  48101. tmp = this.deps;
  48102. this.deps = this.newDeps;
  48103. this.newDeps = tmp;
  48104. this.newDeps.length = 0;
  48105. };
  48106. /**
  48107. * Subscriber interface.
  48108. * Will be called when a dependency changes.
  48109. */
  48110. Watcher.prototype.update = function update () {
  48111. /* istanbul ignore else */
  48112. if (this.lazy) {
  48113. this.dirty = true;
  48114. } else if (this.sync) {
  48115. this.run();
  48116. } else {
  48117. queueWatcher(this);
  48118. }
  48119. };
  48120. /**
  48121. * Scheduler job interface.
  48122. * Will be called by the scheduler.
  48123. */
  48124. Watcher.prototype.run = function run () {
  48125. if (this.active) {
  48126. var value = this.get();
  48127. if (
  48128. value !== this.value ||
  48129. // Deep watchers and watchers on Object/Arrays should fire even
  48130. // when the value is the same, because the value may
  48131. // have mutated.
  48132. isObject(value) ||
  48133. this.deep
  48134. ) {
  48135. // set new value
  48136. var oldValue = this.value;
  48137. this.value = value;
  48138. if (this.user) {
  48139. try {
  48140. this.cb.call(this.vm, value, oldValue);
  48141. } catch (e) {
  48142. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  48143. }
  48144. } else {
  48145. this.cb.call(this.vm, value, oldValue);
  48146. }
  48147. }
  48148. }
  48149. };
  48150. /**
  48151. * Evaluate the value of the watcher.
  48152. * This only gets called for lazy watchers.
  48153. */
  48154. Watcher.prototype.evaluate = function evaluate () {
  48155. this.value = this.get();
  48156. this.dirty = false;
  48157. };
  48158. /**
  48159. * Depend on all deps collected by this watcher.
  48160. */
  48161. Watcher.prototype.depend = function depend () {
  48162. var i = this.deps.length;
  48163. while (i--) {
  48164. this.deps[i].depend();
  48165. }
  48166. };
  48167. /**
  48168. * Remove self from all dependencies' subscriber list.
  48169. */
  48170. Watcher.prototype.teardown = function teardown () {
  48171. if (this.active) {
  48172. // remove self from vm's watcher list
  48173. // this is a somewhat expensive operation so we skip it
  48174. // if the vm is being destroyed.
  48175. if (!this.vm._isBeingDestroyed) {
  48176. remove(this.vm._watchers, this);
  48177. }
  48178. var i = this.deps.length;
  48179. while (i--) {
  48180. this.deps[i].removeSub(this);
  48181. }
  48182. this.active = false;
  48183. }
  48184. };
  48185. /* */
  48186. var sharedPropertyDefinition = {
  48187. enumerable: true,
  48188. configurable: true,
  48189. get: noop,
  48190. set: noop
  48191. };
  48192. function proxy (target, sourceKey, key) {
  48193. sharedPropertyDefinition.get = function proxyGetter () {
  48194. return this[sourceKey][key]
  48195. };
  48196. sharedPropertyDefinition.set = function proxySetter (val) {
  48197. this[sourceKey][key] = val;
  48198. };
  48199. Object.defineProperty(target, key, sharedPropertyDefinition);
  48200. }
  48201. function initState (vm) {
  48202. vm._watchers = [];
  48203. var opts = vm.$options;
  48204. if (opts.props) { initProps(vm, opts.props); }
  48205. if (opts.methods) { initMethods(vm, opts.methods); }
  48206. if (opts.data) {
  48207. initData(vm);
  48208. } else {
  48209. observe(vm._data = {}, true /* asRootData */);
  48210. }
  48211. if (opts.computed) { initComputed(vm, opts.computed); }
  48212. if (opts.watch && opts.watch !== nativeWatch) {
  48213. initWatch(vm, opts.watch);
  48214. }
  48215. }
  48216. function initProps (vm, propsOptions) {
  48217. var propsData = vm.$options.propsData || {};
  48218. var props = vm._props = {};
  48219. // cache prop keys so that future props updates can iterate using Array
  48220. // instead of dynamic object key enumeration.
  48221. var keys = vm.$options._propKeys = [];
  48222. var isRoot = !vm.$parent;
  48223. // root instance props should be converted
  48224. if (!isRoot) {
  48225. toggleObserving(false);
  48226. }
  48227. var loop = function ( key ) {
  48228. keys.push(key);
  48229. var value = validateProp(key, propsOptions, propsData, vm);
  48230. /* istanbul ignore else */
  48231. {
  48232. var hyphenatedKey = hyphenate(key);
  48233. if (isReservedAttribute(hyphenatedKey) ||
  48234. config.isReservedAttr(hyphenatedKey)) {
  48235. warn(
  48236. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  48237. vm
  48238. );
  48239. }
  48240. defineReactive$$1(props, key, value, function () {
  48241. if (!isRoot && !isUpdatingChildComponent) {
  48242. warn(
  48243. "Avoid mutating a prop directly since the value will be " +
  48244. "overwritten whenever the parent component re-renders. " +
  48245. "Instead, use a data or computed property based on the prop's " +
  48246. "value. Prop being mutated: \"" + key + "\"",
  48247. vm
  48248. );
  48249. }
  48250. });
  48251. }
  48252. // static props are already proxied on the component's prototype
  48253. // during Vue.extend(). We only need to proxy props defined at
  48254. // instantiation here.
  48255. if (!(key in vm)) {
  48256. proxy(vm, "_props", key);
  48257. }
  48258. };
  48259. for (var key in propsOptions) loop( key );
  48260. toggleObserving(true);
  48261. }
  48262. function initData (vm) {
  48263. var data = vm.$options.data;
  48264. data = vm._data = typeof data === 'function'
  48265. ? getData(data, vm)
  48266. : data || {};
  48267. if (!isPlainObject(data)) {
  48268. data = {};
  48269. warn(
  48270. 'data functions should return an object:\n' +
  48271. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  48272. vm
  48273. );
  48274. }
  48275. // proxy data on instance
  48276. var keys = Object.keys(data);
  48277. var props = vm.$options.props;
  48278. var methods = vm.$options.methods;
  48279. var i = keys.length;
  48280. while (i--) {
  48281. var key = keys[i];
  48282. {
  48283. if (methods && hasOwn(methods, key)) {
  48284. warn(
  48285. ("Method \"" + key + "\" has already been defined as a data property."),
  48286. vm
  48287. );
  48288. }
  48289. }
  48290. if (props && hasOwn(props, key)) {
  48291. warn(
  48292. "The data property \"" + key + "\" is already declared as a prop. " +
  48293. "Use prop default value instead.",
  48294. vm
  48295. );
  48296. } else if (!isReserved(key)) {
  48297. proxy(vm, "_data", key);
  48298. }
  48299. }
  48300. // observe data
  48301. observe(data, true /* asRootData */);
  48302. }
  48303. function getData (data, vm) {
  48304. // #7573 disable dep collection when invoking data getters
  48305. pushTarget();
  48306. try {
  48307. return data.call(vm, vm)
  48308. } catch (e) {
  48309. handleError(e, vm, "data()");
  48310. return {}
  48311. } finally {
  48312. popTarget();
  48313. }
  48314. }
  48315. var computedWatcherOptions = { lazy: true };
  48316. function initComputed (vm, computed) {
  48317. // $flow-disable-line
  48318. var watchers = vm._computedWatchers = Object.create(null);
  48319. // computed properties are just getters during SSR
  48320. var isSSR = isServerRendering();
  48321. for (var key in computed) {
  48322. var userDef = computed[key];
  48323. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  48324. if (getter == null) {
  48325. warn(
  48326. ("Getter is missing for computed property \"" + key + "\"."),
  48327. vm
  48328. );
  48329. }
  48330. if (!isSSR) {
  48331. // create internal watcher for the computed property.
  48332. watchers[key] = new Watcher(
  48333. vm,
  48334. getter || noop,
  48335. noop,
  48336. computedWatcherOptions
  48337. );
  48338. }
  48339. // component-defined computed properties are already defined on the
  48340. // component prototype. We only need to define computed properties defined
  48341. // at instantiation here.
  48342. if (!(key in vm)) {
  48343. defineComputed(vm, key, userDef);
  48344. } else {
  48345. if (key in vm.$data) {
  48346. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  48347. } else if (vm.$options.props && key in vm.$options.props) {
  48348. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  48349. }
  48350. }
  48351. }
  48352. }
  48353. function defineComputed (
  48354. target,
  48355. key,
  48356. userDef
  48357. ) {
  48358. var shouldCache = !isServerRendering();
  48359. if (typeof userDef === 'function') {
  48360. sharedPropertyDefinition.get = shouldCache
  48361. ? createComputedGetter(key)
  48362. : createGetterInvoker(userDef);
  48363. sharedPropertyDefinition.set = noop;
  48364. } else {
  48365. sharedPropertyDefinition.get = userDef.get
  48366. ? shouldCache && userDef.cache !== false
  48367. ? createComputedGetter(key)
  48368. : createGetterInvoker(userDef.get)
  48369. : noop;
  48370. sharedPropertyDefinition.set = userDef.set || noop;
  48371. }
  48372. if (sharedPropertyDefinition.set === noop) {
  48373. sharedPropertyDefinition.set = function () {
  48374. warn(
  48375. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  48376. this
  48377. );
  48378. };
  48379. }
  48380. Object.defineProperty(target, key, sharedPropertyDefinition);
  48381. }
  48382. function createComputedGetter (key) {
  48383. return function computedGetter () {
  48384. var watcher = this._computedWatchers && this._computedWatchers[key];
  48385. if (watcher) {
  48386. if (watcher.dirty) {
  48387. watcher.evaluate();
  48388. }
  48389. if (Dep.target) {
  48390. watcher.depend();
  48391. }
  48392. return watcher.value
  48393. }
  48394. }
  48395. }
  48396. function createGetterInvoker(fn) {
  48397. return function computedGetter () {
  48398. return fn.call(this, this)
  48399. }
  48400. }
  48401. function initMethods (vm, methods) {
  48402. var props = vm.$options.props;
  48403. for (var key in methods) {
  48404. {
  48405. if (typeof methods[key] !== 'function') {
  48406. warn(
  48407. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  48408. "Did you reference the function correctly?",
  48409. vm
  48410. );
  48411. }
  48412. if (props && hasOwn(props, key)) {
  48413. warn(
  48414. ("Method \"" + key + "\" has already been defined as a prop."),
  48415. vm
  48416. );
  48417. }
  48418. if ((key in vm) && isReserved(key)) {
  48419. warn(
  48420. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  48421. "Avoid defining component methods that start with _ or $."
  48422. );
  48423. }
  48424. }
  48425. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  48426. }
  48427. }
  48428. function initWatch (vm, watch) {
  48429. for (var key in watch) {
  48430. var handler = watch[key];
  48431. if (Array.isArray(handler)) {
  48432. for (var i = 0; i < handler.length; i++) {
  48433. createWatcher(vm, key, handler[i]);
  48434. }
  48435. } else {
  48436. createWatcher(vm, key, handler);
  48437. }
  48438. }
  48439. }
  48440. function createWatcher (
  48441. vm,
  48442. expOrFn,
  48443. handler,
  48444. options
  48445. ) {
  48446. if (isPlainObject(handler)) {
  48447. options = handler;
  48448. handler = handler.handler;
  48449. }
  48450. if (typeof handler === 'string') {
  48451. handler = vm[handler];
  48452. }
  48453. return vm.$watch(expOrFn, handler, options)
  48454. }
  48455. function stateMixin (Vue) {
  48456. // flow somehow has problems with directly declared definition object
  48457. // when using Object.defineProperty, so we have to procedurally build up
  48458. // the object here.
  48459. var dataDef = {};
  48460. dataDef.get = function () { return this._data };
  48461. var propsDef = {};
  48462. propsDef.get = function () { return this._props };
  48463. {
  48464. dataDef.set = function () {
  48465. warn(
  48466. 'Avoid replacing instance root $data. ' +
  48467. 'Use nested data properties instead.',
  48468. this
  48469. );
  48470. };
  48471. propsDef.set = function () {
  48472. warn("$props is readonly.", this);
  48473. };
  48474. }
  48475. Object.defineProperty(Vue.prototype, '$data', dataDef);
  48476. Object.defineProperty(Vue.prototype, '$props', propsDef);
  48477. Vue.prototype.$set = set;
  48478. Vue.prototype.$delete = del;
  48479. Vue.prototype.$watch = function (
  48480. expOrFn,
  48481. cb,
  48482. options
  48483. ) {
  48484. var vm = this;
  48485. if (isPlainObject(cb)) {
  48486. return createWatcher(vm, expOrFn, cb, options)
  48487. }
  48488. options = options || {};
  48489. options.user = true;
  48490. var watcher = new Watcher(vm, expOrFn, cb, options);
  48491. if (options.immediate) {
  48492. try {
  48493. cb.call(vm, watcher.value);
  48494. } catch (error) {
  48495. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  48496. }
  48497. }
  48498. return function unwatchFn () {
  48499. watcher.teardown();
  48500. }
  48501. };
  48502. }
  48503. /* */
  48504. var uid$3 = 0;
  48505. function initMixin (Vue) {
  48506. Vue.prototype._init = function (options) {
  48507. var vm = this;
  48508. // a uid
  48509. vm._uid = uid$3++;
  48510. var startTag, endTag;
  48511. /* istanbul ignore if */
  48512. if (config.performance && mark) {
  48513. startTag = "vue-perf-start:" + (vm._uid);
  48514. endTag = "vue-perf-end:" + (vm._uid);
  48515. mark(startTag);
  48516. }
  48517. // a flag to avoid this being observed
  48518. vm._isVue = true;
  48519. // merge options
  48520. if (options && options._isComponent) {
  48521. // optimize internal component instantiation
  48522. // since dynamic options merging is pretty slow, and none of the
  48523. // internal component options needs special treatment.
  48524. initInternalComponent(vm, options);
  48525. } else {
  48526. vm.$options = mergeOptions(
  48527. resolveConstructorOptions(vm.constructor),
  48528. options || {},
  48529. vm
  48530. );
  48531. }
  48532. /* istanbul ignore else */
  48533. {
  48534. initProxy(vm);
  48535. }
  48536. // expose real self
  48537. vm._self = vm;
  48538. initLifecycle(vm);
  48539. initEvents(vm);
  48540. initRender(vm);
  48541. callHook(vm, 'beforeCreate');
  48542. initInjections(vm); // resolve injections before data/props
  48543. initState(vm);
  48544. initProvide(vm); // resolve provide after data/props
  48545. callHook(vm, 'created');
  48546. /* istanbul ignore if */
  48547. if (config.performance && mark) {
  48548. vm._name = formatComponentName(vm, false);
  48549. mark(endTag);
  48550. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  48551. }
  48552. if (vm.$options.el) {
  48553. vm.$mount(vm.$options.el);
  48554. }
  48555. };
  48556. }
  48557. function initInternalComponent (vm, options) {
  48558. var opts = vm.$options = Object.create(vm.constructor.options);
  48559. // doing this because it's faster than dynamic enumeration.
  48560. var parentVnode = options._parentVnode;
  48561. opts.parent = options.parent;
  48562. opts._parentVnode = parentVnode;
  48563. var vnodeComponentOptions = parentVnode.componentOptions;
  48564. opts.propsData = vnodeComponentOptions.propsData;
  48565. opts._parentListeners = vnodeComponentOptions.listeners;
  48566. opts._renderChildren = vnodeComponentOptions.children;
  48567. opts._componentTag = vnodeComponentOptions.tag;
  48568. if (options.render) {
  48569. opts.render = options.render;
  48570. opts.staticRenderFns = options.staticRenderFns;
  48571. }
  48572. }
  48573. function resolveConstructorOptions (Ctor) {
  48574. var options = Ctor.options;
  48575. if (Ctor.super) {
  48576. var superOptions = resolveConstructorOptions(Ctor.super);
  48577. var cachedSuperOptions = Ctor.superOptions;
  48578. if (superOptions !== cachedSuperOptions) {
  48579. // super option changed,
  48580. // need to resolve new options.
  48581. Ctor.superOptions = superOptions;
  48582. // check if there are any late-modified/attached options (#4976)
  48583. var modifiedOptions = resolveModifiedOptions(Ctor);
  48584. // update base extend options
  48585. if (modifiedOptions) {
  48586. extend(Ctor.extendOptions, modifiedOptions);
  48587. }
  48588. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  48589. if (options.name) {
  48590. options.components[options.name] = Ctor;
  48591. }
  48592. }
  48593. }
  48594. return options
  48595. }
  48596. function resolveModifiedOptions (Ctor) {
  48597. var modified;
  48598. var latest = Ctor.options;
  48599. var sealed = Ctor.sealedOptions;
  48600. for (var key in latest) {
  48601. if (latest[key] !== sealed[key]) {
  48602. if (!modified) { modified = {}; }
  48603. modified[key] = latest[key];
  48604. }
  48605. }
  48606. return modified
  48607. }
  48608. function Vue (options) {
  48609. if (!(this instanceof Vue)
  48610. ) {
  48611. warn('Vue is a constructor and should be called with the `new` keyword');
  48612. }
  48613. this._init(options);
  48614. }
  48615. initMixin(Vue);
  48616. stateMixin(Vue);
  48617. eventsMixin(Vue);
  48618. lifecycleMixin(Vue);
  48619. renderMixin(Vue);
  48620. /* */
  48621. function initUse (Vue) {
  48622. Vue.use = function (plugin) {
  48623. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  48624. if (installedPlugins.indexOf(plugin) > -1) {
  48625. return this
  48626. }
  48627. // additional parameters
  48628. var args = toArray(arguments, 1);
  48629. args.unshift(this);
  48630. if (typeof plugin.install === 'function') {
  48631. plugin.install.apply(plugin, args);
  48632. } else if (typeof plugin === 'function') {
  48633. plugin.apply(null, args);
  48634. }
  48635. installedPlugins.push(plugin);
  48636. return this
  48637. };
  48638. }
  48639. /* */
  48640. function initMixin$1 (Vue) {
  48641. Vue.mixin = function (mixin) {
  48642. this.options = mergeOptions(this.options, mixin);
  48643. return this
  48644. };
  48645. }
  48646. /* */
  48647. function initExtend (Vue) {
  48648. /**
  48649. * Each instance constructor, including Vue, has a unique
  48650. * cid. This enables us to create wrapped "child
  48651. * constructors" for prototypal inheritance and cache them.
  48652. */
  48653. Vue.cid = 0;
  48654. var cid = 1;
  48655. /**
  48656. * Class inheritance
  48657. */
  48658. Vue.extend = function (extendOptions) {
  48659. extendOptions = extendOptions || {};
  48660. var Super = this;
  48661. var SuperId = Super.cid;
  48662. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  48663. if (cachedCtors[SuperId]) {
  48664. return cachedCtors[SuperId]
  48665. }
  48666. var name = extendOptions.name || Super.options.name;
  48667. if (name) {
  48668. validateComponentName(name);
  48669. }
  48670. var Sub = function VueComponent (options) {
  48671. this._init(options);
  48672. };
  48673. Sub.prototype = Object.create(Super.prototype);
  48674. Sub.prototype.constructor = Sub;
  48675. Sub.cid = cid++;
  48676. Sub.options = mergeOptions(
  48677. Super.options,
  48678. extendOptions
  48679. );
  48680. Sub['super'] = Super;
  48681. // For props and computed properties, we define the proxy getters on
  48682. // the Vue instances at extension time, on the extended prototype. This
  48683. // avoids Object.defineProperty calls for each instance created.
  48684. if (Sub.options.props) {
  48685. initProps$1(Sub);
  48686. }
  48687. if (Sub.options.computed) {
  48688. initComputed$1(Sub);
  48689. }
  48690. // allow further extension/mixin/plugin usage
  48691. Sub.extend = Super.extend;
  48692. Sub.mixin = Super.mixin;
  48693. Sub.use = Super.use;
  48694. // create asset registers, so extended classes
  48695. // can have their private assets too.
  48696. ASSET_TYPES.forEach(function (type) {
  48697. Sub[type] = Super[type];
  48698. });
  48699. // enable recursive self-lookup
  48700. if (name) {
  48701. Sub.options.components[name] = Sub;
  48702. }
  48703. // keep a reference to the super options at extension time.
  48704. // later at instantiation we can check if Super's options have
  48705. // been updated.
  48706. Sub.superOptions = Super.options;
  48707. Sub.extendOptions = extendOptions;
  48708. Sub.sealedOptions = extend({}, Sub.options);
  48709. // cache constructor
  48710. cachedCtors[SuperId] = Sub;
  48711. return Sub
  48712. };
  48713. }
  48714. function initProps$1 (Comp) {
  48715. var props = Comp.options.props;
  48716. for (var key in props) {
  48717. proxy(Comp.prototype, "_props", key);
  48718. }
  48719. }
  48720. function initComputed$1 (Comp) {
  48721. var computed = Comp.options.computed;
  48722. for (var key in computed) {
  48723. defineComputed(Comp.prototype, key, computed[key]);
  48724. }
  48725. }
  48726. /* */
  48727. function initAssetRegisters (Vue) {
  48728. /**
  48729. * Create asset registration methods.
  48730. */
  48731. ASSET_TYPES.forEach(function (type) {
  48732. Vue[type] = function (
  48733. id,
  48734. definition
  48735. ) {
  48736. if (!definition) {
  48737. return this.options[type + 's'][id]
  48738. } else {
  48739. /* istanbul ignore if */
  48740. if (type === 'component') {
  48741. validateComponentName(id);
  48742. }
  48743. if (type === 'component' && isPlainObject(definition)) {
  48744. definition.name = definition.name || id;
  48745. definition = this.options._base.extend(definition);
  48746. }
  48747. if (type === 'directive' && typeof definition === 'function') {
  48748. definition = { bind: definition, update: definition };
  48749. }
  48750. this.options[type + 's'][id] = definition;
  48751. return definition
  48752. }
  48753. };
  48754. });
  48755. }
  48756. /* */
  48757. function getComponentName (opts) {
  48758. return opts && (opts.Ctor.options.name || opts.tag)
  48759. }
  48760. function matches (pattern, name) {
  48761. if (Array.isArray(pattern)) {
  48762. return pattern.indexOf(name) > -1
  48763. } else if (typeof pattern === 'string') {
  48764. return pattern.split(',').indexOf(name) > -1
  48765. } else if (isRegExp(pattern)) {
  48766. return pattern.test(name)
  48767. }
  48768. /* istanbul ignore next */
  48769. return false
  48770. }
  48771. function pruneCache (keepAliveInstance, filter) {
  48772. var cache = keepAliveInstance.cache;
  48773. var keys = keepAliveInstance.keys;
  48774. var _vnode = keepAliveInstance._vnode;
  48775. for (var key in cache) {
  48776. var cachedNode = cache[key];
  48777. if (cachedNode) {
  48778. var name = getComponentName(cachedNode.componentOptions);
  48779. if (name && !filter(name)) {
  48780. pruneCacheEntry(cache, key, keys, _vnode);
  48781. }
  48782. }
  48783. }
  48784. }
  48785. function pruneCacheEntry (
  48786. cache,
  48787. key,
  48788. keys,
  48789. current
  48790. ) {
  48791. var cached$$1 = cache[key];
  48792. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  48793. cached$$1.componentInstance.$destroy();
  48794. }
  48795. cache[key] = null;
  48796. remove(keys, key);
  48797. }
  48798. var patternTypes = [String, RegExp, Array];
  48799. var KeepAlive = {
  48800. name: 'keep-alive',
  48801. abstract: true,
  48802. props: {
  48803. include: patternTypes,
  48804. exclude: patternTypes,
  48805. max: [String, Number]
  48806. },
  48807. created: function created () {
  48808. this.cache = Object.create(null);
  48809. this.keys = [];
  48810. },
  48811. destroyed: function destroyed () {
  48812. for (var key in this.cache) {
  48813. pruneCacheEntry(this.cache, key, this.keys);
  48814. }
  48815. },
  48816. mounted: function mounted () {
  48817. var this$1 = this;
  48818. this.$watch('include', function (val) {
  48819. pruneCache(this$1, function (name) { return matches(val, name); });
  48820. });
  48821. this.$watch('exclude', function (val) {
  48822. pruneCache(this$1, function (name) { return !matches(val, name); });
  48823. });
  48824. },
  48825. render: function render () {
  48826. var slot = this.$slots.default;
  48827. var vnode = getFirstComponentChild(slot);
  48828. var componentOptions = vnode && vnode.componentOptions;
  48829. if (componentOptions) {
  48830. // check pattern
  48831. var name = getComponentName(componentOptions);
  48832. var ref = this;
  48833. var include = ref.include;
  48834. var exclude = ref.exclude;
  48835. if (
  48836. // not included
  48837. (include && (!name || !matches(include, name))) ||
  48838. // excluded
  48839. (exclude && name && matches(exclude, name))
  48840. ) {
  48841. return vnode
  48842. }
  48843. var ref$1 = this;
  48844. var cache = ref$1.cache;
  48845. var keys = ref$1.keys;
  48846. var key = vnode.key == null
  48847. // same constructor may get registered as different local components
  48848. // so cid alone is not enough (#3269)
  48849. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  48850. : vnode.key;
  48851. if (cache[key]) {
  48852. vnode.componentInstance = cache[key].componentInstance;
  48853. // make current key freshest
  48854. remove(keys, key);
  48855. keys.push(key);
  48856. } else {
  48857. cache[key] = vnode;
  48858. keys.push(key);
  48859. // prune oldest entry
  48860. if (this.max && keys.length > parseInt(this.max)) {
  48861. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  48862. }
  48863. }
  48864. vnode.data.keepAlive = true;
  48865. }
  48866. return vnode || (slot && slot[0])
  48867. }
  48868. };
  48869. var builtInComponents = {
  48870. KeepAlive: KeepAlive
  48871. };
  48872. /* */
  48873. function initGlobalAPI (Vue) {
  48874. // config
  48875. var configDef = {};
  48876. configDef.get = function () { return config; };
  48877. {
  48878. configDef.set = function () {
  48879. warn(
  48880. 'Do not replace the Vue.config object, set individual fields instead.'
  48881. );
  48882. };
  48883. }
  48884. Object.defineProperty(Vue, 'config', configDef);
  48885. // exposed util methods.
  48886. // NOTE: these are not considered part of the public API - avoid relying on
  48887. // them unless you are aware of the risk.
  48888. Vue.util = {
  48889. warn: warn,
  48890. extend: extend,
  48891. mergeOptions: mergeOptions,
  48892. defineReactive: defineReactive$$1
  48893. };
  48894. Vue.set = set;
  48895. Vue.delete = del;
  48896. Vue.nextTick = nextTick;
  48897. // 2.6 explicit observable API
  48898. Vue.observable = function (obj) {
  48899. observe(obj);
  48900. return obj
  48901. };
  48902. Vue.options = Object.create(null);
  48903. ASSET_TYPES.forEach(function (type) {
  48904. Vue.options[type + 's'] = Object.create(null);
  48905. });
  48906. // this is used to identify the "base" constructor to extend all plain-object
  48907. // components with in Weex's multi-instance scenarios.
  48908. Vue.options._base = Vue;
  48909. extend(Vue.options.components, builtInComponents);
  48910. initUse(Vue);
  48911. initMixin$1(Vue);
  48912. initExtend(Vue);
  48913. initAssetRegisters(Vue);
  48914. }
  48915. initGlobalAPI(Vue);
  48916. Object.defineProperty(Vue.prototype, '$isServer', {
  48917. get: isServerRendering
  48918. });
  48919. Object.defineProperty(Vue.prototype, '$ssrContext', {
  48920. get: function get () {
  48921. /* istanbul ignore next */
  48922. return this.$vnode && this.$vnode.ssrContext
  48923. }
  48924. });
  48925. // expose FunctionalRenderContext for ssr runtime helper installation
  48926. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  48927. value: FunctionalRenderContext
  48928. });
  48929. Vue.version = '2.6.11';
  48930. /* */
  48931. // these are reserved for web because they are directly compiled away
  48932. // during template compilation
  48933. var isReservedAttr = makeMap('style,class');
  48934. // attributes that should be using props for binding
  48935. var acceptValue = makeMap('input,textarea,option,select,progress');
  48936. var mustUseProp = function (tag, type, attr) {
  48937. return (
  48938. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  48939. (attr === 'selected' && tag === 'option') ||
  48940. (attr === 'checked' && tag === 'input') ||
  48941. (attr === 'muted' && tag === 'video')
  48942. )
  48943. };
  48944. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  48945. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  48946. var convertEnumeratedValue = function (key, value) {
  48947. return isFalsyAttrValue(value) || value === 'false'
  48948. ? 'false'
  48949. // allow arbitrary string value for contenteditable
  48950. : key === 'contenteditable' && isValidContentEditableValue(value)
  48951. ? value
  48952. : 'true'
  48953. };
  48954. var isBooleanAttr = makeMap(
  48955. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  48956. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  48957. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  48958. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  48959. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  48960. 'truespeed,typemustmatch,visible'
  48961. );
  48962. var xlinkNS = 'http://www.w3.org/1999/xlink';
  48963. var isXlink = function (name) {
  48964. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  48965. };
  48966. var getXlinkProp = function (name) {
  48967. return isXlink(name) ? name.slice(6, name.length) : ''
  48968. };
  48969. var isFalsyAttrValue = function (val) {
  48970. return val == null || val === false
  48971. };
  48972. /* */
  48973. function genClassForVnode (vnode) {
  48974. var data = vnode.data;
  48975. var parentNode = vnode;
  48976. var childNode = vnode;
  48977. while (isDef(childNode.componentInstance)) {
  48978. childNode = childNode.componentInstance._vnode;
  48979. if (childNode && childNode.data) {
  48980. data = mergeClassData(childNode.data, data);
  48981. }
  48982. }
  48983. while (isDef(parentNode = parentNode.parent)) {
  48984. if (parentNode && parentNode.data) {
  48985. data = mergeClassData(data, parentNode.data);
  48986. }
  48987. }
  48988. return renderClass(data.staticClass, data.class)
  48989. }
  48990. function mergeClassData (child, parent) {
  48991. return {
  48992. staticClass: concat(child.staticClass, parent.staticClass),
  48993. class: isDef(child.class)
  48994. ? [child.class, parent.class]
  48995. : parent.class
  48996. }
  48997. }
  48998. function renderClass (
  48999. staticClass,
  49000. dynamicClass
  49001. ) {
  49002. if (isDef(staticClass) || isDef(dynamicClass)) {
  49003. return concat(staticClass, stringifyClass(dynamicClass))
  49004. }
  49005. /* istanbul ignore next */
  49006. return ''
  49007. }
  49008. function concat (a, b) {
  49009. return a ? b ? (a + ' ' + b) : a : (b || '')
  49010. }
  49011. function stringifyClass (value) {
  49012. if (Array.isArray(value)) {
  49013. return stringifyArray(value)
  49014. }
  49015. if (isObject(value)) {
  49016. return stringifyObject(value)
  49017. }
  49018. if (typeof value === 'string') {
  49019. return value
  49020. }
  49021. /* istanbul ignore next */
  49022. return ''
  49023. }
  49024. function stringifyArray (value) {
  49025. var res = '';
  49026. var stringified;
  49027. for (var i = 0, l = value.length; i < l; i++) {
  49028. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  49029. if (res) { res += ' '; }
  49030. res += stringified;
  49031. }
  49032. }
  49033. return res
  49034. }
  49035. function stringifyObject (value) {
  49036. var res = '';
  49037. for (var key in value) {
  49038. if (value[key]) {
  49039. if (res) { res += ' '; }
  49040. res += key;
  49041. }
  49042. }
  49043. return res
  49044. }
  49045. /* */
  49046. var namespaceMap = {
  49047. svg: 'http://www.w3.org/2000/svg',
  49048. math: 'http://www.w3.org/1998/Math/MathML'
  49049. };
  49050. var isHTMLTag = makeMap(
  49051. 'html,body,base,head,link,meta,style,title,' +
  49052. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  49053. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  49054. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  49055. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  49056. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  49057. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  49058. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  49059. 'output,progress,select,textarea,' +
  49060. 'details,dialog,menu,menuitem,summary,' +
  49061. 'content,element,shadow,template,blockquote,iframe,tfoot'
  49062. );
  49063. // this map is intentionally selective, only covering SVG elements that may
  49064. // contain child elements.
  49065. var isSVG = makeMap(
  49066. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  49067. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  49068. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  49069. true
  49070. );
  49071. var isPreTag = function (tag) { return tag === 'pre'; };
  49072. var isReservedTag = function (tag) {
  49073. return isHTMLTag(tag) || isSVG(tag)
  49074. };
  49075. function getTagNamespace (tag) {
  49076. if (isSVG(tag)) {
  49077. return 'svg'
  49078. }
  49079. // basic support for MathML
  49080. // note it doesn't support other MathML elements being component roots
  49081. if (tag === 'math') {
  49082. return 'math'
  49083. }
  49084. }
  49085. var unknownElementCache = Object.create(null);
  49086. function isUnknownElement (tag) {
  49087. /* istanbul ignore if */
  49088. if (!inBrowser) {
  49089. return true
  49090. }
  49091. if (isReservedTag(tag)) {
  49092. return false
  49093. }
  49094. tag = tag.toLowerCase();
  49095. /* istanbul ignore if */
  49096. if (unknownElementCache[tag] != null) {
  49097. return unknownElementCache[tag]
  49098. }
  49099. var el = document.createElement(tag);
  49100. if (tag.indexOf('-') > -1) {
  49101. // http://stackoverflow.com/a/28210364/1070244
  49102. return (unknownElementCache[tag] = (
  49103. el.constructor === window.HTMLUnknownElement ||
  49104. el.constructor === window.HTMLElement
  49105. ))
  49106. } else {
  49107. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  49108. }
  49109. }
  49110. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  49111. /* */
  49112. /**
  49113. * Query an element selector if it's not an element already.
  49114. */
  49115. function query (el) {
  49116. if (typeof el === 'string') {
  49117. var selected = document.querySelector(el);
  49118. if (!selected) {
  49119. warn(
  49120. 'Cannot find element: ' + el
  49121. );
  49122. return document.createElement('div')
  49123. }
  49124. return selected
  49125. } else {
  49126. return el
  49127. }
  49128. }
  49129. /* */
  49130. function createElement$1 (tagName, vnode) {
  49131. var elm = document.createElement(tagName);
  49132. if (tagName !== 'select') {
  49133. return elm
  49134. }
  49135. // false or null will remove the attribute but undefined will not
  49136. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  49137. elm.setAttribute('multiple', 'multiple');
  49138. }
  49139. return elm
  49140. }
  49141. function createElementNS (namespace, tagName) {
  49142. return document.createElementNS(namespaceMap[namespace], tagName)
  49143. }
  49144. function createTextNode (text) {
  49145. return document.createTextNode(text)
  49146. }
  49147. function createComment (text) {
  49148. return document.createComment(text)
  49149. }
  49150. function insertBefore (parentNode, newNode, referenceNode) {
  49151. parentNode.insertBefore(newNode, referenceNode);
  49152. }
  49153. function removeChild (node, child) {
  49154. node.removeChild(child);
  49155. }
  49156. function appendChild (node, child) {
  49157. node.appendChild(child);
  49158. }
  49159. function parentNode (node) {
  49160. return node.parentNode
  49161. }
  49162. function nextSibling (node) {
  49163. return node.nextSibling
  49164. }
  49165. function tagName (node) {
  49166. return node.tagName
  49167. }
  49168. function setTextContent (node, text) {
  49169. node.textContent = text;
  49170. }
  49171. function setStyleScope (node, scopeId) {
  49172. node.setAttribute(scopeId, '');
  49173. }
  49174. var nodeOps = /*#__PURE__*/Object.freeze({
  49175. createElement: createElement$1,
  49176. createElementNS: createElementNS,
  49177. createTextNode: createTextNode,
  49178. createComment: createComment,
  49179. insertBefore: insertBefore,
  49180. removeChild: removeChild,
  49181. appendChild: appendChild,
  49182. parentNode: parentNode,
  49183. nextSibling: nextSibling,
  49184. tagName: tagName,
  49185. setTextContent: setTextContent,
  49186. setStyleScope: setStyleScope
  49187. });
  49188. /* */
  49189. var ref = {
  49190. create: function create (_, vnode) {
  49191. registerRef(vnode);
  49192. },
  49193. update: function update (oldVnode, vnode) {
  49194. if (oldVnode.data.ref !== vnode.data.ref) {
  49195. registerRef(oldVnode, true);
  49196. registerRef(vnode);
  49197. }
  49198. },
  49199. destroy: function destroy (vnode) {
  49200. registerRef(vnode, true);
  49201. }
  49202. };
  49203. function registerRef (vnode, isRemoval) {
  49204. var key = vnode.data.ref;
  49205. if (!isDef(key)) { return }
  49206. var vm = vnode.context;
  49207. var ref = vnode.componentInstance || vnode.elm;
  49208. var refs = vm.$refs;
  49209. if (isRemoval) {
  49210. if (Array.isArray(refs[key])) {
  49211. remove(refs[key], ref);
  49212. } else if (refs[key] === ref) {
  49213. refs[key] = undefined;
  49214. }
  49215. } else {
  49216. if (vnode.data.refInFor) {
  49217. if (!Array.isArray(refs[key])) {
  49218. refs[key] = [ref];
  49219. } else if (refs[key].indexOf(ref) < 0) {
  49220. // $flow-disable-line
  49221. refs[key].push(ref);
  49222. }
  49223. } else {
  49224. refs[key] = ref;
  49225. }
  49226. }
  49227. }
  49228. /**
  49229. * Virtual DOM patching algorithm based on Snabbdom by
  49230. * Simon Friis Vindum (@paldepind)
  49231. * Licensed under the MIT License
  49232. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  49233. *
  49234. * modified by Evan You (@yyx990803)
  49235. *
  49236. * Not type-checking this because this file is perf-critical and the cost
  49237. * of making flow understand it is not worth it.
  49238. */
  49239. var emptyNode = new VNode('', {}, []);
  49240. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  49241. function sameVnode (a, b) {
  49242. return (
  49243. a.key === b.key && (
  49244. (
  49245. a.tag === b.tag &&
  49246. a.isComment === b.isComment &&
  49247. isDef(a.data) === isDef(b.data) &&
  49248. sameInputType(a, b)
  49249. ) || (
  49250. isTrue(a.isAsyncPlaceholder) &&
  49251. a.asyncFactory === b.asyncFactory &&
  49252. isUndef(b.asyncFactory.error)
  49253. )
  49254. )
  49255. )
  49256. }
  49257. function sameInputType (a, b) {
  49258. if (a.tag !== 'input') { return true }
  49259. var i;
  49260. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  49261. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  49262. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  49263. }
  49264. function createKeyToOldIdx (children, beginIdx, endIdx) {
  49265. var i, key;
  49266. var map = {};
  49267. for (i = beginIdx; i <= endIdx; ++i) {
  49268. key = children[i].key;
  49269. if (isDef(key)) { map[key] = i; }
  49270. }
  49271. return map
  49272. }
  49273. function createPatchFunction (backend) {
  49274. var i, j;
  49275. var cbs = {};
  49276. var modules = backend.modules;
  49277. var nodeOps = backend.nodeOps;
  49278. for (i = 0; i < hooks.length; ++i) {
  49279. cbs[hooks[i]] = [];
  49280. for (j = 0; j < modules.length; ++j) {
  49281. if (isDef(modules[j][hooks[i]])) {
  49282. cbs[hooks[i]].push(modules[j][hooks[i]]);
  49283. }
  49284. }
  49285. }
  49286. function emptyNodeAt (elm) {
  49287. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  49288. }
  49289. function createRmCb (childElm, listeners) {
  49290. function remove$$1 () {
  49291. if (--remove$$1.listeners === 0) {
  49292. removeNode(childElm);
  49293. }
  49294. }
  49295. remove$$1.listeners = listeners;
  49296. return remove$$1
  49297. }
  49298. function removeNode (el) {
  49299. var parent = nodeOps.parentNode(el);
  49300. // element may have already been removed due to v-html / v-text
  49301. if (isDef(parent)) {
  49302. nodeOps.removeChild(parent, el);
  49303. }
  49304. }
  49305. function isUnknownElement$$1 (vnode, inVPre) {
  49306. return (
  49307. !inVPre &&
  49308. !vnode.ns &&
  49309. !(
  49310. config.ignoredElements.length &&
  49311. config.ignoredElements.some(function (ignore) {
  49312. return isRegExp(ignore)
  49313. ? ignore.test(vnode.tag)
  49314. : ignore === vnode.tag
  49315. })
  49316. ) &&
  49317. config.isUnknownElement(vnode.tag)
  49318. )
  49319. }
  49320. var creatingElmInVPre = 0;
  49321. function createElm (
  49322. vnode,
  49323. insertedVnodeQueue,
  49324. parentElm,
  49325. refElm,
  49326. nested,
  49327. ownerArray,
  49328. index
  49329. ) {
  49330. if (isDef(vnode.elm) && isDef(ownerArray)) {
  49331. // This vnode was used in a previous render!
  49332. // now it's used as a new node, overwriting its elm would cause
  49333. // potential patch errors down the road when it's used as an insertion
  49334. // reference node. Instead, we clone the node on-demand before creating
  49335. // associated DOM element for it.
  49336. vnode = ownerArray[index] = cloneVNode(vnode);
  49337. }
  49338. vnode.isRootInsert = !nested; // for transition enter check
  49339. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  49340. return
  49341. }
  49342. var data = vnode.data;
  49343. var children = vnode.children;
  49344. var tag = vnode.tag;
  49345. if (isDef(tag)) {
  49346. {
  49347. if (data && data.pre) {
  49348. creatingElmInVPre++;
  49349. }
  49350. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  49351. warn(
  49352. 'Unknown custom element: <' + tag + '> - did you ' +
  49353. 'register the component correctly? For recursive components, ' +
  49354. 'make sure to provide the "name" option.',
  49355. vnode.context
  49356. );
  49357. }
  49358. }
  49359. vnode.elm = vnode.ns
  49360. ? nodeOps.createElementNS(vnode.ns, tag)
  49361. : nodeOps.createElement(tag, vnode);
  49362. setScope(vnode);
  49363. /* istanbul ignore if */
  49364. {
  49365. createChildren(vnode, children, insertedVnodeQueue);
  49366. if (isDef(data)) {
  49367. invokeCreateHooks(vnode, insertedVnodeQueue);
  49368. }
  49369. insert(parentElm, vnode.elm, refElm);
  49370. }
  49371. if (data && data.pre) {
  49372. creatingElmInVPre--;
  49373. }
  49374. } else if (isTrue(vnode.isComment)) {
  49375. vnode.elm = nodeOps.createComment(vnode.text);
  49376. insert(parentElm, vnode.elm, refElm);
  49377. } else {
  49378. vnode.elm = nodeOps.createTextNode(vnode.text);
  49379. insert(parentElm, vnode.elm, refElm);
  49380. }
  49381. }
  49382. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  49383. var i = vnode.data;
  49384. if (isDef(i)) {
  49385. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  49386. if (isDef(i = i.hook) && isDef(i = i.init)) {
  49387. i(vnode, false /* hydrating */);
  49388. }
  49389. // after calling the init hook, if the vnode is a child component
  49390. // it should've created a child instance and mounted it. the child
  49391. // component also has set the placeholder vnode's elm.
  49392. // in that case we can just return the element and be done.
  49393. if (isDef(vnode.componentInstance)) {
  49394. initComponent(vnode, insertedVnodeQueue);
  49395. insert(parentElm, vnode.elm, refElm);
  49396. if (isTrue(isReactivated)) {
  49397. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  49398. }
  49399. return true
  49400. }
  49401. }
  49402. }
  49403. function initComponent (vnode, insertedVnodeQueue) {
  49404. if (isDef(vnode.data.pendingInsert)) {
  49405. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  49406. vnode.data.pendingInsert = null;
  49407. }
  49408. vnode.elm = vnode.componentInstance.$el;
  49409. if (isPatchable(vnode)) {
  49410. invokeCreateHooks(vnode, insertedVnodeQueue);
  49411. setScope(vnode);
  49412. } else {
  49413. // empty component root.
  49414. // skip all element-related modules except for ref (#3455)
  49415. registerRef(vnode);
  49416. // make sure to invoke the insert hook
  49417. insertedVnodeQueue.push(vnode);
  49418. }
  49419. }
  49420. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  49421. var i;
  49422. // hack for #4339: a reactivated component with inner transition
  49423. // does not trigger because the inner node's created hooks are not called
  49424. // again. It's not ideal to involve module-specific logic in here but
  49425. // there doesn't seem to be a better way to do it.
  49426. var innerNode = vnode;
  49427. while (innerNode.componentInstance) {
  49428. innerNode = innerNode.componentInstance._vnode;
  49429. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  49430. for (i = 0; i < cbs.activate.length; ++i) {
  49431. cbs.activate[i](emptyNode, innerNode);
  49432. }
  49433. insertedVnodeQueue.push(innerNode);
  49434. break
  49435. }
  49436. }
  49437. // unlike a newly created component,
  49438. // a reactivated keep-alive component doesn't insert itself
  49439. insert(parentElm, vnode.elm, refElm);
  49440. }
  49441. function insert (parent, elm, ref$$1) {
  49442. if (isDef(parent)) {
  49443. if (isDef(ref$$1)) {
  49444. if (nodeOps.parentNode(ref$$1) === parent) {
  49445. nodeOps.insertBefore(parent, elm, ref$$1);
  49446. }
  49447. } else {
  49448. nodeOps.appendChild(parent, elm);
  49449. }
  49450. }
  49451. }
  49452. function createChildren (vnode, children, insertedVnodeQueue) {
  49453. if (Array.isArray(children)) {
  49454. {
  49455. checkDuplicateKeys(children);
  49456. }
  49457. for (var i = 0; i < children.length; ++i) {
  49458. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  49459. }
  49460. } else if (isPrimitive(vnode.text)) {
  49461. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  49462. }
  49463. }
  49464. function isPatchable (vnode) {
  49465. while (vnode.componentInstance) {
  49466. vnode = vnode.componentInstance._vnode;
  49467. }
  49468. return isDef(vnode.tag)
  49469. }
  49470. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  49471. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  49472. cbs.create[i$1](emptyNode, vnode);
  49473. }
  49474. i = vnode.data.hook; // Reuse variable
  49475. if (isDef(i)) {
  49476. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  49477. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  49478. }
  49479. }
  49480. // set scope id attribute for scoped CSS.
  49481. // this is implemented as a special case to avoid the overhead
  49482. // of going through the normal attribute patching process.
  49483. function setScope (vnode) {
  49484. var i;
  49485. if (isDef(i = vnode.fnScopeId)) {
  49486. nodeOps.setStyleScope(vnode.elm, i);
  49487. } else {
  49488. var ancestor = vnode;
  49489. while (ancestor) {
  49490. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  49491. nodeOps.setStyleScope(vnode.elm, i);
  49492. }
  49493. ancestor = ancestor.parent;
  49494. }
  49495. }
  49496. // for slot content they should also get the scopeId from the host instance.
  49497. if (isDef(i = activeInstance) &&
  49498. i !== vnode.context &&
  49499. i !== vnode.fnContext &&
  49500. isDef(i = i.$options._scopeId)
  49501. ) {
  49502. nodeOps.setStyleScope(vnode.elm, i);
  49503. }
  49504. }
  49505. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  49506. for (; startIdx <= endIdx; ++startIdx) {
  49507. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  49508. }
  49509. }
  49510. function invokeDestroyHook (vnode) {
  49511. var i, j;
  49512. var data = vnode.data;
  49513. if (isDef(data)) {
  49514. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  49515. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  49516. }
  49517. if (isDef(i = vnode.children)) {
  49518. for (j = 0; j < vnode.children.length; ++j) {
  49519. invokeDestroyHook(vnode.children[j]);
  49520. }
  49521. }
  49522. }
  49523. function removeVnodes (vnodes, startIdx, endIdx) {
  49524. for (; startIdx <= endIdx; ++startIdx) {
  49525. var ch = vnodes[startIdx];
  49526. if (isDef(ch)) {
  49527. if (isDef(ch.tag)) {
  49528. removeAndInvokeRemoveHook(ch);
  49529. invokeDestroyHook(ch);
  49530. } else { // Text node
  49531. removeNode(ch.elm);
  49532. }
  49533. }
  49534. }
  49535. }
  49536. function removeAndInvokeRemoveHook (vnode, rm) {
  49537. if (isDef(rm) || isDef(vnode.data)) {
  49538. var i;
  49539. var listeners = cbs.remove.length + 1;
  49540. if (isDef(rm)) {
  49541. // we have a recursively passed down rm callback
  49542. // increase the listeners count
  49543. rm.listeners += listeners;
  49544. } else {
  49545. // directly removing
  49546. rm = createRmCb(vnode.elm, listeners);
  49547. }
  49548. // recursively invoke hooks on child component root node
  49549. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  49550. removeAndInvokeRemoveHook(i, rm);
  49551. }
  49552. for (i = 0; i < cbs.remove.length; ++i) {
  49553. cbs.remove[i](vnode, rm);
  49554. }
  49555. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  49556. i(vnode, rm);
  49557. } else {
  49558. rm();
  49559. }
  49560. } else {
  49561. removeNode(vnode.elm);
  49562. }
  49563. }
  49564. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  49565. var oldStartIdx = 0;
  49566. var newStartIdx = 0;
  49567. var oldEndIdx = oldCh.length - 1;
  49568. var oldStartVnode = oldCh[0];
  49569. var oldEndVnode = oldCh[oldEndIdx];
  49570. var newEndIdx = newCh.length - 1;
  49571. var newStartVnode = newCh[0];
  49572. var newEndVnode = newCh[newEndIdx];
  49573. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  49574. // removeOnly is a special flag used only by <transition-group>
  49575. // to ensure removed elements stay in correct relative positions
  49576. // during leaving transitions
  49577. var canMove = !removeOnly;
  49578. {
  49579. checkDuplicateKeys(newCh);
  49580. }
  49581. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  49582. if (isUndef(oldStartVnode)) {
  49583. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  49584. } else if (isUndef(oldEndVnode)) {
  49585. oldEndVnode = oldCh[--oldEndIdx];
  49586. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  49587. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  49588. oldStartVnode = oldCh[++oldStartIdx];
  49589. newStartVnode = newCh[++newStartIdx];
  49590. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  49591. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  49592. oldEndVnode = oldCh[--oldEndIdx];
  49593. newEndVnode = newCh[--newEndIdx];
  49594. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  49595. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  49596. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  49597. oldStartVnode = oldCh[++oldStartIdx];
  49598. newEndVnode = newCh[--newEndIdx];
  49599. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  49600. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  49601. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  49602. oldEndVnode = oldCh[--oldEndIdx];
  49603. newStartVnode = newCh[++newStartIdx];
  49604. } else {
  49605. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  49606. idxInOld = isDef(newStartVnode.key)
  49607. ? oldKeyToIdx[newStartVnode.key]
  49608. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  49609. if (isUndef(idxInOld)) { // New element
  49610. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  49611. } else {
  49612. vnodeToMove = oldCh[idxInOld];
  49613. if (sameVnode(vnodeToMove, newStartVnode)) {
  49614. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  49615. oldCh[idxInOld] = undefined;
  49616. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  49617. } else {
  49618. // same key but different element. treat as new element
  49619. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  49620. }
  49621. }
  49622. newStartVnode = newCh[++newStartIdx];
  49623. }
  49624. }
  49625. if (oldStartIdx > oldEndIdx) {
  49626. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  49627. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  49628. } else if (newStartIdx > newEndIdx) {
  49629. removeVnodes(oldCh, oldStartIdx, oldEndIdx);
  49630. }
  49631. }
  49632. function checkDuplicateKeys (children) {
  49633. var seenKeys = {};
  49634. for (var i = 0; i < children.length; i++) {
  49635. var vnode = children[i];
  49636. var key = vnode.key;
  49637. if (isDef(key)) {
  49638. if (seenKeys[key]) {
  49639. warn(
  49640. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  49641. vnode.context
  49642. );
  49643. } else {
  49644. seenKeys[key] = true;
  49645. }
  49646. }
  49647. }
  49648. }
  49649. function findIdxInOld (node, oldCh, start, end) {
  49650. for (var i = start; i < end; i++) {
  49651. var c = oldCh[i];
  49652. if (isDef(c) && sameVnode(node, c)) { return i }
  49653. }
  49654. }
  49655. function patchVnode (
  49656. oldVnode,
  49657. vnode,
  49658. insertedVnodeQueue,
  49659. ownerArray,
  49660. index,
  49661. removeOnly
  49662. ) {
  49663. if (oldVnode === vnode) {
  49664. return
  49665. }
  49666. if (isDef(vnode.elm) && isDef(ownerArray)) {
  49667. // clone reused vnode
  49668. vnode = ownerArray[index] = cloneVNode(vnode);
  49669. }
  49670. var elm = vnode.elm = oldVnode.elm;
  49671. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  49672. if (isDef(vnode.asyncFactory.resolved)) {
  49673. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  49674. } else {
  49675. vnode.isAsyncPlaceholder = true;
  49676. }
  49677. return
  49678. }
  49679. // reuse element for static trees.
  49680. // note we only do this if the vnode is cloned -
  49681. // if the new node is not cloned it means the render functions have been
  49682. // reset by the hot-reload-api and we need to do a proper re-render.
  49683. if (isTrue(vnode.isStatic) &&
  49684. isTrue(oldVnode.isStatic) &&
  49685. vnode.key === oldVnode.key &&
  49686. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  49687. ) {
  49688. vnode.componentInstance = oldVnode.componentInstance;
  49689. return
  49690. }
  49691. var i;
  49692. var data = vnode.data;
  49693. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  49694. i(oldVnode, vnode);
  49695. }
  49696. var oldCh = oldVnode.children;
  49697. var ch = vnode.children;
  49698. if (isDef(data) && isPatchable(vnode)) {
  49699. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  49700. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  49701. }
  49702. if (isUndef(vnode.text)) {
  49703. if (isDef(oldCh) && isDef(ch)) {
  49704. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  49705. } else if (isDef(ch)) {
  49706. {
  49707. checkDuplicateKeys(ch);
  49708. }
  49709. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  49710. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  49711. } else if (isDef(oldCh)) {
  49712. removeVnodes(oldCh, 0, oldCh.length - 1);
  49713. } else if (isDef(oldVnode.text)) {
  49714. nodeOps.setTextContent(elm, '');
  49715. }
  49716. } else if (oldVnode.text !== vnode.text) {
  49717. nodeOps.setTextContent(elm, vnode.text);
  49718. }
  49719. if (isDef(data)) {
  49720. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  49721. }
  49722. }
  49723. function invokeInsertHook (vnode, queue, initial) {
  49724. // delay insert hooks for component root nodes, invoke them after the
  49725. // element is really inserted
  49726. if (isTrue(initial) && isDef(vnode.parent)) {
  49727. vnode.parent.data.pendingInsert = queue;
  49728. } else {
  49729. for (var i = 0; i < queue.length; ++i) {
  49730. queue[i].data.hook.insert(queue[i]);
  49731. }
  49732. }
  49733. }
  49734. var hydrationBailed = false;
  49735. // list of modules that can skip create hook during hydration because they
  49736. // are already rendered on the client or has no need for initialization
  49737. // Note: style is excluded because it relies on initial clone for future
  49738. // deep updates (#7063).
  49739. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  49740. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  49741. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  49742. var i;
  49743. var tag = vnode.tag;
  49744. var data = vnode.data;
  49745. var children = vnode.children;
  49746. inVPre = inVPre || (data && data.pre);
  49747. vnode.elm = elm;
  49748. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  49749. vnode.isAsyncPlaceholder = true;
  49750. return true
  49751. }
  49752. // assert node match
  49753. {
  49754. if (!assertNodeMatch(elm, vnode, inVPre)) {
  49755. return false
  49756. }
  49757. }
  49758. if (isDef(data)) {
  49759. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  49760. if (isDef(i = vnode.componentInstance)) {
  49761. // child component. it should have hydrated its own tree.
  49762. initComponent(vnode, insertedVnodeQueue);
  49763. return true
  49764. }
  49765. }
  49766. if (isDef(tag)) {
  49767. if (isDef(children)) {
  49768. // empty element, allow client to pick up and populate children
  49769. if (!elm.hasChildNodes()) {
  49770. createChildren(vnode, children, insertedVnodeQueue);
  49771. } else {
  49772. // v-html and domProps: innerHTML
  49773. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  49774. if (i !== elm.innerHTML) {
  49775. /* istanbul ignore if */
  49776. if (typeof console !== 'undefined' &&
  49777. !hydrationBailed
  49778. ) {
  49779. hydrationBailed = true;
  49780. console.warn('Parent: ', elm);
  49781. console.warn('server innerHTML: ', i);
  49782. console.warn('client innerHTML: ', elm.innerHTML);
  49783. }
  49784. return false
  49785. }
  49786. } else {
  49787. // iterate and compare children lists
  49788. var childrenMatch = true;
  49789. var childNode = elm.firstChild;
  49790. for (var i$1 = 0; i$1 < children.length; i$1++) {
  49791. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  49792. childrenMatch = false;
  49793. break
  49794. }
  49795. childNode = childNode.nextSibling;
  49796. }
  49797. // if childNode is not null, it means the actual childNodes list is
  49798. // longer than the virtual children list.
  49799. if (!childrenMatch || childNode) {
  49800. /* istanbul ignore if */
  49801. if (typeof console !== 'undefined' &&
  49802. !hydrationBailed
  49803. ) {
  49804. hydrationBailed = true;
  49805. console.warn('Parent: ', elm);
  49806. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  49807. }
  49808. return false
  49809. }
  49810. }
  49811. }
  49812. }
  49813. if (isDef(data)) {
  49814. var fullInvoke = false;
  49815. for (var key in data) {
  49816. if (!isRenderedModule(key)) {
  49817. fullInvoke = true;
  49818. invokeCreateHooks(vnode, insertedVnodeQueue);
  49819. break
  49820. }
  49821. }
  49822. if (!fullInvoke && data['class']) {
  49823. // ensure collecting deps for deep class bindings for future updates
  49824. traverse(data['class']);
  49825. }
  49826. }
  49827. } else if (elm.data !== vnode.text) {
  49828. elm.data = vnode.text;
  49829. }
  49830. return true
  49831. }
  49832. function assertNodeMatch (node, vnode, inVPre) {
  49833. if (isDef(vnode.tag)) {
  49834. return vnode.tag.indexOf('vue-component') === 0 || (
  49835. !isUnknownElement$$1(vnode, inVPre) &&
  49836. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  49837. )
  49838. } else {
  49839. return node.nodeType === (vnode.isComment ? 8 : 3)
  49840. }
  49841. }
  49842. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  49843. if (isUndef(vnode)) {
  49844. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  49845. return
  49846. }
  49847. var isInitialPatch = false;
  49848. var insertedVnodeQueue = [];
  49849. if (isUndef(oldVnode)) {
  49850. // empty mount (likely as component), create new root element
  49851. isInitialPatch = true;
  49852. createElm(vnode, insertedVnodeQueue);
  49853. } else {
  49854. var isRealElement = isDef(oldVnode.nodeType);
  49855. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  49856. // patch existing root node
  49857. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  49858. } else {
  49859. if (isRealElement) {
  49860. // mounting to a real element
  49861. // check if this is server-rendered content and if we can perform
  49862. // a successful hydration.
  49863. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  49864. oldVnode.removeAttribute(SSR_ATTR);
  49865. hydrating = true;
  49866. }
  49867. if (isTrue(hydrating)) {
  49868. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  49869. invokeInsertHook(vnode, insertedVnodeQueue, true);
  49870. return oldVnode
  49871. } else {
  49872. warn(
  49873. 'The client-side rendered virtual DOM tree is not matching ' +
  49874. 'server-rendered content. This is likely caused by incorrect ' +
  49875. 'HTML markup, for example nesting block-level elements inside ' +
  49876. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  49877. 'full client-side render.'
  49878. );
  49879. }
  49880. }
  49881. // either not server-rendered, or hydration failed.
  49882. // create an empty node and replace it
  49883. oldVnode = emptyNodeAt(oldVnode);
  49884. }
  49885. // replacing existing element
  49886. var oldElm = oldVnode.elm;
  49887. var parentElm = nodeOps.parentNode(oldElm);
  49888. // create new node
  49889. createElm(
  49890. vnode,
  49891. insertedVnodeQueue,
  49892. // extremely rare edge case: do not insert if old element is in a
  49893. // leaving transition. Only happens when combining transition +
  49894. // keep-alive + HOCs. (#4590)
  49895. oldElm._leaveCb ? null : parentElm,
  49896. nodeOps.nextSibling(oldElm)
  49897. );
  49898. // update parent placeholder node element, recursively
  49899. if (isDef(vnode.parent)) {
  49900. var ancestor = vnode.parent;
  49901. var patchable = isPatchable(vnode);
  49902. while (ancestor) {
  49903. for (var i = 0; i < cbs.destroy.length; ++i) {
  49904. cbs.destroy[i](ancestor);
  49905. }
  49906. ancestor.elm = vnode.elm;
  49907. if (patchable) {
  49908. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  49909. cbs.create[i$1](emptyNode, ancestor);
  49910. }
  49911. // #6513
  49912. // invoke insert hooks that may have been merged by create hooks.
  49913. // e.g. for directives that uses the "inserted" hook.
  49914. var insert = ancestor.data.hook.insert;
  49915. if (insert.merged) {
  49916. // start at index 1 to avoid re-invoking component mounted hook
  49917. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  49918. insert.fns[i$2]();
  49919. }
  49920. }
  49921. } else {
  49922. registerRef(ancestor);
  49923. }
  49924. ancestor = ancestor.parent;
  49925. }
  49926. }
  49927. // destroy old node
  49928. if (isDef(parentElm)) {
  49929. removeVnodes([oldVnode], 0, 0);
  49930. } else if (isDef(oldVnode.tag)) {
  49931. invokeDestroyHook(oldVnode);
  49932. }
  49933. }
  49934. }
  49935. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  49936. return vnode.elm
  49937. }
  49938. }
  49939. /* */
  49940. var directives = {
  49941. create: updateDirectives,
  49942. update: updateDirectives,
  49943. destroy: function unbindDirectives (vnode) {
  49944. updateDirectives(vnode, emptyNode);
  49945. }
  49946. };
  49947. function updateDirectives (oldVnode, vnode) {
  49948. if (oldVnode.data.directives || vnode.data.directives) {
  49949. _update(oldVnode, vnode);
  49950. }
  49951. }
  49952. function _update (oldVnode, vnode) {
  49953. var isCreate = oldVnode === emptyNode;
  49954. var isDestroy = vnode === emptyNode;
  49955. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  49956. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  49957. var dirsWithInsert = [];
  49958. var dirsWithPostpatch = [];
  49959. var key, oldDir, dir;
  49960. for (key in newDirs) {
  49961. oldDir = oldDirs[key];
  49962. dir = newDirs[key];
  49963. if (!oldDir) {
  49964. // new directive, bind
  49965. callHook$1(dir, 'bind', vnode, oldVnode);
  49966. if (dir.def && dir.def.inserted) {
  49967. dirsWithInsert.push(dir);
  49968. }
  49969. } else {
  49970. // existing directive, update
  49971. dir.oldValue = oldDir.value;
  49972. dir.oldArg = oldDir.arg;
  49973. callHook$1(dir, 'update', vnode, oldVnode);
  49974. if (dir.def && dir.def.componentUpdated) {
  49975. dirsWithPostpatch.push(dir);
  49976. }
  49977. }
  49978. }
  49979. if (dirsWithInsert.length) {
  49980. var callInsert = function () {
  49981. for (var i = 0; i < dirsWithInsert.length; i++) {
  49982. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  49983. }
  49984. };
  49985. if (isCreate) {
  49986. mergeVNodeHook(vnode, 'insert', callInsert);
  49987. } else {
  49988. callInsert();
  49989. }
  49990. }
  49991. if (dirsWithPostpatch.length) {
  49992. mergeVNodeHook(vnode, 'postpatch', function () {
  49993. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  49994. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  49995. }
  49996. });
  49997. }
  49998. if (!isCreate) {
  49999. for (key in oldDirs) {
  50000. if (!newDirs[key]) {
  50001. // no longer present, unbind
  50002. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  50003. }
  50004. }
  50005. }
  50006. }
  50007. var emptyModifiers = Object.create(null);
  50008. function normalizeDirectives$1 (
  50009. dirs,
  50010. vm
  50011. ) {
  50012. var res = Object.create(null);
  50013. if (!dirs) {
  50014. // $flow-disable-line
  50015. return res
  50016. }
  50017. var i, dir;
  50018. for (i = 0; i < dirs.length; i++) {
  50019. dir = dirs[i];
  50020. if (!dir.modifiers) {
  50021. // $flow-disable-line
  50022. dir.modifiers = emptyModifiers;
  50023. }
  50024. res[getRawDirName(dir)] = dir;
  50025. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  50026. }
  50027. // $flow-disable-line
  50028. return res
  50029. }
  50030. function getRawDirName (dir) {
  50031. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  50032. }
  50033. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  50034. var fn = dir.def && dir.def[hook];
  50035. if (fn) {
  50036. try {
  50037. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  50038. } catch (e) {
  50039. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  50040. }
  50041. }
  50042. }
  50043. var baseModules = [
  50044. ref,
  50045. directives
  50046. ];
  50047. /* */
  50048. function updateAttrs (oldVnode, vnode) {
  50049. var opts = vnode.componentOptions;
  50050. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  50051. return
  50052. }
  50053. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  50054. return
  50055. }
  50056. var key, cur, old;
  50057. var elm = vnode.elm;
  50058. var oldAttrs = oldVnode.data.attrs || {};
  50059. var attrs = vnode.data.attrs || {};
  50060. // clone observed objects, as the user probably wants to mutate it
  50061. if (isDef(attrs.__ob__)) {
  50062. attrs = vnode.data.attrs = extend({}, attrs);
  50063. }
  50064. for (key in attrs) {
  50065. cur = attrs[key];
  50066. old = oldAttrs[key];
  50067. if (old !== cur) {
  50068. setAttr(elm, key, cur);
  50069. }
  50070. }
  50071. // #4391: in IE9, setting type can reset value for input[type=radio]
  50072. // #6666: IE/Edge forces progress value down to 1 before setting a max
  50073. /* istanbul ignore if */
  50074. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  50075. setAttr(elm, 'value', attrs.value);
  50076. }
  50077. for (key in oldAttrs) {
  50078. if (isUndef(attrs[key])) {
  50079. if (isXlink(key)) {
  50080. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  50081. } else if (!isEnumeratedAttr(key)) {
  50082. elm.removeAttribute(key);
  50083. }
  50084. }
  50085. }
  50086. }
  50087. function setAttr (el, key, value) {
  50088. if (el.tagName.indexOf('-') > -1) {
  50089. baseSetAttr(el, key, value);
  50090. } else if (isBooleanAttr(key)) {
  50091. // set attribute for blank value
  50092. // e.g. <option disabled>Select one</option>
  50093. if (isFalsyAttrValue(value)) {
  50094. el.removeAttribute(key);
  50095. } else {
  50096. // technically allowfullscreen is a boolean attribute for <iframe>,
  50097. // but Flash expects a value of "true" when used on <embed> tag
  50098. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  50099. ? 'true'
  50100. : key;
  50101. el.setAttribute(key, value);
  50102. }
  50103. } else if (isEnumeratedAttr(key)) {
  50104. el.setAttribute(key, convertEnumeratedValue(key, value));
  50105. } else if (isXlink(key)) {
  50106. if (isFalsyAttrValue(value)) {
  50107. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  50108. } else {
  50109. el.setAttributeNS(xlinkNS, key, value);
  50110. }
  50111. } else {
  50112. baseSetAttr(el, key, value);
  50113. }
  50114. }
  50115. function baseSetAttr (el, key, value) {
  50116. if (isFalsyAttrValue(value)) {
  50117. el.removeAttribute(key);
  50118. } else {
  50119. // #7138: IE10 & 11 fires input event when setting placeholder on
  50120. // <textarea>... block the first input event and remove the blocker
  50121. // immediately.
  50122. /* istanbul ignore if */
  50123. if (
  50124. isIE && !isIE9 &&
  50125. el.tagName === 'TEXTAREA' &&
  50126. key === 'placeholder' && value !== '' && !el.__ieph
  50127. ) {
  50128. var blocker = function (e) {
  50129. e.stopImmediatePropagation();
  50130. el.removeEventListener('input', blocker);
  50131. };
  50132. el.addEventListener('input', blocker);
  50133. // $flow-disable-line
  50134. el.__ieph = true; /* IE placeholder patched */
  50135. }
  50136. el.setAttribute(key, value);
  50137. }
  50138. }
  50139. var attrs = {
  50140. create: updateAttrs,
  50141. update: updateAttrs
  50142. };
  50143. /* */
  50144. function updateClass (oldVnode, vnode) {
  50145. var el = vnode.elm;
  50146. var data = vnode.data;
  50147. var oldData = oldVnode.data;
  50148. if (
  50149. isUndef(data.staticClass) &&
  50150. isUndef(data.class) && (
  50151. isUndef(oldData) || (
  50152. isUndef(oldData.staticClass) &&
  50153. isUndef(oldData.class)
  50154. )
  50155. )
  50156. ) {
  50157. return
  50158. }
  50159. var cls = genClassForVnode(vnode);
  50160. // handle transition classes
  50161. var transitionClass = el._transitionClasses;
  50162. if (isDef(transitionClass)) {
  50163. cls = concat(cls, stringifyClass(transitionClass));
  50164. }
  50165. // set the class
  50166. if (cls !== el._prevClass) {
  50167. el.setAttribute('class', cls);
  50168. el._prevClass = cls;
  50169. }
  50170. }
  50171. var klass = {
  50172. create: updateClass,
  50173. update: updateClass
  50174. };
  50175. /* */
  50176. var validDivisionCharRE = /[\w).+\-_$\]]/;
  50177. function parseFilters (exp) {
  50178. var inSingle = false;
  50179. var inDouble = false;
  50180. var inTemplateString = false;
  50181. var inRegex = false;
  50182. var curly = 0;
  50183. var square = 0;
  50184. var paren = 0;
  50185. var lastFilterIndex = 0;
  50186. var c, prev, i, expression, filters;
  50187. for (i = 0; i < exp.length; i++) {
  50188. prev = c;
  50189. c = exp.charCodeAt(i);
  50190. if (inSingle) {
  50191. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  50192. } else if (inDouble) {
  50193. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  50194. } else if (inTemplateString) {
  50195. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  50196. } else if (inRegex) {
  50197. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  50198. } else if (
  50199. c === 0x7C && // pipe
  50200. exp.charCodeAt(i + 1) !== 0x7C &&
  50201. exp.charCodeAt(i - 1) !== 0x7C &&
  50202. !curly && !square && !paren
  50203. ) {
  50204. if (expression === undefined) {
  50205. // first filter, end of expression
  50206. lastFilterIndex = i + 1;
  50207. expression = exp.slice(0, i).trim();
  50208. } else {
  50209. pushFilter();
  50210. }
  50211. } else {
  50212. switch (c) {
  50213. case 0x22: inDouble = true; break // "
  50214. case 0x27: inSingle = true; break // '
  50215. case 0x60: inTemplateString = true; break // `
  50216. case 0x28: paren++; break // (
  50217. case 0x29: paren--; break // )
  50218. case 0x5B: square++; break // [
  50219. case 0x5D: square--; break // ]
  50220. case 0x7B: curly++; break // {
  50221. case 0x7D: curly--; break // }
  50222. }
  50223. if (c === 0x2f) { // /
  50224. var j = i - 1;
  50225. var p = (void 0);
  50226. // find first non-whitespace prev char
  50227. for (; j >= 0; j--) {
  50228. p = exp.charAt(j);
  50229. if (p !== ' ') { break }
  50230. }
  50231. if (!p || !validDivisionCharRE.test(p)) {
  50232. inRegex = true;
  50233. }
  50234. }
  50235. }
  50236. }
  50237. if (expression === undefined) {
  50238. expression = exp.slice(0, i).trim();
  50239. } else if (lastFilterIndex !== 0) {
  50240. pushFilter();
  50241. }
  50242. function pushFilter () {
  50243. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  50244. lastFilterIndex = i + 1;
  50245. }
  50246. if (filters) {
  50247. for (i = 0; i < filters.length; i++) {
  50248. expression = wrapFilter(expression, filters[i]);
  50249. }
  50250. }
  50251. return expression
  50252. }
  50253. function wrapFilter (exp, filter) {
  50254. var i = filter.indexOf('(');
  50255. if (i < 0) {
  50256. // _f: resolveFilter
  50257. return ("_f(\"" + filter + "\")(" + exp + ")")
  50258. } else {
  50259. var name = filter.slice(0, i);
  50260. var args = filter.slice(i + 1);
  50261. return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
  50262. }
  50263. }
  50264. /* */
  50265. /* eslint-disable no-unused-vars */
  50266. function baseWarn (msg, range) {
  50267. console.error(("[Vue compiler]: " + msg));
  50268. }
  50269. /* eslint-enable no-unused-vars */
  50270. function pluckModuleFunction (
  50271. modules,
  50272. key
  50273. ) {
  50274. return modules
  50275. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  50276. : []
  50277. }
  50278. function addProp (el, name, value, range, dynamic) {
  50279. (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  50280. el.plain = false;
  50281. }
  50282. function addAttr (el, name, value, range, dynamic) {
  50283. var attrs = dynamic
  50284. ? (el.dynamicAttrs || (el.dynamicAttrs = []))
  50285. : (el.attrs || (el.attrs = []));
  50286. attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  50287. el.plain = false;
  50288. }
  50289. // add a raw attr (use this in preTransforms)
  50290. function addRawAttr (el, name, value, range) {
  50291. el.attrsMap[name] = value;
  50292. el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
  50293. }
  50294. function addDirective (
  50295. el,
  50296. name,
  50297. rawName,
  50298. value,
  50299. arg,
  50300. isDynamicArg,
  50301. modifiers,
  50302. range
  50303. ) {
  50304. (el.directives || (el.directives = [])).push(rangeSetItem({
  50305. name: name,
  50306. rawName: rawName,
  50307. value: value,
  50308. arg: arg,
  50309. isDynamicArg: isDynamicArg,
  50310. modifiers: modifiers
  50311. }, range));
  50312. el.plain = false;
  50313. }
  50314. function prependModifierMarker (symbol, name, dynamic) {
  50315. return dynamic
  50316. ? ("_p(" + name + ",\"" + symbol + "\")")
  50317. : symbol + name // mark the event as captured
  50318. }
  50319. function addHandler (
  50320. el,
  50321. name,
  50322. value,
  50323. modifiers,
  50324. important,
  50325. warn,
  50326. range,
  50327. dynamic
  50328. ) {
  50329. modifiers = modifiers || emptyObject;
  50330. // warn prevent and passive modifier
  50331. /* istanbul ignore if */
  50332. if (
  50333. warn &&
  50334. modifiers.prevent && modifiers.passive
  50335. ) {
  50336. warn(
  50337. 'passive and prevent can\'t be used together. ' +
  50338. 'Passive handler can\'t prevent default event.',
  50339. range
  50340. );
  50341. }
  50342. // normalize click.right and click.middle since they don't actually fire
  50343. // this is technically browser-specific, but at least for now browsers are
  50344. // the only target envs that have right/middle clicks.
  50345. if (modifiers.right) {
  50346. if (dynamic) {
  50347. name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
  50348. } else if (name === 'click') {
  50349. name = 'contextmenu';
  50350. delete modifiers.right;
  50351. }
  50352. } else if (modifiers.middle) {
  50353. if (dynamic) {
  50354. name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
  50355. } else if (name === 'click') {
  50356. name = 'mouseup';
  50357. }
  50358. }
  50359. // check capture modifier
  50360. if (modifiers.capture) {
  50361. delete modifiers.capture;
  50362. name = prependModifierMarker('!', name, dynamic);
  50363. }
  50364. if (modifiers.once) {
  50365. delete modifiers.once;
  50366. name = prependModifierMarker('~', name, dynamic);
  50367. }
  50368. /* istanbul ignore if */
  50369. if (modifiers.passive) {
  50370. delete modifiers.passive;
  50371. name = prependModifierMarker('&', name, dynamic);
  50372. }
  50373. var events;
  50374. if (modifiers.native) {
  50375. delete modifiers.native;
  50376. events = el.nativeEvents || (el.nativeEvents = {});
  50377. } else {
  50378. events = el.events || (el.events = {});
  50379. }
  50380. var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
  50381. if (modifiers !== emptyObject) {
  50382. newHandler.modifiers = modifiers;
  50383. }
  50384. var handlers = events[name];
  50385. /* istanbul ignore if */
  50386. if (Array.isArray(handlers)) {
  50387. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  50388. } else if (handlers) {
  50389. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  50390. } else {
  50391. events[name] = newHandler;
  50392. }
  50393. el.plain = false;
  50394. }
  50395. function getRawBindingAttr (
  50396. el,
  50397. name
  50398. ) {
  50399. return el.rawAttrsMap[':' + name] ||
  50400. el.rawAttrsMap['v-bind:' + name] ||
  50401. el.rawAttrsMap[name]
  50402. }
  50403. function getBindingAttr (
  50404. el,
  50405. name,
  50406. getStatic
  50407. ) {
  50408. var dynamicValue =
  50409. getAndRemoveAttr(el, ':' + name) ||
  50410. getAndRemoveAttr(el, 'v-bind:' + name);
  50411. if (dynamicValue != null) {
  50412. return parseFilters(dynamicValue)
  50413. } else if (getStatic !== false) {
  50414. var staticValue = getAndRemoveAttr(el, name);
  50415. if (staticValue != null) {
  50416. return JSON.stringify(staticValue)
  50417. }
  50418. }
  50419. }
  50420. // note: this only removes the attr from the Array (attrsList) so that it
  50421. // doesn't get processed by processAttrs.
  50422. // By default it does NOT remove it from the map (attrsMap) because the map is
  50423. // needed during codegen.
  50424. function getAndRemoveAttr (
  50425. el,
  50426. name,
  50427. removeFromMap
  50428. ) {
  50429. var val;
  50430. if ((val = el.attrsMap[name]) != null) {
  50431. var list = el.attrsList;
  50432. for (var i = 0, l = list.length; i < l; i++) {
  50433. if (list[i].name === name) {
  50434. list.splice(i, 1);
  50435. break
  50436. }
  50437. }
  50438. }
  50439. if (removeFromMap) {
  50440. delete el.attrsMap[name];
  50441. }
  50442. return val
  50443. }
  50444. function getAndRemoveAttrByRegex (
  50445. el,
  50446. name
  50447. ) {
  50448. var list = el.attrsList;
  50449. for (var i = 0, l = list.length; i < l; i++) {
  50450. var attr = list[i];
  50451. if (name.test(attr.name)) {
  50452. list.splice(i, 1);
  50453. return attr
  50454. }
  50455. }
  50456. }
  50457. function rangeSetItem (
  50458. item,
  50459. range
  50460. ) {
  50461. if (range) {
  50462. if (range.start != null) {
  50463. item.start = range.start;
  50464. }
  50465. if (range.end != null) {
  50466. item.end = range.end;
  50467. }
  50468. }
  50469. return item
  50470. }
  50471. /* */
  50472. /**
  50473. * Cross-platform code generation for component v-model
  50474. */
  50475. function genComponentModel (
  50476. el,
  50477. value,
  50478. modifiers
  50479. ) {
  50480. var ref = modifiers || {};
  50481. var number = ref.number;
  50482. var trim = ref.trim;
  50483. var baseValueExpression = '$$v';
  50484. var valueExpression = baseValueExpression;
  50485. if (trim) {
  50486. valueExpression =
  50487. "(typeof " + baseValueExpression + " === 'string'" +
  50488. "? " + baseValueExpression + ".trim()" +
  50489. ": " + baseValueExpression + ")";
  50490. }
  50491. if (number) {
  50492. valueExpression = "_n(" + valueExpression + ")";
  50493. }
  50494. var assignment = genAssignmentCode(value, valueExpression);
  50495. el.model = {
  50496. value: ("(" + value + ")"),
  50497. expression: JSON.stringify(value),
  50498. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  50499. };
  50500. }
  50501. /**
  50502. * Cross-platform codegen helper for generating v-model value assignment code.
  50503. */
  50504. function genAssignmentCode (
  50505. value,
  50506. assignment
  50507. ) {
  50508. var res = parseModel(value);
  50509. if (res.key === null) {
  50510. return (value + "=" + assignment)
  50511. } else {
  50512. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  50513. }
  50514. }
  50515. /**
  50516. * Parse a v-model expression into a base path and a final key segment.
  50517. * Handles both dot-path and possible square brackets.
  50518. *
  50519. * Possible cases:
  50520. *
  50521. * - test
  50522. * - test[key]
  50523. * - test[test1[key]]
  50524. * - test["a"][key]
  50525. * - xxx.test[a[a].test1[key]]
  50526. * - test.xxx.a["asa"][test1[key]]
  50527. *
  50528. */
  50529. var len, str, chr, index$1, expressionPos, expressionEndPos;
  50530. function parseModel (val) {
  50531. // Fix https://github.com/vuejs/vue/pull/7730
  50532. // allow v-model="obj.val " (trailing whitespace)
  50533. val = val.trim();
  50534. len = val.length;
  50535. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  50536. index$1 = val.lastIndexOf('.');
  50537. if (index$1 > -1) {
  50538. return {
  50539. exp: val.slice(0, index$1),
  50540. key: '"' + val.slice(index$1 + 1) + '"'
  50541. }
  50542. } else {
  50543. return {
  50544. exp: val,
  50545. key: null
  50546. }
  50547. }
  50548. }
  50549. str = val;
  50550. index$1 = expressionPos = expressionEndPos = 0;
  50551. while (!eof()) {
  50552. chr = next();
  50553. /* istanbul ignore if */
  50554. if (isStringStart(chr)) {
  50555. parseString(chr);
  50556. } else if (chr === 0x5B) {
  50557. parseBracket(chr);
  50558. }
  50559. }
  50560. return {
  50561. exp: val.slice(0, expressionPos),
  50562. key: val.slice(expressionPos + 1, expressionEndPos)
  50563. }
  50564. }
  50565. function next () {
  50566. return str.charCodeAt(++index$1)
  50567. }
  50568. function eof () {
  50569. return index$1 >= len
  50570. }
  50571. function isStringStart (chr) {
  50572. return chr === 0x22 || chr === 0x27
  50573. }
  50574. function parseBracket (chr) {
  50575. var inBracket = 1;
  50576. expressionPos = index$1;
  50577. while (!eof()) {
  50578. chr = next();
  50579. if (isStringStart(chr)) {
  50580. parseString(chr);
  50581. continue
  50582. }
  50583. if (chr === 0x5B) { inBracket++; }
  50584. if (chr === 0x5D) { inBracket--; }
  50585. if (inBracket === 0) {
  50586. expressionEndPos = index$1;
  50587. break
  50588. }
  50589. }
  50590. }
  50591. function parseString (chr) {
  50592. var stringQuote = chr;
  50593. while (!eof()) {
  50594. chr = next();
  50595. if (chr === stringQuote) {
  50596. break
  50597. }
  50598. }
  50599. }
  50600. /* */
  50601. var warn$1;
  50602. // in some cases, the event used has to be determined at runtime
  50603. // so we used some reserved tokens during compile.
  50604. var RANGE_TOKEN = '__r';
  50605. var CHECKBOX_RADIO_TOKEN = '__c';
  50606. function model (
  50607. el,
  50608. dir,
  50609. _warn
  50610. ) {
  50611. warn$1 = _warn;
  50612. var value = dir.value;
  50613. var modifiers = dir.modifiers;
  50614. var tag = el.tag;
  50615. var type = el.attrsMap.type;
  50616. {
  50617. // inputs with type="file" are read only and setting the input's
  50618. // value will throw an error.
  50619. if (tag === 'input' && type === 'file') {
  50620. warn$1(
  50621. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  50622. "File inputs are read only. Use a v-on:change listener instead.",
  50623. el.rawAttrsMap['v-model']
  50624. );
  50625. }
  50626. }
  50627. if (el.component) {
  50628. genComponentModel(el, value, modifiers);
  50629. // component v-model doesn't need extra runtime
  50630. return false
  50631. } else if (tag === 'select') {
  50632. genSelect(el, value, modifiers);
  50633. } else if (tag === 'input' && type === 'checkbox') {
  50634. genCheckboxModel(el, value, modifiers);
  50635. } else if (tag === 'input' && type === 'radio') {
  50636. genRadioModel(el, value, modifiers);
  50637. } else if (tag === 'input' || tag === 'textarea') {
  50638. genDefaultModel(el, value, modifiers);
  50639. } else if (!config.isReservedTag(tag)) {
  50640. genComponentModel(el, value, modifiers);
  50641. // component v-model doesn't need extra runtime
  50642. return false
  50643. } else {
  50644. warn$1(
  50645. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  50646. "v-model is not supported on this element type. " +
  50647. 'If you are working with contenteditable, it\'s recommended to ' +
  50648. 'wrap a library dedicated for that purpose inside a custom component.',
  50649. el.rawAttrsMap['v-model']
  50650. );
  50651. }
  50652. // ensure runtime directive metadata
  50653. return true
  50654. }
  50655. function genCheckboxModel (
  50656. el,
  50657. value,
  50658. modifiers
  50659. ) {
  50660. var number = modifiers && modifiers.number;
  50661. var valueBinding = getBindingAttr(el, 'value') || 'null';
  50662. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  50663. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  50664. addProp(el, 'checked',
  50665. "Array.isArray(" + value + ")" +
  50666. "?_i(" + value + "," + valueBinding + ")>-1" + (
  50667. trueValueBinding === 'true'
  50668. ? (":(" + value + ")")
  50669. : (":_q(" + value + "," + trueValueBinding + ")")
  50670. )
  50671. );
  50672. addHandler(el, 'change',
  50673. "var $$a=" + value + "," +
  50674. '$$el=$event.target,' +
  50675. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  50676. 'if(Array.isArray($$a)){' +
  50677. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  50678. '$$i=_i($$a,$$v);' +
  50679. "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
  50680. "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
  50681. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  50682. null, true
  50683. );
  50684. }
  50685. function genRadioModel (
  50686. el,
  50687. value,
  50688. modifiers
  50689. ) {
  50690. var number = modifiers && modifiers.number;
  50691. var valueBinding = getBindingAttr(el, 'value') || 'null';
  50692. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  50693. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  50694. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  50695. }
  50696. function genSelect (
  50697. el,
  50698. value,
  50699. modifiers
  50700. ) {
  50701. var number = modifiers && modifiers.number;
  50702. var selectedVal = "Array.prototype.filter" +
  50703. ".call($event.target.options,function(o){return o.selected})" +
  50704. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  50705. "return " + (number ? '_n(val)' : 'val') + "})";
  50706. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  50707. var code = "var $$selectedVal = " + selectedVal + ";";
  50708. code = code + " " + (genAssignmentCode(value, assignment));
  50709. addHandler(el, 'change', code, null, true);
  50710. }
  50711. function genDefaultModel (
  50712. el,
  50713. value,
  50714. modifiers
  50715. ) {
  50716. var type = el.attrsMap.type;
  50717. // warn if v-bind:value conflicts with v-model
  50718. // except for inputs with v-bind:type
  50719. {
  50720. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  50721. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  50722. if (value$1 && !typeBinding) {
  50723. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  50724. warn$1(
  50725. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  50726. 'because the latter already expands to a value binding internally',
  50727. el.rawAttrsMap[binding]
  50728. );
  50729. }
  50730. }
  50731. var ref = modifiers || {};
  50732. var lazy = ref.lazy;
  50733. var number = ref.number;
  50734. var trim = ref.trim;
  50735. var needCompositionGuard = !lazy && type !== 'range';
  50736. var event = lazy
  50737. ? 'change'
  50738. : type === 'range'
  50739. ? RANGE_TOKEN
  50740. : 'input';
  50741. var valueExpression = '$event.target.value';
  50742. if (trim) {
  50743. valueExpression = "$event.target.value.trim()";
  50744. }
  50745. if (number) {
  50746. valueExpression = "_n(" + valueExpression + ")";
  50747. }
  50748. var code = genAssignmentCode(value, valueExpression);
  50749. if (needCompositionGuard) {
  50750. code = "if($event.target.composing)return;" + code;
  50751. }
  50752. addProp(el, 'value', ("(" + value + ")"));
  50753. addHandler(el, event, code, null, true);
  50754. if (trim || number) {
  50755. addHandler(el, 'blur', '$forceUpdate()');
  50756. }
  50757. }
  50758. /* */
  50759. // normalize v-model event tokens that can only be determined at runtime.
  50760. // it's important to place the event as the first in the array because
  50761. // the whole point is ensuring the v-model callback gets called before
  50762. // user-attached handlers.
  50763. function normalizeEvents (on) {
  50764. /* istanbul ignore if */
  50765. if (isDef(on[RANGE_TOKEN])) {
  50766. // IE input[type=range] only supports `change` event
  50767. var event = isIE ? 'change' : 'input';
  50768. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  50769. delete on[RANGE_TOKEN];
  50770. }
  50771. // This was originally intended to fix #4521 but no longer necessary
  50772. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  50773. /* istanbul ignore if */
  50774. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  50775. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  50776. delete on[CHECKBOX_RADIO_TOKEN];
  50777. }
  50778. }
  50779. var target$1;
  50780. function createOnceHandler$1 (event, handler, capture) {
  50781. var _target = target$1; // save current target element in closure
  50782. return function onceHandler () {
  50783. var res = handler.apply(null, arguments);
  50784. if (res !== null) {
  50785. remove$2(event, onceHandler, capture, _target);
  50786. }
  50787. }
  50788. }
  50789. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  50790. // implementation and does not fire microtasks in between event propagation, so
  50791. // safe to exclude.
  50792. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  50793. function add$1 (
  50794. name,
  50795. handler,
  50796. capture,
  50797. passive
  50798. ) {
  50799. // async edge case #6566: inner click event triggers patch, event handler
  50800. // attached to outer element during patch, and triggered again. This
  50801. // happens because browsers fire microtask ticks between event propagation.
  50802. // the solution is simple: we save the timestamp when a handler is attached,
  50803. // and the handler would only fire if the event passed to it was fired
  50804. // AFTER it was attached.
  50805. if (useMicrotaskFix) {
  50806. var attachedTimestamp = currentFlushTimestamp;
  50807. var original = handler;
  50808. handler = original._wrapper = function (e) {
  50809. if (
  50810. // no bubbling, should always fire.
  50811. // this is just a safety net in case event.timeStamp is unreliable in
  50812. // certain weird environments...
  50813. e.target === e.currentTarget ||
  50814. // event is fired after handler attachment
  50815. e.timeStamp >= attachedTimestamp ||
  50816. // bail for environments that have buggy event.timeStamp implementations
  50817. // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
  50818. // #9681 QtWebEngine event.timeStamp is negative value
  50819. e.timeStamp <= 0 ||
  50820. // #9448 bail if event is fired in another document in a multi-page
  50821. // electron/nw.js app, since event.timeStamp will be using a different
  50822. // starting reference
  50823. e.target.ownerDocument !== document
  50824. ) {
  50825. return original.apply(this, arguments)
  50826. }
  50827. };
  50828. }
  50829. target$1.addEventListener(
  50830. name,
  50831. handler,
  50832. supportsPassive
  50833. ? { capture: capture, passive: passive }
  50834. : capture
  50835. );
  50836. }
  50837. function remove$2 (
  50838. name,
  50839. handler,
  50840. capture,
  50841. _target
  50842. ) {
  50843. (_target || target$1).removeEventListener(
  50844. name,
  50845. handler._wrapper || handler,
  50846. capture
  50847. );
  50848. }
  50849. function updateDOMListeners (oldVnode, vnode) {
  50850. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  50851. return
  50852. }
  50853. var on = vnode.data.on || {};
  50854. var oldOn = oldVnode.data.on || {};
  50855. target$1 = vnode.elm;
  50856. normalizeEvents(on);
  50857. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  50858. target$1 = undefined;
  50859. }
  50860. var events = {
  50861. create: updateDOMListeners,
  50862. update: updateDOMListeners
  50863. };
  50864. /* */
  50865. var svgContainer;
  50866. function updateDOMProps (oldVnode, vnode) {
  50867. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  50868. return
  50869. }
  50870. var key, cur;
  50871. var elm = vnode.elm;
  50872. var oldProps = oldVnode.data.domProps || {};
  50873. var props = vnode.data.domProps || {};
  50874. // clone observed objects, as the user probably wants to mutate it
  50875. if (isDef(props.__ob__)) {
  50876. props = vnode.data.domProps = extend({}, props);
  50877. }
  50878. for (key in oldProps) {
  50879. if (!(key in props)) {
  50880. elm[key] = '';
  50881. }
  50882. }
  50883. for (key in props) {
  50884. cur = props[key];
  50885. // ignore children if the node has textContent or innerHTML,
  50886. // as these will throw away existing DOM nodes and cause removal errors
  50887. // on subsequent patches (#3360)
  50888. if (key === 'textContent' || key === 'innerHTML') {
  50889. if (vnode.children) { vnode.children.length = 0; }
  50890. if (cur === oldProps[key]) { continue }
  50891. // #6601 work around Chrome version <= 55 bug where single textNode
  50892. // replaced by innerHTML/textContent retains its parentNode property
  50893. if (elm.childNodes.length === 1) {
  50894. elm.removeChild(elm.childNodes[0]);
  50895. }
  50896. }
  50897. if (key === 'value' && elm.tagName !== 'PROGRESS') {
  50898. // store value as _value as well since
  50899. // non-string values will be stringified
  50900. elm._value = cur;
  50901. // avoid resetting cursor position when value is the same
  50902. var strCur = isUndef(cur) ? '' : String(cur);
  50903. if (shouldUpdateValue(elm, strCur)) {
  50904. elm.value = strCur;
  50905. }
  50906. } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
  50907. // IE doesn't support innerHTML for SVG elements
  50908. svgContainer = svgContainer || document.createElement('div');
  50909. svgContainer.innerHTML = "<svg>" + cur + "</svg>";
  50910. var svg = svgContainer.firstChild;
  50911. while (elm.firstChild) {
  50912. elm.removeChild(elm.firstChild);
  50913. }
  50914. while (svg.firstChild) {
  50915. elm.appendChild(svg.firstChild);
  50916. }
  50917. } else if (
  50918. // skip the update if old and new VDOM state is the same.
  50919. // `value` is handled separately because the DOM value may be temporarily
  50920. // out of sync with VDOM state due to focus, composition and modifiers.
  50921. // This #4521 by skipping the unnecesarry `checked` update.
  50922. cur !== oldProps[key]
  50923. ) {
  50924. // some property updates can throw
  50925. // e.g. `value` on <progress> w/ non-finite value
  50926. try {
  50927. elm[key] = cur;
  50928. } catch (e) {}
  50929. }
  50930. }
  50931. }
  50932. // check platforms/web/util/attrs.js acceptValue
  50933. function shouldUpdateValue (elm, checkVal) {
  50934. return (!elm.composing && (
  50935. elm.tagName === 'OPTION' ||
  50936. isNotInFocusAndDirty(elm, checkVal) ||
  50937. isDirtyWithModifiers(elm, checkVal)
  50938. ))
  50939. }
  50940. function isNotInFocusAndDirty (elm, checkVal) {
  50941. // return true when textbox (.number and .trim) loses focus and its value is
  50942. // not equal to the updated value
  50943. var notInFocus = true;
  50944. // #6157
  50945. // work around IE bug when accessing document.activeElement in an iframe
  50946. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  50947. return notInFocus && elm.value !== checkVal
  50948. }
  50949. function isDirtyWithModifiers (elm, newVal) {
  50950. var value = elm.value;
  50951. var modifiers = elm._vModifiers; // injected by v-model runtime
  50952. if (isDef(modifiers)) {
  50953. if (modifiers.number) {
  50954. return toNumber(value) !== toNumber(newVal)
  50955. }
  50956. if (modifiers.trim) {
  50957. return value.trim() !== newVal.trim()
  50958. }
  50959. }
  50960. return value !== newVal
  50961. }
  50962. var domProps = {
  50963. create: updateDOMProps,
  50964. update: updateDOMProps
  50965. };
  50966. /* */
  50967. var parseStyleText = cached(function (cssText) {
  50968. var res = {};
  50969. var listDelimiter = /;(?![^(]*\))/g;
  50970. var propertyDelimiter = /:(.+)/;
  50971. cssText.split(listDelimiter).forEach(function (item) {
  50972. if (item) {
  50973. var tmp = item.split(propertyDelimiter);
  50974. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  50975. }
  50976. });
  50977. return res
  50978. });
  50979. // merge static and dynamic style data on the same vnode
  50980. function normalizeStyleData (data) {
  50981. var style = normalizeStyleBinding(data.style);
  50982. // static style is pre-processed into an object during compilation
  50983. // and is always a fresh object, so it's safe to merge into it
  50984. return data.staticStyle
  50985. ? extend(data.staticStyle, style)
  50986. : style
  50987. }
  50988. // normalize possible array / string values into Object
  50989. function normalizeStyleBinding (bindingStyle) {
  50990. if (Array.isArray(bindingStyle)) {
  50991. return toObject(bindingStyle)
  50992. }
  50993. if (typeof bindingStyle === 'string') {
  50994. return parseStyleText(bindingStyle)
  50995. }
  50996. return bindingStyle
  50997. }
  50998. /**
  50999. * parent component style should be after child's
  51000. * so that parent component's style could override it
  51001. */
  51002. function getStyle (vnode, checkChild) {
  51003. var res = {};
  51004. var styleData;
  51005. if (checkChild) {
  51006. var childNode = vnode;
  51007. while (childNode.componentInstance) {
  51008. childNode = childNode.componentInstance._vnode;
  51009. if (
  51010. childNode && childNode.data &&
  51011. (styleData = normalizeStyleData(childNode.data))
  51012. ) {
  51013. extend(res, styleData);
  51014. }
  51015. }
  51016. }
  51017. if ((styleData = normalizeStyleData(vnode.data))) {
  51018. extend(res, styleData);
  51019. }
  51020. var parentNode = vnode;
  51021. while ((parentNode = parentNode.parent)) {
  51022. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  51023. extend(res, styleData);
  51024. }
  51025. }
  51026. return res
  51027. }
  51028. /* */
  51029. var cssVarRE = /^--/;
  51030. var importantRE = /\s*!important$/;
  51031. var setProp = function (el, name, val) {
  51032. /* istanbul ignore if */
  51033. if (cssVarRE.test(name)) {
  51034. el.style.setProperty(name, val);
  51035. } else if (importantRE.test(val)) {
  51036. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  51037. } else {
  51038. var normalizedName = normalize(name);
  51039. if (Array.isArray(val)) {
  51040. // Support values array created by autoprefixer, e.g.
  51041. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  51042. // Set them one by one, and the browser will only set those it can recognize
  51043. for (var i = 0, len = val.length; i < len; i++) {
  51044. el.style[normalizedName] = val[i];
  51045. }
  51046. } else {
  51047. el.style[normalizedName] = val;
  51048. }
  51049. }
  51050. };
  51051. var vendorNames = ['Webkit', 'Moz', 'ms'];
  51052. var emptyStyle;
  51053. var normalize = cached(function (prop) {
  51054. emptyStyle = emptyStyle || document.createElement('div').style;
  51055. prop = camelize(prop);
  51056. if (prop !== 'filter' && (prop in emptyStyle)) {
  51057. return prop
  51058. }
  51059. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  51060. for (var i = 0; i < vendorNames.length; i++) {
  51061. var name = vendorNames[i] + capName;
  51062. if (name in emptyStyle) {
  51063. return name
  51064. }
  51065. }
  51066. });
  51067. function updateStyle (oldVnode, vnode) {
  51068. var data = vnode.data;
  51069. var oldData = oldVnode.data;
  51070. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  51071. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  51072. ) {
  51073. return
  51074. }
  51075. var cur, name;
  51076. var el = vnode.elm;
  51077. var oldStaticStyle = oldData.staticStyle;
  51078. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  51079. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  51080. var oldStyle = oldStaticStyle || oldStyleBinding;
  51081. var style = normalizeStyleBinding(vnode.data.style) || {};
  51082. // store normalized style under a different key for next diff
  51083. // make sure to clone it if it's reactive, since the user likely wants
  51084. // to mutate it.
  51085. vnode.data.normalizedStyle = isDef(style.__ob__)
  51086. ? extend({}, style)
  51087. : style;
  51088. var newStyle = getStyle(vnode, true);
  51089. for (name in oldStyle) {
  51090. if (isUndef(newStyle[name])) {
  51091. setProp(el, name, '');
  51092. }
  51093. }
  51094. for (name in newStyle) {
  51095. cur = newStyle[name];
  51096. if (cur !== oldStyle[name]) {
  51097. // ie9 setting to null has no effect, must use empty string
  51098. setProp(el, name, cur == null ? '' : cur);
  51099. }
  51100. }
  51101. }
  51102. var style = {
  51103. create: updateStyle,
  51104. update: updateStyle
  51105. };
  51106. /* */
  51107. var whitespaceRE = /\s+/;
  51108. /**
  51109. * Add class with compatibility for SVG since classList is not supported on
  51110. * SVG elements in IE
  51111. */
  51112. function addClass (el, cls) {
  51113. /* istanbul ignore if */
  51114. if (!cls || !(cls = cls.trim())) {
  51115. return
  51116. }
  51117. /* istanbul ignore else */
  51118. if (el.classList) {
  51119. if (cls.indexOf(' ') > -1) {
  51120. cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
  51121. } else {
  51122. el.classList.add(cls);
  51123. }
  51124. } else {
  51125. var cur = " " + (el.getAttribute('class') || '') + " ";
  51126. if (cur.indexOf(' ' + cls + ' ') < 0) {
  51127. el.setAttribute('class', (cur + cls).trim());
  51128. }
  51129. }
  51130. }
  51131. /**
  51132. * Remove class with compatibility for SVG since classList is not supported on
  51133. * SVG elements in IE
  51134. */
  51135. function removeClass (el, cls) {
  51136. /* istanbul ignore if */
  51137. if (!cls || !(cls = cls.trim())) {
  51138. return
  51139. }
  51140. /* istanbul ignore else */
  51141. if (el.classList) {
  51142. if (cls.indexOf(' ') > -1) {
  51143. cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
  51144. } else {
  51145. el.classList.remove(cls);
  51146. }
  51147. if (!el.classList.length) {
  51148. el.removeAttribute('class');
  51149. }
  51150. } else {
  51151. var cur = " " + (el.getAttribute('class') || '') + " ";
  51152. var tar = ' ' + cls + ' ';
  51153. while (cur.indexOf(tar) >= 0) {
  51154. cur = cur.replace(tar, ' ');
  51155. }
  51156. cur = cur.trim();
  51157. if (cur) {
  51158. el.setAttribute('class', cur);
  51159. } else {
  51160. el.removeAttribute('class');
  51161. }
  51162. }
  51163. }
  51164. /* */
  51165. function resolveTransition (def$$1) {
  51166. if (!def$$1) {
  51167. return
  51168. }
  51169. /* istanbul ignore else */
  51170. if (typeof def$$1 === 'object') {
  51171. var res = {};
  51172. if (def$$1.css !== false) {
  51173. extend(res, autoCssTransition(def$$1.name || 'v'));
  51174. }
  51175. extend(res, def$$1);
  51176. return res
  51177. } else if (typeof def$$1 === 'string') {
  51178. return autoCssTransition(def$$1)
  51179. }
  51180. }
  51181. var autoCssTransition = cached(function (name) {
  51182. return {
  51183. enterClass: (name + "-enter"),
  51184. enterToClass: (name + "-enter-to"),
  51185. enterActiveClass: (name + "-enter-active"),
  51186. leaveClass: (name + "-leave"),
  51187. leaveToClass: (name + "-leave-to"),
  51188. leaveActiveClass: (name + "-leave-active")
  51189. }
  51190. });
  51191. var hasTransition = inBrowser && !isIE9;
  51192. var TRANSITION = 'transition';
  51193. var ANIMATION = 'animation';
  51194. // Transition property/event sniffing
  51195. var transitionProp = 'transition';
  51196. var transitionEndEvent = 'transitionend';
  51197. var animationProp = 'animation';
  51198. var animationEndEvent = 'animationend';
  51199. if (hasTransition) {
  51200. /* istanbul ignore if */
  51201. if (window.ontransitionend === undefined &&
  51202. window.onwebkittransitionend !== undefined
  51203. ) {
  51204. transitionProp = 'WebkitTransition';
  51205. transitionEndEvent = 'webkitTransitionEnd';
  51206. }
  51207. if (window.onanimationend === undefined &&
  51208. window.onwebkitanimationend !== undefined
  51209. ) {
  51210. animationProp = 'WebkitAnimation';
  51211. animationEndEvent = 'webkitAnimationEnd';
  51212. }
  51213. }
  51214. // binding to window is necessary to make hot reload work in IE in strict mode
  51215. var raf = inBrowser
  51216. ? window.requestAnimationFrame
  51217. ? window.requestAnimationFrame.bind(window)
  51218. : setTimeout
  51219. : /* istanbul ignore next */ function (fn) { return fn(); };
  51220. function nextFrame (fn) {
  51221. raf(function () {
  51222. raf(fn);
  51223. });
  51224. }
  51225. function addTransitionClass (el, cls) {
  51226. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  51227. if (transitionClasses.indexOf(cls) < 0) {
  51228. transitionClasses.push(cls);
  51229. addClass(el, cls);
  51230. }
  51231. }
  51232. function removeTransitionClass (el, cls) {
  51233. if (el._transitionClasses) {
  51234. remove(el._transitionClasses, cls);
  51235. }
  51236. removeClass(el, cls);
  51237. }
  51238. function whenTransitionEnds (
  51239. el,
  51240. expectedType,
  51241. cb
  51242. ) {
  51243. var ref = getTransitionInfo(el, expectedType);
  51244. var type = ref.type;
  51245. var timeout = ref.timeout;
  51246. var propCount = ref.propCount;
  51247. if (!type) { return cb() }
  51248. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  51249. var ended = 0;
  51250. var end = function () {
  51251. el.removeEventListener(event, onEnd);
  51252. cb();
  51253. };
  51254. var onEnd = function (e) {
  51255. if (e.target === el) {
  51256. if (++ended >= propCount) {
  51257. end();
  51258. }
  51259. }
  51260. };
  51261. setTimeout(function () {
  51262. if (ended < propCount) {
  51263. end();
  51264. }
  51265. }, timeout + 1);
  51266. el.addEventListener(event, onEnd);
  51267. }
  51268. var transformRE = /\b(transform|all)(,|$)/;
  51269. function getTransitionInfo (el, expectedType) {
  51270. var styles = window.getComputedStyle(el);
  51271. // JSDOM may return undefined for transition properties
  51272. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  51273. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  51274. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  51275. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  51276. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  51277. var animationTimeout = getTimeout(animationDelays, animationDurations);
  51278. var type;
  51279. var timeout = 0;
  51280. var propCount = 0;
  51281. /* istanbul ignore if */
  51282. if (expectedType === TRANSITION) {
  51283. if (transitionTimeout > 0) {
  51284. type = TRANSITION;
  51285. timeout = transitionTimeout;
  51286. propCount = transitionDurations.length;
  51287. }
  51288. } else if (expectedType === ANIMATION) {
  51289. if (animationTimeout > 0) {
  51290. type = ANIMATION;
  51291. timeout = animationTimeout;
  51292. propCount = animationDurations.length;
  51293. }
  51294. } else {
  51295. timeout = Math.max(transitionTimeout, animationTimeout);
  51296. type = timeout > 0
  51297. ? transitionTimeout > animationTimeout
  51298. ? TRANSITION
  51299. : ANIMATION
  51300. : null;
  51301. propCount = type
  51302. ? type === TRANSITION
  51303. ? transitionDurations.length
  51304. : animationDurations.length
  51305. : 0;
  51306. }
  51307. var hasTransform =
  51308. type === TRANSITION &&
  51309. transformRE.test(styles[transitionProp + 'Property']);
  51310. return {
  51311. type: type,
  51312. timeout: timeout,
  51313. propCount: propCount,
  51314. hasTransform: hasTransform
  51315. }
  51316. }
  51317. function getTimeout (delays, durations) {
  51318. /* istanbul ignore next */
  51319. while (delays.length < durations.length) {
  51320. delays = delays.concat(delays);
  51321. }
  51322. return Math.max.apply(null, durations.map(function (d, i) {
  51323. return toMs(d) + toMs(delays[i])
  51324. }))
  51325. }
  51326. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  51327. // in a locale-dependent way, using a comma instead of a dot.
  51328. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  51329. // as a floor function) causing unexpected behaviors
  51330. function toMs (s) {
  51331. return Number(s.slice(0, -1).replace(',', '.')) * 1000
  51332. }
  51333. /* */
  51334. function enter (vnode, toggleDisplay) {
  51335. var el = vnode.elm;
  51336. // call leave callback now
  51337. if (isDef(el._leaveCb)) {
  51338. el._leaveCb.cancelled = true;
  51339. el._leaveCb();
  51340. }
  51341. var data = resolveTransition(vnode.data.transition);
  51342. if (isUndef(data)) {
  51343. return
  51344. }
  51345. /* istanbul ignore if */
  51346. if (isDef(el._enterCb) || el.nodeType !== 1) {
  51347. return
  51348. }
  51349. var css = data.css;
  51350. var type = data.type;
  51351. var enterClass = data.enterClass;
  51352. var enterToClass = data.enterToClass;
  51353. var enterActiveClass = data.enterActiveClass;
  51354. var appearClass = data.appearClass;
  51355. var appearToClass = data.appearToClass;
  51356. var appearActiveClass = data.appearActiveClass;
  51357. var beforeEnter = data.beforeEnter;
  51358. var enter = data.enter;
  51359. var afterEnter = data.afterEnter;
  51360. var enterCancelled = data.enterCancelled;
  51361. var beforeAppear = data.beforeAppear;
  51362. var appear = data.appear;
  51363. var afterAppear = data.afterAppear;
  51364. var appearCancelled = data.appearCancelled;
  51365. var duration = data.duration;
  51366. // activeInstance will always be the <transition> component managing this
  51367. // transition. One edge case to check is when the <transition> is placed
  51368. // as the root node of a child component. In that case we need to check
  51369. // <transition>'s parent for appear check.
  51370. var context = activeInstance;
  51371. var transitionNode = activeInstance.$vnode;
  51372. while (transitionNode && transitionNode.parent) {
  51373. context = transitionNode.context;
  51374. transitionNode = transitionNode.parent;
  51375. }
  51376. var isAppear = !context._isMounted || !vnode.isRootInsert;
  51377. if (isAppear && !appear && appear !== '') {
  51378. return
  51379. }
  51380. var startClass = isAppear && appearClass
  51381. ? appearClass
  51382. : enterClass;
  51383. var activeClass = isAppear && appearActiveClass
  51384. ? appearActiveClass
  51385. : enterActiveClass;
  51386. var toClass = isAppear && appearToClass
  51387. ? appearToClass
  51388. : enterToClass;
  51389. var beforeEnterHook = isAppear
  51390. ? (beforeAppear || beforeEnter)
  51391. : beforeEnter;
  51392. var enterHook = isAppear
  51393. ? (typeof appear === 'function' ? appear : enter)
  51394. : enter;
  51395. var afterEnterHook = isAppear
  51396. ? (afterAppear || afterEnter)
  51397. : afterEnter;
  51398. var enterCancelledHook = isAppear
  51399. ? (appearCancelled || enterCancelled)
  51400. : enterCancelled;
  51401. var explicitEnterDuration = toNumber(
  51402. isObject(duration)
  51403. ? duration.enter
  51404. : duration
  51405. );
  51406. if (explicitEnterDuration != null) {
  51407. checkDuration(explicitEnterDuration, 'enter', vnode);
  51408. }
  51409. var expectsCSS = css !== false && !isIE9;
  51410. var userWantsControl = getHookArgumentsLength(enterHook);
  51411. var cb = el._enterCb = once(function () {
  51412. if (expectsCSS) {
  51413. removeTransitionClass(el, toClass);
  51414. removeTransitionClass(el, activeClass);
  51415. }
  51416. if (cb.cancelled) {
  51417. if (expectsCSS) {
  51418. removeTransitionClass(el, startClass);
  51419. }
  51420. enterCancelledHook && enterCancelledHook(el);
  51421. } else {
  51422. afterEnterHook && afterEnterHook(el);
  51423. }
  51424. el._enterCb = null;
  51425. });
  51426. if (!vnode.data.show) {
  51427. // remove pending leave element on enter by injecting an insert hook
  51428. mergeVNodeHook(vnode, 'insert', function () {
  51429. var parent = el.parentNode;
  51430. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  51431. if (pendingNode &&
  51432. pendingNode.tag === vnode.tag &&
  51433. pendingNode.elm._leaveCb
  51434. ) {
  51435. pendingNode.elm._leaveCb();
  51436. }
  51437. enterHook && enterHook(el, cb);
  51438. });
  51439. }
  51440. // start enter transition
  51441. beforeEnterHook && beforeEnterHook(el);
  51442. if (expectsCSS) {
  51443. addTransitionClass(el, startClass);
  51444. addTransitionClass(el, activeClass);
  51445. nextFrame(function () {
  51446. removeTransitionClass(el, startClass);
  51447. if (!cb.cancelled) {
  51448. addTransitionClass(el, toClass);
  51449. if (!userWantsControl) {
  51450. if (isValidDuration(explicitEnterDuration)) {
  51451. setTimeout(cb, explicitEnterDuration);
  51452. } else {
  51453. whenTransitionEnds(el, type, cb);
  51454. }
  51455. }
  51456. }
  51457. });
  51458. }
  51459. if (vnode.data.show) {
  51460. toggleDisplay && toggleDisplay();
  51461. enterHook && enterHook(el, cb);
  51462. }
  51463. if (!expectsCSS && !userWantsControl) {
  51464. cb();
  51465. }
  51466. }
  51467. function leave (vnode, rm) {
  51468. var el = vnode.elm;
  51469. // call enter callback now
  51470. if (isDef(el._enterCb)) {
  51471. el._enterCb.cancelled = true;
  51472. el._enterCb();
  51473. }
  51474. var data = resolveTransition(vnode.data.transition);
  51475. if (isUndef(data) || el.nodeType !== 1) {
  51476. return rm()
  51477. }
  51478. /* istanbul ignore if */
  51479. if (isDef(el._leaveCb)) {
  51480. return
  51481. }
  51482. var css = data.css;
  51483. var type = data.type;
  51484. var leaveClass = data.leaveClass;
  51485. var leaveToClass = data.leaveToClass;
  51486. var leaveActiveClass = data.leaveActiveClass;
  51487. var beforeLeave = data.beforeLeave;
  51488. var leave = data.leave;
  51489. var afterLeave = data.afterLeave;
  51490. var leaveCancelled = data.leaveCancelled;
  51491. var delayLeave = data.delayLeave;
  51492. var duration = data.duration;
  51493. var expectsCSS = css !== false && !isIE9;
  51494. var userWantsControl = getHookArgumentsLength(leave);
  51495. var explicitLeaveDuration = toNumber(
  51496. isObject(duration)
  51497. ? duration.leave
  51498. : duration
  51499. );
  51500. if (isDef(explicitLeaveDuration)) {
  51501. checkDuration(explicitLeaveDuration, 'leave', vnode);
  51502. }
  51503. var cb = el._leaveCb = once(function () {
  51504. if (el.parentNode && el.parentNode._pending) {
  51505. el.parentNode._pending[vnode.key] = null;
  51506. }
  51507. if (expectsCSS) {
  51508. removeTransitionClass(el, leaveToClass);
  51509. removeTransitionClass(el, leaveActiveClass);
  51510. }
  51511. if (cb.cancelled) {
  51512. if (expectsCSS) {
  51513. removeTransitionClass(el, leaveClass);
  51514. }
  51515. leaveCancelled && leaveCancelled(el);
  51516. } else {
  51517. rm();
  51518. afterLeave && afterLeave(el);
  51519. }
  51520. el._leaveCb = null;
  51521. });
  51522. if (delayLeave) {
  51523. delayLeave(performLeave);
  51524. } else {
  51525. performLeave();
  51526. }
  51527. function performLeave () {
  51528. // the delayed leave may have already been cancelled
  51529. if (cb.cancelled) {
  51530. return
  51531. }
  51532. // record leaving element
  51533. if (!vnode.data.show && el.parentNode) {
  51534. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  51535. }
  51536. beforeLeave && beforeLeave(el);
  51537. if (expectsCSS) {
  51538. addTransitionClass(el, leaveClass);
  51539. addTransitionClass(el, leaveActiveClass);
  51540. nextFrame(function () {
  51541. removeTransitionClass(el, leaveClass);
  51542. if (!cb.cancelled) {
  51543. addTransitionClass(el, leaveToClass);
  51544. if (!userWantsControl) {
  51545. if (isValidDuration(explicitLeaveDuration)) {
  51546. setTimeout(cb, explicitLeaveDuration);
  51547. } else {
  51548. whenTransitionEnds(el, type, cb);
  51549. }
  51550. }
  51551. }
  51552. });
  51553. }
  51554. leave && leave(el, cb);
  51555. if (!expectsCSS && !userWantsControl) {
  51556. cb();
  51557. }
  51558. }
  51559. }
  51560. // only used in dev mode
  51561. function checkDuration (val, name, vnode) {
  51562. if (typeof val !== 'number') {
  51563. warn(
  51564. "<transition> explicit " + name + " duration is not a valid number - " +
  51565. "got " + (JSON.stringify(val)) + ".",
  51566. vnode.context
  51567. );
  51568. } else if (isNaN(val)) {
  51569. warn(
  51570. "<transition> explicit " + name + " duration is NaN - " +
  51571. 'the duration expression might be incorrect.',
  51572. vnode.context
  51573. );
  51574. }
  51575. }
  51576. function isValidDuration (val) {
  51577. return typeof val === 'number' && !isNaN(val)
  51578. }
  51579. /**
  51580. * Normalize a transition hook's argument length. The hook may be:
  51581. * - a merged hook (invoker) with the original in .fns
  51582. * - a wrapped component method (check ._length)
  51583. * - a plain function (.length)
  51584. */
  51585. function getHookArgumentsLength (fn) {
  51586. if (isUndef(fn)) {
  51587. return false
  51588. }
  51589. var invokerFns = fn.fns;
  51590. if (isDef(invokerFns)) {
  51591. // invoker
  51592. return getHookArgumentsLength(
  51593. Array.isArray(invokerFns)
  51594. ? invokerFns[0]
  51595. : invokerFns
  51596. )
  51597. } else {
  51598. return (fn._length || fn.length) > 1
  51599. }
  51600. }
  51601. function _enter (_, vnode) {
  51602. if (vnode.data.show !== true) {
  51603. enter(vnode);
  51604. }
  51605. }
  51606. var transition = inBrowser ? {
  51607. create: _enter,
  51608. activate: _enter,
  51609. remove: function remove$$1 (vnode, rm) {
  51610. /* istanbul ignore else */
  51611. if (vnode.data.show !== true) {
  51612. leave(vnode, rm);
  51613. } else {
  51614. rm();
  51615. }
  51616. }
  51617. } : {};
  51618. var platformModules = [
  51619. attrs,
  51620. klass,
  51621. events,
  51622. domProps,
  51623. style,
  51624. transition
  51625. ];
  51626. /* */
  51627. // the directive module should be applied last, after all
  51628. // built-in modules have been applied.
  51629. var modules = platformModules.concat(baseModules);
  51630. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  51631. /**
  51632. * Not type checking this file because flow doesn't like attaching
  51633. * properties to Elements.
  51634. */
  51635. /* istanbul ignore if */
  51636. if (isIE9) {
  51637. // http://www.matts411.com/post/internet-explorer-9-oninput/
  51638. document.addEventListener('selectionchange', function () {
  51639. var el = document.activeElement;
  51640. if (el && el.vmodel) {
  51641. trigger(el, 'input');
  51642. }
  51643. });
  51644. }
  51645. var directive = {
  51646. inserted: function inserted (el, binding, vnode, oldVnode) {
  51647. if (vnode.tag === 'select') {
  51648. // #6903
  51649. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  51650. mergeVNodeHook(vnode, 'postpatch', function () {
  51651. directive.componentUpdated(el, binding, vnode);
  51652. });
  51653. } else {
  51654. setSelected(el, binding, vnode.context);
  51655. }
  51656. el._vOptions = [].map.call(el.options, getValue);
  51657. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  51658. el._vModifiers = binding.modifiers;
  51659. if (!binding.modifiers.lazy) {
  51660. el.addEventListener('compositionstart', onCompositionStart);
  51661. el.addEventListener('compositionend', onCompositionEnd);
  51662. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  51663. // switching focus before confirming composition choice
  51664. // this also fixes the issue where some browsers e.g. iOS Chrome
  51665. // fires "change" instead of "input" on autocomplete.
  51666. el.addEventListener('change', onCompositionEnd);
  51667. /* istanbul ignore if */
  51668. if (isIE9) {
  51669. el.vmodel = true;
  51670. }
  51671. }
  51672. }
  51673. },
  51674. componentUpdated: function componentUpdated (el, binding, vnode) {
  51675. if (vnode.tag === 'select') {
  51676. setSelected(el, binding, vnode.context);
  51677. // in case the options rendered by v-for have changed,
  51678. // it's possible that the value is out-of-sync with the rendered options.
  51679. // detect such cases and filter out values that no longer has a matching
  51680. // option in the DOM.
  51681. var prevOptions = el._vOptions;
  51682. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  51683. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  51684. // trigger change event if
  51685. // no matching option found for at least one value
  51686. var needReset = el.multiple
  51687. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  51688. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  51689. if (needReset) {
  51690. trigger(el, 'change');
  51691. }
  51692. }
  51693. }
  51694. }
  51695. };
  51696. function setSelected (el, binding, vm) {
  51697. actuallySetSelected(el, binding, vm);
  51698. /* istanbul ignore if */
  51699. if (isIE || isEdge) {
  51700. setTimeout(function () {
  51701. actuallySetSelected(el, binding, vm);
  51702. }, 0);
  51703. }
  51704. }
  51705. function actuallySetSelected (el, binding, vm) {
  51706. var value = binding.value;
  51707. var isMultiple = el.multiple;
  51708. if (isMultiple && !Array.isArray(value)) {
  51709. warn(
  51710. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  51711. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  51712. vm
  51713. );
  51714. return
  51715. }
  51716. var selected, option;
  51717. for (var i = 0, l = el.options.length; i < l; i++) {
  51718. option = el.options[i];
  51719. if (isMultiple) {
  51720. selected = looseIndexOf(value, getValue(option)) > -1;
  51721. if (option.selected !== selected) {
  51722. option.selected = selected;
  51723. }
  51724. } else {
  51725. if (looseEqual(getValue(option), value)) {
  51726. if (el.selectedIndex !== i) {
  51727. el.selectedIndex = i;
  51728. }
  51729. return
  51730. }
  51731. }
  51732. }
  51733. if (!isMultiple) {
  51734. el.selectedIndex = -1;
  51735. }
  51736. }
  51737. function hasNoMatchingOption (value, options) {
  51738. return options.every(function (o) { return !looseEqual(o, value); })
  51739. }
  51740. function getValue (option) {
  51741. return '_value' in option
  51742. ? option._value
  51743. : option.value
  51744. }
  51745. function onCompositionStart (e) {
  51746. e.target.composing = true;
  51747. }
  51748. function onCompositionEnd (e) {
  51749. // prevent triggering an input event for no reason
  51750. if (!e.target.composing) { return }
  51751. e.target.composing = false;
  51752. trigger(e.target, 'input');
  51753. }
  51754. function trigger (el, type) {
  51755. var e = document.createEvent('HTMLEvents');
  51756. e.initEvent(type, true, true);
  51757. el.dispatchEvent(e);
  51758. }
  51759. /* */
  51760. // recursively search for possible transition defined inside the component root
  51761. function locateNode (vnode) {
  51762. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  51763. ? locateNode(vnode.componentInstance._vnode)
  51764. : vnode
  51765. }
  51766. var show = {
  51767. bind: function bind (el, ref, vnode) {
  51768. var value = ref.value;
  51769. vnode = locateNode(vnode);
  51770. var transition$$1 = vnode.data && vnode.data.transition;
  51771. var originalDisplay = el.__vOriginalDisplay =
  51772. el.style.display === 'none' ? '' : el.style.display;
  51773. if (value && transition$$1) {
  51774. vnode.data.show = true;
  51775. enter(vnode, function () {
  51776. el.style.display = originalDisplay;
  51777. });
  51778. } else {
  51779. el.style.display = value ? originalDisplay : 'none';
  51780. }
  51781. },
  51782. update: function update (el, ref, vnode) {
  51783. var value = ref.value;
  51784. var oldValue = ref.oldValue;
  51785. /* istanbul ignore if */
  51786. if (!value === !oldValue) { return }
  51787. vnode = locateNode(vnode);
  51788. var transition$$1 = vnode.data && vnode.data.transition;
  51789. if (transition$$1) {
  51790. vnode.data.show = true;
  51791. if (value) {
  51792. enter(vnode, function () {
  51793. el.style.display = el.__vOriginalDisplay;
  51794. });
  51795. } else {
  51796. leave(vnode, function () {
  51797. el.style.display = 'none';
  51798. });
  51799. }
  51800. } else {
  51801. el.style.display = value ? el.__vOriginalDisplay : 'none';
  51802. }
  51803. },
  51804. unbind: function unbind (
  51805. el,
  51806. binding,
  51807. vnode,
  51808. oldVnode,
  51809. isDestroy
  51810. ) {
  51811. if (!isDestroy) {
  51812. el.style.display = el.__vOriginalDisplay;
  51813. }
  51814. }
  51815. };
  51816. var platformDirectives = {
  51817. model: directive,
  51818. show: show
  51819. };
  51820. /* */
  51821. var transitionProps = {
  51822. name: String,
  51823. appear: Boolean,
  51824. css: Boolean,
  51825. mode: String,
  51826. type: String,
  51827. enterClass: String,
  51828. leaveClass: String,
  51829. enterToClass: String,
  51830. leaveToClass: String,
  51831. enterActiveClass: String,
  51832. leaveActiveClass: String,
  51833. appearClass: String,
  51834. appearActiveClass: String,
  51835. appearToClass: String,
  51836. duration: [Number, String, Object]
  51837. };
  51838. // in case the child is also an abstract component, e.g. <keep-alive>
  51839. // we want to recursively retrieve the real component to be rendered
  51840. function getRealChild (vnode) {
  51841. var compOptions = vnode && vnode.componentOptions;
  51842. if (compOptions && compOptions.Ctor.options.abstract) {
  51843. return getRealChild(getFirstComponentChild(compOptions.children))
  51844. } else {
  51845. return vnode
  51846. }
  51847. }
  51848. function extractTransitionData (comp) {
  51849. var data = {};
  51850. var options = comp.$options;
  51851. // props
  51852. for (var key in options.propsData) {
  51853. data[key] = comp[key];
  51854. }
  51855. // events.
  51856. // extract listeners and pass them directly to the transition methods
  51857. var listeners = options._parentListeners;
  51858. for (var key$1 in listeners) {
  51859. data[camelize(key$1)] = listeners[key$1];
  51860. }
  51861. return data
  51862. }
  51863. function placeholder (h, rawChild) {
  51864. if (/\d-keep-alive$/.test(rawChild.tag)) {
  51865. return h('keep-alive', {
  51866. props: rawChild.componentOptions.propsData
  51867. })
  51868. }
  51869. }
  51870. function hasParentTransition (vnode) {
  51871. while ((vnode = vnode.parent)) {
  51872. if (vnode.data.transition) {
  51873. return true
  51874. }
  51875. }
  51876. }
  51877. function isSameChild (child, oldChild) {
  51878. return oldChild.key === child.key && oldChild.tag === child.tag
  51879. }
  51880. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  51881. var isVShowDirective = function (d) { return d.name === 'show'; };
  51882. var Transition = {
  51883. name: 'transition',
  51884. props: transitionProps,
  51885. abstract: true,
  51886. render: function render (h) {
  51887. var this$1 = this;
  51888. var children = this.$slots.default;
  51889. if (!children) {
  51890. return
  51891. }
  51892. // filter out text nodes (possible whitespaces)
  51893. children = children.filter(isNotTextNode);
  51894. /* istanbul ignore if */
  51895. if (!children.length) {
  51896. return
  51897. }
  51898. // warn multiple elements
  51899. if (children.length > 1) {
  51900. warn(
  51901. '<transition> can only be used on a single element. Use ' +
  51902. '<transition-group> for lists.',
  51903. this.$parent
  51904. );
  51905. }
  51906. var mode = this.mode;
  51907. // warn invalid mode
  51908. if (mode && mode !== 'in-out' && mode !== 'out-in'
  51909. ) {
  51910. warn(
  51911. 'invalid <transition> mode: ' + mode,
  51912. this.$parent
  51913. );
  51914. }
  51915. var rawChild = children[0];
  51916. // if this is a component root node and the component's
  51917. // parent container node also has transition, skip.
  51918. if (hasParentTransition(this.$vnode)) {
  51919. return rawChild
  51920. }
  51921. // apply transition data to child
  51922. // use getRealChild() to ignore abstract components e.g. keep-alive
  51923. var child = getRealChild(rawChild);
  51924. /* istanbul ignore if */
  51925. if (!child) {
  51926. return rawChild
  51927. }
  51928. if (this._leaving) {
  51929. return placeholder(h, rawChild)
  51930. }
  51931. // ensure a key that is unique to the vnode type and to this transition
  51932. // component instance. This key will be used to remove pending leaving nodes
  51933. // during entering.
  51934. var id = "__transition-" + (this._uid) + "-";
  51935. child.key = child.key == null
  51936. ? child.isComment
  51937. ? id + 'comment'
  51938. : id + child.tag
  51939. : isPrimitive(child.key)
  51940. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  51941. : child.key;
  51942. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  51943. var oldRawChild = this._vnode;
  51944. var oldChild = getRealChild(oldRawChild);
  51945. // mark v-show
  51946. // so that the transition module can hand over the control to the directive
  51947. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  51948. child.data.show = true;
  51949. }
  51950. if (
  51951. oldChild &&
  51952. oldChild.data &&
  51953. !isSameChild(child, oldChild) &&
  51954. !isAsyncPlaceholder(oldChild) &&
  51955. // #6687 component root is a comment node
  51956. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  51957. ) {
  51958. // replace old child transition data with fresh one
  51959. // important for dynamic transitions!
  51960. var oldData = oldChild.data.transition = extend({}, data);
  51961. // handle transition mode
  51962. if (mode === 'out-in') {
  51963. // return placeholder node and queue update when leave finishes
  51964. this._leaving = true;
  51965. mergeVNodeHook(oldData, 'afterLeave', function () {
  51966. this$1._leaving = false;
  51967. this$1.$forceUpdate();
  51968. });
  51969. return placeholder(h, rawChild)
  51970. } else if (mode === 'in-out') {
  51971. if (isAsyncPlaceholder(child)) {
  51972. return oldRawChild
  51973. }
  51974. var delayedLeave;
  51975. var performLeave = function () { delayedLeave(); };
  51976. mergeVNodeHook(data, 'afterEnter', performLeave);
  51977. mergeVNodeHook(data, 'enterCancelled', performLeave);
  51978. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  51979. }
  51980. }
  51981. return rawChild
  51982. }
  51983. };
  51984. /* */
  51985. var props = extend({
  51986. tag: String,
  51987. moveClass: String
  51988. }, transitionProps);
  51989. delete props.mode;
  51990. var TransitionGroup = {
  51991. props: props,
  51992. beforeMount: function beforeMount () {
  51993. var this$1 = this;
  51994. var update = this._update;
  51995. this._update = function (vnode, hydrating) {
  51996. var restoreActiveInstance = setActiveInstance(this$1);
  51997. // force removing pass
  51998. this$1.__patch__(
  51999. this$1._vnode,
  52000. this$1.kept,
  52001. false, // hydrating
  52002. true // removeOnly (!important, avoids unnecessary moves)
  52003. );
  52004. this$1._vnode = this$1.kept;
  52005. restoreActiveInstance();
  52006. update.call(this$1, vnode, hydrating);
  52007. };
  52008. },
  52009. render: function render (h) {
  52010. var tag = this.tag || this.$vnode.data.tag || 'span';
  52011. var map = Object.create(null);
  52012. var prevChildren = this.prevChildren = this.children;
  52013. var rawChildren = this.$slots.default || [];
  52014. var children = this.children = [];
  52015. var transitionData = extractTransitionData(this);
  52016. for (var i = 0; i < rawChildren.length; i++) {
  52017. var c = rawChildren[i];
  52018. if (c.tag) {
  52019. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  52020. children.push(c);
  52021. map[c.key] = c
  52022. ;(c.data || (c.data = {})).transition = transitionData;
  52023. } else {
  52024. var opts = c.componentOptions;
  52025. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  52026. warn(("<transition-group> children must be keyed: <" + name + ">"));
  52027. }
  52028. }
  52029. }
  52030. if (prevChildren) {
  52031. var kept = [];
  52032. var removed = [];
  52033. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  52034. var c$1 = prevChildren[i$1];
  52035. c$1.data.transition = transitionData;
  52036. c$1.data.pos = c$1.elm.getBoundingClientRect();
  52037. if (map[c$1.key]) {
  52038. kept.push(c$1);
  52039. } else {
  52040. removed.push(c$1);
  52041. }
  52042. }
  52043. this.kept = h(tag, null, kept);
  52044. this.removed = removed;
  52045. }
  52046. return h(tag, null, children)
  52047. },
  52048. updated: function updated () {
  52049. var children = this.prevChildren;
  52050. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  52051. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  52052. return
  52053. }
  52054. // we divide the work into three loops to avoid mixing DOM reads and writes
  52055. // in each iteration - which helps prevent layout thrashing.
  52056. children.forEach(callPendingCbs);
  52057. children.forEach(recordPosition);
  52058. children.forEach(applyTranslation);
  52059. // force reflow to put everything in position
  52060. // assign to this to avoid being removed in tree-shaking
  52061. // $flow-disable-line
  52062. this._reflow = document.body.offsetHeight;
  52063. children.forEach(function (c) {
  52064. if (c.data.moved) {
  52065. var el = c.elm;
  52066. var s = el.style;
  52067. addTransitionClass(el, moveClass);
  52068. s.transform = s.WebkitTransform = s.transitionDuration = '';
  52069. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  52070. if (e && e.target !== el) {
  52071. return
  52072. }
  52073. if (!e || /transform$/.test(e.propertyName)) {
  52074. el.removeEventListener(transitionEndEvent, cb);
  52075. el._moveCb = null;
  52076. removeTransitionClass(el, moveClass);
  52077. }
  52078. });
  52079. }
  52080. });
  52081. },
  52082. methods: {
  52083. hasMove: function hasMove (el, moveClass) {
  52084. /* istanbul ignore if */
  52085. if (!hasTransition) {
  52086. return false
  52087. }
  52088. /* istanbul ignore if */
  52089. if (this._hasMove) {
  52090. return this._hasMove
  52091. }
  52092. // Detect whether an element with the move class applied has
  52093. // CSS transitions. Since the element may be inside an entering
  52094. // transition at this very moment, we make a clone of it and remove
  52095. // all other transition classes applied to ensure only the move class
  52096. // is applied.
  52097. var clone = el.cloneNode();
  52098. if (el._transitionClasses) {
  52099. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  52100. }
  52101. addClass(clone, moveClass);
  52102. clone.style.display = 'none';
  52103. this.$el.appendChild(clone);
  52104. var info = getTransitionInfo(clone);
  52105. this.$el.removeChild(clone);
  52106. return (this._hasMove = info.hasTransform)
  52107. }
  52108. }
  52109. };
  52110. function callPendingCbs (c) {
  52111. /* istanbul ignore if */
  52112. if (c.elm._moveCb) {
  52113. c.elm._moveCb();
  52114. }
  52115. /* istanbul ignore if */
  52116. if (c.elm._enterCb) {
  52117. c.elm._enterCb();
  52118. }
  52119. }
  52120. function recordPosition (c) {
  52121. c.data.newPos = c.elm.getBoundingClientRect();
  52122. }
  52123. function applyTranslation (c) {
  52124. var oldPos = c.data.pos;
  52125. var newPos = c.data.newPos;
  52126. var dx = oldPos.left - newPos.left;
  52127. var dy = oldPos.top - newPos.top;
  52128. if (dx || dy) {
  52129. c.data.moved = true;
  52130. var s = c.elm.style;
  52131. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  52132. s.transitionDuration = '0s';
  52133. }
  52134. }
  52135. var platformComponents = {
  52136. Transition: Transition,
  52137. TransitionGroup: TransitionGroup
  52138. };
  52139. /* */
  52140. // install platform specific utils
  52141. Vue.config.mustUseProp = mustUseProp;
  52142. Vue.config.isReservedTag = isReservedTag;
  52143. Vue.config.isReservedAttr = isReservedAttr;
  52144. Vue.config.getTagNamespace = getTagNamespace;
  52145. Vue.config.isUnknownElement = isUnknownElement;
  52146. // install platform runtime directives & components
  52147. extend(Vue.options.directives, platformDirectives);
  52148. extend(Vue.options.components, platformComponents);
  52149. // install platform patch function
  52150. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  52151. // public mount method
  52152. Vue.prototype.$mount = function (
  52153. el,
  52154. hydrating
  52155. ) {
  52156. el = el && inBrowser ? query(el) : undefined;
  52157. return mountComponent(this, el, hydrating)
  52158. };
  52159. // devtools global hook
  52160. /* istanbul ignore next */
  52161. if (inBrowser) {
  52162. setTimeout(function () {
  52163. if (config.devtools) {
  52164. if (devtools) {
  52165. devtools.emit('init', Vue);
  52166. } else {
  52167. console[console.info ? 'info' : 'log'](
  52168. 'Download the Vue Devtools extension for a better development experience:\n' +
  52169. 'https://github.com/vuejs/vue-devtools'
  52170. );
  52171. }
  52172. }
  52173. if (config.productionTip !== false &&
  52174. typeof console !== 'undefined'
  52175. ) {
  52176. console[console.info ? 'info' : 'log'](
  52177. "You are running Vue in development mode.\n" +
  52178. "Make sure to turn on production mode when deploying for production.\n" +
  52179. "See more tips at https://vuejs.org/guide/deployment.html"
  52180. );
  52181. }
  52182. }, 0);
  52183. }
  52184. /* */
  52185. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  52186. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  52187. var buildRegex = cached(function (delimiters) {
  52188. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  52189. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  52190. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  52191. });
  52192. function parseText (
  52193. text,
  52194. delimiters
  52195. ) {
  52196. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  52197. if (!tagRE.test(text)) {
  52198. return
  52199. }
  52200. var tokens = [];
  52201. var rawTokens = [];
  52202. var lastIndex = tagRE.lastIndex = 0;
  52203. var match, index, tokenValue;
  52204. while ((match = tagRE.exec(text))) {
  52205. index = match.index;
  52206. // push text token
  52207. if (index > lastIndex) {
  52208. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  52209. tokens.push(JSON.stringify(tokenValue));
  52210. }
  52211. // tag token
  52212. var exp = parseFilters(match[1].trim());
  52213. tokens.push(("_s(" + exp + ")"));
  52214. rawTokens.push({ '@binding': exp });
  52215. lastIndex = index + match[0].length;
  52216. }
  52217. if (lastIndex < text.length) {
  52218. rawTokens.push(tokenValue = text.slice(lastIndex));
  52219. tokens.push(JSON.stringify(tokenValue));
  52220. }
  52221. return {
  52222. expression: tokens.join('+'),
  52223. tokens: rawTokens
  52224. }
  52225. }
  52226. /* */
  52227. function transformNode (el, options) {
  52228. var warn = options.warn || baseWarn;
  52229. var staticClass = getAndRemoveAttr(el, 'class');
  52230. if (staticClass) {
  52231. var res = parseText(staticClass, options.delimiters);
  52232. if (res) {
  52233. warn(
  52234. "class=\"" + staticClass + "\": " +
  52235. 'Interpolation inside attributes has been removed. ' +
  52236. 'Use v-bind or the colon shorthand instead. For example, ' +
  52237. 'instead of <div class="{{ val }}">, use <div :class="val">.',
  52238. el.rawAttrsMap['class']
  52239. );
  52240. }
  52241. }
  52242. if (staticClass) {
  52243. el.staticClass = JSON.stringify(staticClass);
  52244. }
  52245. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  52246. if (classBinding) {
  52247. el.classBinding = classBinding;
  52248. }
  52249. }
  52250. function genData (el) {
  52251. var data = '';
  52252. if (el.staticClass) {
  52253. data += "staticClass:" + (el.staticClass) + ",";
  52254. }
  52255. if (el.classBinding) {
  52256. data += "class:" + (el.classBinding) + ",";
  52257. }
  52258. return data
  52259. }
  52260. var klass$1 = {
  52261. staticKeys: ['staticClass'],
  52262. transformNode: transformNode,
  52263. genData: genData
  52264. };
  52265. /* */
  52266. function transformNode$1 (el, options) {
  52267. var warn = options.warn || baseWarn;
  52268. var staticStyle = getAndRemoveAttr(el, 'style');
  52269. if (staticStyle) {
  52270. /* istanbul ignore if */
  52271. {
  52272. var res = parseText(staticStyle, options.delimiters);
  52273. if (res) {
  52274. warn(
  52275. "style=\"" + staticStyle + "\": " +
  52276. 'Interpolation inside attributes has been removed. ' +
  52277. 'Use v-bind or the colon shorthand instead. For example, ' +
  52278. 'instead of <div style="{{ val }}">, use <div :style="val">.',
  52279. el.rawAttrsMap['style']
  52280. );
  52281. }
  52282. }
  52283. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  52284. }
  52285. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  52286. if (styleBinding) {
  52287. el.styleBinding = styleBinding;
  52288. }
  52289. }
  52290. function genData$1 (el) {
  52291. var data = '';
  52292. if (el.staticStyle) {
  52293. data += "staticStyle:" + (el.staticStyle) + ",";
  52294. }
  52295. if (el.styleBinding) {
  52296. data += "style:(" + (el.styleBinding) + "),";
  52297. }
  52298. return data
  52299. }
  52300. var style$1 = {
  52301. staticKeys: ['staticStyle'],
  52302. transformNode: transformNode$1,
  52303. genData: genData$1
  52304. };
  52305. /* */
  52306. var decoder;
  52307. var he = {
  52308. decode: function decode (html) {
  52309. decoder = decoder || document.createElement('div');
  52310. decoder.innerHTML = html;
  52311. return decoder.textContent
  52312. }
  52313. };
  52314. /* */
  52315. var isUnaryTag = makeMap(
  52316. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  52317. 'link,meta,param,source,track,wbr'
  52318. );
  52319. // Elements that you can, intentionally, leave open
  52320. // (and which close themselves)
  52321. var canBeLeftOpenTag = makeMap(
  52322. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  52323. );
  52324. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  52325. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  52326. var isNonPhrasingTag = makeMap(
  52327. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  52328. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  52329. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  52330. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  52331. 'title,tr,track'
  52332. );
  52333. /**
  52334. * Not type-checking this file because it's mostly vendor code.
  52335. */
  52336. // Regular Expressions for parsing tags and attributes
  52337. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  52338. var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  52339. var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
  52340. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  52341. var startTagOpen = new RegExp(("^<" + qnameCapture));
  52342. var startTagClose = /^\s*(\/?)>/;
  52343. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  52344. var doctype = /^<!DOCTYPE [^>]+>/i;
  52345. // #7298: escape - to avoid being passed as HTML comment when inlined in page
  52346. var comment = /^<!\--/;
  52347. var conditionalComment = /^<!\[/;
  52348. // Special Elements (can contain anything)
  52349. var isPlainTextElement = makeMap('script,style,textarea', true);
  52350. var reCache = {};
  52351. var decodingMap = {
  52352. '&lt;': '<',
  52353. '&gt;': '>',
  52354. '&quot;': '"',
  52355. '&amp;': '&',
  52356. '&#10;': '\n',
  52357. '&#9;': '\t',
  52358. '&#39;': "'"
  52359. };
  52360. var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
  52361. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
  52362. // #5992
  52363. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  52364. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  52365. function decodeAttr (value, shouldDecodeNewlines) {
  52366. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  52367. return value.replace(re, function (match) { return decodingMap[match]; })
  52368. }
  52369. function parseHTML (html, options) {
  52370. var stack = [];
  52371. var expectHTML = options.expectHTML;
  52372. var isUnaryTag$$1 = options.isUnaryTag || no;
  52373. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  52374. var index = 0;
  52375. var last, lastTag;
  52376. while (html) {
  52377. last = html;
  52378. // Make sure we're not in a plaintext content element like script/style
  52379. if (!lastTag || !isPlainTextElement(lastTag)) {
  52380. var textEnd = html.indexOf('<');
  52381. if (textEnd === 0) {
  52382. // Comment:
  52383. if (comment.test(html)) {
  52384. var commentEnd = html.indexOf('-->');
  52385. if (commentEnd >= 0) {
  52386. if (options.shouldKeepComment) {
  52387. options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
  52388. }
  52389. advance(commentEnd + 3);
  52390. continue
  52391. }
  52392. }
  52393. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  52394. if (conditionalComment.test(html)) {
  52395. var conditionalEnd = html.indexOf(']>');
  52396. if (conditionalEnd >= 0) {
  52397. advance(conditionalEnd + 2);
  52398. continue
  52399. }
  52400. }
  52401. // Doctype:
  52402. var doctypeMatch = html.match(doctype);
  52403. if (doctypeMatch) {
  52404. advance(doctypeMatch[0].length);
  52405. continue
  52406. }
  52407. // End tag:
  52408. var endTagMatch = html.match(endTag);
  52409. if (endTagMatch) {
  52410. var curIndex = index;
  52411. advance(endTagMatch[0].length);
  52412. parseEndTag(endTagMatch[1], curIndex, index);
  52413. continue
  52414. }
  52415. // Start tag:
  52416. var startTagMatch = parseStartTag();
  52417. if (startTagMatch) {
  52418. handleStartTag(startTagMatch);
  52419. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  52420. advance(1);
  52421. }
  52422. continue
  52423. }
  52424. }
  52425. var text = (void 0), rest = (void 0), next = (void 0);
  52426. if (textEnd >= 0) {
  52427. rest = html.slice(textEnd);
  52428. while (
  52429. !endTag.test(rest) &&
  52430. !startTagOpen.test(rest) &&
  52431. !comment.test(rest) &&
  52432. !conditionalComment.test(rest)
  52433. ) {
  52434. // < in plain text, be forgiving and treat it as text
  52435. next = rest.indexOf('<', 1);
  52436. if (next < 0) { break }
  52437. textEnd += next;
  52438. rest = html.slice(textEnd);
  52439. }
  52440. text = html.substring(0, textEnd);
  52441. }
  52442. if (textEnd < 0) {
  52443. text = html;
  52444. }
  52445. if (text) {
  52446. advance(text.length);
  52447. }
  52448. if (options.chars && text) {
  52449. options.chars(text, index - text.length, index);
  52450. }
  52451. } else {
  52452. var endTagLength = 0;
  52453. var stackedTag = lastTag.toLowerCase();
  52454. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  52455. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  52456. endTagLength = endTag.length;
  52457. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  52458. text = text
  52459. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  52460. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  52461. }
  52462. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  52463. text = text.slice(1);
  52464. }
  52465. if (options.chars) {
  52466. options.chars(text);
  52467. }
  52468. return ''
  52469. });
  52470. index += html.length - rest$1.length;
  52471. html = rest$1;
  52472. parseEndTag(stackedTag, index - endTagLength, index);
  52473. }
  52474. if (html === last) {
  52475. options.chars && options.chars(html);
  52476. if (!stack.length && options.warn) {
  52477. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
  52478. }
  52479. break
  52480. }
  52481. }
  52482. // Clean up any remaining tags
  52483. parseEndTag();
  52484. function advance (n) {
  52485. index += n;
  52486. html = html.substring(n);
  52487. }
  52488. function parseStartTag () {
  52489. var start = html.match(startTagOpen);
  52490. if (start) {
  52491. var match = {
  52492. tagName: start[1],
  52493. attrs: [],
  52494. start: index
  52495. };
  52496. advance(start[0].length);
  52497. var end, attr;
  52498. while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
  52499. attr.start = index;
  52500. advance(attr[0].length);
  52501. attr.end = index;
  52502. match.attrs.push(attr);
  52503. }
  52504. if (end) {
  52505. match.unarySlash = end[1];
  52506. advance(end[0].length);
  52507. match.end = index;
  52508. return match
  52509. }
  52510. }
  52511. }
  52512. function handleStartTag (match) {
  52513. var tagName = match.tagName;
  52514. var unarySlash = match.unarySlash;
  52515. if (expectHTML) {
  52516. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  52517. parseEndTag(lastTag);
  52518. }
  52519. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  52520. parseEndTag(tagName);
  52521. }
  52522. }
  52523. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  52524. var l = match.attrs.length;
  52525. var attrs = new Array(l);
  52526. for (var i = 0; i < l; i++) {
  52527. var args = match.attrs[i];
  52528. var value = args[3] || args[4] || args[5] || '';
  52529. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  52530. ? options.shouldDecodeNewlinesForHref
  52531. : options.shouldDecodeNewlines;
  52532. attrs[i] = {
  52533. name: args[1],
  52534. value: decodeAttr(value, shouldDecodeNewlines)
  52535. };
  52536. if (options.outputSourceRange) {
  52537. attrs[i].start = args.start + args[0].match(/^\s*/).length;
  52538. attrs[i].end = args.end;
  52539. }
  52540. }
  52541. if (!unary) {
  52542. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
  52543. lastTag = tagName;
  52544. }
  52545. if (options.start) {
  52546. options.start(tagName, attrs, unary, match.start, match.end);
  52547. }
  52548. }
  52549. function parseEndTag (tagName, start, end) {
  52550. var pos, lowerCasedTagName;
  52551. if (start == null) { start = index; }
  52552. if (end == null) { end = index; }
  52553. // Find the closest opened tag of the same type
  52554. if (tagName) {
  52555. lowerCasedTagName = tagName.toLowerCase();
  52556. for (pos = stack.length - 1; pos >= 0; pos--) {
  52557. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  52558. break
  52559. }
  52560. }
  52561. } else {
  52562. // If no tag name is provided, clean shop
  52563. pos = 0;
  52564. }
  52565. if (pos >= 0) {
  52566. // Close all the open elements, up the stack
  52567. for (var i = stack.length - 1; i >= pos; i--) {
  52568. if (i > pos || !tagName &&
  52569. options.warn
  52570. ) {
  52571. options.warn(
  52572. ("tag <" + (stack[i].tag) + "> has no matching end tag."),
  52573. { start: stack[i].start, end: stack[i].end }
  52574. );
  52575. }
  52576. if (options.end) {
  52577. options.end(stack[i].tag, start, end);
  52578. }
  52579. }
  52580. // Remove the open elements from the stack
  52581. stack.length = pos;
  52582. lastTag = pos && stack[pos - 1].tag;
  52583. } else if (lowerCasedTagName === 'br') {
  52584. if (options.start) {
  52585. options.start(tagName, [], true, start, end);
  52586. }
  52587. } else if (lowerCasedTagName === 'p') {
  52588. if (options.start) {
  52589. options.start(tagName, [], false, start, end);
  52590. }
  52591. if (options.end) {
  52592. options.end(tagName, start, end);
  52593. }
  52594. }
  52595. }
  52596. }
  52597. /* */
  52598. var onRE = /^@|^v-on:/;
  52599. var dirRE = /^v-|^@|^:|^#/;
  52600. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  52601. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  52602. var stripParensRE = /^\(|\)$/g;
  52603. var dynamicArgRE = /^\[.*\]$/;
  52604. var argRE = /:(.*)$/;
  52605. var bindRE = /^:|^\.|^v-bind:/;
  52606. var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
  52607. var slotRE = /^v-slot(:|$)|^#/;
  52608. var lineBreakRE = /[\r\n]/;
  52609. var whitespaceRE$1 = /\s+/g;
  52610. var invalidAttributeRE = /[\s"'<>\/=]/;
  52611. var decodeHTMLCached = cached(he.decode);
  52612. var emptySlotScopeToken = "_empty_";
  52613. // configurable state
  52614. var warn$2;
  52615. var delimiters;
  52616. var transforms;
  52617. var preTransforms;
  52618. var postTransforms;
  52619. var platformIsPreTag;
  52620. var platformMustUseProp;
  52621. var platformGetTagNamespace;
  52622. var maybeComponent;
  52623. function createASTElement (
  52624. tag,
  52625. attrs,
  52626. parent
  52627. ) {
  52628. return {
  52629. type: 1,
  52630. tag: tag,
  52631. attrsList: attrs,
  52632. attrsMap: makeAttrsMap(attrs),
  52633. rawAttrsMap: {},
  52634. parent: parent,
  52635. children: []
  52636. }
  52637. }
  52638. /**
  52639. * Convert HTML string to AST.
  52640. */
  52641. function parse (
  52642. template,
  52643. options
  52644. ) {
  52645. warn$2 = options.warn || baseWarn;
  52646. platformIsPreTag = options.isPreTag || no;
  52647. platformMustUseProp = options.mustUseProp || no;
  52648. platformGetTagNamespace = options.getTagNamespace || no;
  52649. var isReservedTag = options.isReservedTag || no;
  52650. maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  52651. transforms = pluckModuleFunction(options.modules, 'transformNode');
  52652. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  52653. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  52654. delimiters = options.delimiters;
  52655. var stack = [];
  52656. var preserveWhitespace = options.preserveWhitespace !== false;
  52657. var whitespaceOption = options.whitespace;
  52658. var root;
  52659. var currentParent;
  52660. var inVPre = false;
  52661. var inPre = false;
  52662. var warned = false;
  52663. function warnOnce (msg, range) {
  52664. if (!warned) {
  52665. warned = true;
  52666. warn$2(msg, range);
  52667. }
  52668. }
  52669. function closeElement (element) {
  52670. trimEndingWhitespace(element);
  52671. if (!inVPre && !element.processed) {
  52672. element = processElement(element, options);
  52673. }
  52674. // tree management
  52675. if (!stack.length && element !== root) {
  52676. // allow root elements with v-if, v-else-if and v-else
  52677. if (root.if && (element.elseif || element.else)) {
  52678. {
  52679. checkRootConstraints(element);
  52680. }
  52681. addIfCondition(root, {
  52682. exp: element.elseif,
  52683. block: element
  52684. });
  52685. } else {
  52686. warnOnce(
  52687. "Component template should contain exactly one root element. " +
  52688. "If you are using v-if on multiple elements, " +
  52689. "use v-else-if to chain them instead.",
  52690. { start: element.start }
  52691. );
  52692. }
  52693. }
  52694. if (currentParent && !element.forbidden) {
  52695. if (element.elseif || element.else) {
  52696. processIfConditions(element, currentParent);
  52697. } else {
  52698. if (element.slotScope) {
  52699. // scoped slot
  52700. // keep it in the children list so that v-else(-if) conditions can
  52701. // find it as the prev node.
  52702. var name = element.slotTarget || '"default"'
  52703. ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  52704. }
  52705. currentParent.children.push(element);
  52706. element.parent = currentParent;
  52707. }
  52708. }
  52709. // final children cleanup
  52710. // filter out scoped slots
  52711. element.children = element.children.filter(function (c) { return !(c).slotScope; });
  52712. // remove trailing whitespace node again
  52713. trimEndingWhitespace(element);
  52714. // check pre state
  52715. if (element.pre) {
  52716. inVPre = false;
  52717. }
  52718. if (platformIsPreTag(element.tag)) {
  52719. inPre = false;
  52720. }
  52721. // apply post-transforms
  52722. for (var i = 0; i < postTransforms.length; i++) {
  52723. postTransforms[i](element, options);
  52724. }
  52725. }
  52726. function trimEndingWhitespace (el) {
  52727. // remove trailing whitespace node
  52728. if (!inPre) {
  52729. var lastNode;
  52730. while (
  52731. (lastNode = el.children[el.children.length - 1]) &&
  52732. lastNode.type === 3 &&
  52733. lastNode.text === ' '
  52734. ) {
  52735. el.children.pop();
  52736. }
  52737. }
  52738. }
  52739. function checkRootConstraints (el) {
  52740. if (el.tag === 'slot' || el.tag === 'template') {
  52741. warnOnce(
  52742. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  52743. 'contain multiple nodes.',
  52744. { start: el.start }
  52745. );
  52746. }
  52747. if (el.attrsMap.hasOwnProperty('v-for')) {
  52748. warnOnce(
  52749. 'Cannot use v-for on stateful component root element because ' +
  52750. 'it renders multiple elements.',
  52751. el.rawAttrsMap['v-for']
  52752. );
  52753. }
  52754. }
  52755. parseHTML(template, {
  52756. warn: warn$2,
  52757. expectHTML: options.expectHTML,
  52758. isUnaryTag: options.isUnaryTag,
  52759. canBeLeftOpenTag: options.canBeLeftOpenTag,
  52760. shouldDecodeNewlines: options.shouldDecodeNewlines,
  52761. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  52762. shouldKeepComment: options.comments,
  52763. outputSourceRange: options.outputSourceRange,
  52764. start: function start (tag, attrs, unary, start$1, end) {
  52765. // check namespace.
  52766. // inherit parent ns if there is one
  52767. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  52768. // handle IE svg bug
  52769. /* istanbul ignore if */
  52770. if (isIE && ns === 'svg') {
  52771. attrs = guardIESVGBug(attrs);
  52772. }
  52773. var element = createASTElement(tag, attrs, currentParent);
  52774. if (ns) {
  52775. element.ns = ns;
  52776. }
  52777. {
  52778. if (options.outputSourceRange) {
  52779. element.start = start$1;
  52780. element.end = end;
  52781. element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
  52782. cumulated[attr.name] = attr;
  52783. return cumulated
  52784. }, {});
  52785. }
  52786. attrs.forEach(function (attr) {
  52787. if (invalidAttributeRE.test(attr.name)) {
  52788. warn$2(
  52789. "Invalid dynamic argument expression: attribute names cannot contain " +
  52790. "spaces, quotes, <, >, / or =.",
  52791. {
  52792. start: attr.start + attr.name.indexOf("["),
  52793. end: attr.start + attr.name.length
  52794. }
  52795. );
  52796. }
  52797. });
  52798. }
  52799. if (isForbiddenTag(element) && !isServerRendering()) {
  52800. element.forbidden = true;
  52801. warn$2(
  52802. 'Templates should only be responsible for mapping the state to the ' +
  52803. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  52804. "<" + tag + ">" + ', as they will not be parsed.',
  52805. { start: element.start }
  52806. );
  52807. }
  52808. // apply pre-transforms
  52809. for (var i = 0; i < preTransforms.length; i++) {
  52810. element = preTransforms[i](element, options) || element;
  52811. }
  52812. if (!inVPre) {
  52813. processPre(element);
  52814. if (element.pre) {
  52815. inVPre = true;
  52816. }
  52817. }
  52818. if (platformIsPreTag(element.tag)) {
  52819. inPre = true;
  52820. }
  52821. if (inVPre) {
  52822. processRawAttrs(element);
  52823. } else if (!element.processed) {
  52824. // structural directives
  52825. processFor(element);
  52826. processIf(element);
  52827. processOnce(element);
  52828. }
  52829. if (!root) {
  52830. root = element;
  52831. {
  52832. checkRootConstraints(root);
  52833. }
  52834. }
  52835. if (!unary) {
  52836. currentParent = element;
  52837. stack.push(element);
  52838. } else {
  52839. closeElement(element);
  52840. }
  52841. },
  52842. end: function end (tag, start, end$1) {
  52843. var element = stack[stack.length - 1];
  52844. // pop stack
  52845. stack.length -= 1;
  52846. currentParent = stack[stack.length - 1];
  52847. if (options.outputSourceRange) {
  52848. element.end = end$1;
  52849. }
  52850. closeElement(element);
  52851. },
  52852. chars: function chars (text, start, end) {
  52853. if (!currentParent) {
  52854. {
  52855. if (text === template) {
  52856. warnOnce(
  52857. 'Component template requires a root element, rather than just text.',
  52858. { start: start }
  52859. );
  52860. } else if ((text = text.trim())) {
  52861. warnOnce(
  52862. ("text \"" + text + "\" outside root element will be ignored."),
  52863. { start: start }
  52864. );
  52865. }
  52866. }
  52867. return
  52868. }
  52869. // IE textarea placeholder bug
  52870. /* istanbul ignore if */
  52871. if (isIE &&
  52872. currentParent.tag === 'textarea' &&
  52873. currentParent.attrsMap.placeholder === text
  52874. ) {
  52875. return
  52876. }
  52877. var children = currentParent.children;
  52878. if (inPre || text.trim()) {
  52879. text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
  52880. } else if (!children.length) {
  52881. // remove the whitespace-only node right after an opening tag
  52882. text = '';
  52883. } else if (whitespaceOption) {
  52884. if (whitespaceOption === 'condense') {
  52885. // in condense mode, remove the whitespace node if it contains
  52886. // line break, otherwise condense to a single space
  52887. text = lineBreakRE.test(text) ? '' : ' ';
  52888. } else {
  52889. text = ' ';
  52890. }
  52891. } else {
  52892. text = preserveWhitespace ? ' ' : '';
  52893. }
  52894. if (text) {
  52895. if (!inPre && whitespaceOption === 'condense') {
  52896. // condense consecutive whitespaces into single space
  52897. text = text.replace(whitespaceRE$1, ' ');
  52898. }
  52899. var res;
  52900. var child;
  52901. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  52902. child = {
  52903. type: 2,
  52904. expression: res.expression,
  52905. tokens: res.tokens,
  52906. text: text
  52907. };
  52908. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  52909. child = {
  52910. type: 3,
  52911. text: text
  52912. };
  52913. }
  52914. if (child) {
  52915. if (options.outputSourceRange) {
  52916. child.start = start;
  52917. child.end = end;
  52918. }
  52919. children.push(child);
  52920. }
  52921. }
  52922. },
  52923. comment: function comment (text, start, end) {
  52924. // adding anyting as a sibling to the root node is forbidden
  52925. // comments should still be allowed, but ignored
  52926. if (currentParent) {
  52927. var child = {
  52928. type: 3,
  52929. text: text,
  52930. isComment: true
  52931. };
  52932. if (options.outputSourceRange) {
  52933. child.start = start;
  52934. child.end = end;
  52935. }
  52936. currentParent.children.push(child);
  52937. }
  52938. }
  52939. });
  52940. return root
  52941. }
  52942. function processPre (el) {
  52943. if (getAndRemoveAttr(el, 'v-pre') != null) {
  52944. el.pre = true;
  52945. }
  52946. }
  52947. function processRawAttrs (el) {
  52948. var list = el.attrsList;
  52949. var len = list.length;
  52950. if (len) {
  52951. var attrs = el.attrs = new Array(len);
  52952. for (var i = 0; i < len; i++) {
  52953. attrs[i] = {
  52954. name: list[i].name,
  52955. value: JSON.stringify(list[i].value)
  52956. };
  52957. if (list[i].start != null) {
  52958. attrs[i].start = list[i].start;
  52959. attrs[i].end = list[i].end;
  52960. }
  52961. }
  52962. } else if (!el.pre) {
  52963. // non root node in pre blocks with no attributes
  52964. el.plain = true;
  52965. }
  52966. }
  52967. function processElement (
  52968. element,
  52969. options
  52970. ) {
  52971. processKey(element);
  52972. // determine whether this is a plain element after
  52973. // removing structural attributes
  52974. element.plain = (
  52975. !element.key &&
  52976. !element.scopedSlots &&
  52977. !element.attrsList.length
  52978. );
  52979. processRef(element);
  52980. processSlotContent(element);
  52981. processSlotOutlet(element);
  52982. processComponent(element);
  52983. for (var i = 0; i < transforms.length; i++) {
  52984. element = transforms[i](element, options) || element;
  52985. }
  52986. processAttrs(element);
  52987. return element
  52988. }
  52989. function processKey (el) {
  52990. var exp = getBindingAttr(el, 'key');
  52991. if (exp) {
  52992. {
  52993. if (el.tag === 'template') {
  52994. warn$2(
  52995. "<template> cannot be keyed. Place the key on real elements instead.",
  52996. getRawBindingAttr(el, 'key')
  52997. );
  52998. }
  52999. if (el.for) {
  53000. var iterator = el.iterator2 || el.iterator1;
  53001. var parent = el.parent;
  53002. if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
  53003. warn$2(
  53004. "Do not use v-for index as key on <transition-group> children, " +
  53005. "this is the same as not using keys.",
  53006. getRawBindingAttr(el, 'key'),
  53007. true /* tip */
  53008. );
  53009. }
  53010. }
  53011. }
  53012. el.key = exp;
  53013. }
  53014. }
  53015. function processRef (el) {
  53016. var ref = getBindingAttr(el, 'ref');
  53017. if (ref) {
  53018. el.ref = ref;
  53019. el.refInFor = checkInFor(el);
  53020. }
  53021. }
  53022. function processFor (el) {
  53023. var exp;
  53024. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  53025. var res = parseFor(exp);
  53026. if (res) {
  53027. extend(el, res);
  53028. } else {
  53029. warn$2(
  53030. ("Invalid v-for expression: " + exp),
  53031. el.rawAttrsMap['v-for']
  53032. );
  53033. }
  53034. }
  53035. }
  53036. function parseFor (exp) {
  53037. var inMatch = exp.match(forAliasRE);
  53038. if (!inMatch) { return }
  53039. var res = {};
  53040. res.for = inMatch[2].trim();
  53041. var alias = inMatch[1].trim().replace(stripParensRE, '');
  53042. var iteratorMatch = alias.match(forIteratorRE);
  53043. if (iteratorMatch) {
  53044. res.alias = alias.replace(forIteratorRE, '').trim();
  53045. res.iterator1 = iteratorMatch[1].trim();
  53046. if (iteratorMatch[2]) {
  53047. res.iterator2 = iteratorMatch[2].trim();
  53048. }
  53049. } else {
  53050. res.alias = alias;
  53051. }
  53052. return res
  53053. }
  53054. function processIf (el) {
  53055. var exp = getAndRemoveAttr(el, 'v-if');
  53056. if (exp) {
  53057. el.if = exp;
  53058. addIfCondition(el, {
  53059. exp: exp,
  53060. block: el
  53061. });
  53062. } else {
  53063. if (getAndRemoveAttr(el, 'v-else') != null) {
  53064. el.else = true;
  53065. }
  53066. var elseif = getAndRemoveAttr(el, 'v-else-if');
  53067. if (elseif) {
  53068. el.elseif = elseif;
  53069. }
  53070. }
  53071. }
  53072. function processIfConditions (el, parent) {
  53073. var prev = findPrevElement(parent.children);
  53074. if (prev && prev.if) {
  53075. addIfCondition(prev, {
  53076. exp: el.elseif,
  53077. block: el
  53078. });
  53079. } else {
  53080. warn$2(
  53081. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  53082. "used on element <" + (el.tag) + "> without corresponding v-if.",
  53083. el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
  53084. );
  53085. }
  53086. }
  53087. function findPrevElement (children) {
  53088. var i = children.length;
  53089. while (i--) {
  53090. if (children[i].type === 1) {
  53091. return children[i]
  53092. } else {
  53093. if (children[i].text !== ' ') {
  53094. warn$2(
  53095. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  53096. "will be ignored.",
  53097. children[i]
  53098. );
  53099. }
  53100. children.pop();
  53101. }
  53102. }
  53103. }
  53104. function addIfCondition (el, condition) {
  53105. if (!el.ifConditions) {
  53106. el.ifConditions = [];
  53107. }
  53108. el.ifConditions.push(condition);
  53109. }
  53110. function processOnce (el) {
  53111. var once$$1 = getAndRemoveAttr(el, 'v-once');
  53112. if (once$$1 != null) {
  53113. el.once = true;
  53114. }
  53115. }
  53116. // handle content being passed to a component as slot,
  53117. // e.g. <template slot="xxx">, <div slot-scope="xxx">
  53118. function processSlotContent (el) {
  53119. var slotScope;
  53120. if (el.tag === 'template') {
  53121. slotScope = getAndRemoveAttr(el, 'scope');
  53122. /* istanbul ignore if */
  53123. if (slotScope) {
  53124. warn$2(
  53125. "the \"scope\" attribute for scoped slots have been deprecated and " +
  53126. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  53127. "can also be used on plain elements in addition to <template> to " +
  53128. "denote scoped slots.",
  53129. el.rawAttrsMap['scope'],
  53130. true
  53131. );
  53132. }
  53133. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  53134. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  53135. /* istanbul ignore if */
  53136. if (el.attrsMap['v-for']) {
  53137. warn$2(
  53138. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  53139. "(v-for takes higher priority). Use a wrapper <template> for the " +
  53140. "scoped slot to make it clearer.",
  53141. el.rawAttrsMap['slot-scope'],
  53142. true
  53143. );
  53144. }
  53145. el.slotScope = slotScope;
  53146. }
  53147. // slot="xxx"
  53148. var slotTarget = getBindingAttr(el, 'slot');
  53149. if (slotTarget) {
  53150. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  53151. el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
  53152. // preserve slot as an attribute for native shadow DOM compat
  53153. // only for non-scoped slots.
  53154. if (el.tag !== 'template' && !el.slotScope) {
  53155. addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
  53156. }
  53157. }
  53158. // 2.6 v-slot syntax
  53159. {
  53160. if (el.tag === 'template') {
  53161. // v-slot on <template>
  53162. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  53163. if (slotBinding) {
  53164. {
  53165. if (el.slotTarget || el.slotScope) {
  53166. warn$2(
  53167. "Unexpected mixed usage of different slot syntaxes.",
  53168. el
  53169. );
  53170. }
  53171. if (el.parent && !maybeComponent(el.parent)) {
  53172. warn$2(
  53173. "<template v-slot> can only appear at the root level inside " +
  53174. "the receiving component",
  53175. el
  53176. );
  53177. }
  53178. }
  53179. var ref = getSlotName(slotBinding);
  53180. var name = ref.name;
  53181. var dynamic = ref.dynamic;
  53182. el.slotTarget = name;
  53183. el.slotTargetDynamic = dynamic;
  53184. el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
  53185. }
  53186. } else {
  53187. // v-slot on component, denotes default slot
  53188. var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
  53189. if (slotBinding$1) {
  53190. {
  53191. if (!maybeComponent(el)) {
  53192. warn$2(
  53193. "v-slot can only be used on components or <template>.",
  53194. slotBinding$1
  53195. );
  53196. }
  53197. if (el.slotScope || el.slotTarget) {
  53198. warn$2(
  53199. "Unexpected mixed usage of different slot syntaxes.",
  53200. el
  53201. );
  53202. }
  53203. if (el.scopedSlots) {
  53204. warn$2(
  53205. "To avoid scope ambiguity, the default slot should also use " +
  53206. "<template> syntax when there are other named slots.",
  53207. slotBinding$1
  53208. );
  53209. }
  53210. }
  53211. // add the component's children to its default slot
  53212. var slots = el.scopedSlots || (el.scopedSlots = {});
  53213. var ref$1 = getSlotName(slotBinding$1);
  53214. var name$1 = ref$1.name;
  53215. var dynamic$1 = ref$1.dynamic;
  53216. var slotContainer = slots[name$1] = createASTElement('template', [], el);
  53217. slotContainer.slotTarget = name$1;
  53218. slotContainer.slotTargetDynamic = dynamic$1;
  53219. slotContainer.children = el.children.filter(function (c) {
  53220. if (!c.slotScope) {
  53221. c.parent = slotContainer;
  53222. return true
  53223. }
  53224. });
  53225. slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
  53226. // remove children as they are returned from scopedSlots now
  53227. el.children = [];
  53228. // mark el non-plain so data gets generated
  53229. el.plain = false;
  53230. }
  53231. }
  53232. }
  53233. }
  53234. function getSlotName (binding) {
  53235. var name = binding.name.replace(slotRE, '');
  53236. if (!name) {
  53237. if (binding.name[0] !== '#') {
  53238. name = 'default';
  53239. } else {
  53240. warn$2(
  53241. "v-slot shorthand syntax requires a slot name.",
  53242. binding
  53243. );
  53244. }
  53245. }
  53246. return dynamicArgRE.test(name)
  53247. // dynamic [name]
  53248. ? { name: name.slice(1, -1), dynamic: true }
  53249. // static name
  53250. : { name: ("\"" + name + "\""), dynamic: false }
  53251. }
  53252. // handle <slot/> outlets
  53253. function processSlotOutlet (el) {
  53254. if (el.tag === 'slot') {
  53255. el.slotName = getBindingAttr(el, 'name');
  53256. if (el.key) {
  53257. warn$2(
  53258. "`key` does not work on <slot> because slots are abstract outlets " +
  53259. "and can possibly expand into multiple elements. " +
  53260. "Use the key on a wrapping element instead.",
  53261. getRawBindingAttr(el, 'key')
  53262. );
  53263. }
  53264. }
  53265. }
  53266. function processComponent (el) {
  53267. var binding;
  53268. if ((binding = getBindingAttr(el, 'is'))) {
  53269. el.component = binding;
  53270. }
  53271. if (getAndRemoveAttr(el, 'inline-template') != null) {
  53272. el.inlineTemplate = true;
  53273. }
  53274. }
  53275. function processAttrs (el) {
  53276. var list = el.attrsList;
  53277. var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
  53278. for (i = 0, l = list.length; i < l; i++) {
  53279. name = rawName = list[i].name;
  53280. value = list[i].value;
  53281. if (dirRE.test(name)) {
  53282. // mark element as dynamic
  53283. el.hasBindings = true;
  53284. // modifiers
  53285. modifiers = parseModifiers(name.replace(dirRE, ''));
  53286. // support .foo shorthand syntax for the .prop modifier
  53287. if (modifiers) {
  53288. name = name.replace(modifierRE, '');
  53289. }
  53290. if (bindRE.test(name)) { // v-bind
  53291. name = name.replace(bindRE, '');
  53292. value = parseFilters(value);
  53293. isDynamic = dynamicArgRE.test(name);
  53294. if (isDynamic) {
  53295. name = name.slice(1, -1);
  53296. }
  53297. if (
  53298. value.trim().length === 0
  53299. ) {
  53300. warn$2(
  53301. ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
  53302. );
  53303. }
  53304. if (modifiers) {
  53305. if (modifiers.prop && !isDynamic) {
  53306. name = camelize(name);
  53307. if (name === 'innerHtml') { name = 'innerHTML'; }
  53308. }
  53309. if (modifiers.camel && !isDynamic) {
  53310. name = camelize(name);
  53311. }
  53312. if (modifiers.sync) {
  53313. syncGen = genAssignmentCode(value, "$event");
  53314. if (!isDynamic) {
  53315. addHandler(
  53316. el,
  53317. ("update:" + (camelize(name))),
  53318. syncGen,
  53319. null,
  53320. false,
  53321. warn$2,
  53322. list[i]
  53323. );
  53324. if (hyphenate(name) !== camelize(name)) {
  53325. addHandler(
  53326. el,
  53327. ("update:" + (hyphenate(name))),
  53328. syncGen,
  53329. null,
  53330. false,
  53331. warn$2,
  53332. list[i]
  53333. );
  53334. }
  53335. } else {
  53336. // handler w/ dynamic event name
  53337. addHandler(
  53338. el,
  53339. ("\"update:\"+(" + name + ")"),
  53340. syncGen,
  53341. null,
  53342. false,
  53343. warn$2,
  53344. list[i],
  53345. true // dynamic
  53346. );
  53347. }
  53348. }
  53349. }
  53350. if ((modifiers && modifiers.prop) || (
  53351. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  53352. )) {
  53353. addProp(el, name, value, list[i], isDynamic);
  53354. } else {
  53355. addAttr(el, name, value, list[i], isDynamic);
  53356. }
  53357. } else if (onRE.test(name)) { // v-on
  53358. name = name.replace(onRE, '');
  53359. isDynamic = dynamicArgRE.test(name);
  53360. if (isDynamic) {
  53361. name = name.slice(1, -1);
  53362. }
  53363. addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
  53364. } else { // normal directives
  53365. name = name.replace(dirRE, '');
  53366. // parse arg
  53367. var argMatch = name.match(argRE);
  53368. var arg = argMatch && argMatch[1];
  53369. isDynamic = false;
  53370. if (arg) {
  53371. name = name.slice(0, -(arg.length + 1));
  53372. if (dynamicArgRE.test(arg)) {
  53373. arg = arg.slice(1, -1);
  53374. isDynamic = true;
  53375. }
  53376. }
  53377. addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
  53378. if (name === 'model') {
  53379. checkForAliasModel(el, value);
  53380. }
  53381. }
  53382. } else {
  53383. // literal attribute
  53384. {
  53385. var res = parseText(value, delimiters);
  53386. if (res) {
  53387. warn$2(
  53388. name + "=\"" + value + "\": " +
  53389. 'Interpolation inside attributes has been removed. ' +
  53390. 'Use v-bind or the colon shorthand instead. For example, ' +
  53391. 'instead of <div id="{{ val }}">, use <div :id="val">.',
  53392. list[i]
  53393. );
  53394. }
  53395. }
  53396. addAttr(el, name, JSON.stringify(value), list[i]);
  53397. // #6887 firefox doesn't update muted state if set via attribute
  53398. // even immediately after element creation
  53399. if (!el.component &&
  53400. name === 'muted' &&
  53401. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  53402. addProp(el, name, 'true', list[i]);
  53403. }
  53404. }
  53405. }
  53406. }
  53407. function checkInFor (el) {
  53408. var parent = el;
  53409. while (parent) {
  53410. if (parent.for !== undefined) {
  53411. return true
  53412. }
  53413. parent = parent.parent;
  53414. }
  53415. return false
  53416. }
  53417. function parseModifiers (name) {
  53418. var match = name.match(modifierRE);
  53419. if (match) {
  53420. var ret = {};
  53421. match.forEach(function (m) { ret[m.slice(1)] = true; });
  53422. return ret
  53423. }
  53424. }
  53425. function makeAttrsMap (attrs) {
  53426. var map = {};
  53427. for (var i = 0, l = attrs.length; i < l; i++) {
  53428. if (
  53429. map[attrs[i].name] && !isIE && !isEdge
  53430. ) {
  53431. warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
  53432. }
  53433. map[attrs[i].name] = attrs[i].value;
  53434. }
  53435. return map
  53436. }
  53437. // for script (e.g. type="x/template") or style, do not decode content
  53438. function isTextTag (el) {
  53439. return el.tag === 'script' || el.tag === 'style'
  53440. }
  53441. function isForbiddenTag (el) {
  53442. return (
  53443. el.tag === 'style' ||
  53444. (el.tag === 'script' && (
  53445. !el.attrsMap.type ||
  53446. el.attrsMap.type === 'text/javascript'
  53447. ))
  53448. )
  53449. }
  53450. var ieNSBug = /^xmlns:NS\d+/;
  53451. var ieNSPrefix = /^NS\d+:/;
  53452. /* istanbul ignore next */
  53453. function guardIESVGBug (attrs) {
  53454. var res = [];
  53455. for (var i = 0; i < attrs.length; i++) {
  53456. var attr = attrs[i];
  53457. if (!ieNSBug.test(attr.name)) {
  53458. attr.name = attr.name.replace(ieNSPrefix, '');
  53459. res.push(attr);
  53460. }
  53461. }
  53462. return res
  53463. }
  53464. function checkForAliasModel (el, value) {
  53465. var _el = el;
  53466. while (_el) {
  53467. if (_el.for && _el.alias === value) {
  53468. warn$2(
  53469. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  53470. "You are binding v-model directly to a v-for iteration alias. " +
  53471. "This will not be able to modify the v-for source array because " +
  53472. "writing to the alias is like modifying a function local variable. " +
  53473. "Consider using an array of objects and use v-model on an object property instead.",
  53474. el.rawAttrsMap['v-model']
  53475. );
  53476. }
  53477. _el = _el.parent;
  53478. }
  53479. }
  53480. /* */
  53481. function preTransformNode (el, options) {
  53482. if (el.tag === 'input') {
  53483. var map = el.attrsMap;
  53484. if (!map['v-model']) {
  53485. return
  53486. }
  53487. var typeBinding;
  53488. if (map[':type'] || map['v-bind:type']) {
  53489. typeBinding = getBindingAttr(el, 'type');
  53490. }
  53491. if (!map.type && !typeBinding && map['v-bind']) {
  53492. typeBinding = "(" + (map['v-bind']) + ").type";
  53493. }
  53494. if (typeBinding) {
  53495. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  53496. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  53497. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  53498. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  53499. // 1. checkbox
  53500. var branch0 = cloneASTElement(el);
  53501. // process for on the main node
  53502. processFor(branch0);
  53503. addRawAttr(branch0, 'type', 'checkbox');
  53504. processElement(branch0, options);
  53505. branch0.processed = true; // prevent it from double-processed
  53506. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  53507. addIfCondition(branch0, {
  53508. exp: branch0.if,
  53509. block: branch0
  53510. });
  53511. // 2. add radio else-if condition
  53512. var branch1 = cloneASTElement(el);
  53513. getAndRemoveAttr(branch1, 'v-for', true);
  53514. addRawAttr(branch1, 'type', 'radio');
  53515. processElement(branch1, options);
  53516. addIfCondition(branch0, {
  53517. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  53518. block: branch1
  53519. });
  53520. // 3. other
  53521. var branch2 = cloneASTElement(el);
  53522. getAndRemoveAttr(branch2, 'v-for', true);
  53523. addRawAttr(branch2, ':type', typeBinding);
  53524. processElement(branch2, options);
  53525. addIfCondition(branch0, {
  53526. exp: ifCondition,
  53527. block: branch2
  53528. });
  53529. if (hasElse) {
  53530. branch0.else = true;
  53531. } else if (elseIfCondition) {
  53532. branch0.elseif = elseIfCondition;
  53533. }
  53534. return branch0
  53535. }
  53536. }
  53537. }
  53538. function cloneASTElement (el) {
  53539. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  53540. }
  53541. var model$1 = {
  53542. preTransformNode: preTransformNode
  53543. };
  53544. var modules$1 = [
  53545. klass$1,
  53546. style$1,
  53547. model$1
  53548. ];
  53549. /* */
  53550. function text (el, dir) {
  53551. if (dir.value) {
  53552. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
  53553. }
  53554. }
  53555. /* */
  53556. function html (el, dir) {
  53557. if (dir.value) {
  53558. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
  53559. }
  53560. }
  53561. var directives$1 = {
  53562. model: model,
  53563. text: text,
  53564. html: html
  53565. };
  53566. /* */
  53567. var baseOptions = {
  53568. expectHTML: true,
  53569. modules: modules$1,
  53570. directives: directives$1,
  53571. isPreTag: isPreTag,
  53572. isUnaryTag: isUnaryTag,
  53573. mustUseProp: mustUseProp,
  53574. canBeLeftOpenTag: canBeLeftOpenTag,
  53575. isReservedTag: isReservedTag,
  53576. getTagNamespace: getTagNamespace,
  53577. staticKeys: genStaticKeys(modules$1)
  53578. };
  53579. /* */
  53580. var isStaticKey;
  53581. var isPlatformReservedTag;
  53582. var genStaticKeysCached = cached(genStaticKeys$1);
  53583. /**
  53584. * Goal of the optimizer: walk the generated template AST tree
  53585. * and detect sub-trees that are purely static, i.e. parts of
  53586. * the DOM that never needs to change.
  53587. *
  53588. * Once we detect these sub-trees, we can:
  53589. *
  53590. * 1. Hoist them into constants, so that we no longer need to
  53591. * create fresh nodes for them on each re-render;
  53592. * 2. Completely skip them in the patching process.
  53593. */
  53594. function optimize (root, options) {
  53595. if (!root) { return }
  53596. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  53597. isPlatformReservedTag = options.isReservedTag || no;
  53598. // first pass: mark all non-static nodes.
  53599. markStatic$1(root);
  53600. // second pass: mark static roots.
  53601. markStaticRoots(root, false);
  53602. }
  53603. function genStaticKeys$1 (keys) {
  53604. return makeMap(
  53605. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
  53606. (keys ? ',' + keys : '')
  53607. )
  53608. }
  53609. function markStatic$1 (node) {
  53610. node.static = isStatic(node);
  53611. if (node.type === 1) {
  53612. // do not make component slot content static. this avoids
  53613. // 1. components not able to mutate slot nodes
  53614. // 2. static slot content fails for hot-reloading
  53615. if (
  53616. !isPlatformReservedTag(node.tag) &&
  53617. node.tag !== 'slot' &&
  53618. node.attrsMap['inline-template'] == null
  53619. ) {
  53620. return
  53621. }
  53622. for (var i = 0, l = node.children.length; i < l; i++) {
  53623. var child = node.children[i];
  53624. markStatic$1(child);
  53625. if (!child.static) {
  53626. node.static = false;
  53627. }
  53628. }
  53629. if (node.ifConditions) {
  53630. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  53631. var block = node.ifConditions[i$1].block;
  53632. markStatic$1(block);
  53633. if (!block.static) {
  53634. node.static = false;
  53635. }
  53636. }
  53637. }
  53638. }
  53639. }
  53640. function markStaticRoots (node, isInFor) {
  53641. if (node.type === 1) {
  53642. if (node.static || node.once) {
  53643. node.staticInFor = isInFor;
  53644. }
  53645. // For a node to qualify as a static root, it should have children that
  53646. // are not just static text. Otherwise the cost of hoisting out will
  53647. // outweigh the benefits and it's better off to just always render it fresh.
  53648. if (node.static && node.children.length && !(
  53649. node.children.length === 1 &&
  53650. node.children[0].type === 3
  53651. )) {
  53652. node.staticRoot = true;
  53653. return
  53654. } else {
  53655. node.staticRoot = false;
  53656. }
  53657. if (node.children) {
  53658. for (var i = 0, l = node.children.length; i < l; i++) {
  53659. markStaticRoots(node.children[i], isInFor || !!node.for);
  53660. }
  53661. }
  53662. if (node.ifConditions) {
  53663. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  53664. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  53665. }
  53666. }
  53667. }
  53668. }
  53669. function isStatic (node) {
  53670. if (node.type === 2) { // expression
  53671. return false
  53672. }
  53673. if (node.type === 3) { // text
  53674. return true
  53675. }
  53676. return !!(node.pre || (
  53677. !node.hasBindings && // no dynamic bindings
  53678. !node.if && !node.for && // not v-if or v-for or v-else
  53679. !isBuiltInTag(node.tag) && // not a built-in
  53680. isPlatformReservedTag(node.tag) && // not a component
  53681. !isDirectChildOfTemplateFor(node) &&
  53682. Object.keys(node).every(isStaticKey)
  53683. ))
  53684. }
  53685. function isDirectChildOfTemplateFor (node) {
  53686. while (node.parent) {
  53687. node = node.parent;
  53688. if (node.tag !== 'template') {
  53689. return false
  53690. }
  53691. if (node.for) {
  53692. return true
  53693. }
  53694. }
  53695. return false
  53696. }
  53697. /* */
  53698. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
  53699. var fnInvokeRE = /\([^)]*?\);*$/;
  53700. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  53701. // KeyboardEvent.keyCode aliases
  53702. var keyCodes = {
  53703. esc: 27,
  53704. tab: 9,
  53705. enter: 13,
  53706. space: 32,
  53707. up: 38,
  53708. left: 37,
  53709. right: 39,
  53710. down: 40,
  53711. 'delete': [8, 46]
  53712. };
  53713. // KeyboardEvent.key aliases
  53714. var keyNames = {
  53715. // #7880: IE11 and Edge use `Esc` for Escape key name.
  53716. esc: ['Esc', 'Escape'],
  53717. tab: 'Tab',
  53718. enter: 'Enter',
  53719. // #9112: IE11 uses `Spacebar` for Space key name.
  53720. space: [' ', 'Spacebar'],
  53721. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  53722. up: ['Up', 'ArrowUp'],
  53723. left: ['Left', 'ArrowLeft'],
  53724. right: ['Right', 'ArrowRight'],
  53725. down: ['Down', 'ArrowDown'],
  53726. // #9112: IE11 uses `Del` for Delete key name.
  53727. 'delete': ['Backspace', 'Delete', 'Del']
  53728. };
  53729. // #4868: modifiers that prevent the execution of the listener
  53730. // need to explicitly return null so that we can determine whether to remove
  53731. // the listener for .once
  53732. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  53733. var modifierCode = {
  53734. stop: '$event.stopPropagation();',
  53735. prevent: '$event.preventDefault();',
  53736. self: genGuard("$event.target !== $event.currentTarget"),
  53737. ctrl: genGuard("!$event.ctrlKey"),
  53738. shift: genGuard("!$event.shiftKey"),
  53739. alt: genGuard("!$event.altKey"),
  53740. meta: genGuard("!$event.metaKey"),
  53741. left: genGuard("'button' in $event && $event.button !== 0"),
  53742. middle: genGuard("'button' in $event && $event.button !== 1"),
  53743. right: genGuard("'button' in $event && $event.button !== 2")
  53744. };
  53745. function genHandlers (
  53746. events,
  53747. isNative
  53748. ) {
  53749. var prefix = isNative ? 'nativeOn:' : 'on:';
  53750. var staticHandlers = "";
  53751. var dynamicHandlers = "";
  53752. for (var name in events) {
  53753. var handlerCode = genHandler(events[name]);
  53754. if (events[name] && events[name].dynamic) {
  53755. dynamicHandlers += name + "," + handlerCode + ",";
  53756. } else {
  53757. staticHandlers += "\"" + name + "\":" + handlerCode + ",";
  53758. }
  53759. }
  53760. staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
  53761. if (dynamicHandlers) {
  53762. return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
  53763. } else {
  53764. return prefix + staticHandlers
  53765. }
  53766. }
  53767. function genHandler (handler) {
  53768. if (!handler) {
  53769. return 'function(){}'
  53770. }
  53771. if (Array.isArray(handler)) {
  53772. return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
  53773. }
  53774. var isMethodPath = simplePathRE.test(handler.value);
  53775. var isFunctionExpression = fnExpRE.test(handler.value);
  53776. var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
  53777. if (!handler.modifiers) {
  53778. if (isMethodPath || isFunctionExpression) {
  53779. return handler.value
  53780. }
  53781. return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
  53782. } else {
  53783. var code = '';
  53784. var genModifierCode = '';
  53785. var keys = [];
  53786. for (var key in handler.modifiers) {
  53787. if (modifierCode[key]) {
  53788. genModifierCode += modifierCode[key];
  53789. // left/right
  53790. if (keyCodes[key]) {
  53791. keys.push(key);
  53792. }
  53793. } else if (key === 'exact') {
  53794. var modifiers = (handler.modifiers);
  53795. genModifierCode += genGuard(
  53796. ['ctrl', 'shift', 'alt', 'meta']
  53797. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  53798. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  53799. .join('||')
  53800. );
  53801. } else {
  53802. keys.push(key);
  53803. }
  53804. }
  53805. if (keys.length) {
  53806. code += genKeyFilter(keys);
  53807. }
  53808. // Make sure modifiers like prevent and stop get executed after key filtering
  53809. if (genModifierCode) {
  53810. code += genModifierCode;
  53811. }
  53812. var handlerCode = isMethodPath
  53813. ? ("return " + (handler.value) + "($event)")
  53814. : isFunctionExpression
  53815. ? ("return (" + (handler.value) + ")($event)")
  53816. : isFunctionInvocation
  53817. ? ("return " + (handler.value))
  53818. : handler.value;
  53819. return ("function($event){" + code + handlerCode + "}")
  53820. }
  53821. }
  53822. function genKeyFilter (keys) {
  53823. return (
  53824. // make sure the key filters only apply to KeyboardEvents
  53825. // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
  53826. // key events that do not have keyCode property...
  53827. "if(!$event.type.indexOf('key')&&" +
  53828. (keys.map(genFilterCode).join('&&')) + ")return null;"
  53829. )
  53830. }
  53831. function genFilterCode (key) {
  53832. var keyVal = parseInt(key, 10);
  53833. if (keyVal) {
  53834. return ("$event.keyCode!==" + keyVal)
  53835. }
  53836. var keyCode = keyCodes[key];
  53837. var keyName = keyNames[key];
  53838. return (
  53839. "_k($event.keyCode," +
  53840. (JSON.stringify(key)) + "," +
  53841. (JSON.stringify(keyCode)) + "," +
  53842. "$event.key," +
  53843. "" + (JSON.stringify(keyName)) +
  53844. ")"
  53845. )
  53846. }
  53847. /* */
  53848. function on (el, dir) {
  53849. if (dir.modifiers) {
  53850. warn("v-on without argument does not support modifiers.");
  53851. }
  53852. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  53853. }
  53854. /* */
  53855. function bind$1 (el, dir) {
  53856. el.wrapData = function (code) {
  53857. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  53858. };
  53859. }
  53860. /* */
  53861. var baseDirectives = {
  53862. on: on,
  53863. bind: bind$1,
  53864. cloak: noop
  53865. };
  53866. /* */
  53867. var CodegenState = function CodegenState (options) {
  53868. this.options = options;
  53869. this.warn = options.warn || baseWarn;
  53870. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  53871. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  53872. this.directives = extend(extend({}, baseDirectives), options.directives);
  53873. var isReservedTag = options.isReservedTag || no;
  53874. this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  53875. this.onceId = 0;
  53876. this.staticRenderFns = [];
  53877. this.pre = false;
  53878. };
  53879. function generate (
  53880. ast,
  53881. options
  53882. ) {
  53883. var state = new CodegenState(options);
  53884. var code = ast ? genElement(ast, state) : '_c("div")';
  53885. return {
  53886. render: ("with(this){return " + code + "}"),
  53887. staticRenderFns: state.staticRenderFns
  53888. }
  53889. }
  53890. function genElement (el, state) {
  53891. if (el.parent) {
  53892. el.pre = el.pre || el.parent.pre;
  53893. }
  53894. if (el.staticRoot && !el.staticProcessed) {
  53895. return genStatic(el, state)
  53896. } else if (el.once && !el.onceProcessed) {
  53897. return genOnce(el, state)
  53898. } else if (el.for && !el.forProcessed) {
  53899. return genFor(el, state)
  53900. } else if (el.if && !el.ifProcessed) {
  53901. return genIf(el, state)
  53902. } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  53903. return genChildren(el, state) || 'void 0'
  53904. } else if (el.tag === 'slot') {
  53905. return genSlot(el, state)
  53906. } else {
  53907. // component or element
  53908. var code;
  53909. if (el.component) {
  53910. code = genComponent(el.component, el, state);
  53911. } else {
  53912. var data;
  53913. if (!el.plain || (el.pre && state.maybeComponent(el))) {
  53914. data = genData$2(el, state);
  53915. }
  53916. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  53917. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  53918. }
  53919. // module transforms
  53920. for (var i = 0; i < state.transforms.length; i++) {
  53921. code = state.transforms[i](el, code);
  53922. }
  53923. return code
  53924. }
  53925. }
  53926. // hoist static sub-trees out
  53927. function genStatic (el, state) {
  53928. el.staticProcessed = true;
  53929. // Some elements (templates) need to behave differently inside of a v-pre
  53930. // node. All pre nodes are static roots, so we can use this as a location to
  53931. // wrap a state change and reset it upon exiting the pre node.
  53932. var originalPreState = state.pre;
  53933. if (el.pre) {
  53934. state.pre = el.pre;
  53935. }
  53936. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  53937. state.pre = originalPreState;
  53938. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  53939. }
  53940. // v-once
  53941. function genOnce (el, state) {
  53942. el.onceProcessed = true;
  53943. if (el.if && !el.ifProcessed) {
  53944. return genIf(el, state)
  53945. } else if (el.staticInFor) {
  53946. var key = '';
  53947. var parent = el.parent;
  53948. while (parent) {
  53949. if (parent.for) {
  53950. key = parent.key;
  53951. break
  53952. }
  53953. parent = parent.parent;
  53954. }
  53955. if (!key) {
  53956. state.warn(
  53957. "v-once can only be used inside v-for that is keyed. ",
  53958. el.rawAttrsMap['v-once']
  53959. );
  53960. return genElement(el, state)
  53961. }
  53962. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  53963. } else {
  53964. return genStatic(el, state)
  53965. }
  53966. }
  53967. function genIf (
  53968. el,
  53969. state,
  53970. altGen,
  53971. altEmpty
  53972. ) {
  53973. el.ifProcessed = true; // avoid recursion
  53974. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  53975. }
  53976. function genIfConditions (
  53977. conditions,
  53978. state,
  53979. altGen,
  53980. altEmpty
  53981. ) {
  53982. if (!conditions.length) {
  53983. return altEmpty || '_e()'
  53984. }
  53985. var condition = conditions.shift();
  53986. if (condition.exp) {
  53987. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  53988. } else {
  53989. return ("" + (genTernaryExp(condition.block)))
  53990. }
  53991. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  53992. function genTernaryExp (el) {
  53993. return altGen
  53994. ? altGen(el, state)
  53995. : el.once
  53996. ? genOnce(el, state)
  53997. : genElement(el, state)
  53998. }
  53999. }
  54000. function genFor (
  54001. el,
  54002. state,
  54003. altGen,
  54004. altHelper
  54005. ) {
  54006. var exp = el.for;
  54007. var alias = el.alias;
  54008. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  54009. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  54010. if (state.maybeComponent(el) &&
  54011. el.tag !== 'slot' &&
  54012. el.tag !== 'template' &&
  54013. !el.key
  54014. ) {
  54015. state.warn(
  54016. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  54017. "v-for should have explicit keys. " +
  54018. "See https://vuejs.org/guide/list.html#key for more info.",
  54019. el.rawAttrsMap['v-for'],
  54020. true /* tip */
  54021. );
  54022. }
  54023. el.forProcessed = true; // avoid recursion
  54024. return (altHelper || '_l') + "((" + exp + ")," +
  54025. "function(" + alias + iterator1 + iterator2 + "){" +
  54026. "return " + ((altGen || genElement)(el, state)) +
  54027. '})'
  54028. }
  54029. function genData$2 (el, state) {
  54030. var data = '{';
  54031. // directives first.
  54032. // directives may mutate the el's other properties before they are generated.
  54033. var dirs = genDirectives(el, state);
  54034. if (dirs) { data += dirs + ','; }
  54035. // key
  54036. if (el.key) {
  54037. data += "key:" + (el.key) + ",";
  54038. }
  54039. // ref
  54040. if (el.ref) {
  54041. data += "ref:" + (el.ref) + ",";
  54042. }
  54043. if (el.refInFor) {
  54044. data += "refInFor:true,";
  54045. }
  54046. // pre
  54047. if (el.pre) {
  54048. data += "pre:true,";
  54049. }
  54050. // record original tag name for components using "is" attribute
  54051. if (el.component) {
  54052. data += "tag:\"" + (el.tag) + "\",";
  54053. }
  54054. // module data generation functions
  54055. for (var i = 0; i < state.dataGenFns.length; i++) {
  54056. data += state.dataGenFns[i](el);
  54057. }
  54058. // attributes
  54059. if (el.attrs) {
  54060. data += "attrs:" + (genProps(el.attrs)) + ",";
  54061. }
  54062. // DOM props
  54063. if (el.props) {
  54064. data += "domProps:" + (genProps(el.props)) + ",";
  54065. }
  54066. // event handlers
  54067. if (el.events) {
  54068. data += (genHandlers(el.events, false)) + ",";
  54069. }
  54070. if (el.nativeEvents) {
  54071. data += (genHandlers(el.nativeEvents, true)) + ",";
  54072. }
  54073. // slot target
  54074. // only for non-scoped slots
  54075. if (el.slotTarget && !el.slotScope) {
  54076. data += "slot:" + (el.slotTarget) + ",";
  54077. }
  54078. // scoped slots
  54079. if (el.scopedSlots) {
  54080. data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
  54081. }
  54082. // component v-model
  54083. if (el.model) {
  54084. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  54085. }
  54086. // inline-template
  54087. if (el.inlineTemplate) {
  54088. var inlineTemplate = genInlineTemplate(el, state);
  54089. if (inlineTemplate) {
  54090. data += inlineTemplate + ",";
  54091. }
  54092. }
  54093. data = data.replace(/,$/, '') + '}';
  54094. // v-bind dynamic argument wrap
  54095. // v-bind with dynamic arguments must be applied using the same v-bind object
  54096. // merge helper so that class/style/mustUseProp attrs are handled correctly.
  54097. if (el.dynamicAttrs) {
  54098. data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
  54099. }
  54100. // v-bind data wrap
  54101. if (el.wrapData) {
  54102. data = el.wrapData(data);
  54103. }
  54104. // v-on data wrap
  54105. if (el.wrapListeners) {
  54106. data = el.wrapListeners(data);
  54107. }
  54108. return data
  54109. }
  54110. function genDirectives (el, state) {
  54111. var dirs = el.directives;
  54112. if (!dirs) { return }
  54113. var res = 'directives:[';
  54114. var hasRuntime = false;
  54115. var i, l, dir, needRuntime;
  54116. for (i = 0, l = dirs.length; i < l; i++) {
  54117. dir = dirs[i];
  54118. needRuntime = true;
  54119. var gen = state.directives[dir.name];
  54120. if (gen) {
  54121. // compile-time directive that manipulates AST.
  54122. // returns true if it also needs a runtime counterpart.
  54123. needRuntime = !!gen(el, dir, state.warn);
  54124. }
  54125. if (needRuntime) {
  54126. hasRuntime = true;
  54127. 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))) : '') + "},";
  54128. }
  54129. }
  54130. if (hasRuntime) {
  54131. return res.slice(0, -1) + ']'
  54132. }
  54133. }
  54134. function genInlineTemplate (el, state) {
  54135. var ast = el.children[0];
  54136. if (el.children.length !== 1 || ast.type !== 1) {
  54137. state.warn(
  54138. 'Inline-template components must have exactly one child element.',
  54139. { start: el.start }
  54140. );
  54141. }
  54142. if (ast && ast.type === 1) {
  54143. var inlineRenderFns = generate(ast, state.options);
  54144. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  54145. }
  54146. }
  54147. function genScopedSlots (
  54148. el,
  54149. slots,
  54150. state
  54151. ) {
  54152. // by default scoped slots are considered "stable", this allows child
  54153. // components with only scoped slots to skip forced updates from parent.
  54154. // but in some cases we have to bail-out of this optimization
  54155. // for example if the slot contains dynamic names, has v-if or v-for on them...
  54156. var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
  54157. var slot = slots[key];
  54158. return (
  54159. slot.slotTargetDynamic ||
  54160. slot.if ||
  54161. slot.for ||
  54162. containsSlotChild(slot) // is passing down slot from parent which may be dynamic
  54163. )
  54164. });
  54165. // #9534: if a component with scoped slots is inside a conditional branch,
  54166. // it's possible for the same component to be reused but with different
  54167. // compiled slot content. To avoid that, we generate a unique key based on
  54168. // the generated code of all the slot contents.
  54169. var needsKey = !!el.if;
  54170. // OR when it is inside another scoped slot or v-for (the reactivity may be
  54171. // disconnected due to the intermediate scope variable)
  54172. // #9438, #9506
  54173. // TODO: this can be further optimized by properly analyzing in-scope bindings
  54174. // and skip force updating ones that do not actually use scope variables.
  54175. if (!needsForceUpdate) {
  54176. var parent = el.parent;
  54177. while (parent) {
  54178. if (
  54179. (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
  54180. parent.for
  54181. ) {
  54182. needsForceUpdate = true;
  54183. break
  54184. }
  54185. if (parent.if) {
  54186. needsKey = true;
  54187. }
  54188. parent = parent.parent;
  54189. }
  54190. }
  54191. var generatedSlots = Object.keys(slots)
  54192. .map(function (key) { return genScopedSlot(slots[key], state); })
  54193. .join(',');
  54194. return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
  54195. }
  54196. function hash(str) {
  54197. var hash = 5381;
  54198. var i = str.length;
  54199. while(i) {
  54200. hash = (hash * 33) ^ str.charCodeAt(--i);
  54201. }
  54202. return hash >>> 0
  54203. }
  54204. function containsSlotChild (el) {
  54205. if (el.type === 1) {
  54206. if (el.tag === 'slot') {
  54207. return true
  54208. }
  54209. return el.children.some(containsSlotChild)
  54210. }
  54211. return false
  54212. }
  54213. function genScopedSlot (
  54214. el,
  54215. state
  54216. ) {
  54217. var isLegacySyntax = el.attrsMap['slot-scope'];
  54218. if (el.if && !el.ifProcessed && !isLegacySyntax) {
  54219. return genIf(el, state, genScopedSlot, "null")
  54220. }
  54221. if (el.for && !el.forProcessed) {
  54222. return genFor(el, state, genScopedSlot)
  54223. }
  54224. var slotScope = el.slotScope === emptySlotScopeToken
  54225. ? ""
  54226. : String(el.slotScope);
  54227. var fn = "function(" + slotScope + "){" +
  54228. "return " + (el.tag === 'template'
  54229. ? el.if && isLegacySyntax
  54230. ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
  54231. : genChildren(el, state) || 'undefined'
  54232. : genElement(el, state)) + "}";
  54233. // reverse proxy v-slot without scope on this.$slots
  54234. var reverseProxy = slotScope ? "" : ",proxy:true";
  54235. return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
  54236. }
  54237. function genChildren (
  54238. el,
  54239. state,
  54240. checkSkip,
  54241. altGenElement,
  54242. altGenNode
  54243. ) {
  54244. var children = el.children;
  54245. if (children.length) {
  54246. var el$1 = children[0];
  54247. // optimize single v-for
  54248. if (children.length === 1 &&
  54249. el$1.for &&
  54250. el$1.tag !== 'template' &&
  54251. el$1.tag !== 'slot'
  54252. ) {
  54253. var normalizationType = checkSkip
  54254. ? state.maybeComponent(el$1) ? ",1" : ",0"
  54255. : "";
  54256. return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
  54257. }
  54258. var normalizationType$1 = checkSkip
  54259. ? getNormalizationType(children, state.maybeComponent)
  54260. : 0;
  54261. var gen = altGenNode || genNode;
  54262. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
  54263. }
  54264. }
  54265. // determine the normalization needed for the children array.
  54266. // 0: no normalization needed
  54267. // 1: simple normalization needed (possible 1-level deep nested array)
  54268. // 2: full normalization needed
  54269. function getNormalizationType (
  54270. children,
  54271. maybeComponent
  54272. ) {
  54273. var res = 0;
  54274. for (var i = 0; i < children.length; i++) {
  54275. var el = children[i];
  54276. if (el.type !== 1) {
  54277. continue
  54278. }
  54279. if (needsNormalization(el) ||
  54280. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  54281. res = 2;
  54282. break
  54283. }
  54284. if (maybeComponent(el) ||
  54285. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  54286. res = 1;
  54287. }
  54288. }
  54289. return res
  54290. }
  54291. function needsNormalization (el) {
  54292. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  54293. }
  54294. function genNode (node, state) {
  54295. if (node.type === 1) {
  54296. return genElement(node, state)
  54297. } else if (node.type === 3 && node.isComment) {
  54298. return genComment(node)
  54299. } else {
  54300. return genText(node)
  54301. }
  54302. }
  54303. function genText (text) {
  54304. return ("_v(" + (text.type === 2
  54305. ? text.expression // no need for () because already wrapped in _s()
  54306. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  54307. }
  54308. function genComment (comment) {
  54309. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  54310. }
  54311. function genSlot (el, state) {
  54312. var slotName = el.slotName || '"default"';
  54313. var children = genChildren(el, state);
  54314. var res = "_t(" + slotName + (children ? ("," + children) : '');
  54315. var attrs = el.attrs || el.dynamicAttrs
  54316. ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
  54317. // slot props are camelized
  54318. name: camelize(attr.name),
  54319. value: attr.value,
  54320. dynamic: attr.dynamic
  54321. }); }))
  54322. : null;
  54323. var bind$$1 = el.attrsMap['v-bind'];
  54324. if ((attrs || bind$$1) && !children) {
  54325. res += ",null";
  54326. }
  54327. if (attrs) {
  54328. res += "," + attrs;
  54329. }
  54330. if (bind$$1) {
  54331. res += (attrs ? '' : ',null') + "," + bind$$1;
  54332. }
  54333. return res + ')'
  54334. }
  54335. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  54336. function genComponent (
  54337. componentName,
  54338. el,
  54339. state
  54340. ) {
  54341. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  54342. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  54343. }
  54344. function genProps (props) {
  54345. var staticProps = "";
  54346. var dynamicProps = "";
  54347. for (var i = 0; i < props.length; i++) {
  54348. var prop = props[i];
  54349. var value = transformSpecialNewlines(prop.value);
  54350. if (prop.dynamic) {
  54351. dynamicProps += (prop.name) + "," + value + ",";
  54352. } else {
  54353. staticProps += "\"" + (prop.name) + "\":" + value + ",";
  54354. }
  54355. }
  54356. staticProps = "{" + (staticProps.slice(0, -1)) + "}";
  54357. if (dynamicProps) {
  54358. return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
  54359. } else {
  54360. return staticProps
  54361. }
  54362. }
  54363. // #3895, #4268
  54364. function transformSpecialNewlines (text) {
  54365. return text
  54366. .replace(/\u2028/g, '\\u2028')
  54367. .replace(/\u2029/g, '\\u2029')
  54368. }
  54369. /* */
  54370. // these keywords should not appear inside expressions, but operators like
  54371. // typeof, instanceof and in are allowed
  54372. var prohibitedKeywordRE = new RegExp('\\b' + (
  54373. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  54374. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  54375. 'extends,finally,continue,debugger,function,arguments'
  54376. ).split(',').join('\\b|\\b') + '\\b');
  54377. // these unary operators should not be used as property/method names
  54378. var unaryOperatorsRE = new RegExp('\\b' + (
  54379. 'delete,typeof,void'
  54380. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  54381. // strip strings in expressions
  54382. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  54383. // detect problematic expressions in a template
  54384. function detectErrors (ast, warn) {
  54385. if (ast) {
  54386. checkNode(ast, warn);
  54387. }
  54388. }
  54389. function checkNode (node, warn) {
  54390. if (node.type === 1) {
  54391. for (var name in node.attrsMap) {
  54392. if (dirRE.test(name)) {
  54393. var value = node.attrsMap[name];
  54394. if (value) {
  54395. var range = node.rawAttrsMap[name];
  54396. if (name === 'v-for') {
  54397. checkFor(node, ("v-for=\"" + value + "\""), warn, range);
  54398. } else if (name === 'v-slot' || name[0] === '#') {
  54399. checkFunctionParameterExpression(value, (name + "=\"" + value + "\""), warn, range);
  54400. } else if (onRE.test(name)) {
  54401. checkEvent(value, (name + "=\"" + value + "\""), warn, range);
  54402. } else {
  54403. checkExpression(value, (name + "=\"" + value + "\""), warn, range);
  54404. }
  54405. }
  54406. }
  54407. }
  54408. if (node.children) {
  54409. for (var i = 0; i < node.children.length; i++) {
  54410. checkNode(node.children[i], warn);
  54411. }
  54412. }
  54413. } else if (node.type === 2) {
  54414. checkExpression(node.expression, node.text, warn, node);
  54415. }
  54416. }
  54417. function checkEvent (exp, text, warn, range) {
  54418. var stripped = exp.replace(stripStringRE, '');
  54419. var keywordMatch = stripped.match(unaryOperatorsRE);
  54420. if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
  54421. warn(
  54422. "avoid using JavaScript unary operator as property name: " +
  54423. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
  54424. range
  54425. );
  54426. }
  54427. checkExpression(exp, text, warn, range);
  54428. }
  54429. function checkFor (node, text, warn, range) {
  54430. checkExpression(node.for || '', text, warn, range);
  54431. checkIdentifier(node.alias, 'v-for alias', text, warn, range);
  54432. checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
  54433. checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
  54434. }
  54435. function checkIdentifier (
  54436. ident,
  54437. type,
  54438. text,
  54439. warn,
  54440. range
  54441. ) {
  54442. if (typeof ident === 'string') {
  54443. try {
  54444. new Function(("var " + ident + "=_"));
  54445. } catch (e) {
  54446. warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
  54447. }
  54448. }
  54449. }
  54450. function checkExpression (exp, text, warn, range) {
  54451. try {
  54452. new Function(("return " + exp));
  54453. } catch (e) {
  54454. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  54455. if (keywordMatch) {
  54456. warn(
  54457. "avoid using JavaScript keyword as property name: " +
  54458. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
  54459. range
  54460. );
  54461. } else {
  54462. warn(
  54463. "invalid expression: " + (e.message) + " in\n\n" +
  54464. " " + exp + "\n\n" +
  54465. " Raw expression: " + (text.trim()) + "\n",
  54466. range
  54467. );
  54468. }
  54469. }
  54470. }
  54471. function checkFunctionParameterExpression (exp, text, warn, range) {
  54472. try {
  54473. new Function(exp, '');
  54474. } catch (e) {
  54475. warn(
  54476. "invalid function parameter expression: " + (e.message) + " in\n\n" +
  54477. " " + exp + "\n\n" +
  54478. " Raw expression: " + (text.trim()) + "\n",
  54479. range
  54480. );
  54481. }
  54482. }
  54483. /* */
  54484. var range = 2;
  54485. function generateCodeFrame (
  54486. source,
  54487. start,
  54488. end
  54489. ) {
  54490. if ( start === void 0 ) start = 0;
  54491. if ( end === void 0 ) end = source.length;
  54492. var lines = source.split(/\r?\n/);
  54493. var count = 0;
  54494. var res = [];
  54495. for (var i = 0; i < lines.length; i++) {
  54496. count += lines[i].length + 1;
  54497. if (count >= start) {
  54498. for (var j = i - range; j <= i + range || end > count; j++) {
  54499. if (j < 0 || j >= lines.length) { continue }
  54500. res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
  54501. var lineLength = lines[j].length;
  54502. if (j === i) {
  54503. // push underline
  54504. var pad = start - (count - lineLength) + 1;
  54505. var length = end > count ? lineLength - pad : end - start;
  54506. res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
  54507. } else if (j > i) {
  54508. if (end > count) {
  54509. var length$1 = Math.min(end - count, lineLength);
  54510. res.push(" | " + repeat$1("^", length$1));
  54511. }
  54512. count += lineLength + 1;
  54513. }
  54514. }
  54515. break
  54516. }
  54517. }
  54518. return res.join('\n')
  54519. }
  54520. function repeat$1 (str, n) {
  54521. var result = '';
  54522. if (n > 0) {
  54523. while (true) { // eslint-disable-line
  54524. if (n & 1) { result += str; }
  54525. n >>>= 1;
  54526. if (n <= 0) { break }
  54527. str += str;
  54528. }
  54529. }
  54530. return result
  54531. }
  54532. /* */
  54533. function createFunction (code, errors) {
  54534. try {
  54535. return new Function(code)
  54536. } catch (err) {
  54537. errors.push({ err: err, code: code });
  54538. return noop
  54539. }
  54540. }
  54541. function createCompileToFunctionFn (compile) {
  54542. var cache = Object.create(null);
  54543. return function compileToFunctions (
  54544. template,
  54545. options,
  54546. vm
  54547. ) {
  54548. options = extend({}, options);
  54549. var warn$$1 = options.warn || warn;
  54550. delete options.warn;
  54551. /* istanbul ignore if */
  54552. {
  54553. // detect possible CSP restriction
  54554. try {
  54555. new Function('return 1');
  54556. } catch (e) {
  54557. if (e.toString().match(/unsafe-eval|CSP/)) {
  54558. warn$$1(
  54559. 'It seems you are using the standalone build of Vue.js in an ' +
  54560. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  54561. 'The template compiler cannot work in this environment. Consider ' +
  54562. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  54563. 'templates into render functions.'
  54564. );
  54565. }
  54566. }
  54567. }
  54568. // check cache
  54569. var key = options.delimiters
  54570. ? String(options.delimiters) + template
  54571. : template;
  54572. if (cache[key]) {
  54573. return cache[key]
  54574. }
  54575. // compile
  54576. var compiled = compile(template, options);
  54577. // check compilation errors/tips
  54578. {
  54579. if (compiled.errors && compiled.errors.length) {
  54580. if (options.outputSourceRange) {
  54581. compiled.errors.forEach(function (e) {
  54582. warn$$1(
  54583. "Error compiling template:\n\n" + (e.msg) + "\n\n" +
  54584. generateCodeFrame(template, e.start, e.end),
  54585. vm
  54586. );
  54587. });
  54588. } else {
  54589. warn$$1(
  54590. "Error compiling template:\n\n" + template + "\n\n" +
  54591. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  54592. vm
  54593. );
  54594. }
  54595. }
  54596. if (compiled.tips && compiled.tips.length) {
  54597. if (options.outputSourceRange) {
  54598. compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
  54599. } else {
  54600. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  54601. }
  54602. }
  54603. }
  54604. // turn code into functions
  54605. var res = {};
  54606. var fnGenErrors = [];
  54607. res.render = createFunction(compiled.render, fnGenErrors);
  54608. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  54609. return createFunction(code, fnGenErrors)
  54610. });
  54611. // check function generation errors.
  54612. // this should only happen if there is a bug in the compiler itself.
  54613. // mostly for codegen development use
  54614. /* istanbul ignore if */
  54615. {
  54616. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  54617. warn$$1(
  54618. "Failed to generate render function:\n\n" +
  54619. fnGenErrors.map(function (ref) {
  54620. var err = ref.err;
  54621. var code = ref.code;
  54622. return ((err.toString()) + " in\n\n" + code + "\n");
  54623. }).join('\n'),
  54624. vm
  54625. );
  54626. }
  54627. }
  54628. return (cache[key] = res)
  54629. }
  54630. }
  54631. /* */
  54632. function createCompilerCreator (baseCompile) {
  54633. return function createCompiler (baseOptions) {
  54634. function compile (
  54635. template,
  54636. options
  54637. ) {
  54638. var finalOptions = Object.create(baseOptions);
  54639. var errors = [];
  54640. var tips = [];
  54641. var warn = function (msg, range, tip) {
  54642. (tip ? tips : errors).push(msg);
  54643. };
  54644. if (options) {
  54645. if (options.outputSourceRange) {
  54646. // $flow-disable-line
  54647. var leadingSpaceLength = template.match(/^\s*/)[0].length;
  54648. warn = function (msg, range, tip) {
  54649. var data = { msg: msg };
  54650. if (range) {
  54651. if (range.start != null) {
  54652. data.start = range.start + leadingSpaceLength;
  54653. }
  54654. if (range.end != null) {
  54655. data.end = range.end + leadingSpaceLength;
  54656. }
  54657. }
  54658. (tip ? tips : errors).push(data);
  54659. };
  54660. }
  54661. // merge custom modules
  54662. if (options.modules) {
  54663. finalOptions.modules =
  54664. (baseOptions.modules || []).concat(options.modules);
  54665. }
  54666. // merge custom directives
  54667. if (options.directives) {
  54668. finalOptions.directives = extend(
  54669. Object.create(baseOptions.directives || null),
  54670. options.directives
  54671. );
  54672. }
  54673. // copy other options
  54674. for (var key in options) {
  54675. if (key !== 'modules' && key !== 'directives') {
  54676. finalOptions[key] = options[key];
  54677. }
  54678. }
  54679. }
  54680. finalOptions.warn = warn;
  54681. var compiled = baseCompile(template.trim(), finalOptions);
  54682. {
  54683. detectErrors(compiled.ast, warn);
  54684. }
  54685. compiled.errors = errors;
  54686. compiled.tips = tips;
  54687. return compiled
  54688. }
  54689. return {
  54690. compile: compile,
  54691. compileToFunctions: createCompileToFunctionFn(compile)
  54692. }
  54693. }
  54694. }
  54695. /* */
  54696. // `createCompilerCreator` allows creating compilers that use alternative
  54697. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  54698. // Here we just export a default compiler using the default parts.
  54699. var createCompiler = createCompilerCreator(function baseCompile (
  54700. template,
  54701. options
  54702. ) {
  54703. var ast = parse(template.trim(), options);
  54704. if (options.optimize !== false) {
  54705. optimize(ast, options);
  54706. }
  54707. var code = generate(ast, options);
  54708. return {
  54709. ast: ast,
  54710. render: code.render,
  54711. staticRenderFns: code.staticRenderFns
  54712. }
  54713. });
  54714. /* */
  54715. var ref$1 = createCompiler(baseOptions);
  54716. var compile = ref$1.compile;
  54717. var compileToFunctions = ref$1.compileToFunctions;
  54718. /* */
  54719. // check whether current browser encodes a char inside attribute values
  54720. var div;
  54721. function getShouldDecode (href) {
  54722. div = div || document.createElement('div');
  54723. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  54724. return div.innerHTML.indexOf('&#10;') > 0
  54725. }
  54726. // #3663: IE encodes newlines inside attribute values while other browsers don't
  54727. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  54728. // #6828: chrome encodes content in a[href]
  54729. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  54730. /* */
  54731. var idToTemplate = cached(function (id) {
  54732. var el = query(id);
  54733. return el && el.innerHTML
  54734. });
  54735. var mount = Vue.prototype.$mount;
  54736. Vue.prototype.$mount = function (
  54737. el,
  54738. hydrating
  54739. ) {
  54740. el = el && query(el);
  54741. /* istanbul ignore if */
  54742. if (el === document.body || el === document.documentElement) {
  54743. warn(
  54744. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  54745. );
  54746. return this
  54747. }
  54748. var options = this.$options;
  54749. // resolve template/el and convert to render function
  54750. if (!options.render) {
  54751. var template = options.template;
  54752. if (template) {
  54753. if (typeof template === 'string') {
  54754. if (template.charAt(0) === '#') {
  54755. template = idToTemplate(template);
  54756. /* istanbul ignore if */
  54757. if (!template) {
  54758. warn(
  54759. ("Template element not found or is empty: " + (options.template)),
  54760. this
  54761. );
  54762. }
  54763. }
  54764. } else if (template.nodeType) {
  54765. template = template.innerHTML;
  54766. } else {
  54767. {
  54768. warn('invalid template option:' + template, this);
  54769. }
  54770. return this
  54771. }
  54772. } else if (el) {
  54773. template = getOuterHTML(el);
  54774. }
  54775. if (template) {
  54776. /* istanbul ignore if */
  54777. if (config.performance && mark) {
  54778. mark('compile');
  54779. }
  54780. var ref = compileToFunctions(template, {
  54781. outputSourceRange: "development" !== 'production',
  54782. shouldDecodeNewlines: shouldDecodeNewlines,
  54783. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  54784. delimiters: options.delimiters,
  54785. comments: options.comments
  54786. }, this);
  54787. var render = ref.render;
  54788. var staticRenderFns = ref.staticRenderFns;
  54789. options.render = render;
  54790. options.staticRenderFns = staticRenderFns;
  54791. /* istanbul ignore if */
  54792. if (config.performance && mark) {
  54793. mark('compile end');
  54794. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  54795. }
  54796. }
  54797. }
  54798. return mount.call(this, el, hydrating)
  54799. };
  54800. /**
  54801. * Get outerHTML of elements, taking care
  54802. * of SVG elements in IE as well.
  54803. */
  54804. function getOuterHTML (el) {
  54805. if (el.outerHTML) {
  54806. return el.outerHTML
  54807. } else {
  54808. var container = document.createElement('div');
  54809. container.appendChild(el.cloneNode(true));
  54810. return container.innerHTML
  54811. }
  54812. }
  54813. Vue.compile = compileToFunctions;
  54814. module.exports = Vue;
  54815. /* 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))
  54816. /***/ }),
  54817. /***/ "./node_modules/vue/dist/vue.common.js":
  54818. /*!*********************************************!*\
  54819. !*** ./node_modules/vue/dist/vue.common.js ***!
  54820. \*********************************************/
  54821. /*! no static exports found */
  54822. /***/ (function(module, exports, __webpack_require__) {
  54823. if (false) {} else {
  54824. module.exports = __webpack_require__(/*! ./vue.common.dev.js */ "./node_modules/vue/dist/vue.common.dev.js")
  54825. }
  54826. /***/ }),
  54827. /***/ "./node_modules/webpack/buildin/global.js":
  54828. /*!***********************************!*\
  54829. !*** (webpack)/buildin/global.js ***!
  54830. \***********************************/
  54831. /*! no static exports found */
  54832. /***/ (function(module, exports) {
  54833. var g;
  54834. // This works in non-strict mode
  54835. g = (function() {
  54836. return this;
  54837. })();
  54838. try {
  54839. // This works if eval is allowed (see CSP)
  54840. g = g || new Function("return this")();
  54841. } catch (e) {
  54842. // This works if the window reference is available
  54843. if (typeof window === "object") g = window;
  54844. }
  54845. // g can still be undefined, but nothing to do about it...
  54846. // We return undefined, instead of nothing here, so it's
  54847. // easier to handle this case. if(!global) { ...}
  54848. module.exports = g;
  54849. /***/ }),
  54850. /***/ "./node_modules/webpack/buildin/module.js":
  54851. /*!***********************************!*\
  54852. !*** (webpack)/buildin/module.js ***!
  54853. \***********************************/
  54854. /*! no static exports found */
  54855. /***/ (function(module, exports) {
  54856. module.exports = function(module) {
  54857. if (!module.webpackPolyfill) {
  54858. module.deprecate = function() {};
  54859. module.paths = [];
  54860. // module.parent = undefined by default
  54861. if (!module.children) module.children = [];
  54862. Object.defineProperty(module, "loaded", {
  54863. enumerable: true,
  54864. get: function() {
  54865. return module.l;
  54866. }
  54867. });
  54868. Object.defineProperty(module, "id", {
  54869. enumerable: true,
  54870. get: function() {
  54871. return module.i;
  54872. }
  54873. });
  54874. module.webpackPolyfill = 1;
  54875. }
  54876. return module;
  54877. };
  54878. /***/ }),
  54879. /***/ "./resources/js/app.js":
  54880. /*!*****************************!*\
  54881. !*** ./resources/js/app.js ***!
  54882. \*****************************/
  54883. /*! no static exports found */
  54884. /***/ (function(module, exports, __webpack_require__) {
  54885. /**
  54886. * First we will load all of this project's JavaScript dependencies which
  54887. * includes Vue and other libraries. It is a great starting point when
  54888. * building robust, powerful web applications using Vue and Laravel.
  54889. */
  54890. __webpack_require__(/*! ./bootstrap */ "./resources/js/bootstrap.js");
  54891. window.Clipboard = __webpack_require__(/*! clipboard */ "./node_modules/clipboard/dist/clipboard.js");
  54892. __webpack_require__(/*! ./notify.min.js */ "./resources/js/notify.min.js");
  54893. window.Vue = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.common.js");
  54894. /**
  54895. * The following block of code may be used to automatically register your
  54896. * Vue components. It will recursively scan this directory for the Vue
  54897. * components and automatically register them with their "basename".
  54898. *
  54899. * Eg. ./components/ExampleComponent.vue -> <example-component></example-component>
  54900. */
  54901. // const files = require.context('./', true, /\.vue$/i)
  54902. // files.keys().map(key => Vue.component(key.split('/').pop().split('.')[0], files(key).default))
  54903. Vue.component('example-component', __webpack_require__(/*! ./components/ExampleComponent.vue */ "./resources/js/components/ExampleComponent.vue")["default"]);
  54904. Vue.component('woinfo', __webpack_require__(/*! ./components/woinfo.vue */ "./resources/js/components/woinfo.vue")["default"]);
  54905. Vue.component('assetinfo', __webpack_require__(/*! ./components/assetinfo.vue */ "./resources/js/components/assetinfo.vue")["default"]);
  54906. Vue.component('credential', __webpack_require__(/*! ./components/credential.vue */ "./resources/js/components/credential.vue")["default"]);
  54907. Vue.component('notes', __webpack_require__(/*! ./components/notes.vue */ "./resources/js/components/notes.vue")["default"]);
  54908. Vue.component('modal', __webpack_require__(/*! ./components/modal.vue */ "./resources/js/components/modal.vue")["default"]);
  54909. Vue.component('woinfo-edit-modal', __webpack_require__(/*! ./components/woinfo-edit-modal.vue */ "./resources/js/components/woinfo-edit-modal.vue")["default"]);
  54910. Vue.component('errorlist', __webpack_require__(/*! ./components/errorlist.vue */ "./resources/js/components/errorlist.vue")["default"]);
  54911. /**
  54912. * Next, we will create a fresh Vue application instance and attach it to
  54913. * the page. Then, you may begin adding components to this application
  54914. * or customize the JavaScript scaffolding to fit your unique needs.
  54915. */
  54916. var app = new Vue({
  54917. el: '#app'
  54918. });
  54919. $(function () {
  54920. $('[data-toggle="tooltip"]').tooltip();
  54921. });
  54922. var clipboard = new Clipboard('.btn-clip');
  54923. clipboard.on('success', function (e) {
  54924. $('#' + e.trigger.getAttribute('id')).notify('Copied to Clipboard', {
  54925. position: "right",
  54926. className: 'success'
  54927. });
  54928. e.clearSelection();
  54929. });
  54930. /***/ }),
  54931. /***/ "./resources/js/bootstrap.js":
  54932. /*!***********************************!*\
  54933. !*** ./resources/js/bootstrap.js ***!
  54934. \***********************************/
  54935. /*! no exports provided */
  54936. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54937. "use strict";
  54938. __webpack_require__.r(__webpack_exports__);
  54939. /* harmony import */ var laravel_echo__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! laravel-echo */ "./node_modules/laravel-echo/dist/echo.js");
  54940. window._ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js");
  54941. /**
  54942. * We'll load jQuery and the Bootstrap jQuery plugin which provides support
  54943. * for JavaScript based Bootstrap features such as modals and tabs. This
  54944. * code may be modified to fit the specific needs of your application.
  54945. */
  54946. try {
  54947. window.Popper = __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")["default"];
  54948. window.$ = window.jQuery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  54949. __webpack_require__(/*! bootstrap */ "./node_modules/bootstrap/dist/js/bootstrap.js");
  54950. } catch (e) {}
  54951. /**
  54952. * We'll load the axios HTTP library which allows us to easily issue requests
  54953. * to our Laravel back-end. This library automatically handles sending the
  54954. * CSRF token as a header based on the value of the "XSRF" token cookie.
  54955. */
  54956. window.axios = __webpack_require__(/*! axios */ "./node_modules/axios/index.js");
  54957. window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
  54958. /**
  54959. * Echo exposes an expressive API for subscribing to channels and listening
  54960. * for events that are broadcast by Laravel. Echo and event broadcasting
  54961. * allows your team to easily build robust real-time web applications.
  54962. */
  54963. window.Pusher = __webpack_require__(/*! pusher-js */ "./node_modules/pusher-js/dist/web/pusher.js");
  54964. window.Echo = new laravel_echo__WEBPACK_IMPORTED_MODULE_0__["default"]({
  54965. broadcaster: 'pusher',
  54966. key: "upccrt",
  54967. wsHost: window.location.hostname,
  54968. wsPort: 6001,
  54969. disableStats: true
  54970. });
  54971. /***/ }),
  54972. /***/ "./resources/js/components/ExampleComponent.vue":
  54973. /*!******************************************************!*\
  54974. !*** ./resources/js/components/ExampleComponent.vue ***!
  54975. \******************************************************/
  54976. /*! exports provided: default */
  54977. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  54978. "use strict";
  54979. __webpack_require__.r(__webpack_exports__);
  54980. /* 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&");
  54981. /* 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&");
  54982. /* 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");
  54983. /* normalize component */
  54984. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  54985. _ExampleComponent_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  54986. _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["render"],
  54987. _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  54988. false,
  54989. null,
  54990. null,
  54991. null
  54992. )
  54993. /* hot reload */
  54994. if (false) { var api; }
  54995. component.options.__file = "resources/js/components/ExampleComponent.vue"
  54996. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  54997. /***/ }),
  54998. /***/ "./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js&":
  54999. /*!*******************************************************************************!*\
  55000. !*** ./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js& ***!
  55001. \*******************************************************************************/
  55002. /*! exports provided: default */
  55003. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55004. "use strict";
  55005. __webpack_require__.r(__webpack_exports__);
  55006. /* 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&");
  55007. /* 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"]);
  55008. /***/ }),
  55009. /***/ "./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e&":
  55010. /*!*************************************************************************************!*\
  55011. !*** ./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e& ***!
  55012. \*************************************************************************************/
  55013. /*! exports provided: render, staticRenderFns */
  55014. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55015. "use strict";
  55016. __webpack_require__.r(__webpack_exports__);
  55017. /* 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&");
  55018. /* 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"]; });
  55019. /* 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"]; });
  55020. /***/ }),
  55021. /***/ "./resources/js/components/assetinfo.vue":
  55022. /*!***********************************************!*\
  55023. !*** ./resources/js/components/assetinfo.vue ***!
  55024. \***********************************************/
  55025. /*! exports provided: default */
  55026. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55027. "use strict";
  55028. __webpack_require__.r(__webpack_exports__);
  55029. /* 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&");
  55030. /* 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&");
  55031. /* 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");
  55032. /* normalize component */
  55033. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55034. _assetinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55035. _assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__["render"],
  55036. _assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55037. false,
  55038. null,
  55039. null,
  55040. null
  55041. )
  55042. /* hot reload */
  55043. if (false) { var api; }
  55044. component.options.__file = "resources/js/components/assetinfo.vue"
  55045. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55046. /***/ }),
  55047. /***/ "./resources/js/components/assetinfo.vue?vue&type=script&lang=js&":
  55048. /*!************************************************************************!*\
  55049. !*** ./resources/js/components/assetinfo.vue?vue&type=script&lang=js& ***!
  55050. \************************************************************************/
  55051. /*! exports provided: default */
  55052. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55053. "use strict";
  55054. __webpack_require__.r(__webpack_exports__);
  55055. /* 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&");
  55056. /* 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"]);
  55057. /***/ }),
  55058. /***/ "./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3&":
  55059. /*!******************************************************************************!*\
  55060. !*** ./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3& ***!
  55061. \******************************************************************************/
  55062. /*! exports provided: render, staticRenderFns */
  55063. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55064. "use strict";
  55065. __webpack_require__.r(__webpack_exports__);
  55066. /* 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&");
  55067. /* 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"]; });
  55068. /* 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"]; });
  55069. /***/ }),
  55070. /***/ "./resources/js/components/credential.vue":
  55071. /*!************************************************!*\
  55072. !*** ./resources/js/components/credential.vue ***!
  55073. \************************************************/
  55074. /*! exports provided: default */
  55075. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55076. "use strict";
  55077. __webpack_require__.r(__webpack_exports__);
  55078. /* 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&");
  55079. /* 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&");
  55080. /* 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");
  55081. /* normalize component */
  55082. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55083. _credential_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55084. _credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__["render"],
  55085. _credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55086. false,
  55087. null,
  55088. null,
  55089. null
  55090. )
  55091. /* hot reload */
  55092. if (false) { var api; }
  55093. component.options.__file = "resources/js/components/credential.vue"
  55094. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55095. /***/ }),
  55096. /***/ "./resources/js/components/credential.vue?vue&type=script&lang=js&":
  55097. /*!*************************************************************************!*\
  55098. !*** ./resources/js/components/credential.vue?vue&type=script&lang=js& ***!
  55099. \*************************************************************************/
  55100. /*! exports provided: default */
  55101. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55102. "use strict";
  55103. __webpack_require__.r(__webpack_exports__);
  55104. /* 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&");
  55105. /* 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"]);
  55106. /***/ }),
  55107. /***/ "./resources/js/components/credential.vue?vue&type=template&id=0f5cc562&":
  55108. /*!*******************************************************************************!*\
  55109. !*** ./resources/js/components/credential.vue?vue&type=template&id=0f5cc562& ***!
  55110. \*******************************************************************************/
  55111. /*! exports provided: render, staticRenderFns */
  55112. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55113. "use strict";
  55114. __webpack_require__.r(__webpack_exports__);
  55115. /* 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&");
  55116. /* 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"]; });
  55117. /* 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"]; });
  55118. /***/ }),
  55119. /***/ "./resources/js/components/errorlist.vue":
  55120. /*!***********************************************!*\
  55121. !*** ./resources/js/components/errorlist.vue ***!
  55122. \***********************************************/
  55123. /*! exports provided: default */
  55124. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55125. "use strict";
  55126. __webpack_require__.r(__webpack_exports__);
  55127. /* 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&");
  55128. /* 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&");
  55129. /* 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");
  55130. /* normalize component */
  55131. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55132. _errorlist_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55133. _errorlist_vue_vue_type_template_id_1546f5eb___WEBPACK_IMPORTED_MODULE_0__["render"],
  55134. _errorlist_vue_vue_type_template_id_1546f5eb___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55135. false,
  55136. null,
  55137. null,
  55138. null
  55139. )
  55140. /* hot reload */
  55141. if (false) { var api; }
  55142. component.options.__file = "resources/js/components/errorlist.vue"
  55143. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55144. /***/ }),
  55145. /***/ "./resources/js/components/errorlist.vue?vue&type=script&lang=js&":
  55146. /*!************************************************************************!*\
  55147. !*** ./resources/js/components/errorlist.vue?vue&type=script&lang=js& ***!
  55148. \************************************************************************/
  55149. /*! exports provided: default */
  55150. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55151. "use strict";
  55152. __webpack_require__.r(__webpack_exports__);
  55153. /* 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&");
  55154. /* 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"]);
  55155. /***/ }),
  55156. /***/ "./resources/js/components/errorlist.vue?vue&type=template&id=1546f5eb&":
  55157. /*!******************************************************************************!*\
  55158. !*** ./resources/js/components/errorlist.vue?vue&type=template&id=1546f5eb& ***!
  55159. \******************************************************************************/
  55160. /*! exports provided: render, staticRenderFns */
  55161. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55162. "use strict";
  55163. __webpack_require__.r(__webpack_exports__);
  55164. /* 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&");
  55165. /* 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"]; });
  55166. /* 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"]; });
  55167. /***/ }),
  55168. /***/ "./resources/js/components/modal.vue":
  55169. /*!*******************************************!*\
  55170. !*** ./resources/js/components/modal.vue ***!
  55171. \*******************************************/
  55172. /*! exports provided: default */
  55173. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55174. "use strict";
  55175. __webpack_require__.r(__webpack_exports__);
  55176. /* 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&");
  55177. /* 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");
  55178. var script = {}
  55179. /* normalize component */
  55180. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_1__["default"])(
  55181. script,
  55182. _modal_vue_vue_type_template_id_478d961c___WEBPACK_IMPORTED_MODULE_0__["render"],
  55183. _modal_vue_vue_type_template_id_478d961c___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55184. false,
  55185. null,
  55186. null,
  55187. null
  55188. )
  55189. /* hot reload */
  55190. if (false) { var api; }
  55191. component.options.__file = "resources/js/components/modal.vue"
  55192. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55193. /***/ }),
  55194. /***/ "./resources/js/components/modal.vue?vue&type=template&id=478d961c&":
  55195. /*!**************************************************************************!*\
  55196. !*** ./resources/js/components/modal.vue?vue&type=template&id=478d961c& ***!
  55197. \**************************************************************************/
  55198. /*! exports provided: render, staticRenderFns */
  55199. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55200. "use strict";
  55201. __webpack_require__.r(__webpack_exports__);
  55202. /* 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&");
  55203. /* 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"]; });
  55204. /* 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"]; });
  55205. /***/ }),
  55206. /***/ "./resources/js/components/notes.vue":
  55207. /*!*******************************************!*\
  55208. !*** ./resources/js/components/notes.vue ***!
  55209. \*******************************************/
  55210. /*! exports provided: default */
  55211. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55212. "use strict";
  55213. __webpack_require__.r(__webpack_exports__);
  55214. /* 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&");
  55215. /* 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&");
  55216. /* 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");
  55217. /* normalize component */
  55218. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55219. _notes_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55220. _notes_vue_vue_type_template_id_73d141f4___WEBPACK_IMPORTED_MODULE_0__["render"],
  55221. _notes_vue_vue_type_template_id_73d141f4___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55222. false,
  55223. null,
  55224. null,
  55225. null
  55226. )
  55227. /* hot reload */
  55228. if (false) { var api; }
  55229. component.options.__file = "resources/js/components/notes.vue"
  55230. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55231. /***/ }),
  55232. /***/ "./resources/js/components/notes.vue?vue&type=script&lang=js&":
  55233. /*!********************************************************************!*\
  55234. !*** ./resources/js/components/notes.vue?vue&type=script&lang=js& ***!
  55235. \********************************************************************/
  55236. /*! exports provided: default */
  55237. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55238. "use strict";
  55239. __webpack_require__.r(__webpack_exports__);
  55240. /* 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&");
  55241. /* 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"]);
  55242. /***/ }),
  55243. /***/ "./resources/js/components/notes.vue?vue&type=template&id=73d141f4&":
  55244. /*!**************************************************************************!*\
  55245. !*** ./resources/js/components/notes.vue?vue&type=template&id=73d141f4& ***!
  55246. \**************************************************************************/
  55247. /*! exports provided: render, staticRenderFns */
  55248. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55249. "use strict";
  55250. __webpack_require__.r(__webpack_exports__);
  55251. /* 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&");
  55252. /* 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"]; });
  55253. /* 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"]; });
  55254. /***/ }),
  55255. /***/ "./resources/js/components/woinfo-edit-modal.vue":
  55256. /*!*******************************************************!*\
  55257. !*** ./resources/js/components/woinfo-edit-modal.vue ***!
  55258. \*******************************************************/
  55259. /*! exports provided: default */
  55260. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55261. "use strict";
  55262. __webpack_require__.r(__webpack_exports__);
  55263. /* 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&");
  55264. /* 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&");
  55265. /* 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");
  55266. /* normalize component */
  55267. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55268. _woinfo_edit_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55269. _woinfo_edit_modal_vue_vue_type_template_id_ad3662d4___WEBPACK_IMPORTED_MODULE_0__["render"],
  55270. _woinfo_edit_modal_vue_vue_type_template_id_ad3662d4___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55271. false,
  55272. null,
  55273. null,
  55274. null
  55275. )
  55276. /* hot reload */
  55277. if (false) { var api; }
  55278. component.options.__file = "resources/js/components/woinfo-edit-modal.vue"
  55279. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55280. /***/ }),
  55281. /***/ "./resources/js/components/woinfo-edit-modal.vue?vue&type=script&lang=js&":
  55282. /*!********************************************************************************!*\
  55283. !*** ./resources/js/components/woinfo-edit-modal.vue?vue&type=script&lang=js& ***!
  55284. \********************************************************************************/
  55285. /*! exports provided: default */
  55286. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55287. "use strict";
  55288. __webpack_require__.r(__webpack_exports__);
  55289. /* 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&");
  55290. /* 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"]);
  55291. /***/ }),
  55292. /***/ "./resources/js/components/woinfo-edit-modal.vue?vue&type=template&id=ad3662d4&":
  55293. /*!**************************************************************************************!*\
  55294. !*** ./resources/js/components/woinfo-edit-modal.vue?vue&type=template&id=ad3662d4& ***!
  55295. \**************************************************************************************/
  55296. /*! exports provided: render, staticRenderFns */
  55297. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55298. "use strict";
  55299. __webpack_require__.r(__webpack_exports__);
  55300. /* 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&");
  55301. /* 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"]; });
  55302. /* 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"]; });
  55303. /***/ }),
  55304. /***/ "./resources/js/components/woinfo.vue":
  55305. /*!********************************************!*\
  55306. !*** ./resources/js/components/woinfo.vue ***!
  55307. \********************************************/
  55308. /*! exports provided: default */
  55309. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55310. "use strict";
  55311. __webpack_require__.r(__webpack_exports__);
  55312. /* 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&");
  55313. /* 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&");
  55314. /* 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");
  55315. /* normalize component */
  55316. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55317. _woinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55318. _woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__["render"],
  55319. _woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55320. false,
  55321. null,
  55322. null,
  55323. null
  55324. )
  55325. /* hot reload */
  55326. if (false) { var api; }
  55327. component.options.__file = "resources/js/components/woinfo.vue"
  55328. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55329. /***/ }),
  55330. /***/ "./resources/js/components/woinfo.vue?vue&type=script&lang=js&":
  55331. /*!*********************************************************************!*\
  55332. !*** ./resources/js/components/woinfo.vue?vue&type=script&lang=js& ***!
  55333. \*********************************************************************/
  55334. /*! exports provided: default */
  55335. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55336. "use strict";
  55337. __webpack_require__.r(__webpack_exports__);
  55338. /* 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&");
  55339. /* 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"]);
  55340. /***/ }),
  55341. /***/ "./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de&":
  55342. /*!***************************************************************************!*\
  55343. !*** ./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de& ***!
  55344. \***************************************************************************/
  55345. /*! exports provided: render, staticRenderFns */
  55346. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55347. "use strict";
  55348. __webpack_require__.r(__webpack_exports__);
  55349. /* 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&");
  55350. /* 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"]; });
  55351. /* 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"]; });
  55352. /***/ }),
  55353. /***/ "./resources/js/mixins/dateMixin.js":
  55354. /*!******************************************!*\
  55355. !*** ./resources/js/mixins/dateMixin.js ***!
  55356. \******************************************/
  55357. /*! exports provided: default */
  55358. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55359. "use strict";
  55360. __webpack_require__.r(__webpack_exports__);
  55361. /* harmony default export */ __webpack_exports__["default"] = ({
  55362. methods: {
  55363. treatAsUTC: function treatAsUTC(date) {
  55364. var result = new Date(date);
  55365. result.setMinutes(result.getMinutes() - result.getTimezoneOffset());
  55366. return result;
  55367. },
  55368. daysSinceToday: function daysSinceToday(date) {
  55369. var currentDate = new Date();
  55370. var millisecondsPerDay = 24 * 60 * 60 * 1000;
  55371. return (this.treatAsUTC(currentDate) - this.treatAsUTC(date)) / millisecondsPerDay;
  55372. },
  55373. getHRDate: function getHRDate(dateString) {
  55374. var date = new Date(dateString);
  55375. return date.toLocaleString('default', {
  55376. month: 'short',
  55377. day: 'numeric',
  55378. year: 'numeric',
  55379. hour: 'numeric',
  55380. minute: 'numeric'
  55381. });
  55382. },
  55383. isZero: function isZero(dateString) {
  55384. return dateString === '0000-00-00 00:00:00';
  55385. }
  55386. }
  55387. });
  55388. /***/ }),
  55389. /***/ "./resources/js/notify.min.js":
  55390. /*!************************************!*\
  55391. !*** ./resources/js/notify.min.js ***!
  55392. \************************************/
  55393. /*! no static exports found */
  55394. /***/ (function(module, exports, __webpack_require__) {
  55395. 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); }
  55396. (function (e) {
  55397. true ? !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js")], __WEBPACK_AMD_DEFINE_FACTORY__ = (e),
  55398. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  55399. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  55400. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : undefined;
  55401. })(function (e) {
  55402. function A(t, n, i) {
  55403. typeof i == "string" && (i = {
  55404. className: i
  55405. }), 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);
  55406. }
  55407. var t = [].indexOf || function (e) {
  55408. for (var t = 0, n = this.length; t < n; t++) {
  55409. if (t in this && this[t] === e) return t;
  55410. }
  55411. return -1;
  55412. },
  55413. n = "notify",
  55414. r = n + "js",
  55415. i = n + "!blank",
  55416. s = {
  55417. t: "top",
  55418. m: "middle",
  55419. b: "bottom",
  55420. l: "left",
  55421. c: "center",
  55422. r: "right"
  55423. },
  55424. o = ["l", "c", "r"],
  55425. u = ["t", "m", "b"],
  55426. a = ["t", "b", "l", "r"],
  55427. f = {
  55428. t: "b",
  55429. m: null,
  55430. b: "t",
  55431. l: "r",
  55432. c: null,
  55433. r: "l"
  55434. },
  55435. l = function l(t) {
  55436. var n;
  55437. return n = [], e.each(t.split(/\W+/), function (e, t) {
  55438. var r;
  55439. r = t.toLowerCase().charAt(0);
  55440. if (s[r]) return n.push(r);
  55441. }), n;
  55442. },
  55443. c = {},
  55444. h = {
  55445. name: "core",
  55446. html: '<div class="' + r + '-wrapper">\n <div class="' + r + '-arrow"></div>\n <div class="' + r + '-container"></div>\n</div>',
  55447. 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}"
  55448. },
  55449. p = {
  55450. "border-radius": ["-webkit-", "-moz-"]
  55451. },
  55452. d = function d(e) {
  55453. return c[e];
  55454. },
  55455. v = function v(e) {
  55456. if (!e) throw "Missing Style name";
  55457. c[e] && delete c[e];
  55458. },
  55459. m = function m(t, i) {
  55460. if (!t) throw "Missing Style name";
  55461. if (!i) throw "Missing Style definition";
  55462. if (!i.html) throw "Missing Style HTML";
  55463. var s = c[t];
  55464. s && s.cssElem && (window.console && console.warn(n + ": overwriting style '" + t + "'"), c[t].cssElem.remove()), i.name = t, c[t] = i;
  55465. var o = "";
  55466. i.classes && e.each(i.classes, function (t, n) {
  55467. return o += "." + r + "-" + i.name + "-" + t + " {\n", e.each(n, function (t, n) {
  55468. return p[t] && e.each(p[t], function (e, r) {
  55469. return o += " " + r + t + ": " + n + ";\n";
  55470. }), o += " " + t + ": " + n + ";\n";
  55471. }), o += "}\n";
  55472. }), i.css && (o += "/* styles for " + i.name + " */\n" + i.css), o && (i.cssElem = g(o), i.cssElem.attr("id", "notify-" + i.name));
  55473. var u = {},
  55474. a = e(i.html);
  55475. y("html", a, u), y("text", a, u), i.fields = u;
  55476. },
  55477. g = function g(t) {
  55478. var n, r, i;
  55479. r = x("style"), r.attr("type", "text/css"), e("head").append(r);
  55480. try {
  55481. r.html(t);
  55482. } catch (s) {
  55483. r[0].styleSheet.cssText = t;
  55484. }
  55485. return r;
  55486. },
  55487. y = function y(t, n, r) {
  55488. var s;
  55489. return t !== "html" && (t = "text"), s = "data-notify-" + t, b(n, "[" + s + "]").each(function () {
  55490. var n;
  55491. n = e(this).attr(s), n || (n = i), r[n] = t;
  55492. });
  55493. },
  55494. b = function b(e, t) {
  55495. return e.is(t) ? e : e.find(t);
  55496. },
  55497. w = {
  55498. clickToHide: !0,
  55499. autoHide: !0,
  55500. autoHideDelay: 5e3,
  55501. arrowShow: !0,
  55502. arrowSize: 5,
  55503. breakNewLines: !0,
  55504. elementPosition: "bottom",
  55505. globalPosition: "top right",
  55506. style: "bootstrap",
  55507. className: "error",
  55508. showAnimation: "slideDown",
  55509. showDuration: 400,
  55510. hideAnimation: "slideUp",
  55511. hideDuration: 200,
  55512. gap: 5
  55513. },
  55514. E = function E(t, n) {
  55515. var r;
  55516. return r = function r() {}, r.prototype = t, e.extend(!0, new r(), n);
  55517. },
  55518. S = function S(t) {
  55519. return e.extend(w, t);
  55520. },
  55521. x = function x(t) {
  55522. return e("<" + t + "></" + t + ">");
  55523. },
  55524. T = {},
  55525. N = function N(t) {
  55526. var n;
  55527. return t.is("[type=radio]") && (n = t.parents("form:first").find("[type=radio]").filter(function (n, r) {
  55528. return e(r).attr("name") === t.attr("name");
  55529. }), t = n.first()), t;
  55530. },
  55531. C = function C(e, t, n) {
  55532. var r, i;
  55533. if (typeof n == "string") n = parseInt(n, 10);else if (typeof n != "number") return;
  55534. if (isNaN(n)) return;
  55535. 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;
  55536. },
  55537. k = function k(e, t, n) {
  55538. if (e === "l" || e === "t") return 0;
  55539. if (e === "c" || e === "m") return n / 2 - t / 2;
  55540. if (e === "r" || e === "b") return n - t;
  55541. throw "Invalid alignment";
  55542. },
  55543. L = function L(e) {
  55544. return L.e = L.e || x("div"), L.e.text(e).html();
  55545. };
  55546. A.prototype.loadHTML = function () {
  55547. var t;
  55548. t = this.getStyle(), this.userContainer = e(t.html), this.userFields = t.fields;
  55549. }, A.prototype.show = function (e, t) {
  55550. var n, r, i, s, o;
  55551. r = function (n) {
  55552. return function () {
  55553. !e && !n.elem && n.destroy();
  55554. if (t) return t();
  55555. };
  55556. }(this), o = this.container.parent().parents(":hidden").length > 0, i = this.container.add(this.arrow), n = [];
  55557. 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 {
  55558. if (!!o || !!e) return r();
  55559. s = this.options.hideAnimation, n.push(this.options.hideDuration);
  55560. }
  55561. return n.push(r), i[s].apply(i, n);
  55562. }, A.prototype.setGlobalPosition = function () {
  55563. var t = this.getPosition(),
  55564. n = t[0],
  55565. i = t[1],
  55566. o = s[n],
  55567. u = s[i],
  55568. a = n + "|" + i,
  55569. f = T[a];
  55570. if (!f || !document.body.contains(f[0])) {
  55571. f = T[a] = x("div");
  55572. var l = {};
  55573. 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);
  55574. }
  55575. return f.prepend(this.wrapper);
  55576. }, A.prototype.setElementPosition = function () {
  55577. 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;
  55578. 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"];
  55579. for (w = 0, S = B.length; w < S; w++) {
  55580. D = B[w], N = parseInt(this.elem.css("margin-" + D), 10), N && C(p, D, N);
  55581. }
  55582. b = Math.max(0, this.options.gap - (this.options.arrowShow ? i : 0)), C(p, A, b);
  55583. if (!this.options.arrowShow) this.arrow.hide();else {
  55584. 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";
  55585. for (E = 0, x = a.length; E < x; E++) {
  55586. D = a[E], P = s[D];
  55587. if (D === L) continue;
  55588. l = P === T ? n : "transparent", r["border-" + P] = i + "px solid " + l;
  55589. }
  55590. C(p, s[L], i), t.call(a, O) >= 0 && C(r, s[O], i * 2);
  55591. }
  55592. 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);
  55593. if (r) return this.arrow.removeAttr("style").css(r);
  55594. }, A.prototype.getPosition = function () {
  55595. var e, n, r, i, s, f, c, h;
  55596. h = this.options.position || (this.elem ? this.options.elementPosition : this.options.globalPosition), e = l(h), e.length === 0 && (e[0] = "b");
  55597. if (n = e[0], t.call(a, n) < 0) throw "Must be one of [" + a + "]";
  55598. 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";
  55599. return e.length === 2 && (e[2] = e[1]), e;
  55600. }, A.prototype.getStyle = function (e) {
  55601. var t;
  55602. e || (e = this.options.style), e || (e = "default"), t = c[e];
  55603. if (!t) throw "Missing style: " + e;
  55604. return t;
  55605. }, A.prototype.updateClasses = function () {
  55606. var t, n;
  55607. 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) {
  55608. return r + "-" + n.name + "-" + e;
  55609. }).join(" "), this.userContainer.attr("class", t);
  55610. }, A.prototype.run = function (t, n) {
  55611. var r, s, o, u, a;
  55612. e.isPlainObject(n) ? e.extend(this.options, n) : e.type(n) === "string" && (this.options.className = n);
  55613. if (this.container && !t) {
  55614. this.show(!1);
  55615. return;
  55616. }
  55617. if (!this.container && !t) return;
  55618. s = {}, e.isPlainObject(t) ? s = t : s[i] = t;
  55619. for (o in s) {
  55620. r = s[o], u = this.userFields[o];
  55621. if (!u) continue;
  55622. 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);
  55623. }
  55624. 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));
  55625. }, A.prototype.destroy = function () {
  55626. this.wrapper.data(r, null), this.wrapper.remove();
  55627. }, e[n] = function (t, r, i) {
  55628. return t && t.nodeName || t.jquery ? e(t)[n](r, i) : (i = r, r = t, new A(null, r, i)), t;
  55629. }, e.fn[n] = function (t, n) {
  55630. return e(this).each(function () {
  55631. var i = N(e(this)).data(r);
  55632. i && i.destroy();
  55633. var s = new A(e(this), t, n);
  55634. }), this;
  55635. }, e.extend(e[n], {
  55636. defaults: S,
  55637. addStyle: m,
  55638. removeStyle: v,
  55639. pluginOptions: w,
  55640. getStyle: d,
  55641. insertCSS: g
  55642. }), m("bootstrap", {
  55643. html: "<div>\n<span data-notify-text></span>\n</div>",
  55644. classes: {
  55645. base: {
  55646. "font-weight": "bold",
  55647. padding: "8px 15px 8px 14px",
  55648. "text-shadow": "0 1px 0 rgba(255, 255, 255, 0.5)",
  55649. "background-color": "#fcf8e3",
  55650. border: "1px solid #fbeed5",
  55651. "border-radius": "4px",
  55652. "white-space": "nowrap",
  55653. "padding-left": "25px",
  55654. "background-repeat": "no-repeat",
  55655. "background-position": "3px 7px"
  55656. },
  55657. error: {
  55658. color: "#B94A48",
  55659. "background-color": "#F2DEDE",
  55660. "border-color": "#EED3D7",
  55661. "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=)"
  55662. },
  55663. success: {
  55664. color: "#468847",
  55665. "background-color": "#DFF0D8",
  55666. "border-color": "#D6E9C6",
  55667. "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==)"
  55668. },
  55669. info: {
  55670. color: "#3A87AD",
  55671. "background-color": "#D9EDF7",
  55672. "border-color": "#BCE8F1",
  55673. "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=)"
  55674. },
  55675. warn: {
  55676. color: "#C09853",
  55677. "background-color": "#FCF8E3",
  55678. "border-color": "#FBEED5",
  55679. "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)"
  55680. }
  55681. }
  55682. }), e(function () {
  55683. g(h.css).attr("id", "core-notify"), e(document).on("click", "." + r + "-hidable", function (t) {
  55684. e(this).trigger("notify-hide");
  55685. }), e(document).on("notify-hide", "." + r + "-wrapper", function (t) {
  55686. var n = e(this).data(r);
  55687. n && n.show(!1);
  55688. });
  55689. });
  55690. });
  55691. /***/ }),
  55692. /***/ "./resources/sass/app.scss":
  55693. /*!*********************************!*\
  55694. !*** ./resources/sass/app.scss ***!
  55695. \*********************************/
  55696. /*! no static exports found */
  55697. /***/ (function(module, exports) {
  55698. // removed by extract-text-webpack-plugin
  55699. /***/ }),
  55700. /***/ 0:
  55701. /*!*************************************************************!*\
  55702. !*** multi ./resources/js/app.js ./resources/sass/app.scss ***!
  55703. \*************************************************************/
  55704. /*! no static exports found */
  55705. /***/ (function(module, exports, __webpack_require__) {
  55706. __webpack_require__(/*! /home/vagrant/upccrt/resources/js/app.js */"./resources/js/app.js");
  55707. module.exports = __webpack_require__(/*! /home/vagrant/upccrt/resources/sass/app.scss */"./resources/sass/app.scss");
  55708. /***/ })
  55709. /******/ });