app.js 1.8 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879498804988149882498834988449885498864988749888498894989049891498924989349894498954989649897498984989949900499014990249903499044990549906499074990849909499104991149912499134991449915499164991749918499194992049921499224992349924499254992649927499284992949930499314993249933499344993549936499374993849939499404994149942499434994449945499464994749948499494995049951499524995349954499554995649957499584995949960499614996249963499644996549966499674996849969499704997149972499734997449975499764997749978499794998049981499824998349984499854998649987499884998949990499914999249993499944999549996499974999849999500005000150002500035000450005500065000750008500095001050011500125001350014500155001650017500185001950020500215002250023500245002550026500275002850029500305003150032500335003450035500365003750038500395004050041500425004350044500455004650047500485004950050500515005250053500545005550056500575005850059500605006150062500635006450065500665006750068500695007050071500725007350074500755007650077500785007950080500815008250083500845008550086500875008850089500905009150092500935009450095500965009750098500995010050101501025010350104501055010650107501085010950110501115011250113501145011550116501175011850119501205012150122501235012450125501265012750128501295013050131501325013350134501355013650137501385013950140501415014250143501445014550146501475014850149501505015150152501535015450155501565015750158501595016050161501625016350164501655016650167501685016950170501715017250173501745017550176501775017850179501805018150182501835018450185501865018750188501895019050191501925019350194501955019650197501985019950200502015020250203502045020550206502075020850209502105021150212502135021450215502165021750218502195022050221502225022350224502255022650227502285022950230502315023250233502345023550236502375023850239502405024150242502435024450245502465024750248502495025050251502525025350254502555025650257502585025950260502615026250263502645026550266502675026850269502705027150272502735027450275502765027750278502795028050281502825028350284502855028650287502885028950290502915029250293502945029550296502975029850299503005030150302503035030450305503065030750308503095031050311503125031350314503155031650317503185031950320503215032250323503245032550326503275032850329503305033150332503335033450335503365033750338503395034050341503425034350344503455034650347503485034950350503515035250353503545035550356503575035850359503605036150362503635036450365503665036750368503695037050371503725037350374503755037650377503785037950380503815038250383503845038550386503875038850389503905039150392503935039450395503965039750398503995040050401504025040350404504055040650407504085040950410504115041250413504145041550416504175041850419504205042150422504235042450425504265042750428504295043050431504325043350434504355043650437504385043950440504415044250443504445044550446504475044850449504505045150452504535045450455504565045750458504595046050461504625046350464504655046650467504685046950470504715047250473504745047550476504775047850479504805048150482504835048450485504865048750488504895049050491504925049350494504955049650497504985049950500505015050250503505045050550506505075050850509505105051150512505135051450515505165051750518505195052050521505225052350524505255052650527505285052950530505315053250533505345053550536505375053850539505405054150542505435054450545505465054750548505495055050551505525055350554505555055650557505585055950560505615056250563505645056550566505675056850569505705057150572505735057450575505765057750578505795058050581505825058350584505855058650587505885058950590505915059250593505945059550596505975059850599506005060150602506035060450605506065060750608506095061050611506125061350614506155061650617506185061950620506215062250623506245062550626506275062850629506305063150632506335063450635506365063750638506395064050641506425064350644506455064650647506485064950650506515065250653506545065550656506575065850659506605066150662506635066450665506665066750668506695067050671506725067350674506755067650677506785067950680506815068250683506845068550686506875068850689506905069150692506935069450695506965069750698506995070050701507025070350704507055070650707507085070950710507115071250713507145071550716507175071850719507205072150722507235072450725507265072750728507295073050731507325073350734507355073650737507385073950740507415074250743507445074550746507475074850749507505075150752507535075450755507565075750758507595076050761507625076350764507655076650767507685076950770507715077250773507745077550776507775077850779507805078150782507835078450785507865078750788507895079050791507925079350794507955079650797507985079950800508015080250803508045080550806508075080850809508105081150812508135081450815508165081750818508195082050821508225082350824508255082650827508285082950830508315083250833508345083550836508375083850839508405084150842508435084450845508465084750848508495085050851508525085350854508555085650857508585085950860508615086250863508645086550866508675086850869508705087150872508735087450875508765087750878508795088050881508825088350884508855088650887508885088950890508915089250893508945089550896508975089850899509005090150902509035090450905509065090750908509095091050911509125091350914509155091650917509185091950920509215092250923509245092550926509275092850929509305093150932509335093450935509365093750938509395094050941509425094350944509455094650947509485094950950509515095250953509545095550956509575095850959509605096150962509635096450965509665096750968509695097050971509725097350974509755097650977509785097950980509815098250983509845098550986509875098850989509905099150992509935099450995509965099750998509995100051001510025100351004510055100651007510085100951010510115101251013510145101551016510175101851019510205102151022510235102451025510265102751028510295103051031510325103351034510355103651037510385103951040510415104251043510445104551046510475104851049510505105151052510535105451055510565105751058510595106051061510625106351064510655106651067510685106951070510715107251073510745107551076510775107851079510805108151082510835108451085510865108751088510895109051091510925109351094510955109651097510985109951100511015110251103511045110551106511075110851109511105111151112511135111451115511165111751118511195112051121511225112351124511255112651127511285112951130511315113251133511345113551136511375113851139511405114151142511435114451145511465114751148511495115051151511525115351154511555115651157511585115951160511615116251163511645116551166511675116851169511705117151172511735117451175511765117751178511795118051181511825118351184511855118651187511885118951190511915119251193511945119551196511975119851199512005120151202512035120451205512065120751208512095121051211512125121351214512155121651217512185121951220512215122251223512245122551226512275122851229512305123151232512335123451235512365123751238512395124051241512425124351244512455124651247512485124951250512515125251253512545125551256512575125851259512605126151262512635126451265512665126751268512695127051271512725127351274512755127651277512785127951280512815128251283512845128551286512875128851289512905129151292512935129451295512965129751298512995130051301513025130351304513055130651307513085130951310513115131251313513145131551316513175131851319513205132151322513235132451325513265132751328513295133051331513325133351334513355133651337513385133951340513415134251343513445134551346513475134851349513505135151352513535135451355513565135751358513595136051361513625136351364513655136651367513685136951370513715137251373513745137551376513775137851379513805138151382513835138451385513865138751388513895139051391513925139351394513955139651397513985139951400514015140251403514045140551406514075140851409514105141151412514135141451415514165141751418514195142051421514225142351424514255142651427514285142951430514315143251433514345143551436514375143851439514405144151442514435144451445514465144751448514495145051451514525145351454514555145651457514585145951460514615146251463514645146551466514675146851469514705147151472514735147451475514765147751478514795148051481514825148351484514855148651487514885148951490514915149251493514945149551496514975149851499515005150151502515035150451505515065150751508515095151051511515125151351514515155151651517515185151951520515215152251523515245152551526515275152851529515305153151532515335153451535515365153751538515395154051541515425154351544515455154651547515485154951550515515155251553515545155551556515575155851559515605156151562515635156451565515665156751568515695157051571515725157351574515755157651577515785157951580515815158251583515845158551586515875158851589515905159151592515935159451595515965159751598515995160051601516025160351604516055160651607516085160951610516115161251613516145161551616516175161851619516205162151622516235162451625516265162751628516295163051631516325163351634516355163651637516385163951640516415164251643516445164551646516475164851649516505165151652516535165451655516565165751658516595166051661516625166351664516655166651667516685166951670516715167251673516745167551676516775167851679516805168151682516835168451685516865168751688516895169051691516925169351694516955169651697516985169951700517015170251703517045170551706517075170851709517105171151712517135171451715517165171751718517195172051721517225172351724517255172651727517285172951730517315173251733517345173551736517375173851739517405174151742517435174451745517465174751748517495175051751517525175351754517555175651757517585175951760517615176251763517645176551766517675176851769517705177151772517735177451775517765177751778517795178051781517825178351784517855178651787517885178951790517915179251793517945179551796517975179851799518005180151802518035180451805518065180751808518095181051811518125181351814518155181651817518185181951820518215182251823518245182551826518275182851829518305183151832518335183451835518365183751838518395184051841518425184351844518455184651847518485184951850518515185251853518545185551856518575185851859518605186151862518635186451865518665186751868518695187051871518725187351874518755187651877518785187951880518815188251883518845188551886518875188851889518905189151892518935189451895518965189751898518995190051901519025190351904519055190651907519085190951910519115191251913519145191551916519175191851919519205192151922519235192451925519265192751928519295193051931519325193351934519355193651937519385193951940519415194251943519445194551946519475194851949519505195151952519535195451955519565195751958519595196051961519625196351964519655196651967519685196951970519715197251973519745197551976519775197851979519805198151982519835198451985519865198751988519895199051991519925199351994519955199651997519985199952000520015200252003520045200552006520075200852009520105201152012520135201452015520165201752018520195202052021520225202352024520255202652027520285202952030520315203252033520345203552036520375203852039520405204152042520435204452045520465204752048520495205052051520525205352054520555205652057520585205952060520615206252063520645206552066520675206852069520705207152072520735207452075520765207752078520795208052081520825208352084520855208652087520885208952090520915209252093520945209552096520975209852099521005210152102521035210452105521065210752108521095211052111521125211352114521155211652117521185211952120521215212252123521245212552126521275212852129521305213152132521335213452135521365213752138521395214052141521425214352144521455214652147521485214952150521515215252153521545215552156521575215852159521605216152162521635216452165521665216752168521695217052171521725217352174521755217652177521785217952180521815218252183521845218552186521875218852189521905219152192521935219452195521965219752198521995220052201522025220352204522055220652207522085220952210522115221252213522145221552216522175221852219522205222152222522235222452225522265222752228522295223052231522325223352234522355223652237522385223952240522415224252243522445224552246522475224852249522505225152252522535225452255522565225752258522595226052261522625226352264522655226652267522685226952270522715227252273522745227552276522775227852279522805228152282522835228452285522865228752288522895229052291522925229352294522955229652297522985229952300523015230252303523045230552306523075230852309523105231152312523135231452315523165231752318523195232052321523225232352324523255232652327523285232952330523315233252333523345233552336523375233852339523405234152342523435234452345523465234752348523495235052351523525235352354523555235652357523585235952360523615236252363523645236552366523675236852369523705237152372523735237452375523765237752378523795238052381523825238352384523855238652387523885238952390523915239252393523945239552396523975239852399524005240152402524035240452405524065240752408524095241052411524125241352414524155241652417524185241952420524215242252423524245242552426524275242852429524305243152432524335243452435524365243752438524395244052441524425244352444524455244652447524485244952450524515245252453524545245552456524575245852459524605246152462524635246452465524665246752468524695247052471524725247352474524755247652477524785247952480524815248252483524845248552486524875248852489524905249152492524935249452495524965249752498524995250052501525025250352504525055250652507525085250952510525115251252513525145251552516525175251852519525205252152522525235252452525525265252752528525295253052531525325253352534525355253652537525385253952540525415254252543525445254552546525475254852549525505255152552525535255452555525565255752558525595256052561525625256352564525655256652567525685256952570525715257252573525745257552576525775257852579525805258152582525835258452585525865258752588525895259052591525925259352594525955259652597525985259952600526015260252603526045260552606526075260852609526105261152612526135261452615526165261752618526195262052621526225262352624526255262652627526285262952630526315263252633526345263552636526375263852639526405264152642526435264452645526465264752648526495265052651526525265352654526555265652657526585265952660526615266252663526645266552666526675266852669526705267152672526735267452675526765267752678526795268052681526825268352684526855268652687526885268952690526915269252693526945269552696526975269852699527005270152702527035270452705527065270752708527095271052711527125271352714527155271652717527185271952720527215272252723527245272552726527275272852729527305273152732527335273452735527365273752738527395274052741527425274352744527455274652747527485274952750527515275252753527545275552756527575275852759527605276152762527635276452765527665276752768527695277052771527725277352774527755277652777527785277952780527815278252783527845278552786527875278852789527905279152792527935279452795527965279752798527995280052801528025280352804528055280652807528085280952810528115281252813528145281552816528175281852819528205282152822528235282452825528265282752828528295283052831528325283352834528355283652837528385283952840528415284252843528445284552846528475284852849528505285152852528535285452855528565285752858528595286052861528625286352864528655286652867528685286952870528715287252873528745287552876528775287852879528805288152882528835288452885528865288752888528895289052891528925289352894528955289652897528985289952900529015290252903529045290552906529075290852909529105291152912529135291452915529165291752918529195292052921529225292352924529255292652927529285292952930529315293252933529345293552936529375293852939529405294152942529435294452945529465294752948529495295052951529525295352954529555295652957529585295952960529615296252963529645296552966529675296852969529705297152972529735297452975529765297752978529795298052981529825298352984529855298652987529885298952990529915299252993529945299552996529975299852999530005300153002530035300453005530065300753008530095301053011530125301353014530155301653017530185301953020530215302253023530245302553026530275302853029530305303153032530335303453035530365303753038530395304053041530425304353044530455304653047530485304953050530515305253053530545305553056530575305853059530605306153062530635306453065530665306753068530695307053071530725307353074530755307653077530785307953080530815308253083530845308553086530875308853089530905309153092530935309453095530965309753098530995310053101531025310353104531055310653107531085310953110531115311253113531145311553116531175311853119531205312153122531235312453125531265312753128531295313053131531325313353134531355313653137531385313953140531415314253143531445314553146531475314853149531505315153152531535315453155531565315753158531595316053161531625316353164531655316653167531685316953170531715317253173531745317553176531775317853179531805318153182531835318453185531865318753188531895319053191531925319353194531955319653197531985319953200532015320253203532045320553206532075320853209532105321153212532135321453215532165321753218532195322053221532225322353224532255322653227532285322953230532315323253233532345323553236532375323853239532405324153242532435324453245532465324753248532495325053251532525325353254532555325653257532585325953260532615326253263532645326553266532675326853269532705327153272532735327453275532765327753278532795328053281532825328353284532855328653287532885328953290532915329253293532945329553296532975329853299533005330153302533035330453305533065330753308533095331053311533125331353314533155331653317533185331953320533215332253323533245332553326533275332853329533305333153332533335333453335533365333753338533395334053341533425334353344533455334653347533485334953350533515335253353533545335553356533575335853359533605336153362533635336453365533665336753368533695337053371533725337353374533755337653377533785337953380533815338253383533845338553386533875338853389533905339153392533935339453395533965339753398533995340053401534025340353404534055340653407534085340953410534115341253413534145341553416534175341853419534205342153422534235342453425534265342753428534295343053431534325343353434534355343653437534385343953440534415344253443534445344553446534475344853449534505345153452534535345453455534565345753458534595346053461534625346353464534655346653467534685346953470534715347253473534745347553476534775347853479534805348153482534835348453485534865348753488534895349053491534925349353494534955349653497534985349953500535015350253503535045350553506535075350853509535105351153512535135351453515535165351753518535195352053521535225352353524535255352653527535285352953530535315353253533535345353553536535375353853539535405354153542535435354453545535465354753548535495355053551535525355353554535555355653557535585355953560535615356253563535645356553566535675356853569535705357153572535735357453575535765357753578535795358053581535825358353584535855358653587535885358953590535915359253593535945359553596535975359853599536005360153602536035360453605536065360753608536095361053611536125361353614536155361653617536185361953620536215362253623536245362553626536275362853629536305363153632536335363453635536365363753638536395364053641536425364353644536455364653647536485364953650536515365253653536545365553656536575365853659536605366153662536635366453665536665366753668536695367053671536725367353674536755367653677536785367953680536815368253683536845368553686536875368853689536905369153692536935369453695536965369753698536995370053701537025370353704537055370653707537085370953710537115371253713537145371553716537175371853719537205372153722537235372453725537265372753728537295373053731537325373353734537355373653737537385373953740537415374253743537445374553746537475374853749537505375153752537535375453755537565375753758537595376053761537625376353764537655376653767537685376953770537715377253773537745377553776537775377853779537805378153782537835378453785537865378753788537895379053791537925379353794537955379653797537985379953800538015380253803538045380553806538075380853809538105381153812538135381453815538165381753818538195382053821538225382353824538255382653827538285382953830538315383253833538345383553836538375383853839538405384153842538435384453845538465384753848538495385053851538525385353854538555385653857538585385953860538615386253863538645386553866538675386853869538705387153872538735387453875538765387753878538795388053881538825388353884538855388653887538885388953890538915389253893538945389553896538975389853899539005390153902539035390453905539065390753908539095391053911539125391353914539155391653917539185391953920539215392253923539245392553926539275392853929539305393153932539335393453935539365393753938539395394053941539425394353944539455394653947539485394953950539515395253953539545395553956539575395853959539605396153962539635396453965539665396753968539695397053971539725397353974539755397653977539785397953980539815398253983539845398553986539875398853989539905399153992539935399453995539965399753998539995400054001540025400354004540055400654007540085400954010540115401254013540145401554016540175401854019540205402154022540235402454025540265402754028540295403054031540325403354034540355403654037540385403954040540415404254043540445404554046540475404854049540505405154052540535405454055540565405754058540595406054061540625406354064540655406654067540685406954070540715407254073540745407554076540775407854079540805408154082540835408454085540865408754088540895409054091540925409354094540955409654097540985409954100541015410254103541045410554106541075410854109541105411154112541135411454115541165411754118541195412054121541225412354124541255412654127541285412954130541315413254133541345413554136541375413854139541405414154142541435414454145541465414754148541495415054151541525415354154541555415654157541585415954160541615416254163541645416554166541675416854169541705417154172541735417454175541765417754178541795418054181541825418354184541855418654187541885418954190541915419254193541945419554196541975419854199542005420154202542035420454205542065420754208542095421054211542125421354214542155421654217542185421954220542215422254223542245422554226542275422854229542305423154232542335423454235542365423754238542395424054241542425424354244542455424654247542485424954250542515425254253542545425554256542575425854259542605426154262542635426454265542665426754268542695427054271542725427354274542755427654277542785427954280542815428254283542845428554286542875428854289542905429154292542935429454295542965429754298542995430054301543025430354304543055430654307543085430954310543115431254313543145431554316543175431854319543205432154322543235432454325543265432754328543295433054331543325433354334543355433654337543385433954340543415434254343543445434554346543475434854349543505435154352543535435454355543565435754358543595436054361543625436354364543655436654367543685436954370543715437254373543745437554376543775437854379543805438154382543835438454385543865438754388543895439054391543925439354394543955439654397543985439954400544015440254403544045440554406544075440854409544105441154412544135441454415544165441754418544195442054421544225442354424544255442654427544285442954430544315443254433544345443554436544375443854439544405444154442544435444454445544465444754448544495445054451544525445354454544555445654457544585445954460544615446254463544645446554466544675446854469544705447154472544735447454475544765447754478544795448054481544825448354484544855448654487544885448954490544915449254493544945449554496544975449854499545005450154502545035450454505545065450754508545095451054511545125451354514545155451654517545185451954520545215452254523545245452554526545275452854529545305453154532545335453454535545365453754538545395454054541545425454354544545455454654547545485454954550545515455254553545545455554556545575455854559545605456154562545635456454565545665456754568545695457054571545725457354574545755457654577545785457954580545815458254583545845458554586545875458854589545905459154592545935459454595545965459754598545995460054601546025460354604546055460654607546085460954610546115461254613546145461554616546175461854619546205462154622546235462454625546265462754628546295463054631546325463354634546355463654637546385463954640546415464254643546445464554646546475464854649546505465154652546535465454655546565465754658546595466054661546625466354664546655466654667546685466954670546715467254673546745467554676546775467854679546805468154682546835468454685546865468754688546895469054691546925469354694546955469654697546985469954700547015470254703547045470554706547075470854709547105471154712547135471454715547165471754718547195472054721547225472354724547255472654727547285472954730547315473254733547345473554736547375473854739547405474154742547435474454745547465474754748547495475054751547525475354754547555475654757547585475954760547615476254763547645476554766547675476854769547705477154772547735477454775547765477754778547795478054781547825478354784547855478654787547885478954790547915479254793547945479554796547975479854799548005480154802548035480454805548065480754808548095481054811548125481354814548155481654817548185481954820548215482254823548245482554826548275482854829548305483154832548335483454835548365483754838548395484054841548425484354844548455484654847548485484954850548515485254853548545485554856548575485854859548605486154862548635486454865548665486754868548695487054871548725487354874548755487654877548785487954880548815488254883548845488554886548875488854889548905489154892548935489454895548965489754898548995490054901549025490354904549055490654907549085490954910549115491254913549145491554916549175491854919549205492154922549235492454925549265492754928549295493054931549325493354934549355493654937549385493954940549415494254943549445494554946549475494854949549505495154952549535495454955549565495754958549595496054961549625496354964549655496654967549685496954970549715497254973549745497554976549775497854979549805498154982549835498454985549865498754988549895499054991549925499354994549955499654997549985499955000550015500255003550045500555006550075500855009550105501155012550135501455015550165501755018550195502055021550225502355024550255502655027550285502955030550315503255033550345503555036550375503855039550405504155042550435504455045550465504755048550495505055051550525505355054550555505655057550585505955060550615506255063550645506555066550675506855069550705507155072550735507455075550765507755078550795508055081550825508355084550855508655087550885508955090550915509255093550945509555096550975509855099551005510155102551035510455105551065510755108551095511055111551125511355114551155511655117551185511955120551215512255123551245512555126551275512855129551305513155132551335513455135551365513755138551395514055141551425514355144551455514655147551485514955150551515515255153551545515555156551575515855159551605516155162551635516455165551665516755168551695517055171551725517355174551755517655177551785517955180551815518255183551845518555186551875518855189551905519155192551935519455195551965519755198551995520055201552025520355204552055520655207552085520955210552115521255213552145521555216552175521855219552205522155222552235522455225552265522755228552295523055231552325523355234552355523655237552385523955240552415524255243552445524555246552475524855249552505525155252552535525455255552565525755258552595526055261552625526355264552655526655267552685526955270552715527255273552745527555276552775527855279552805528155282552835528455285552865528755288552895529055291552925529355294552955529655297552985529955300553015530255303553045530555306553075530855309553105531155312553135531455315553165531755318553195532055321553225532355324553255532655327553285532955330553315533255333553345533555336553375533855339553405534155342553435534455345553465534755348553495535055351553525535355354553555535655357553585535955360553615536255363553645536555366553675536855369553705537155372553735537455375553765537755378553795538055381553825538355384553855538655387553885538955390553915539255393553945539555396553975539855399554005540155402554035540455405554065540755408554095541055411554125541355414554155541655417554185541955420554215542255423554245542555426554275542855429554305543155432554335543455435554365543755438554395544055441554425544355444554455544655447554485544955450554515545255453554545545555456554575545855459554605546155462554635546455465554665546755468554695547055471554725547355474554755547655477554785547955480554815548255483554845548555486554875548855489554905549155492554935549455495554965549755498554995550055501555025550355504555055550655507555085550955510555115551255513555145551555516555175551855519555205552155522555235552455525555265552755528555295553055531555325553355534555355553655537555385553955540555415554255543555445554555546555475554855549555505555155552555535555455555555565555755558555595556055561555625556355564555655556655567555685556955570555715557255573555745557555576555775557855579555805558155582555835558455585555865558755588555895559055591555925559355594555955559655597555985559955600556015560255603556045560555606556075560855609556105561155612556135561455615556165561755618556195562055621556225562355624556255562655627556285562955630556315563255633556345563555636556375563855639556405564155642556435564455645556465564755648556495565055651556525565355654556555565655657556585565955660556615566255663556645566555666556675566855669556705567155672556735567455675556765567755678556795568055681556825568355684556855568655687556885568955690556915569255693556945569555696556975569855699557005570155702557035570455705557065570755708557095571055711557125571355714557155571655717557185571955720557215572255723557245572555726557275572855729557305573155732557335573455735557365573755738557395574055741557425574355744557455574655747557485574955750557515575255753557545575555756557575575855759557605576155762557635576455765557665576755768557695577055771557725577355774557755577655777557785577955780557815578255783557845578555786557875578855789557905579155792557935579455795557965579755798557995580055801558025580355804558055580655807558085580955810558115581255813558145581555816558175581855819558205582155822558235582455825558265582755828558295583055831558325583355834558355583655837558385583955840558415584255843558445584555846558475584855849558505585155852558535585455855558565585755858558595586055861558625586355864558655586655867558685586955870558715587255873558745587555876558775587855879558805588155882558835588455885558865588755888558895589055891558925589355894558955589655897558985589955900559015590255903559045590555906559075590855909559105591155912559135591455915559165591755918559195592055921559225592355924559255592655927559285592955930559315593255933559345593555936559375593855939559405594155942559435594455945559465594755948559495595055951559525595355954559555595655957559585595955960559615596255963559645596555966559675596855969559705597155972559735597455975559765597755978559795598055981559825598355984559855598655987559885598955990559915599255993559945599555996559975599855999560005600156002560035600456005560065600756008560095601056011560125601356014560155601656017560185601956020560215602256023560245602556026560275602856029560305603156032560335603456035560365603756038560395604056041560425604356044560455604656047560485604956050560515605256053560545605556056560575605856059560605606156062560635606456065560665606756068560695607056071560725607356074560755607656077560785607956080560815608256083560845608556086560875608856089560905609156092560935609456095560965609756098560995610056101561025610356104561055610656107561085610956110561115611256113561145611556116561175611856119561205612156122561235612456125561265612756128561295613056131561325613356134561355613656137561385613956140561415614256143561445614556146561475614856149561505615156152561535615456155561565615756158561595616056161561625616356164561655616656167561685616956170561715617256173561745617556176561775617856179561805618156182561835618456185561865618756188561895619056191561925619356194561955619656197561985619956200562015620256203562045620556206562075620856209562105621156212562135621456215562165621756218562195622056221562225622356224562255622656227562285622956230562315623256233562345623556236562375623856239562405624156242562435624456245562465624756248562495625056251562525625356254562555625656257562585625956260562615626256263562645626556266562675626856269562705627156272562735627456275562765627756278562795628056281562825628356284562855628656287562885628956290562915629256293562945629556296562975629856299563005630156302563035630456305563065630756308563095631056311563125631356314563155631656317563185631956320563215632256323563245632556326563275632856329563305633156332563335633456335563365633756338563395634056341563425634356344563455634656347563485634956350563515635256353563545635556356563575635856359563605636156362563635636456365563665636756368563695637056371563725637356374563755637656377563785637956380563815638256383563845638556386563875638856389563905639156392563935639456395563965639756398563995640056401564025640356404564055640656407564085640956410564115641256413564145641556416564175641856419564205642156422564235642456425564265642756428564295643056431564325643356434564355643656437564385643956440564415644256443564445644556446564475644856449564505645156452564535645456455564565645756458564595646056461564625646356464564655646656467564685646956470564715647256473564745647556476564775647856479564805648156482564835648456485564865648756488564895649056491564925649356494564955649656497564985649956500565015650256503565045650556506565075650856509565105651156512565135651456515565165651756518565195652056521565225652356524565255652656527565285652956530565315653256533565345653556536565375653856539565405654156542565435654456545565465654756548565495655056551565525655356554565555655656557565585655956560565615656256563565645656556566565675656856569565705657156572565735657456575565765657756578565795658056581565825658356584565855658656587565885658956590565915659256593565945659556596565975659856599566005660156602566035660456605566065660756608566095661056611566125661356614566155661656617566185661956620566215662256623566245662556626566275662856629566305663156632566335663456635566365663756638566395664056641566425664356644566455664656647566485664956650566515665256653566545665556656566575665856659566605666156662566635666456665566665666756668566695667056671566725667356674566755667656677566785667956680566815668256683566845668556686566875668856689566905669156692566935669456695566965669756698566995670056701567025670356704567055670656707567085670956710567115671256713567145671556716567175671856719567205672156722567235672456725567265672756728567295673056731567325673356734567355673656737567385673956740567415674256743567445674556746567475674856749567505675156752567535675456755567565675756758567595676056761567625676356764567655676656767567685676956770567715677256773567745677556776567775677856779567805678156782567835678456785567865678756788567895679056791567925679356794567955679656797567985679956800568015680256803568045680556806568075680856809568105681156812568135681456815568165681756818568195682056821568225682356824568255682656827568285682956830568315683256833568345683556836568375683856839568405684156842568435684456845568465684756848568495685056851568525685356854568555685656857568585685956860568615686256863568645686556866568675686856869568705687156872568735687456875568765687756878568795688056881568825688356884568855688656887568885688956890568915689256893568945689556896568975689856899569005690156902569035690456905569065690756908569095691056911569125691356914569155691656917569185691956920569215692256923569245692556926569275692856929569305693156932569335693456935569365693756938569395694056941569425694356944569455694656947569485694956950569515695256953569545695556956569575695856959569605696156962569635696456965569665696756968569695697056971569725697356974569755697656977569785697956980569815698256983569845698556986569875698856989569905699156992569935699456995569965699756998569995700057001570025700357004570055700657007570085700957010570115701257013570145701557016570175701857019570205702157022570235702457025570265702757028570295703057031570325703357034570355703657037570385703957040570415704257043570445704557046570475704857049570505705157052570535705457055570565705757058570595706057061570625706357064570655706657067570685706957070570715707257073570745707557076570775707857079570805708157082570835708457085570865708757088570895709057091570925709357094570955709657097570985709957100571015710257103571045710557106571075710857109571105711157112571135711457115571165711757118571195712057121571225712357124571255712657127571285712957130571315713257133571345713557136571375713857139571405714157142571435714457145571465714757148571495715057151571525715357154571555715657157571585715957160571615716257163571645716557166571675716857169571705717157172571735717457175571765717757178571795718057181571825718357184571855718657187571885718957190571915719257193571945719557196571975719857199572005720157202572035720457205572065720757208572095721057211572125721357214572155721657217572185721957220572215722257223572245722557226572275722857229572305723157232572335723457235572365723757238572395724057241572425724357244572455724657247572485724957250572515725257253572545725557256572575725857259572605726157262572635726457265572665726757268572695727057271572725727357274572755727657277572785727957280572815728257283572845728557286572875728857289572905729157292572935729457295572965729757298572995730057301573025730357304573055730657307573085730957310573115731257313573145731557316573175731857319573205732157322573235732457325573265732757328573295733057331573325733357334573355733657337573385733957340573415734257343573445734557346573475734857349573505735157352573535735457355573565735757358573595736057361573625736357364573655736657367573685736957370573715737257373573745737557376573775737857379573805738157382573835738457385573865738757388573895739057391573925739357394573955739657397573985739957400574015740257403574045740557406574075740857409574105741157412574135741457415574165741757418574195742057421574225742357424574255742657427574285742957430574315743257433574345743557436574375743857439574405744157442574435744457445574465744757448574495745057451574525745357454574555745657457574585745957460574615746257463574645746557466574675746857469574705747157472574735747457475574765747757478574795748057481574825748357484574855748657487574885748957490574915749257493574945749557496574975749857499575005750157502575035750457505575065750757508575095751057511575125751357514575155751657517575185751957520575215752257523575245752557526575275752857529575305753157532575335753457535575365753757538575395754057541575425754357544575455754657547575485754957550575515755257553575545755557556575575755857559575605756157562575635756457565575665756757568575695757057571575725757357574575755757657577575785757957580575815758257583575845758557586575875758857589575905759157592575935759457595575965759757598575995760057601576025760357604576055760657607576085760957610576115761257613576145761557616576175761857619576205762157622576235762457625576265762757628576295763057631576325763357634576355763657637576385763957640576415764257643576445764557646576475764857649576505765157652576535765457655576565765757658576595766057661576625766357664576655766657667576685766957670576715767257673576745767557676576775767857679576805768157682576835768457685576865768757688576895769057691576925769357694576955769657697576985769957700577015770257703577045770557706577075770857709577105771157712577135771457715577165771757718577195772057721577225772357724577255772657727577285772957730577315773257733577345773557736577375773857739577405774157742577435774457745577465774757748577495775057751577525775357754577555775657757577585775957760577615776257763577645776557766577675776857769577705777157772577735777457775577765777757778577795778057781577825778357784577855778657787577885778957790577915779257793577945779557796577975779857799578005780157802578035780457805578065780757808578095781057811578125781357814578155781657817578185781957820578215782257823578245782557826578275782857829578305783157832578335783457835578365783757838578395784057841578425784357844578455784657847578485784957850578515785257853578545785557856578575785857859578605786157862578635786457865578665786757868578695787057871578725787357874578755787657877578785787957880578815788257883578845788557886578875788857889578905789157892578935789457895578965789757898578995790057901579025790357904579055790657907579085790957910579115791257913579145791557916579175791857919579205792157922579235792457925579265792757928579295793057931579325793357934579355793657937579385793957940579415794257943579445794557946579475794857949579505795157952579535795457955579565795757958579595796057961579625796357964579655796657967579685796957970579715797257973579745797557976579775797857979579805798157982579835798457985579865798757988579895799057991579925799357994579955799657997579985799958000580015800258003580045800558006580075800858009580105801158012580135801458015580165801758018580195802058021580225802358024580255802658027580285802958030580315803258033580345803558036580375803858039580405804158042580435804458045580465804758048580495805058051580525805358054580555805658057580585805958060580615806258063580645806558066580675806858069580705807158072580735807458075580765807758078580795808058081580825808358084580855808658087580885808958090580915809258093580945809558096580975809858099581005810158102581035810458105581065810758108581095811058111581125811358114581155811658117581185811958120581215812258123581245812558126581275812858129581305813158132581335813458135581365813758138581395814058141581425814358144581455814658147581485814958150581515815258153581545815558156581575815858159581605816158162581635816458165581665816758168581695817058171581725817358174581755817658177581785817958180581815818258183581845818558186581875818858189581905819158192581935819458195581965819758198581995820058201582025820358204582055820658207582085820958210582115821258213582145821558216582175821858219582205822158222582235822458225582265822758228582295823058231582325823358234582355823658237582385823958240582415824258243582445824558246582475824858249582505825158252582535825458255582565825758258582595826058261582625826358264582655826658267582685826958270582715827258273582745827558276582775827858279582805828158282582835828458285582865828758288582895829058291582925829358294582955829658297582985829958300583015830258303583045830558306583075830858309583105831158312583135831458315583165831758318583195832058321583225832358324583255832658327583285832958330583315833258333583345833558336583375833858339583405834158342583435834458345583465834758348583495835058351583525835358354583555835658357583585835958360583615836258363583645836558366583675836858369583705837158372583735837458375583765837758378583795838058381583825838358384583855838658387583885838958390583915839258393583945839558396583975839858399584005840158402584035840458405584065840758408584095841058411584125841358414584155841658417584185841958420584215842258423584245842558426584275842858429584305843158432584335843458435584365843758438584395844058441584425844358444584455844658447584485844958450584515845258453584545845558456584575845858459584605846158462584635846458465584665846758468584695847058471584725847358474584755847658477584785847958480584815848258483584845848558486584875848858489584905849158492584935849458495584965849758498584995850058501585025850358504585055850658507585085850958510585115851258513585145851558516585175851858519585205852158522585235852458525585265852758528585295853058531585325853358534585355853658537585385853958540585415854258543585445854558546585475854858549585505855158552585535855458555585565855758558585595856058561585625856358564585655856658567585685856958570585715857258573585745857558576585775857858579585805858158582585835858458585585865858758588585895859058591585925859358594585955859658597585985859958600586015860258603586045860558606586075860858609586105861158612586135861458615586165861758618586195862058621586225862358624586255862658627586285862958630586315863258633586345863558636586375863858639586405864158642586435864458645586465864758648586495865058651586525865358654586555865658657586585865958660586615866258663586645866558666586675866858669586705867158672586735867458675586765867758678586795868058681586825868358684586855868658687586885868958690586915869258693586945869558696586975869858699587005870158702587035870458705587065870758708587095871058711587125871358714587155871658717587185871958720587215872258723587245872558726587275872858729587305873158732587335873458735587365873758738587395874058741587425874358744587455874658747587485874958750587515875258753587545875558756587575875858759587605876158762587635876458765587665876758768587695877058771587725877358774587755877658777587785877958780587815878258783587845878558786587875878858789587905879158792587935879458795587965879758798587995880058801588025880358804588055880658807588085880958810588115881258813588145881558816588175881858819588205882158822588235882458825588265882758828588295883058831588325883358834588355883658837588385883958840588415884258843588445884558846588475884858849588505885158852588535885458855588565885758858588595886058861588625886358864588655886658867588685886958870588715887258873588745887558876588775887858879588805888158882588835888458885588865888758888588895889058891588925889358894588955889658897588985889958900589015890258903589045890558906589075890858909589105891158912589135891458915589165891758918589195892058921589225892358924589255892658927589285892958930589315893258933589345893558936589375893858939589405894158942589435894458945589465894758948589495895058951589525895358954589555895658957589585895958960589615896258963589645896558966589675896858969589705897158972589735897458975589765897758978589795898058981589825898358984589855898658987589885898958990589915899258993589945899558996589975899858999590005900159002590035900459005590065900759008590095901059011590125901359014590155901659017590185901959020590215902259023590245902559026590275902859029590305903159032590335903459035590365903759038590395904059041590425904359044590455904659047590485904959050590515905259053590545905559056590575905859059590605906159062590635906459065590665906759068590695907059071590725907359074590755907659077590785907959080590815908259083590845908559086590875908859089590905909159092590935909459095590965909759098590995910059101591025910359104591055910659107591085910959110591115911259113591145911559116591175911859119591205912159122591235912459125591265912759128591295913059131591325913359134591355913659137591385913959140591415914259143591445914559146591475914859149591505915159152591535915459155591565915759158591595916059161591625916359164591655916659167591685916959170591715917259173591745917559176591775917859179591805918159182591835918459185591865918759188591895919059191591925919359194591955919659197591985919959200592015920259203592045920559206592075920859209592105921159212592135921459215592165921759218592195922059221592225922359224592255922659227592285922959230592315923259233592345923559236592375923859239592405924159242592435924459245592465924759248592495925059251592525925359254592555925659257592585925959260592615926259263592645926559266592675926859269592705927159272592735927459275592765927759278592795928059281592825928359284592855928659287592885928959290592915929259293592945929559296592975929859299593005930159302593035930459305593065930759308593095931059311593125931359314593155931659317593185931959320593215932259323593245932559326593275932859329593305933159332593335933459335593365933759338593395934059341593425934359344593455934659347593485934959350593515935259353593545935559356593575935859359593605936159362593635936459365593665936759368593695937059371593725937359374593755937659377593785937959380593815938259383593845938559386593875938859389593905939159392593935939459395593965939759398593995940059401594025940359404594055940659407594085940959410594115941259413594145941559416594175941859419594205942159422594235942459425594265942759428594295943059431594325943359434594355943659437594385943959440594415944259443594445944559446594475944859449594505945159452594535945459455594565945759458594595946059461594625946359464594655946659467594685946959470594715947259473594745947559476594775947859479594805948159482594835948459485594865948759488594895949059491594925949359494594955949659497594985949959500595015950259503595045950559506595075950859509595105951159512595135951459515595165951759518595195952059521595225952359524595255952659527595285952959530595315953259533595345953559536595375953859539595405954159542595435954459545595465954759548595495955059551595525955359554595555955659557595585955959560595615956259563595645956559566595675956859569595705957159572595735957459575595765957759578595795958059581595825958359584595855958659587595885958959590595915959259593595945959559596595975959859599596005960159602596035960459605596065960759608596095961059611596125961359614596155961659617596185961959620596215962259623596245962559626596275962859629596305963159632596335963459635596365963759638596395964059641596425964359644596455964659647596485964959650596515965259653596545965559656596575965859659596605966159662596635966459665596665966759668596695967059671596725967359674596755967659677596785967959680596815968259683596845968559686596875968859689596905969159692596935969459695596965969759698596995970059701597025970359704597055970659707597085970959710597115971259713597145971559716597175971859719597205972159722597235972459725597265972759728597295973059731597325973359734597355973659737597385973959740597415974259743597445974559746597475974859749597505975159752597535975459755597565975759758597595976059761597625976359764597655976659767597685976959770597715977259773597745977559776597775977859779597805978159782597835978459785597865978759788597895979059791597925979359794597955979659797597985979959800598015980259803598045980559806598075980859809598105981159812598135981459815598165981759818598195982059821598225982359824598255982659827598285982959830598315983259833598345983559836598375983859839598405984159842598435984459845598465984759848598495985059851598525985359854598555985659857598585985959860598615986259863598645986559866598675986859869598705987159872598735987459875598765987759878598795988059881598825988359884598855988659887598885988959890598915989259893598945989559896598975989859899599005990159902599035990459905599065990759908599095991059911599125991359914599155991659917599185991959920599215992259923599245992559926599275992859929599305993159932599335993459935599365993759938599395994059941599425994359944599455994659947599485994959950599515995259953599545995559956599575995859959599605996159962599635996459965599665996759968599695997059971599725997359974599755997659977599785997959980599815998259983599845998559986599875998859989599905999159992599935999459995599965999759998599996000060001600026000360004600056000660007600086000960010600116001260013600146001560016600176001860019600206002160022600236002460025600266002760028600296003060031600326003360034600356003660037600386003960040600416004260043600446004560046600476004860049600506005160052600536005460055600566005760058600596006060061600626006360064600656006660067600686006960070600716007260073600746007560076600776007860079600806008160082600836008460085600866008760088600896009060091600926009360094600956009660097600986009960100601016010260103601046010560106601076010860109601106011160112601136011460115601166011760118601196012060121601226012360124601256012660127601286012960130601316013260133601346013560136601376013860139601406014160142601436014460145601466014760148601496015060151601526015360154601556015660157601586015960160601616016260163601646016560166601676016860169601706017160172601736017460175601766017760178601796018060181601826018360184601856018660187601886018960190601916019260193601946019560196601976019860199602006020160202602036020460205602066020760208602096021060211602126021360214602156021660217602186021960220602216022260223602246022560226602276022860229602306023160232602336023460235602366023760238602396024060241602426024360244602456024660247602486024960250602516025260253602546025560256602576025860259602606026160262602636026460265602666026760268602696027060271602726027360274602756027660277602786027960280602816028260283602846028560286602876028860289602906029160292602936029460295602966029760298602996030060301603026030360304603056030660307603086030960310603116031260313603146031560316603176031860319603206032160322603236032460325603266032760328603296033060331603326033360334603356033660337603386033960340603416034260343603446034560346603476034860349603506035160352603536035460355603566035760358603596036060361603626036360364603656036660367603686036960370603716037260373603746037560376603776037860379603806038160382603836038460385603866038760388603896039060391603926039360394603956039660397603986039960400604016040260403604046040560406604076040860409604106041160412604136041460415604166041760418604196042060421604226042360424604256042660427604286042960430604316043260433604346043560436604376043860439604406044160442604436044460445604466044760448604496045060451604526045360454604556045660457604586045960460604616046260463604646046560466604676046860469604706047160472604736047460475604766047760478604796048060481604826048360484604856048660487604886048960490604916049260493604946049560496604976049860499605006050160502605036050460505605066050760508605096051060511605126051360514605156051660517605186051960520605216052260523605246052560526605276052860529605306053160532605336053460535605366053760538605396054060541605426054360544605456054660547605486054960550605516055260553605546055560556605576055860559605606056160562605636056460565605666056760568605696057060571605726057360574605756057660577605786057960580605816058260583605846058560586605876058860589605906059160592605936059460595605966059760598605996060060601606026060360604606056060660607606086060960610606116061260613606146061560616606176061860619606206062160622606236062460625606266062760628606296063060631606326063360634606356063660637606386063960640606416064260643606446064560646606476064860649606506065160652606536065460655606566065760658606596066060661606626066360664606656066660667606686066960670606716067260673606746067560676606776067860679606806068160682606836068460685606866068760688606896069060691606926069360694606956069660697606986069960700607016070260703607046070560706607076070860709607106071160712607136071460715607166071760718607196072060721607226072360724607256072660727607286072960730607316073260733607346073560736607376073860739607406074160742607436074460745607466074760748607496075060751607526075360754607556075660757607586075960760607616076260763607646076560766607676076860769607706077160772607736077460775607766077760778607796078060781607826078360784607856078660787607886078960790607916079260793607946079560796607976079860799608006080160802608036080460805608066080760808608096081060811608126081360814608156081660817608186081960820608216082260823608246082560826608276082860829608306083160832608336083460835608366083760838608396084060841608426084360844608456084660847608486084960850608516085260853608546085560856608576085860859608606086160862608636086460865608666086760868608696087060871608726087360874608756087660877608786087960880608816088260883608846088560886608876088860889608906089160892608936089460895608966089760898608996090060901609026090360904609056090660907609086090960910609116091260913609146091560916609176091860919609206092160922609236092460925609266092760928609296093060931609326093360934609356093660937609386093960940609416094260943609446094560946609476094860949609506095160952609536095460955609566095760958609596096060961609626096360964609656096660967609686096960970609716097260973609746097560976609776097860979609806098160982609836098460985609866098760988609896099060991609926099360994609956099660997609986099961000610016100261003610046100561006610076100861009610106101161012610136101461015610166101761018610196102061021610226102361024610256102661027610286102961030610316103261033610346103561036610376103861039610406104161042610436104461045610466104761048610496105061051610526105361054610556105661057610586105961060610616106261063610646106561066610676106861069610706107161072610736107461075610766107761078610796108061081610826108361084610856108661087610886108961090610916109261093610946109561096610976109861099611006110161102611036110461105611066110761108611096111061111611126111361114611156111661117611186111961120611216112261123611246112561126611276112861129611306113161132611336113461135611366113761138611396114061141611426114361144611456114661147611486114961150611516115261153611546115561156611576115861159611606116161162611636116461165611666116761168611696117061171611726117361174611756117661177611786117961180611816118261183611846118561186611876118861189611906119161192611936119461195611966119761198611996120061201612026120361204612056120661207612086120961210612116121261213612146121561216612176121861219612206122161222612236122461225612266122761228612296123061231612326123361234612356123661237612386123961240612416124261243612446124561246612476124861249612506125161252612536125461255612566125761258612596126061261612626126361264612656126661267612686126961270612716127261273612746127561276612776127861279612806128161282612836128461285612866128761288612896129061291612926129361294612956129661297612986129961300613016130261303613046130561306613076130861309613106131161312613136131461315613166131761318613196132061321613226132361324613256132661327613286132961330613316133261333613346133561336613376133861339613406134161342613436134461345613466134761348613496135061351613526135361354613556135661357613586135961360613616136261363613646136561366613676136861369613706137161372613736137461375613766137761378613796138061381613826138361384613856138661387613886138961390613916139261393613946139561396613976139861399614006140161402614036140461405614066140761408614096141061411614126141361414614156141661417614186141961420614216142261423614246142561426614276142861429614306143161432614336143461435614366143761438614396144061441614426144361444614456144661447614486144961450614516145261453614546145561456614576145861459614606146161462614636146461465614666146761468614696147061471614726147361474614756147661477614786147961480614816148261483614846148561486614876148861489614906149161492614936149461495614966149761498614996150061501615026150361504615056150661507615086150961510615116151261513615146151561516615176151861519615206152161522615236152461525615266152761528615296153061531615326153361534615356153661537615386153961540615416154261543615446154561546615476154861549615506155161552615536155461555615566155761558615596156061561615626156361564615656156661567615686156961570615716157261573615746157561576615776157861579615806158161582615836158461585615866158761588615896159061591615926159361594615956159661597615986159961600616016160261603616046160561606616076160861609616106161161612616136161461615616166161761618616196162061621616226162361624616256162661627616286162961630616316163261633616346163561636616376163861639616406164161642616436164461645616466164761648616496165061651616526165361654616556165661657616586165961660616616166261663616646166561666616676166861669616706167161672616736167461675616766167761678616796168061681616826168361684616856168661687616886168961690616916169261693616946169561696616976169861699617006170161702617036170461705617066170761708617096171061711617126171361714617156171661717617186171961720617216172261723617246172561726617276172861729617306173161732617336173461735617366173761738617396174061741617426174361744617456174661747617486174961750617516175261753617546175561756617576175861759617606176161762617636176461765617666176761768617696177061771617726177361774617756177661777617786177961780617816178261783617846178561786617876178861789617906179161792617936179461795617966179761798617996180061801618026180361804618056180661807618086180961810618116181261813618146181561816618176181861819618206182161822618236182461825618266182761828618296183061831618326183361834618356183661837618386183961840618416184261843618446184561846618476184861849618506185161852618536185461855618566185761858618596186061861618626186361864618656186661867618686186961870618716187261873618746187561876618776187861879618806188161882618836188461885618866188761888618896189061891618926189361894618956189661897618986189961900619016190261903619046190561906619076190861909619106191161912619136191461915619166191761918619196192061921619226192361924619256192661927619286192961930619316193261933619346193561936619376193861939619406194161942619436194461945619466194761948619496195061951619526195361954619556195661957619586195961960619616196261963619646196561966619676196861969619706197161972619736197461975619766197761978619796198061981619826198361984619856198661987619886198961990619916199261993619946199561996619976199861999620006200162002620036200462005620066200762008620096201062011620126201362014620156201662017620186201962020620216202262023620246202562026620276202862029620306203162032620336203462035620366203762038620396204062041620426204362044620456204662047620486204962050620516205262053620546205562056620576205862059620606206162062620636206462065620666206762068620696207062071620726207362074620756207662077620786207962080620816208262083620846208562086620876208862089620906209162092620936209462095620966209762098620996210062101621026210362104621056210662107621086210962110621116211262113621146211562116621176211862119621206212162122621236212462125621266212762128621296213062131621326213362134621356213662137621386213962140621416214262143621446214562146621476214862149621506215162152621536215462155621566215762158621596216062161621626216362164621656216662167621686216962170621716217262173621746217562176621776217862179621806218162182621836218462185621866218762188621896219062191621926219362194621956219662197621986219962200622016220262203622046220562206622076220862209622106221162212622136221462215622166221762218622196222062221622226222362224622256222662227622286222962230622316223262233622346223562236622376223862239622406224162242622436224462245622466224762248622496225062251622526225362254622556225662257622586225962260622616226262263622646226562266622676226862269622706227162272622736227462275622766227762278622796228062281622826228362284622856228662287622886228962290622916229262293622946229562296622976229862299623006230162302623036230462305623066230762308623096231062311623126231362314623156231662317623186231962320623216232262323623246232562326623276232862329623306233162332623336233462335623366233762338623396234062341623426234362344623456234662347623486234962350623516235262353623546235562356623576235862359623606236162362623636236462365623666236762368623696237062371623726237362374623756237662377623786237962380623816238262383623846238562386623876238862389623906239162392623936239462395623966239762398623996240062401624026240362404624056240662407624086240962410624116241262413624146241562416624176241862419624206242162422624236242462425624266242762428624296243062431624326243362434624356243662437624386243962440624416244262443624446244562446624476244862449624506245162452624536245462455624566245762458624596246062461624626246362464624656246662467624686246962470624716247262473624746247562476624776247862479624806248162482624836248462485624866248762488624896249062491624926249362494624956249662497624986249962500625016250262503625046250562506625076250862509625106251162512625136251462515625166251762518625196252062521625226252362524625256252662527625286252962530625316253262533625346253562536625376253862539625406254162542625436254462545625466254762548625496255062551625526255362554625556255662557625586255962560625616256262563625646256562566625676256862569625706257162572625736257462575625766257762578625796258062581625826258362584625856258662587625886258962590625916259262593625946259562596625976259862599626006260162602626036260462605626066260762608626096261062611626126261362614626156261662617626186261962620626216262262623626246262562626626276262862629626306263162632626336263462635626366263762638626396264062641626426264362644626456264662647626486264962650626516265262653626546265562656626576265862659626606266162662626636266462665626666266762668626696267062671626726267362674626756267662677626786267962680626816268262683626846268562686626876268862689626906269162692626936269462695626966269762698626996270062701627026270362704627056270662707627086270962710627116271262713627146271562716627176271862719627206272162722627236272462725627266272762728627296273062731627326273362734627356273662737627386273962740627416274262743627446274562746627476274862749627506275162752627536275462755627566275762758627596276062761627626276362764627656276662767627686276962770627716277262773627746277562776627776277862779627806278162782627836278462785627866278762788627896279062791627926279362794627956279662797627986279962800628016280262803628046280562806628076280862809628106281162812628136281462815628166281762818628196282062821628226282362824628256282662827628286282962830628316283262833628346283562836628376283862839628406284162842628436284462845628466284762848628496285062851628526285362854628556285662857628586285962860628616286262863628646286562866628676286862869628706287162872628736287462875628766287762878628796288062881628826288362884628856288662887628886288962890628916289262893628946289562896628976289862899629006290162902629036290462905629066290762908629096291062911629126291362914629156291662917629186291962920629216292262923629246292562926629276292862929629306293162932629336293462935629366293762938629396294062941629426294362944629456294662947629486294962950629516295262953629546295562956629576295862959629606296162962629636296462965629666296762968629696297062971629726297362974629756297662977629786297962980629816298262983629846298562986629876298862989629906299162992629936299462995629966299762998629996300063001630026300363004630056300663007630086300963010630116301263013630146301563016630176301863019630206302163022630236302463025630266302763028630296303063031630326303363034630356303663037630386303963040630416304263043630446304563046630476304863049630506305163052630536305463055630566305763058630596306063061630626306363064630656306663067630686306963070630716307263073630746307563076630776307863079630806308163082630836308463085630866308763088630896309063091630926309363094630956309663097630986309963100631016310263103631046310563106631076310863109631106311163112631136311463115631166311763118631196312063121631226312363124631256312663127631286312963130631316313263133631346313563136631376313863139631406314163142631436314463145631466314763148631496315063151631526315363154631556315663157631586315963160631616316263163631646316563166631676316863169631706317163172631736317463175631766317763178631796318063181631826318363184631856318663187631886318963190631916319263193631946319563196631976319863199632006320163202632036320463205632066320763208632096321063211632126321363214632156321663217632186321963220632216322263223632246322563226632276322863229632306323163232632336323463235632366323763238632396324063241632426324363244632456324663247632486324963250632516325263253632546325563256632576325863259632606326163262632636326463265632666326763268632696327063271632726327363274632756327663277632786327963280632816328263283632846328563286632876328863289632906329163292632936329463295632966329763298632996330063301633026330363304633056330663307633086330963310633116331263313633146331563316633176331863319633206332163322633236332463325633266332763328633296333063331633326333363334633356333663337633386333963340633416334263343633446334563346633476334863349633506335163352633536335463355633566335763358633596336063361633626336363364633656336663367633686336963370633716337263373633746337563376633776337863379633806338163382633836338463385633866338763388633896339063391633926339363394633956339663397633986339963400634016340263403634046340563406634076340863409634106341163412634136341463415634166341763418634196342063421634226342363424634256342663427634286342963430634316343263433634346343563436634376343863439634406344163442634436344463445634466344763448634496345063451634526345363454634556345663457634586345963460634616346263463634646346563466634676346863469634706347163472634736347463475634766347763478634796348063481634826348363484634856348663487634886348963490634916349263493634946349563496634976349863499635006350163502635036350463505635066350763508635096351063511635126351363514635156351663517635186351963520635216352263523635246352563526635276352863529635306353163532635336353463535635366353763538635396354063541635426354363544635456354663547635486354963550635516355263553635546355563556635576355863559635606356163562635636356463565635666356763568635696357063571635726357363574635756357663577635786357963580635816358263583635846358563586635876358863589635906359163592635936359463595635966359763598635996360063601636026360363604636056360663607636086360963610636116361263613636146361563616636176361863619636206362163622636236362463625636266362763628636296363063631636326363363634636356363663637636386363963640636416364263643636446364563646636476364863649636506365163652636536365463655636566365763658636596366063661636626366363664636656366663667636686366963670636716367263673636746367563676636776367863679636806368163682636836368463685636866368763688636896369063691636926369363694636956369663697636986369963700637016370263703637046370563706637076370863709637106371163712637136371463715637166371763718637196372063721637226372363724637256372663727637286372963730637316373263733637346373563736637376373863739637406374163742637436374463745637466374763748637496375063751637526375363754637556375663757637586375963760637616376263763637646376563766637676376863769637706377163772637736377463775637766377763778637796378063781637826378363784637856378663787637886378963790637916379263793637946379563796637976379863799638006380163802638036380463805638066380763808638096381063811638126381363814638156381663817638186381963820638216382263823638246382563826638276382863829638306383163832638336383463835638366383763838638396384063841638426384363844638456384663847638486384963850638516385263853638546385563856638576385863859638606386163862638636386463865638666386763868638696387063871638726387363874638756387663877638786387963880638816388263883638846388563886638876388863889638906389163892638936389463895638966389763898638996390063901639026390363904639056390663907639086390963910639116391263913639146391563916639176391863919639206392163922639236392463925639266392763928639296393063931639326393363934639356393663937639386393963940639416394263943639446394563946639476394863949639506395163952639536395463955639566395763958639596396063961639626396363964639656396663967639686396963970639716397263973639746397563976639776397863979639806398163982639836398463985639866398763988639896399063991639926399363994639956399663997639986399964000640016400264003640046400564006640076400864009640106401164012640136401464015640166401764018640196402064021640226402364024640256402664027640286402964030640316403264033640346403564036640376403864039640406404164042640436404464045640466404764048640496405064051640526405364054640556405664057640586405964060640616406264063640646406564066640676406864069640706407164072
  1. /******/ (function(modules) { // webpackBootstrap
  2. /******/ // The module cache
  3. /******/ var installedModules = {};
  4. /******/
  5. /******/ // The require function
  6. /******/ function __webpack_require__(moduleId) {
  7. /******/
  8. /******/ // Check if module is in cache
  9. /******/ if(installedModules[moduleId]) {
  10. /******/ return installedModules[moduleId].exports;
  11. /******/ }
  12. /******/ // Create a new module (and put it into the cache)
  13. /******/ var module = installedModules[moduleId] = {
  14. /******/ i: moduleId,
  15. /******/ l: false,
  16. /******/ exports: {}
  17. /******/ };
  18. /******/
  19. /******/ // Execute the module function
  20. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  21. /******/
  22. /******/ // Flag the module as loaded
  23. /******/ module.l = true;
  24. /******/
  25. /******/ // Return the exports of the module
  26. /******/ return module.exports;
  27. /******/ }
  28. /******/
  29. /******/
  30. /******/ // expose the modules object (__webpack_modules__)
  31. /******/ __webpack_require__.m = modules;
  32. /******/
  33. /******/ // expose the module cache
  34. /******/ __webpack_require__.c = installedModules;
  35. /******/
  36. /******/ // define getter function for harmony exports
  37. /******/ __webpack_require__.d = function(exports, name, getter) {
  38. /******/ if(!__webpack_require__.o(exports, name)) {
  39. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  40. /******/ }
  41. /******/ };
  42. /******/
  43. /******/ // define __esModule on exports
  44. /******/ __webpack_require__.r = function(exports) {
  45. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  46. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  47. /******/ }
  48. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  49. /******/ };
  50. /******/
  51. /******/ // create a fake namespace object
  52. /******/ // mode & 1: value is a module id, require it
  53. /******/ // mode & 2: merge all properties of value into the ns
  54. /******/ // mode & 4: return value when already ns object
  55. /******/ // mode & 8|1: behave like require
  56. /******/ __webpack_require__.t = function(value, mode) {
  57. /******/ if(mode & 1) value = __webpack_require__(value);
  58. /******/ if(mode & 8) return value;
  59. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  60. /******/ var ns = Object.create(null);
  61. /******/ __webpack_require__.r(ns);
  62. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  63. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  64. /******/ return ns;
  65. /******/ };
  66. /******/
  67. /******/ // getDefaultExport function for compatibility with non-harmony modules
  68. /******/ __webpack_require__.n = function(module) {
  69. /******/ var getter = module && module.__esModule ?
  70. /******/ function getDefault() { return module['default']; } :
  71. /******/ function getModuleExports() { return module; };
  72. /******/ __webpack_require__.d(getter, 'a', getter);
  73. /******/ return getter;
  74. /******/ };
  75. /******/
  76. /******/ // Object.prototype.hasOwnProperty.call
  77. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  78. /******/
  79. /******/ // __webpack_public_path__
  80. /******/ __webpack_require__.p = "/";
  81. /******/
  82. /******/
  83. /******/ // Load entry module and return exports
  84. /******/ return __webpack_require__(__webpack_require__.s = 0);
  85. /******/ })
  86. /************************************************************************/
  87. /******/ ({
  88. /***/ "./node_modules/axios/index.js":
  89. /*!*************************************!*\
  90. !*** ./node_modules/axios/index.js ***!
  91. \*************************************/
  92. /*! no static exports found */
  93. /***/ (function(module, exports, __webpack_require__) {
  94. module.exports = __webpack_require__(/*! ./lib/axios */ "./node_modules/axios/lib/axios.js");
  95. /***/ }),
  96. /***/ "./node_modules/axios/lib/adapters/xhr.js":
  97. /*!************************************************!*\
  98. !*** ./node_modules/axios/lib/adapters/xhr.js ***!
  99. \************************************************/
  100. /*! no static exports found */
  101. /***/ (function(module, exports, __webpack_require__) {
  102. "use strict";
  103. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  104. var settle = __webpack_require__(/*! ./../core/settle */ "./node_modules/axios/lib/core/settle.js");
  105. var buildURL = __webpack_require__(/*! ./../helpers/buildURL */ "./node_modules/axios/lib/helpers/buildURL.js");
  106. var buildFullPath = __webpack_require__(/*! ../core/buildFullPath */ "./node_modules/axios/lib/core/buildFullPath.js");
  107. var parseHeaders = __webpack_require__(/*! ./../helpers/parseHeaders */ "./node_modules/axios/lib/helpers/parseHeaders.js");
  108. var isURLSameOrigin = __webpack_require__(/*! ./../helpers/isURLSameOrigin */ "./node_modules/axios/lib/helpers/isURLSameOrigin.js");
  109. var createError = __webpack_require__(/*! ../core/createError */ "./node_modules/axios/lib/core/createError.js");
  110. module.exports = function xhrAdapter(config) {
  111. return new Promise(function dispatchXhrRequest(resolve, reject) {
  112. var requestData = config.data;
  113. var requestHeaders = config.headers;
  114. if (utils.isFormData(requestData)) {
  115. delete requestHeaders['Content-Type']; // Let the browser set it
  116. }
  117. var request = new XMLHttpRequest();
  118. // HTTP basic authentication
  119. if (config.auth) {
  120. var username = config.auth.username || '';
  121. var password = config.auth.password || '';
  122. requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
  123. }
  124. var fullPath = buildFullPath(config.baseURL, config.url);
  125. request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
  126. // Set the request timeout in MS
  127. request.timeout = config.timeout;
  128. // Listen for ready state
  129. request.onreadystatechange = function handleLoad() {
  130. if (!request || request.readyState !== 4) {
  131. return;
  132. }
  133. // The request errored out and we didn't get a response, this will be
  134. // handled by onerror instead
  135. // With one exception: request that using file: protocol, most browsers
  136. // will return status as 0 even though it's a successful request
  137. if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
  138. return;
  139. }
  140. // Prepare the response
  141. var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
  142. var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
  143. var response = {
  144. data: responseData,
  145. status: request.status,
  146. statusText: request.statusText,
  147. headers: responseHeaders,
  148. config: config,
  149. request: request
  150. };
  151. settle(resolve, reject, response);
  152. // Clean up request
  153. request = null;
  154. };
  155. // Handle browser request cancellation (as opposed to a manual cancellation)
  156. request.onabort = function handleAbort() {
  157. if (!request) {
  158. return;
  159. }
  160. reject(createError('Request aborted', config, 'ECONNABORTED', request));
  161. // Clean up request
  162. request = null;
  163. };
  164. // Handle low level network errors
  165. request.onerror = function handleError() {
  166. // Real errors are hidden from us by the browser
  167. // onerror should only fire if it's a network error
  168. reject(createError('Network Error', config, null, request));
  169. // Clean up request
  170. request = null;
  171. };
  172. // Handle timeout
  173. request.ontimeout = function handleTimeout() {
  174. var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded';
  175. if (config.timeoutErrorMessage) {
  176. timeoutErrorMessage = config.timeoutErrorMessage;
  177. }
  178. reject(createError(timeoutErrorMessage, config, 'ECONNABORTED',
  179. request));
  180. // Clean up request
  181. request = null;
  182. };
  183. // Add xsrf header
  184. // This is only done if running in a standard browser environment.
  185. // Specifically not if we're in a web worker, or react-native.
  186. if (utils.isStandardBrowserEnv()) {
  187. var cookies = __webpack_require__(/*! ./../helpers/cookies */ "./node_modules/axios/lib/helpers/cookies.js");
  188. // Add xsrf header
  189. var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ?
  190. cookies.read(config.xsrfCookieName) :
  191. undefined;
  192. if (xsrfValue) {
  193. requestHeaders[config.xsrfHeaderName] = xsrfValue;
  194. }
  195. }
  196. // Add headers to the request
  197. if ('setRequestHeader' in request) {
  198. utils.forEach(requestHeaders, function setRequestHeader(val, key) {
  199. if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
  200. // Remove Content-Type if data is undefined
  201. delete requestHeaders[key];
  202. } else {
  203. // Otherwise add header to the request
  204. request.setRequestHeader(key, val);
  205. }
  206. });
  207. }
  208. // Add withCredentials to request if needed
  209. if (!utils.isUndefined(config.withCredentials)) {
  210. request.withCredentials = !!config.withCredentials;
  211. }
  212. // Add responseType to request if needed
  213. if (config.responseType) {
  214. try {
  215. request.responseType = config.responseType;
  216. } catch (e) {
  217. // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.
  218. // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.
  219. if (config.responseType !== 'json') {
  220. throw e;
  221. }
  222. }
  223. }
  224. // Handle progress if needed
  225. if (typeof config.onDownloadProgress === 'function') {
  226. request.addEventListener('progress', config.onDownloadProgress);
  227. }
  228. // Not all browsers support upload events
  229. if (typeof config.onUploadProgress === 'function' && request.upload) {
  230. request.upload.addEventListener('progress', config.onUploadProgress);
  231. }
  232. if (config.cancelToken) {
  233. // Handle cancellation
  234. config.cancelToken.promise.then(function onCanceled(cancel) {
  235. if (!request) {
  236. return;
  237. }
  238. request.abort();
  239. reject(cancel);
  240. // Clean up request
  241. request = null;
  242. });
  243. }
  244. if (requestData === undefined) {
  245. requestData = null;
  246. }
  247. // Send the request
  248. request.send(requestData);
  249. });
  250. };
  251. /***/ }),
  252. /***/ "./node_modules/axios/lib/axios.js":
  253. /*!*****************************************!*\
  254. !*** ./node_modules/axios/lib/axios.js ***!
  255. \*****************************************/
  256. /*! no static exports found */
  257. /***/ (function(module, exports, __webpack_require__) {
  258. "use strict";
  259. var utils = __webpack_require__(/*! ./utils */ "./node_modules/axios/lib/utils.js");
  260. var bind = __webpack_require__(/*! ./helpers/bind */ "./node_modules/axios/lib/helpers/bind.js");
  261. var Axios = __webpack_require__(/*! ./core/Axios */ "./node_modules/axios/lib/core/Axios.js");
  262. var mergeConfig = __webpack_require__(/*! ./core/mergeConfig */ "./node_modules/axios/lib/core/mergeConfig.js");
  263. var defaults = __webpack_require__(/*! ./defaults */ "./node_modules/axios/lib/defaults.js");
  264. /**
  265. * Create an instance of Axios
  266. *
  267. * @param {Object} defaultConfig The default config for the instance
  268. * @return {Axios} A new instance of Axios
  269. */
  270. function createInstance(defaultConfig) {
  271. var context = new Axios(defaultConfig);
  272. var instance = bind(Axios.prototype.request, context);
  273. // Copy axios.prototype to instance
  274. utils.extend(instance, Axios.prototype, context);
  275. // Copy context to instance
  276. utils.extend(instance, context);
  277. return instance;
  278. }
  279. // Create the default instance to be exported
  280. var axios = createInstance(defaults);
  281. // Expose Axios class to allow class inheritance
  282. axios.Axios = Axios;
  283. // Factory for creating new instances
  284. axios.create = function create(instanceConfig) {
  285. return createInstance(mergeConfig(axios.defaults, instanceConfig));
  286. };
  287. // Expose Cancel & CancelToken
  288. axios.Cancel = __webpack_require__(/*! ./cancel/Cancel */ "./node_modules/axios/lib/cancel/Cancel.js");
  289. axios.CancelToken = __webpack_require__(/*! ./cancel/CancelToken */ "./node_modules/axios/lib/cancel/CancelToken.js");
  290. axios.isCancel = __webpack_require__(/*! ./cancel/isCancel */ "./node_modules/axios/lib/cancel/isCancel.js");
  291. // Expose all/spread
  292. axios.all = function all(promises) {
  293. return Promise.all(promises);
  294. };
  295. axios.spread = __webpack_require__(/*! ./helpers/spread */ "./node_modules/axios/lib/helpers/spread.js");
  296. module.exports = axios;
  297. // Allow use of default import syntax in TypeScript
  298. module.exports.default = axios;
  299. /***/ }),
  300. /***/ "./node_modules/axios/lib/cancel/Cancel.js":
  301. /*!*************************************************!*\
  302. !*** ./node_modules/axios/lib/cancel/Cancel.js ***!
  303. \*************************************************/
  304. /*! no static exports found */
  305. /***/ (function(module, exports, __webpack_require__) {
  306. "use strict";
  307. /**
  308. * A `Cancel` is an object that is thrown when an operation is canceled.
  309. *
  310. * @class
  311. * @param {string=} message The message.
  312. */
  313. function Cancel(message) {
  314. this.message = message;
  315. }
  316. Cancel.prototype.toString = function toString() {
  317. return 'Cancel' + (this.message ? ': ' + this.message : '');
  318. };
  319. Cancel.prototype.__CANCEL__ = true;
  320. module.exports = Cancel;
  321. /***/ }),
  322. /***/ "./node_modules/axios/lib/cancel/CancelToken.js":
  323. /*!******************************************************!*\
  324. !*** ./node_modules/axios/lib/cancel/CancelToken.js ***!
  325. \******************************************************/
  326. /*! no static exports found */
  327. /***/ (function(module, exports, __webpack_require__) {
  328. "use strict";
  329. var Cancel = __webpack_require__(/*! ./Cancel */ "./node_modules/axios/lib/cancel/Cancel.js");
  330. /**
  331. * A `CancelToken` is an object that can be used to request cancellation of an operation.
  332. *
  333. * @class
  334. * @param {Function} executor The executor function.
  335. */
  336. function CancelToken(executor) {
  337. if (typeof executor !== 'function') {
  338. throw new TypeError('executor must be a function.');
  339. }
  340. var resolvePromise;
  341. this.promise = new Promise(function promiseExecutor(resolve) {
  342. resolvePromise = resolve;
  343. });
  344. var token = this;
  345. executor(function cancel(message) {
  346. if (token.reason) {
  347. // Cancellation has already been requested
  348. return;
  349. }
  350. token.reason = new Cancel(message);
  351. resolvePromise(token.reason);
  352. });
  353. }
  354. /**
  355. * Throws a `Cancel` if cancellation has been requested.
  356. */
  357. CancelToken.prototype.throwIfRequested = function throwIfRequested() {
  358. if (this.reason) {
  359. throw this.reason;
  360. }
  361. };
  362. /**
  363. * Returns an object that contains a new `CancelToken` and a function that, when called,
  364. * cancels the `CancelToken`.
  365. */
  366. CancelToken.source = function source() {
  367. var cancel;
  368. var token = new CancelToken(function executor(c) {
  369. cancel = c;
  370. });
  371. return {
  372. token: token,
  373. cancel: cancel
  374. };
  375. };
  376. module.exports = CancelToken;
  377. /***/ }),
  378. /***/ "./node_modules/axios/lib/cancel/isCancel.js":
  379. /*!***************************************************!*\
  380. !*** ./node_modules/axios/lib/cancel/isCancel.js ***!
  381. \***************************************************/
  382. /*! no static exports found */
  383. /***/ (function(module, exports, __webpack_require__) {
  384. "use strict";
  385. module.exports = function isCancel(value) {
  386. return !!(value && value.__CANCEL__);
  387. };
  388. /***/ }),
  389. /***/ "./node_modules/axios/lib/core/Axios.js":
  390. /*!**********************************************!*\
  391. !*** ./node_modules/axios/lib/core/Axios.js ***!
  392. \**********************************************/
  393. /*! no static exports found */
  394. /***/ (function(module, exports, __webpack_require__) {
  395. "use strict";
  396. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  397. var buildURL = __webpack_require__(/*! ../helpers/buildURL */ "./node_modules/axios/lib/helpers/buildURL.js");
  398. var InterceptorManager = __webpack_require__(/*! ./InterceptorManager */ "./node_modules/axios/lib/core/InterceptorManager.js");
  399. var dispatchRequest = __webpack_require__(/*! ./dispatchRequest */ "./node_modules/axios/lib/core/dispatchRequest.js");
  400. var mergeConfig = __webpack_require__(/*! ./mergeConfig */ "./node_modules/axios/lib/core/mergeConfig.js");
  401. /**
  402. * Create a new instance of Axios
  403. *
  404. * @param {Object} instanceConfig The default config for the instance
  405. */
  406. function Axios(instanceConfig) {
  407. this.defaults = instanceConfig;
  408. this.interceptors = {
  409. request: new InterceptorManager(),
  410. response: new InterceptorManager()
  411. };
  412. }
  413. /**
  414. * Dispatch a request
  415. *
  416. * @param {Object} config The config specific for this request (merged with this.defaults)
  417. */
  418. Axios.prototype.request = function request(config) {
  419. /*eslint no-param-reassign:0*/
  420. // Allow for axios('example/url'[, config]) a la fetch API
  421. if (typeof config === 'string') {
  422. config = arguments[1] || {};
  423. config.url = arguments[0];
  424. } else {
  425. config = config || {};
  426. }
  427. config = mergeConfig(this.defaults, config);
  428. // Set config.method
  429. if (config.method) {
  430. config.method = config.method.toLowerCase();
  431. } else if (this.defaults.method) {
  432. config.method = this.defaults.method.toLowerCase();
  433. } else {
  434. config.method = 'get';
  435. }
  436. // Hook up interceptors middleware
  437. var chain = [dispatchRequest, undefined];
  438. var promise = Promise.resolve(config);
  439. this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
  440. chain.unshift(interceptor.fulfilled, interceptor.rejected);
  441. });
  442. this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
  443. chain.push(interceptor.fulfilled, interceptor.rejected);
  444. });
  445. while (chain.length) {
  446. promise = promise.then(chain.shift(), chain.shift());
  447. }
  448. return promise;
  449. };
  450. Axios.prototype.getUri = function getUri(config) {
  451. config = mergeConfig(this.defaults, config);
  452. return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, '');
  453. };
  454. // Provide aliases for supported request methods
  455. utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
  456. /*eslint func-names:0*/
  457. Axios.prototype[method] = function(url, config) {
  458. return this.request(utils.merge(config || {}, {
  459. method: method,
  460. url: url
  461. }));
  462. };
  463. });
  464. utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  465. /*eslint func-names:0*/
  466. Axios.prototype[method] = function(url, data, config) {
  467. return this.request(utils.merge(config || {}, {
  468. method: method,
  469. url: url,
  470. data: data
  471. }));
  472. };
  473. });
  474. module.exports = Axios;
  475. /***/ }),
  476. /***/ "./node_modules/axios/lib/core/InterceptorManager.js":
  477. /*!***********************************************************!*\
  478. !*** ./node_modules/axios/lib/core/InterceptorManager.js ***!
  479. \***********************************************************/
  480. /*! no static exports found */
  481. /***/ (function(module, exports, __webpack_require__) {
  482. "use strict";
  483. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  484. function InterceptorManager() {
  485. this.handlers = [];
  486. }
  487. /**
  488. * Add a new interceptor to the stack
  489. *
  490. * @param {Function} fulfilled The function to handle `then` for a `Promise`
  491. * @param {Function} rejected The function to handle `reject` for a `Promise`
  492. *
  493. * @return {Number} An ID used to remove interceptor later
  494. */
  495. InterceptorManager.prototype.use = function use(fulfilled, rejected) {
  496. this.handlers.push({
  497. fulfilled: fulfilled,
  498. rejected: rejected
  499. });
  500. return this.handlers.length - 1;
  501. };
  502. /**
  503. * Remove an interceptor from the stack
  504. *
  505. * @param {Number} id The ID that was returned by `use`
  506. */
  507. InterceptorManager.prototype.eject = function eject(id) {
  508. if (this.handlers[id]) {
  509. this.handlers[id] = null;
  510. }
  511. };
  512. /**
  513. * Iterate over all the registered interceptors
  514. *
  515. * This method is particularly useful for skipping over any
  516. * interceptors that may have become `null` calling `eject`.
  517. *
  518. * @param {Function} fn The function to call for each interceptor
  519. */
  520. InterceptorManager.prototype.forEach = function forEach(fn) {
  521. utils.forEach(this.handlers, function forEachHandler(h) {
  522. if (h !== null) {
  523. fn(h);
  524. }
  525. });
  526. };
  527. module.exports = InterceptorManager;
  528. /***/ }),
  529. /***/ "./node_modules/axios/lib/core/buildFullPath.js":
  530. /*!******************************************************!*\
  531. !*** ./node_modules/axios/lib/core/buildFullPath.js ***!
  532. \******************************************************/
  533. /*! no static exports found */
  534. /***/ (function(module, exports, __webpack_require__) {
  535. "use strict";
  536. var isAbsoluteURL = __webpack_require__(/*! ../helpers/isAbsoluteURL */ "./node_modules/axios/lib/helpers/isAbsoluteURL.js");
  537. var combineURLs = __webpack_require__(/*! ../helpers/combineURLs */ "./node_modules/axios/lib/helpers/combineURLs.js");
  538. /**
  539. * Creates a new URL by combining the baseURL with the requestedURL,
  540. * only when the requestedURL is not already an absolute URL.
  541. * If the requestURL is absolute, this function returns the requestedURL untouched.
  542. *
  543. * @param {string} baseURL The base URL
  544. * @param {string} requestedURL Absolute or relative URL to combine
  545. * @returns {string} The combined full path
  546. */
  547. module.exports = function buildFullPath(baseURL, requestedURL) {
  548. if (baseURL && !isAbsoluteURL(requestedURL)) {
  549. return combineURLs(baseURL, requestedURL);
  550. }
  551. return requestedURL;
  552. };
  553. /***/ }),
  554. /***/ "./node_modules/axios/lib/core/createError.js":
  555. /*!****************************************************!*\
  556. !*** ./node_modules/axios/lib/core/createError.js ***!
  557. \****************************************************/
  558. /*! no static exports found */
  559. /***/ (function(module, exports, __webpack_require__) {
  560. "use strict";
  561. var enhanceError = __webpack_require__(/*! ./enhanceError */ "./node_modules/axios/lib/core/enhanceError.js");
  562. /**
  563. * Create an Error with the specified message, config, error code, request and response.
  564. *
  565. * @param {string} message The error message.
  566. * @param {Object} config The config.
  567. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  568. * @param {Object} [request] The request.
  569. * @param {Object} [response] The response.
  570. * @returns {Error} The created error.
  571. */
  572. module.exports = function createError(message, config, code, request, response) {
  573. var error = new Error(message);
  574. return enhanceError(error, config, code, request, response);
  575. };
  576. /***/ }),
  577. /***/ "./node_modules/axios/lib/core/dispatchRequest.js":
  578. /*!********************************************************!*\
  579. !*** ./node_modules/axios/lib/core/dispatchRequest.js ***!
  580. \********************************************************/
  581. /*! no static exports found */
  582. /***/ (function(module, exports, __webpack_require__) {
  583. "use strict";
  584. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  585. var transformData = __webpack_require__(/*! ./transformData */ "./node_modules/axios/lib/core/transformData.js");
  586. var isCancel = __webpack_require__(/*! ../cancel/isCancel */ "./node_modules/axios/lib/cancel/isCancel.js");
  587. var defaults = __webpack_require__(/*! ../defaults */ "./node_modules/axios/lib/defaults.js");
  588. /**
  589. * Throws a `Cancel` if cancellation has been requested.
  590. */
  591. function throwIfCancellationRequested(config) {
  592. if (config.cancelToken) {
  593. config.cancelToken.throwIfRequested();
  594. }
  595. }
  596. /**
  597. * Dispatch a request to the server using the configured adapter.
  598. *
  599. * @param {object} config The config that is to be used for the request
  600. * @returns {Promise} The Promise to be fulfilled
  601. */
  602. module.exports = function dispatchRequest(config) {
  603. throwIfCancellationRequested(config);
  604. // Ensure headers exist
  605. config.headers = config.headers || {};
  606. // Transform request data
  607. config.data = transformData(
  608. config.data,
  609. config.headers,
  610. config.transformRequest
  611. );
  612. // Flatten headers
  613. config.headers = utils.merge(
  614. config.headers.common || {},
  615. config.headers[config.method] || {},
  616. config.headers
  617. );
  618. utils.forEach(
  619. ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
  620. function cleanHeaderConfig(method) {
  621. delete config.headers[method];
  622. }
  623. );
  624. var adapter = config.adapter || defaults.adapter;
  625. return adapter(config).then(function onAdapterResolution(response) {
  626. throwIfCancellationRequested(config);
  627. // Transform response data
  628. response.data = transformData(
  629. response.data,
  630. response.headers,
  631. config.transformResponse
  632. );
  633. return response;
  634. }, function onAdapterRejection(reason) {
  635. if (!isCancel(reason)) {
  636. throwIfCancellationRequested(config);
  637. // Transform response data
  638. if (reason && reason.response) {
  639. reason.response.data = transformData(
  640. reason.response.data,
  641. reason.response.headers,
  642. config.transformResponse
  643. );
  644. }
  645. }
  646. return Promise.reject(reason);
  647. });
  648. };
  649. /***/ }),
  650. /***/ "./node_modules/axios/lib/core/enhanceError.js":
  651. /*!*****************************************************!*\
  652. !*** ./node_modules/axios/lib/core/enhanceError.js ***!
  653. \*****************************************************/
  654. /*! no static exports found */
  655. /***/ (function(module, exports, __webpack_require__) {
  656. "use strict";
  657. /**
  658. * Update an Error with the specified config, error code, and response.
  659. *
  660. * @param {Error} error The error to update.
  661. * @param {Object} config The config.
  662. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  663. * @param {Object} [request] The request.
  664. * @param {Object} [response] The response.
  665. * @returns {Error} The error.
  666. */
  667. module.exports = function enhanceError(error, config, code, request, response) {
  668. error.config = config;
  669. if (code) {
  670. error.code = code;
  671. }
  672. error.request = request;
  673. error.response = response;
  674. error.isAxiosError = true;
  675. error.toJSON = function() {
  676. return {
  677. // Standard
  678. message: this.message,
  679. name: this.name,
  680. // Microsoft
  681. description: this.description,
  682. number: this.number,
  683. // Mozilla
  684. fileName: this.fileName,
  685. lineNumber: this.lineNumber,
  686. columnNumber: this.columnNumber,
  687. stack: this.stack,
  688. // Axios
  689. config: this.config,
  690. code: this.code
  691. };
  692. };
  693. return error;
  694. };
  695. /***/ }),
  696. /***/ "./node_modules/axios/lib/core/mergeConfig.js":
  697. /*!****************************************************!*\
  698. !*** ./node_modules/axios/lib/core/mergeConfig.js ***!
  699. \****************************************************/
  700. /*! no static exports found */
  701. /***/ (function(module, exports, __webpack_require__) {
  702. "use strict";
  703. var utils = __webpack_require__(/*! ../utils */ "./node_modules/axios/lib/utils.js");
  704. /**
  705. * Config-specific merge-function which creates a new config-object
  706. * by merging two configuration objects together.
  707. *
  708. * @param {Object} config1
  709. * @param {Object} config2
  710. * @returns {Object} New object resulting from merging config2 to config1
  711. */
  712. module.exports = function mergeConfig(config1, config2) {
  713. // eslint-disable-next-line no-param-reassign
  714. config2 = config2 || {};
  715. var config = {};
  716. var valueFromConfig2Keys = ['url', 'method', 'params', 'data'];
  717. var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy'];
  718. var defaultToConfig2Keys = [
  719. 'baseURL', 'url', 'transformRequest', 'transformResponse', 'paramsSerializer',
  720. 'timeout', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',
  721. 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress',
  722. 'maxContentLength', 'validateStatus', 'maxRedirects', 'httpAgent',
  723. 'httpsAgent', 'cancelToken', 'socketPath'
  724. ];
  725. utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) {
  726. if (typeof config2[prop] !== 'undefined') {
  727. config[prop] = config2[prop];
  728. }
  729. });
  730. utils.forEach(mergeDeepPropertiesKeys, function mergeDeepProperties(prop) {
  731. if (utils.isObject(config2[prop])) {
  732. config[prop] = utils.deepMerge(config1[prop], config2[prop]);
  733. } else if (typeof config2[prop] !== 'undefined') {
  734. config[prop] = config2[prop];
  735. } else if (utils.isObject(config1[prop])) {
  736. config[prop] = utils.deepMerge(config1[prop]);
  737. } else if (typeof config1[prop] !== 'undefined') {
  738. config[prop] = config1[prop];
  739. }
  740. });
  741. utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) {
  742. if (typeof config2[prop] !== 'undefined') {
  743. config[prop] = config2[prop];
  744. } else if (typeof config1[prop] !== 'undefined') {
  745. config[prop] = config1[prop];
  746. }
  747. });
  748. var axiosKeys = valueFromConfig2Keys
  749. .concat(mergeDeepPropertiesKeys)
  750. .concat(defaultToConfig2Keys);
  751. var otherKeys = Object
  752. .keys(config2)
  753. .filter(function filterAxiosKeys(key) {
  754. return axiosKeys.indexOf(key) === -1;
  755. });
  756. utils.forEach(otherKeys, function otherKeysDefaultToConfig2(prop) {
  757. if (typeof config2[prop] !== 'undefined') {
  758. config[prop] = config2[prop];
  759. } else if (typeof config1[prop] !== 'undefined') {
  760. config[prop] = config1[prop];
  761. }
  762. });
  763. return config;
  764. };
  765. /***/ }),
  766. /***/ "./node_modules/axios/lib/core/settle.js":
  767. /*!***********************************************!*\
  768. !*** ./node_modules/axios/lib/core/settle.js ***!
  769. \***********************************************/
  770. /*! no static exports found */
  771. /***/ (function(module, exports, __webpack_require__) {
  772. "use strict";
  773. var createError = __webpack_require__(/*! ./createError */ "./node_modules/axios/lib/core/createError.js");
  774. /**
  775. * Resolve or reject a Promise based on response status.
  776. *
  777. * @param {Function} resolve A function that resolves the promise.
  778. * @param {Function} reject A function that rejects the promise.
  779. * @param {object} response The response.
  780. */
  781. module.exports = function settle(resolve, reject, response) {
  782. var validateStatus = response.config.validateStatus;
  783. if (!validateStatus || validateStatus(response.status)) {
  784. resolve(response);
  785. } else {
  786. reject(createError(
  787. 'Request failed with status code ' + response.status,
  788. response.config,
  789. null,
  790. response.request,
  791. response
  792. ));
  793. }
  794. };
  795. /***/ }),
  796. /***/ "./node_modules/axios/lib/core/transformData.js":
  797. /*!******************************************************!*\
  798. !*** ./node_modules/axios/lib/core/transformData.js ***!
  799. \******************************************************/
  800. /*! no static exports found */
  801. /***/ (function(module, exports, __webpack_require__) {
  802. "use strict";
  803. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  804. /**
  805. * Transform the data for a request or a response
  806. *
  807. * @param {Object|String} data The data to be transformed
  808. * @param {Array} headers The headers for the request or response
  809. * @param {Array|Function} fns A single function or Array of functions
  810. * @returns {*} The resulting transformed data
  811. */
  812. module.exports = function transformData(data, headers, fns) {
  813. /*eslint no-param-reassign:0*/
  814. utils.forEach(fns, function transform(fn) {
  815. data = fn(data, headers);
  816. });
  817. return data;
  818. };
  819. /***/ }),
  820. /***/ "./node_modules/axios/lib/defaults.js":
  821. /*!********************************************!*\
  822. !*** ./node_modules/axios/lib/defaults.js ***!
  823. \********************************************/
  824. /*! no static exports found */
  825. /***/ (function(module, exports, __webpack_require__) {
  826. "use strict";
  827. /* WEBPACK VAR INJECTION */(function(process) {
  828. var utils = __webpack_require__(/*! ./utils */ "./node_modules/axios/lib/utils.js");
  829. var normalizeHeaderName = __webpack_require__(/*! ./helpers/normalizeHeaderName */ "./node_modules/axios/lib/helpers/normalizeHeaderName.js");
  830. var DEFAULT_CONTENT_TYPE = {
  831. 'Content-Type': 'application/x-www-form-urlencoded'
  832. };
  833. function setContentTypeIfUnset(headers, value) {
  834. if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
  835. headers['Content-Type'] = value;
  836. }
  837. }
  838. function getDefaultAdapter() {
  839. var adapter;
  840. if (typeof XMLHttpRequest !== 'undefined') {
  841. // For browsers use XHR adapter
  842. adapter = __webpack_require__(/*! ./adapters/xhr */ "./node_modules/axios/lib/adapters/xhr.js");
  843. } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
  844. // For node use HTTP adapter
  845. adapter = __webpack_require__(/*! ./adapters/http */ "./node_modules/axios/lib/adapters/xhr.js");
  846. }
  847. return adapter;
  848. }
  849. var defaults = {
  850. adapter: getDefaultAdapter(),
  851. transformRequest: [function transformRequest(data, headers) {
  852. normalizeHeaderName(headers, 'Accept');
  853. normalizeHeaderName(headers, 'Content-Type');
  854. if (utils.isFormData(data) ||
  855. utils.isArrayBuffer(data) ||
  856. utils.isBuffer(data) ||
  857. utils.isStream(data) ||
  858. utils.isFile(data) ||
  859. utils.isBlob(data)
  860. ) {
  861. return data;
  862. }
  863. if (utils.isArrayBufferView(data)) {
  864. return data.buffer;
  865. }
  866. if (utils.isURLSearchParams(data)) {
  867. setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
  868. return data.toString();
  869. }
  870. if (utils.isObject(data)) {
  871. setContentTypeIfUnset(headers, 'application/json;charset=utf-8');
  872. return JSON.stringify(data);
  873. }
  874. return data;
  875. }],
  876. transformResponse: [function transformResponse(data) {
  877. /*eslint no-param-reassign:0*/
  878. if (typeof data === 'string') {
  879. try {
  880. data = JSON.parse(data);
  881. } catch (e) { /* Ignore */ }
  882. }
  883. return data;
  884. }],
  885. /**
  886. * A timeout in milliseconds to abort a request. If set to 0 (default) a
  887. * timeout is not created.
  888. */
  889. timeout: 0,
  890. xsrfCookieName: 'XSRF-TOKEN',
  891. xsrfHeaderName: 'X-XSRF-TOKEN',
  892. maxContentLength: -1,
  893. validateStatus: function validateStatus(status) {
  894. return status >= 200 && status < 300;
  895. }
  896. };
  897. defaults.headers = {
  898. common: {
  899. 'Accept': 'application/json, text/plain, */*'
  900. }
  901. };
  902. utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
  903. defaults.headers[method] = {};
  904. });
  905. utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  906. defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
  907. });
  908. module.exports = defaults;
  909. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../process/browser.js */ "./node_modules/process/browser.js")))
  910. /***/ }),
  911. /***/ "./node_modules/axios/lib/helpers/bind.js":
  912. /*!************************************************!*\
  913. !*** ./node_modules/axios/lib/helpers/bind.js ***!
  914. \************************************************/
  915. /*! no static exports found */
  916. /***/ (function(module, exports, __webpack_require__) {
  917. "use strict";
  918. module.exports = function bind(fn, thisArg) {
  919. return function wrap() {
  920. var args = new Array(arguments.length);
  921. for (var i = 0; i < args.length; i++) {
  922. args[i] = arguments[i];
  923. }
  924. return fn.apply(thisArg, args);
  925. };
  926. };
  927. /***/ }),
  928. /***/ "./node_modules/axios/lib/helpers/buildURL.js":
  929. /*!****************************************************!*\
  930. !*** ./node_modules/axios/lib/helpers/buildURL.js ***!
  931. \****************************************************/
  932. /*! no static exports found */
  933. /***/ (function(module, exports, __webpack_require__) {
  934. "use strict";
  935. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  936. function encode(val) {
  937. return encodeURIComponent(val).
  938. replace(/%40/gi, '@').
  939. replace(/%3A/gi, ':').
  940. replace(/%24/g, '$').
  941. replace(/%2C/gi, ',').
  942. replace(/%20/g, '+').
  943. replace(/%5B/gi, '[').
  944. replace(/%5D/gi, ']');
  945. }
  946. /**
  947. * Build a URL by appending params to the end
  948. *
  949. * @param {string} url The base of the url (e.g., http://www.google.com)
  950. * @param {object} [params] The params to be appended
  951. * @returns {string} The formatted url
  952. */
  953. module.exports = function buildURL(url, params, paramsSerializer) {
  954. /*eslint no-param-reassign:0*/
  955. if (!params) {
  956. return url;
  957. }
  958. var serializedParams;
  959. if (paramsSerializer) {
  960. serializedParams = paramsSerializer(params);
  961. } else if (utils.isURLSearchParams(params)) {
  962. serializedParams = params.toString();
  963. } else {
  964. var parts = [];
  965. utils.forEach(params, function serialize(val, key) {
  966. if (val === null || typeof val === 'undefined') {
  967. return;
  968. }
  969. if (utils.isArray(val)) {
  970. key = key + '[]';
  971. } else {
  972. val = [val];
  973. }
  974. utils.forEach(val, function parseValue(v) {
  975. if (utils.isDate(v)) {
  976. v = v.toISOString();
  977. } else if (utils.isObject(v)) {
  978. v = JSON.stringify(v);
  979. }
  980. parts.push(encode(key) + '=' + encode(v));
  981. });
  982. });
  983. serializedParams = parts.join('&');
  984. }
  985. if (serializedParams) {
  986. var hashmarkIndex = url.indexOf('#');
  987. if (hashmarkIndex !== -1) {
  988. url = url.slice(0, hashmarkIndex);
  989. }
  990. url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
  991. }
  992. return url;
  993. };
  994. /***/ }),
  995. /***/ "./node_modules/axios/lib/helpers/combineURLs.js":
  996. /*!*******************************************************!*\
  997. !*** ./node_modules/axios/lib/helpers/combineURLs.js ***!
  998. \*******************************************************/
  999. /*! no static exports found */
  1000. /***/ (function(module, exports, __webpack_require__) {
  1001. "use strict";
  1002. /**
  1003. * Creates a new URL by combining the specified URLs
  1004. *
  1005. * @param {string} baseURL The base URL
  1006. * @param {string} relativeURL The relative URL
  1007. * @returns {string} The combined URL
  1008. */
  1009. module.exports = function combineURLs(baseURL, relativeURL) {
  1010. return relativeURL
  1011. ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
  1012. : baseURL;
  1013. };
  1014. /***/ }),
  1015. /***/ "./node_modules/axios/lib/helpers/cookies.js":
  1016. /*!***************************************************!*\
  1017. !*** ./node_modules/axios/lib/helpers/cookies.js ***!
  1018. \***************************************************/
  1019. /*! no static exports found */
  1020. /***/ (function(module, exports, __webpack_require__) {
  1021. "use strict";
  1022. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  1023. module.exports = (
  1024. utils.isStandardBrowserEnv() ?
  1025. // Standard browser envs support document.cookie
  1026. (function standardBrowserEnv() {
  1027. return {
  1028. write: function write(name, value, expires, path, domain, secure) {
  1029. var cookie = [];
  1030. cookie.push(name + '=' + encodeURIComponent(value));
  1031. if (utils.isNumber(expires)) {
  1032. cookie.push('expires=' + new Date(expires).toGMTString());
  1033. }
  1034. if (utils.isString(path)) {
  1035. cookie.push('path=' + path);
  1036. }
  1037. if (utils.isString(domain)) {
  1038. cookie.push('domain=' + domain);
  1039. }
  1040. if (secure === true) {
  1041. cookie.push('secure');
  1042. }
  1043. document.cookie = cookie.join('; ');
  1044. },
  1045. read: function read(name) {
  1046. var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
  1047. return (match ? decodeURIComponent(match[3]) : null);
  1048. },
  1049. remove: function remove(name) {
  1050. this.write(name, '', Date.now() - 86400000);
  1051. }
  1052. };
  1053. })() :
  1054. // Non standard browser env (web workers, react-native) lack needed support.
  1055. (function nonStandardBrowserEnv() {
  1056. return {
  1057. write: function write() {},
  1058. read: function read() { return null; },
  1059. remove: function remove() {}
  1060. };
  1061. })()
  1062. );
  1063. /***/ }),
  1064. /***/ "./node_modules/axios/lib/helpers/isAbsoluteURL.js":
  1065. /*!*********************************************************!*\
  1066. !*** ./node_modules/axios/lib/helpers/isAbsoluteURL.js ***!
  1067. \*********************************************************/
  1068. /*! no static exports found */
  1069. /***/ (function(module, exports, __webpack_require__) {
  1070. "use strict";
  1071. /**
  1072. * Determines whether the specified URL is absolute
  1073. *
  1074. * @param {string} url The URL to test
  1075. * @returns {boolean} True if the specified URL is absolute, otherwise false
  1076. */
  1077. module.exports = function isAbsoluteURL(url) {
  1078. // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
  1079. // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
  1080. // by any combination of letters, digits, plus, period, or hyphen.
  1081. return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
  1082. };
  1083. /***/ }),
  1084. /***/ "./node_modules/axios/lib/helpers/isURLSameOrigin.js":
  1085. /*!***********************************************************!*\
  1086. !*** ./node_modules/axios/lib/helpers/isURLSameOrigin.js ***!
  1087. \***********************************************************/
  1088. /*! no static exports found */
  1089. /***/ (function(module, exports, __webpack_require__) {
  1090. "use strict";
  1091. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  1092. module.exports = (
  1093. utils.isStandardBrowserEnv() ?
  1094. // Standard browser envs have full support of the APIs needed to test
  1095. // whether the request URL is of the same origin as current location.
  1096. (function standardBrowserEnv() {
  1097. var msie = /(msie|trident)/i.test(navigator.userAgent);
  1098. var urlParsingNode = document.createElement('a');
  1099. var originURL;
  1100. /**
  1101. * Parse a URL to discover it's components
  1102. *
  1103. * @param {String} url The URL to be parsed
  1104. * @returns {Object}
  1105. */
  1106. function resolveURL(url) {
  1107. var href = url;
  1108. if (msie) {
  1109. // IE needs attribute set twice to normalize properties
  1110. urlParsingNode.setAttribute('href', href);
  1111. href = urlParsingNode.href;
  1112. }
  1113. urlParsingNode.setAttribute('href', href);
  1114. // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
  1115. return {
  1116. href: urlParsingNode.href,
  1117. protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
  1118. host: urlParsingNode.host,
  1119. search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
  1120. hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
  1121. hostname: urlParsingNode.hostname,
  1122. port: urlParsingNode.port,
  1123. pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
  1124. urlParsingNode.pathname :
  1125. '/' + urlParsingNode.pathname
  1126. };
  1127. }
  1128. originURL = resolveURL(window.location.href);
  1129. /**
  1130. * Determine if a URL shares the same origin as the current location
  1131. *
  1132. * @param {String} requestURL The URL to test
  1133. * @returns {boolean} True if URL shares the same origin, otherwise false
  1134. */
  1135. return function isURLSameOrigin(requestURL) {
  1136. var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
  1137. return (parsed.protocol === originURL.protocol &&
  1138. parsed.host === originURL.host);
  1139. };
  1140. })() :
  1141. // Non standard browser envs (web workers, react-native) lack needed support.
  1142. (function nonStandardBrowserEnv() {
  1143. return function isURLSameOrigin() {
  1144. return true;
  1145. };
  1146. })()
  1147. );
  1148. /***/ }),
  1149. /***/ "./node_modules/axios/lib/helpers/normalizeHeaderName.js":
  1150. /*!***************************************************************!*\
  1151. !*** ./node_modules/axios/lib/helpers/normalizeHeaderName.js ***!
  1152. \***************************************************************/
  1153. /*! no static exports found */
  1154. /***/ (function(module, exports, __webpack_require__) {
  1155. "use strict";
  1156. var utils = __webpack_require__(/*! ../utils */ "./node_modules/axios/lib/utils.js");
  1157. module.exports = function normalizeHeaderName(headers, normalizedName) {
  1158. utils.forEach(headers, function processHeader(value, name) {
  1159. if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
  1160. headers[normalizedName] = value;
  1161. delete headers[name];
  1162. }
  1163. });
  1164. };
  1165. /***/ }),
  1166. /***/ "./node_modules/axios/lib/helpers/parseHeaders.js":
  1167. /*!********************************************************!*\
  1168. !*** ./node_modules/axios/lib/helpers/parseHeaders.js ***!
  1169. \********************************************************/
  1170. /*! no static exports found */
  1171. /***/ (function(module, exports, __webpack_require__) {
  1172. "use strict";
  1173. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  1174. // Headers whose duplicates are ignored by node
  1175. // c.f. https://nodejs.org/api/http.html#http_message_headers
  1176. var ignoreDuplicateOf = [
  1177. 'age', 'authorization', 'content-length', 'content-type', 'etag',
  1178. 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
  1179. 'last-modified', 'location', 'max-forwards', 'proxy-authorization',
  1180. 'referer', 'retry-after', 'user-agent'
  1181. ];
  1182. /**
  1183. * Parse headers into an object
  1184. *
  1185. * ```
  1186. * Date: Wed, 27 Aug 2014 08:58:49 GMT
  1187. * Content-Type: application/json
  1188. * Connection: keep-alive
  1189. * Transfer-Encoding: chunked
  1190. * ```
  1191. *
  1192. * @param {String} headers Headers needing to be parsed
  1193. * @returns {Object} Headers parsed into an object
  1194. */
  1195. module.exports = function parseHeaders(headers) {
  1196. var parsed = {};
  1197. var key;
  1198. var val;
  1199. var i;
  1200. if (!headers) { return parsed; }
  1201. utils.forEach(headers.split('\n'), function parser(line) {
  1202. i = line.indexOf(':');
  1203. key = utils.trim(line.substr(0, i)).toLowerCase();
  1204. val = utils.trim(line.substr(i + 1));
  1205. if (key) {
  1206. if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
  1207. return;
  1208. }
  1209. if (key === 'set-cookie') {
  1210. parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
  1211. } else {
  1212. parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
  1213. }
  1214. }
  1215. });
  1216. return parsed;
  1217. };
  1218. /***/ }),
  1219. /***/ "./node_modules/axios/lib/helpers/spread.js":
  1220. /*!**************************************************!*\
  1221. !*** ./node_modules/axios/lib/helpers/spread.js ***!
  1222. \**************************************************/
  1223. /*! no static exports found */
  1224. /***/ (function(module, exports, __webpack_require__) {
  1225. "use strict";
  1226. /**
  1227. * Syntactic sugar for invoking a function and expanding an array for arguments.
  1228. *
  1229. * Common use case would be to use `Function.prototype.apply`.
  1230. *
  1231. * ```js
  1232. * function f(x, y, z) {}
  1233. * var args = [1, 2, 3];
  1234. * f.apply(null, args);
  1235. * ```
  1236. *
  1237. * With `spread` this example can be re-written.
  1238. *
  1239. * ```js
  1240. * spread(function(x, y, z) {})([1, 2, 3]);
  1241. * ```
  1242. *
  1243. * @param {Function} callback
  1244. * @returns {Function}
  1245. */
  1246. module.exports = function spread(callback) {
  1247. return function wrap(arr) {
  1248. return callback.apply(null, arr);
  1249. };
  1250. };
  1251. /***/ }),
  1252. /***/ "./node_modules/axios/lib/utils.js":
  1253. /*!*****************************************!*\
  1254. !*** ./node_modules/axios/lib/utils.js ***!
  1255. \*****************************************/
  1256. /*! no static exports found */
  1257. /***/ (function(module, exports, __webpack_require__) {
  1258. "use strict";
  1259. var bind = __webpack_require__(/*! ./helpers/bind */ "./node_modules/axios/lib/helpers/bind.js");
  1260. /*global toString:true*/
  1261. // utils is a library of generic helper functions non-specific to axios
  1262. var toString = Object.prototype.toString;
  1263. /**
  1264. * Determine if a value is an Array
  1265. *
  1266. * @param {Object} val The value to test
  1267. * @returns {boolean} True if value is an Array, otherwise false
  1268. */
  1269. function isArray(val) {
  1270. return toString.call(val) === '[object Array]';
  1271. }
  1272. /**
  1273. * Determine if a value is undefined
  1274. *
  1275. * @param {Object} val The value to test
  1276. * @returns {boolean} True if the value is undefined, otherwise false
  1277. */
  1278. function isUndefined(val) {
  1279. return typeof val === 'undefined';
  1280. }
  1281. /**
  1282. * Determine if a value is a Buffer
  1283. *
  1284. * @param {Object} val The value to test
  1285. * @returns {boolean} True if value is a Buffer, otherwise false
  1286. */
  1287. function isBuffer(val) {
  1288. return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
  1289. && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);
  1290. }
  1291. /**
  1292. * Determine if a value is an ArrayBuffer
  1293. *
  1294. * @param {Object} val The value to test
  1295. * @returns {boolean} True if value is an ArrayBuffer, otherwise false
  1296. */
  1297. function isArrayBuffer(val) {
  1298. return toString.call(val) === '[object ArrayBuffer]';
  1299. }
  1300. /**
  1301. * Determine if a value is a FormData
  1302. *
  1303. * @param {Object} val The value to test
  1304. * @returns {boolean} True if value is an FormData, otherwise false
  1305. */
  1306. function isFormData(val) {
  1307. return (typeof FormData !== 'undefined') && (val instanceof FormData);
  1308. }
  1309. /**
  1310. * Determine if a value is a view on an ArrayBuffer
  1311. *
  1312. * @param {Object} val The value to test
  1313. * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
  1314. */
  1315. function isArrayBufferView(val) {
  1316. var result;
  1317. if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
  1318. result = ArrayBuffer.isView(val);
  1319. } else {
  1320. result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);
  1321. }
  1322. return result;
  1323. }
  1324. /**
  1325. * Determine if a value is a String
  1326. *
  1327. * @param {Object} val The value to test
  1328. * @returns {boolean} True if value is a String, otherwise false
  1329. */
  1330. function isString(val) {
  1331. return typeof val === 'string';
  1332. }
  1333. /**
  1334. * Determine if a value is a Number
  1335. *
  1336. * @param {Object} val The value to test
  1337. * @returns {boolean} True if value is a Number, otherwise false
  1338. */
  1339. function isNumber(val) {
  1340. return typeof val === 'number';
  1341. }
  1342. /**
  1343. * Determine if a value is an Object
  1344. *
  1345. * @param {Object} val The value to test
  1346. * @returns {boolean} True if value is an Object, otherwise false
  1347. */
  1348. function isObject(val) {
  1349. return val !== null && typeof val === 'object';
  1350. }
  1351. /**
  1352. * Determine if a value is a Date
  1353. *
  1354. * @param {Object} val The value to test
  1355. * @returns {boolean} True if value is a Date, otherwise false
  1356. */
  1357. function isDate(val) {
  1358. return toString.call(val) === '[object Date]';
  1359. }
  1360. /**
  1361. * Determine if a value is a File
  1362. *
  1363. * @param {Object} val The value to test
  1364. * @returns {boolean} True if value is a File, otherwise false
  1365. */
  1366. function isFile(val) {
  1367. return toString.call(val) === '[object File]';
  1368. }
  1369. /**
  1370. * Determine if a value is a Blob
  1371. *
  1372. * @param {Object} val The value to test
  1373. * @returns {boolean} True if value is a Blob, otherwise false
  1374. */
  1375. function isBlob(val) {
  1376. return toString.call(val) === '[object Blob]';
  1377. }
  1378. /**
  1379. * Determine if a value is a Function
  1380. *
  1381. * @param {Object} val The value to test
  1382. * @returns {boolean} True if value is a Function, otherwise false
  1383. */
  1384. function isFunction(val) {
  1385. return toString.call(val) === '[object Function]';
  1386. }
  1387. /**
  1388. * Determine if a value is a Stream
  1389. *
  1390. * @param {Object} val The value to test
  1391. * @returns {boolean} True if value is a Stream, otherwise false
  1392. */
  1393. function isStream(val) {
  1394. return isObject(val) && isFunction(val.pipe);
  1395. }
  1396. /**
  1397. * Determine if a value is a URLSearchParams object
  1398. *
  1399. * @param {Object} val The value to test
  1400. * @returns {boolean} True if value is a URLSearchParams object, otherwise false
  1401. */
  1402. function isURLSearchParams(val) {
  1403. return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
  1404. }
  1405. /**
  1406. * Trim excess whitespace off the beginning and end of a string
  1407. *
  1408. * @param {String} str The String to trim
  1409. * @returns {String} The String freed of excess whitespace
  1410. */
  1411. function trim(str) {
  1412. return str.replace(/^\s*/, '').replace(/\s*$/, '');
  1413. }
  1414. /**
  1415. * Determine if we're running in a standard browser environment
  1416. *
  1417. * This allows axios to run in a web worker, and react-native.
  1418. * Both environments support XMLHttpRequest, but not fully standard globals.
  1419. *
  1420. * web workers:
  1421. * typeof window -> undefined
  1422. * typeof document -> undefined
  1423. *
  1424. * react-native:
  1425. * navigator.product -> 'ReactNative'
  1426. * nativescript
  1427. * navigator.product -> 'NativeScript' or 'NS'
  1428. */
  1429. function isStandardBrowserEnv() {
  1430. if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||
  1431. navigator.product === 'NativeScript' ||
  1432. navigator.product === 'NS')) {
  1433. return false;
  1434. }
  1435. return (
  1436. typeof window !== 'undefined' &&
  1437. typeof document !== 'undefined'
  1438. );
  1439. }
  1440. /**
  1441. * Iterate over an Array or an Object invoking a function for each item.
  1442. *
  1443. * If `obj` is an Array callback will be called passing
  1444. * the value, index, and complete array for each item.
  1445. *
  1446. * If 'obj' is an Object callback will be called passing
  1447. * the value, key, and complete object for each property.
  1448. *
  1449. * @param {Object|Array} obj The object to iterate
  1450. * @param {Function} fn The callback to invoke for each item
  1451. */
  1452. function forEach(obj, fn) {
  1453. // Don't bother if no value provided
  1454. if (obj === null || typeof obj === 'undefined') {
  1455. return;
  1456. }
  1457. // Force an array if not already something iterable
  1458. if (typeof obj !== 'object') {
  1459. /*eslint no-param-reassign:0*/
  1460. obj = [obj];
  1461. }
  1462. if (isArray(obj)) {
  1463. // Iterate over array values
  1464. for (var i = 0, l = obj.length; i < l; i++) {
  1465. fn.call(null, obj[i], i, obj);
  1466. }
  1467. } else {
  1468. // Iterate over object keys
  1469. for (var key in obj) {
  1470. if (Object.prototype.hasOwnProperty.call(obj, key)) {
  1471. fn.call(null, obj[key], key, obj);
  1472. }
  1473. }
  1474. }
  1475. }
  1476. /**
  1477. * Accepts varargs expecting each argument to be an object, then
  1478. * immutably merges the properties of each object and returns result.
  1479. *
  1480. * When multiple objects contain the same key the later object in
  1481. * the arguments list will take precedence.
  1482. *
  1483. * Example:
  1484. *
  1485. * ```js
  1486. * var result = merge({foo: 123}, {foo: 456});
  1487. * console.log(result.foo); // outputs 456
  1488. * ```
  1489. *
  1490. * @param {Object} obj1 Object to merge
  1491. * @returns {Object} Result of all merge properties
  1492. */
  1493. function merge(/* obj1, obj2, obj3, ... */) {
  1494. var result = {};
  1495. function assignValue(val, key) {
  1496. if (typeof result[key] === 'object' && typeof val === 'object') {
  1497. result[key] = merge(result[key], val);
  1498. } else {
  1499. result[key] = val;
  1500. }
  1501. }
  1502. for (var i = 0, l = arguments.length; i < l; i++) {
  1503. forEach(arguments[i], assignValue);
  1504. }
  1505. return result;
  1506. }
  1507. /**
  1508. * Function equal to merge with the difference being that no reference
  1509. * to original objects is kept.
  1510. *
  1511. * @see merge
  1512. * @param {Object} obj1 Object to merge
  1513. * @returns {Object} Result of all merge properties
  1514. */
  1515. function deepMerge(/* obj1, obj2, obj3, ... */) {
  1516. var result = {};
  1517. function assignValue(val, key) {
  1518. if (typeof result[key] === 'object' && typeof val === 'object') {
  1519. result[key] = deepMerge(result[key], val);
  1520. } else if (typeof val === 'object') {
  1521. result[key] = deepMerge({}, val);
  1522. } else {
  1523. result[key] = val;
  1524. }
  1525. }
  1526. for (var i = 0, l = arguments.length; i < l; i++) {
  1527. forEach(arguments[i], assignValue);
  1528. }
  1529. return result;
  1530. }
  1531. /**
  1532. * Extends object a by mutably adding to it the properties of object b.
  1533. *
  1534. * @param {Object} a The object to be extended
  1535. * @param {Object} b The object to copy properties from
  1536. * @param {Object} thisArg The object to bind function to
  1537. * @return {Object} The resulting value of object a
  1538. */
  1539. function extend(a, b, thisArg) {
  1540. forEach(b, function assignValue(val, key) {
  1541. if (thisArg && typeof val === 'function') {
  1542. a[key] = bind(val, thisArg);
  1543. } else {
  1544. a[key] = val;
  1545. }
  1546. });
  1547. return a;
  1548. }
  1549. module.exports = {
  1550. isArray: isArray,
  1551. isArrayBuffer: isArrayBuffer,
  1552. isBuffer: isBuffer,
  1553. isFormData: isFormData,
  1554. isArrayBufferView: isArrayBufferView,
  1555. isString: isString,
  1556. isNumber: isNumber,
  1557. isObject: isObject,
  1558. isUndefined: isUndefined,
  1559. isDate: isDate,
  1560. isFile: isFile,
  1561. isBlob: isBlob,
  1562. isFunction: isFunction,
  1563. isStream: isStream,
  1564. isURLSearchParams: isURLSearchParams,
  1565. isStandardBrowserEnv: isStandardBrowserEnv,
  1566. forEach: forEach,
  1567. merge: merge,
  1568. deepMerge: deepMerge,
  1569. extend: extend,
  1570. trim: trim
  1571. };
  1572. /***/ }),
  1573. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js&":
  1574. /*!***************************************************************************************************************************************************************************!*\
  1575. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js& ***!
  1576. \***************************************************************************************************************************************************************************/
  1577. /*! exports provided: default */
  1578. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1579. "use strict";
  1580. __webpack_require__.r(__webpack_exports__);
  1581. //
  1582. //
  1583. //
  1584. //
  1585. //
  1586. //
  1587. //
  1588. //
  1589. //
  1590. //
  1591. //
  1592. //
  1593. //
  1594. //
  1595. //
  1596. //
  1597. /* harmony default export */ __webpack_exports__["default"] = ({
  1598. mounted: function mounted() {
  1599. console.log('Component mounted.');
  1600. }
  1601. });
  1602. /***/ }),
  1603. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/assetinfo.vue?vue&type=script&lang=js&":
  1604. /*!********************************************************************************************************************************************************************!*\
  1605. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/assetinfo.vue?vue&type=script&lang=js& ***!
  1606. \********************************************************************************************************************************************************************/
  1607. /*! exports provided: default */
  1608. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1609. "use strict";
  1610. __webpack_require__.r(__webpack_exports__);
  1611. //
  1612. //
  1613. //
  1614. //
  1615. //
  1616. //
  1617. //
  1618. //
  1619. //
  1620. //
  1621. //
  1622. //
  1623. //
  1624. //
  1625. //
  1626. //
  1627. //
  1628. //
  1629. //
  1630. //
  1631. //
  1632. //
  1633. //
  1634. //
  1635. //
  1636. //
  1637. //
  1638. //
  1639. //
  1640. //
  1641. //
  1642. //
  1643. //
  1644. //
  1645. //
  1646. //
  1647. //
  1648. //
  1649. //
  1650. //
  1651. //
  1652. //
  1653. //
  1654. //
  1655. //
  1656. //
  1657. //
  1658. //
  1659. //
  1660. //
  1661. //
  1662. //
  1663. //
  1664. //
  1665. //
  1666. //
  1667. /* harmony default export */ __webpack_exports__["default"] = ({
  1668. props: ['asset', 'pcextraStart'],
  1669. data: function data() {
  1670. return {
  1671. data: JSON.parse(this.asset),
  1672. pcextra: JSON.parse(this.pcextraStart)
  1673. };
  1674. },
  1675. mounted: function mounted() {
  1676. var _this = this;
  1677. Echo.channel('asset.' + this.data.pcid).listen('AssetUpdated', function (e) {
  1678. _this.data = e.data;
  1679. _this.pcextra = JSON.parse(e.pcextra);
  1680. });
  1681. },
  1682. methods: {
  1683. updateAsset: function updateAsset() {
  1684. this.data.pcextra = this.pcextra;
  1685. axios.put('/api/assets/' + this.data.pcid, this.data).then(function (response) {})["catch"](function (error) {});
  1686. $('#asseteditModal').modal('hide');
  1687. }
  1688. }
  1689. });
  1690. /***/ }),
  1691. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=script&lang=js&":
  1692. /*!***************************************************************************************************************************************************************************************!*\
  1693. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=script&lang=js& ***!
  1694. \***************************************************************************************************************************************************************************************/
  1695. /*! exports provided: default */
  1696. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1697. "use strict";
  1698. __webpack_require__.r(__webpack_exports__);
  1699. //
  1700. //
  1701. //
  1702. //
  1703. //
  1704. //
  1705. //
  1706. //
  1707. //
  1708. //
  1709. //
  1710. //
  1711. //
  1712. //
  1713. //
  1714. //
  1715. //
  1716. //
  1717. //
  1718. //
  1719. //
  1720. /* harmony default export */ __webpack_exports__["default"] = ({
  1721. props: {
  1722. value: null,
  1723. // An object with the following format
  1724. // {
  1725. // key: value,
  1726. // key: value,
  1727. // }
  1728. options: {
  1729. type: Object,
  1730. required: true
  1731. },
  1732. allowCustom: {
  1733. type: Boolean,
  1734. "default": false
  1735. }
  1736. },
  1737. data: function data() {
  1738. return {
  1739. searchText: '',
  1740. selectedOption: null,
  1741. open: false,
  1742. // allows for checking whether button was clicked or text was typed.
  1743. // If button was clicked, we show all options without having to clear
  1744. // out any searchText that was autofilled when page loaded.
  1745. isSearching: false
  1746. };
  1747. },
  1748. computed: {
  1749. matches: function matches() {
  1750. var _this = this;
  1751. // If button was clicked, show all options, if typing, filter
  1752. // options based on searchText
  1753. return Object.entries(this.options).filter(function (option) {
  1754. var optionText = option[1].toUpperCase();
  1755. if (_this.isSearching) {
  1756. return optionText.match(_this.searchText.toUpperCase());
  1757. } else {
  1758. return optionText.match('');
  1759. }
  1760. });
  1761. }
  1762. },
  1763. methods: {
  1764. // if button is clicked, show all options
  1765. setOpen: function setOpen(isOpen) {
  1766. this.open = isOpen;
  1767. this.isSearching = false;
  1768. },
  1769. // if typing in the box, start filtering options
  1770. searchChanged: function searchChanged() {
  1771. if (!this.open) {
  1772. this.open = true;
  1773. }
  1774. if (!this.isSearching) {
  1775. this.isSearching = true;
  1776. } // If custom values are allowed, emits {id: 'custom', name: searchtext}
  1777. if (this.allowCustom) {
  1778. this.$emit('input', {
  1779. 'id': 'custom',
  1780. 'name': this.searchText
  1781. });
  1782. }
  1783. },
  1784. // emits { id: suggestion_id, name: suggestion_name} to v-model when
  1785. // a suggestion is selected
  1786. suggestionSelected: function suggestionSelected(suggestion) {
  1787. this.open = false;
  1788. this.searchText = suggestion[1];
  1789. this.$emit('input', {
  1790. 'id': suggestion[0],
  1791. 'name': suggestion[1]
  1792. });
  1793. },
  1794. updateComponentWithValue: function updateComponentWithValue(newValue) {
  1795. if (this.allowCustom) {
  1796. this.searchText = this.value.name;
  1797. } else {
  1798. if (newValue.id > -1) {
  1799. // Find the matching text for the supplied option value
  1800. for (var id in this.options) {
  1801. if (this.options.hasOwnProperty(id)) {
  1802. if (this.options[id] === this.options[newValue.id]) {
  1803. this.searchText = this.options[id];
  1804. }
  1805. }
  1806. }
  1807. }
  1808. }
  1809. }
  1810. },
  1811. mounted: function mounted() {
  1812. this.updateComponentWithValue(this.value);
  1813. },
  1814. watch: {
  1815. value: function value(newValue) {
  1816. this.updateComponentWithValue(newValue);
  1817. }
  1818. }
  1819. });
  1820. /***/ }),
  1821. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential-form-modal.vue?vue&type=script&lang=js&":
  1822. /*!********************************************************************************************************************************************************************************!*\
  1823. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/credential-form-modal.vue?vue&type=script&lang=js& ***!
  1824. \********************************************************************************************************************************************************************************/
  1825. /*! exports provided: default */
  1826. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1827. "use strict";
  1828. __webpack_require__.r(__webpack_exports__);
  1829. //
  1830. //
  1831. //
  1832. //
  1833. //
  1834. //
  1835. //
  1836. //
  1837. //
  1838. //
  1839. //
  1840. //
  1841. //
  1842. //
  1843. //
  1844. //
  1845. //
  1846. //
  1847. //
  1848. //
  1849. //
  1850. //
  1851. //
  1852. //
  1853. //
  1854. //
  1855. /* harmony default export */ __webpack_exports__["default"] = ({
  1856. props: {
  1857. populateWith: {
  1858. type: Object,
  1859. "default": function _default() {
  1860. return {
  1861. creddesc: null,
  1862. creduser: null,
  1863. credpass: null,
  1864. groupid: null,
  1865. pcid: null,
  1866. credtype: null
  1867. };
  1868. }
  1869. },
  1870. modalId: {
  1871. type: String,
  1872. required: true
  1873. },
  1874. descriptions: {
  1875. type: Object,
  1876. required: true
  1877. },
  1878. create: {
  1879. type: Boolean
  1880. },
  1881. pcid: {
  1882. type: Number
  1883. },
  1884. groupid: {
  1885. type: Number
  1886. }
  1887. },
  1888. data: function data() {
  1889. return {
  1890. data: JSON.parse(JSON.stringify(this.populateWith)),
  1891. creddesc: {},
  1892. id: this.modalId,
  1893. errors: []
  1894. };
  1895. },
  1896. mounted: function mounted() {
  1897. this.creddesc = {
  1898. 'id': this.data.credtype,
  1899. 'name': this.data.creddesc
  1900. };
  1901. },
  1902. methods: {
  1903. rndStr: function rndStr(len) {
  1904. var text = "";
  1905. var chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%";
  1906. for (var i = 0; i < len; i++) {
  1907. text += chars.charAt(Math.floor(Math.random() * chars.length));
  1908. }
  1909. return text;
  1910. },
  1911. getRandomPassword: function getRandomPassword(id) {
  1912. this.data.credpass = this.rndStr(16);
  1913. },
  1914. updateCredential: function updateCredential() {
  1915. var _this = this;
  1916. if (this.creddesc.id === "custom") {
  1917. this.data.credtype = 1;
  1918. this.data.creddesc = this.creddesc.name;
  1919. } else {
  1920. this.data.credtype = this.creddesc.id;
  1921. this.data.creddesc = this.creddesc.name;
  1922. }
  1923. if (this.create) {
  1924. if (this.pcid) {
  1925. this.data.pcid = this.pcid;
  1926. }
  1927. if (this.groupid) {
  1928. this.data.groupid = this.groupid;
  1929. }
  1930. axios.post('/api/credentials/', this.data).then(function (response) {
  1931. $('#' + _this.id).modal('hide');
  1932. });
  1933. } else {
  1934. axios.put('/api/credentials/' + this.data.credid, this.data).then(function (response) {
  1935. $('#' + _this.id).modal('hide');
  1936. })["catch"](function (error) {
  1937. console.error(error);
  1938. });
  1939. }
  1940. }
  1941. }
  1942. });
  1943. /***/ }),
  1944. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential-list.vue?vue&type=script&lang=js&":
  1945. /*!**************************************************************************************************************************************************************************!*\
  1946. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/credential-list.vue?vue&type=script&lang=js& ***!
  1947. \**************************************************************************************************************************************************************************/
  1948. /*! exports provided: default */
  1949. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1950. "use strict";
  1951. __webpack_require__.r(__webpack_exports__);
  1952. //
  1953. //
  1954. //
  1955. //
  1956. //
  1957. //
  1958. //
  1959. //
  1960. //
  1961. /* harmony default export */ __webpack_exports__["default"] = ({
  1962. props: {
  1963. credentialList: {
  1964. type: Array,
  1965. required: true
  1966. },
  1967. descriptions: {
  1968. type: Array,
  1969. required: true
  1970. },
  1971. pcid: {
  1972. type: Number
  1973. },
  1974. groupid: {
  1975. type: Number
  1976. }
  1977. },
  1978. data: function data() {
  1979. return {
  1980. credentials: this.credentialList
  1981. };
  1982. },
  1983. computed: {
  1984. creddescList: function creddescList() {
  1985. var list = {};
  1986. this.descriptions.map(function (val) {
  1987. list[val.creddescid] = val.credtitle;
  1988. });
  1989. return list;
  1990. }
  1991. },
  1992. methods: {
  1993. deleteCred: function deleteCred(index) {
  1994. this.credentials.splice(index, 1);
  1995. }
  1996. },
  1997. mounted: function mounted() {
  1998. var _this = this;
  1999. if (this.pcid) {
  2000. Echo.channel('credlist.pcid.' + this.pcid).listen('CredentialDeleted', function (e) {
  2001. var deletedCred = e.credential;
  2002. var index = _this.credentials.findIndex(function (credential) {
  2003. return credential.credid === deletedCred['credid'];
  2004. });
  2005. $('#credential' + deletedCred['credid'] + 'deleteModal').modal('hide');
  2006. _this.deleteCred(index);
  2007. }).listen('CredentialAdded', function (e) {
  2008. _this.credentials.unshift(e.credential);
  2009. });
  2010. }
  2011. if (this.groupid) {
  2012. Echo.channel('credlist.groupid.' + this.groupid).listen('CredentialDeleted', function (e) {
  2013. var deletedCred = e.credential;
  2014. var index = _this.credentials.findIndex(function (credential) {
  2015. return credential.groupid === deletedCred['groupid'];
  2016. });
  2017. $('#credential' + deletedCred['credid'] + 'deleteModal').modal('hide');
  2018. _this.deleteCred(index);
  2019. }).listen('CredentialAdded', function (e) {
  2020. _this.credentials.unshift(e.credential);
  2021. });
  2022. }
  2023. }
  2024. });
  2025. /***/ }),
  2026. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential.vue?vue&type=script&lang=js&":
  2027. /*!*********************************************************************************************************************************************************************!*\
  2028. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/credential.vue?vue&type=script&lang=js& ***!
  2029. \*********************************************************************************************************************************************************************/
  2030. /*! exports provided: default */
  2031. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2032. "use strict";
  2033. __webpack_require__.r(__webpack_exports__);
  2034. //
  2035. //
  2036. //
  2037. //
  2038. //
  2039. //
  2040. //
  2041. //
  2042. //
  2043. //
  2044. //
  2045. //
  2046. //
  2047. //
  2048. //
  2049. //
  2050. //
  2051. //
  2052. //
  2053. //
  2054. //
  2055. //
  2056. //
  2057. //
  2058. //
  2059. //
  2060. //
  2061. //
  2062. //
  2063. //
  2064. //
  2065. //
  2066. //
  2067. //
  2068. //
  2069. //
  2070. //
  2071. //
  2072. //
  2073. //
  2074. //
  2075. //
  2076. //
  2077. /* harmony default export */ __webpack_exports__["default"] = ({
  2078. props: ['credential', 'descriptions'],
  2079. data: function data() {
  2080. return {
  2081. data: this.credential,
  2082. creddescList: this.descriptions
  2083. };
  2084. },
  2085. mounted: function mounted() {
  2086. var _this = this;
  2087. Echo.channel('credential.' + this.data.credid).listen('CredentialUpdated', function (e) {
  2088. _this.data = e.credential;
  2089. });
  2090. },
  2091. methods: {
  2092. deleteCredential: function deleteCredential() {
  2093. var _this2 = this;
  2094. axios["delete"]('/api/credentials/' + this.data.credid, this.data).then(function (response) {
  2095. $('#credential' + _this2.data.credid + 'deleteModal').modal('hide');
  2096. })["catch"](function (error) {
  2097. console.error(error);
  2098. });
  2099. }
  2100. }
  2101. });
  2102. /***/ }),
  2103. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/errorlist.vue?vue&type=script&lang=js&":
  2104. /*!********************************************************************************************************************************************************************!*\
  2105. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/errorlist.vue?vue&type=script&lang=js& ***!
  2106. \********************************************************************************************************************************************************************/
  2107. /*! exports provided: default */
  2108. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2109. "use strict";
  2110. __webpack_require__.r(__webpack_exports__);
  2111. //
  2112. //
  2113. //
  2114. //
  2115. //
  2116. /* harmony default export */ __webpack_exports__["default"] = ({
  2117. props: ['errors'],
  2118. data: function data() {
  2119. return {
  2120. errorList: this.errors
  2121. };
  2122. },
  2123. watch: {
  2124. errors: function errors(newErrors) {
  2125. this.errorList = newErrors;
  2126. }
  2127. }
  2128. });
  2129. /***/ }),
  2130. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/note-form-modal.vue?vue&type=script&lang=js&":
  2131. /*!**************************************************************************************************************************************************************************!*\
  2132. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/note-form-modal.vue?vue&type=script&lang=js& ***!
  2133. \**************************************************************************************************************************************************************************/
  2134. /*! exports provided: default */
  2135. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2136. "use strict";
  2137. __webpack_require__.r(__webpack_exports__);
  2138. //
  2139. //
  2140. //
  2141. //
  2142. //
  2143. //
  2144. //
  2145. //
  2146. //
  2147. //
  2148. //
  2149. //
  2150. //
  2151. //
  2152. //
  2153. //
  2154. //
  2155. /* harmony default export */ __webpack_exports__["default"] = ({
  2156. props: {
  2157. populateWith: {
  2158. type: Object,
  2159. require: true
  2160. },
  2161. modalId: {
  2162. type: String,
  2163. require: true
  2164. },
  2165. noteType: {
  2166. type: Number
  2167. },
  2168. noteUser: {
  2169. type: String
  2170. },
  2171. woid: {
  2172. type: Number
  2173. }
  2174. },
  2175. data: function data() {
  2176. return {
  2177. note: JSON.parse(JSON.stringify(this.populateWith))
  2178. };
  2179. },
  2180. methods: {
  2181. updateNote: function updateNote(note) {
  2182. axios.put('/api/workorders/notes/' + note.noteid, note).then(function (response) {
  2183. hideModal();
  2184. });
  2185. },
  2186. hideModal: function hideModal() {
  2187. $('#' + this.modalId).modal('hide');
  2188. }
  2189. }
  2190. });
  2191. /***/ }),
  2192. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/notes.vue?vue&type=script&lang=js&":
  2193. /*!****************************************************************************************************************************************************************!*\
  2194. !*** ./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& ***!
  2195. \****************************************************************************************************************************************************************/
  2196. /*! exports provided: default */
  2197. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2198. "use strict";
  2199. __webpack_require__.r(__webpack_exports__);
  2200. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  2201. //
  2202. //
  2203. //
  2204. //
  2205. //
  2206. //
  2207. //
  2208. //
  2209. //
  2210. //
  2211. //
  2212. //
  2213. //
  2214. //
  2215. //
  2216. //
  2217. //
  2218. //
  2219. //
  2220. //
  2221. //
  2222. //
  2223. //
  2224. //
  2225. //
  2226. //
  2227. //
  2228. //
  2229. //
  2230. //
  2231. //
  2232. //
  2233. //
  2234. //
  2235. //
  2236. //
  2237. //
  2238. //
  2239. /* harmony default export */ __webpack_exports__["default"] = ({
  2240. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  2241. props: ['initialnotes', 'authusername', 'noteType', 'woid'],
  2242. data: function data() {
  2243. return {
  2244. notes: Object.values(this.initialnotes),
  2245. currentOrder: 'order-first',
  2246. newNote: {
  2247. notetype: this.noteType,
  2248. thenote: '',
  2249. noteuser: this.authusername,
  2250. woid: this.woid
  2251. }
  2252. };
  2253. },
  2254. mounted: function mounted() {
  2255. var _this = this;
  2256. Echo.channel('wonotes.' + this.noteType + '.' + this.woid).listen('WorkOrderNoteAdded', function (e) {
  2257. _this.notes.push(e.note);
  2258. }).listen('WorkOrderNoteEdited', function (e) {
  2259. var index = _this.notes.findIndex(function (note) {
  2260. return note.noteid === e.note.noteid;
  2261. });
  2262. _this.notes[index] = e.note;
  2263. }).listen('WorkOrderNoteDeleted', function (e) {
  2264. var index = _this.notes.findIndex(function (note) {
  2265. return note.noteid === e.noteid;
  2266. });
  2267. _this.notes.splice(index, 1);
  2268. });
  2269. },
  2270. methods: {
  2271. setOrder: function setOrder(index) {
  2272. if (index === 0) {
  2273. this.currentOrder = 'order-first';
  2274. } else if (this.notes[index].noteuser !== this.notes[index - 1].noteuser) {
  2275. if (this.currentOrder === 'order-first') {
  2276. this.currentOrder = 'order-last';
  2277. } else {
  2278. this.currentOrder = 'order-first';
  2279. }
  2280. }
  2281. return this.currentOrder;
  2282. },
  2283. createNote: function createNote() {
  2284. var _this2 = this;
  2285. axios.post('/api/workorders/notes', this.newNote).then(function (response) {
  2286. $('#note' + _this2.noteType + 'add').collapse('hide');
  2287. _this2.newNote.thenote = '';
  2288. });
  2289. }
  2290. }
  2291. });
  2292. /***/ }),
  2293. /***/ "./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&":
  2294. /*!****************************************************************************************************************************************************************************!*\
  2295. !*** ./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& ***!
  2296. \****************************************************************************************************************************************************************************/
  2297. /*! exports provided: default */
  2298. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2299. "use strict";
  2300. __webpack_require__.r(__webpack_exports__);
  2301. //
  2302. //
  2303. //
  2304. //
  2305. //
  2306. //
  2307. //
  2308. //
  2309. //
  2310. //
  2311. //
  2312. //
  2313. //
  2314. //
  2315. //
  2316. //
  2317. //
  2318. //
  2319. //
  2320. //
  2321. //
  2322. //
  2323. //
  2324. //
  2325. //
  2326. //
  2327. //
  2328. //
  2329. //
  2330. //
  2331. //
  2332. //
  2333. //
  2334. /* harmony default export */ __webpack_exports__["default"] = ({
  2335. props: ['populateWith', 'storeList', 'modalId'],
  2336. data: function data() {
  2337. return {
  2338. // Copies object from prop, so it doesn't mutate the object
  2339. // from the parent component. Parent component will be updated via
  2340. // Websocket if updateWorkOrder is successful.
  2341. data: JSON.parse(JSON.stringify(this.populateWith)),
  2342. id: this.modalId,
  2343. store: {},
  2344. errors: []
  2345. };
  2346. },
  2347. mounted: function mounted() {
  2348. this.store = {
  2349. 'id': this.data.storeid,
  2350. 'name': this.storeList[this.data.storeid]
  2351. };
  2352. },
  2353. methods: {
  2354. updateWorkOrder: function updateWorkOrder() {
  2355. var _this = this;
  2356. this.data.storeid = this.store.id;
  2357. axios.put('/api/workorders/' + this.data.woid, this.data).then(function (response) {
  2358. $('#workordereditModal').modal('hide');
  2359. })["catch"](function (error) {
  2360. _this.errors = JSON.parse(error.response.request.response).errors;
  2361. });
  2362. }
  2363. }
  2364. });
  2365. /***/ }),
  2366. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/woinfo.vue?vue&type=script&lang=js&":
  2367. /*!*****************************************************************************************************************************************************************!*\
  2368. !*** ./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& ***!
  2369. \*****************************************************************************************************************************************************************/
  2370. /*! exports provided: default */
  2371. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2372. "use strict";
  2373. __webpack_require__.r(__webpack_exports__);
  2374. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  2375. //
  2376. //
  2377. //
  2378. //
  2379. //
  2380. //
  2381. //
  2382. //
  2383. //
  2384. //
  2385. //
  2386. //
  2387. //
  2388. //
  2389. //
  2390. //
  2391. //
  2392. //
  2393. //
  2394. //
  2395. /* harmony default export */ __webpack_exports__["default"] = ({
  2396. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  2397. props: ['workOrder', 'stores'],
  2398. data: function data() {
  2399. return {
  2400. data: JSON.parse(this.workOrder)
  2401. };
  2402. },
  2403. computed: {
  2404. storeList: function storeList() {
  2405. var list = {};
  2406. JSON.parse(this.stores).map(function (val) {
  2407. list[val.storeid] = val.storesname;
  2408. });
  2409. return list;
  2410. }
  2411. },
  2412. mounted: function mounted() {
  2413. var _this = this;
  2414. Echo.channel('work-order.' + this.data.woid).listen('WorkOrderUpdated', function (e) {
  2415. _this.data = e.data;
  2416. });
  2417. }
  2418. });
  2419. /***/ }),
  2420. /***/ "./node_modules/base64-js/index.js":
  2421. /*!*****************************************!*\
  2422. !*** ./node_modules/base64-js/index.js ***!
  2423. \*****************************************/
  2424. /*! no static exports found */
  2425. /***/ (function(module, exports, __webpack_require__) {
  2426. "use strict";
  2427. exports.byteLength = byteLength
  2428. exports.toByteArray = toByteArray
  2429. exports.fromByteArray = fromByteArray
  2430. var lookup = []
  2431. var revLookup = []
  2432. var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
  2433. var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
  2434. for (var i = 0, len = code.length; i < len; ++i) {
  2435. lookup[i] = code[i]
  2436. revLookup[code.charCodeAt(i)] = i
  2437. }
  2438. // Support decoding URL-safe base64 strings, as Node.js does.
  2439. // See: https://en.wikipedia.org/wiki/Base64#URL_applications
  2440. revLookup['-'.charCodeAt(0)] = 62
  2441. revLookup['_'.charCodeAt(0)] = 63
  2442. function getLens (b64) {
  2443. var len = b64.length
  2444. if (len % 4 > 0) {
  2445. throw new Error('Invalid string. Length must be a multiple of 4')
  2446. }
  2447. // Trim off extra bytes after placeholder bytes are found
  2448. // See: https://github.com/beatgammit/base64-js/issues/42
  2449. var validLen = b64.indexOf('=')
  2450. if (validLen === -1) validLen = len
  2451. var placeHoldersLen = validLen === len
  2452. ? 0
  2453. : 4 - (validLen % 4)
  2454. return [validLen, placeHoldersLen]
  2455. }
  2456. // base64 is 4/3 + up to two characters of the original data
  2457. function byteLength (b64) {
  2458. var lens = getLens(b64)
  2459. var validLen = lens[0]
  2460. var placeHoldersLen = lens[1]
  2461. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  2462. }
  2463. function _byteLength (b64, validLen, placeHoldersLen) {
  2464. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  2465. }
  2466. function toByteArray (b64) {
  2467. var tmp
  2468. var lens = getLens(b64)
  2469. var validLen = lens[0]
  2470. var placeHoldersLen = lens[1]
  2471. var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
  2472. var curByte = 0
  2473. // if there are placeholders, only get up to the last complete 4 chars
  2474. var len = placeHoldersLen > 0
  2475. ? validLen - 4
  2476. : validLen
  2477. var i
  2478. for (i = 0; i < len; i += 4) {
  2479. tmp =
  2480. (revLookup[b64.charCodeAt(i)] << 18) |
  2481. (revLookup[b64.charCodeAt(i + 1)] << 12) |
  2482. (revLookup[b64.charCodeAt(i + 2)] << 6) |
  2483. revLookup[b64.charCodeAt(i + 3)]
  2484. arr[curByte++] = (tmp >> 16) & 0xFF
  2485. arr[curByte++] = (tmp >> 8) & 0xFF
  2486. arr[curByte++] = tmp & 0xFF
  2487. }
  2488. if (placeHoldersLen === 2) {
  2489. tmp =
  2490. (revLookup[b64.charCodeAt(i)] << 2) |
  2491. (revLookup[b64.charCodeAt(i + 1)] >> 4)
  2492. arr[curByte++] = tmp & 0xFF
  2493. }
  2494. if (placeHoldersLen === 1) {
  2495. tmp =
  2496. (revLookup[b64.charCodeAt(i)] << 10) |
  2497. (revLookup[b64.charCodeAt(i + 1)] << 4) |
  2498. (revLookup[b64.charCodeAt(i + 2)] >> 2)
  2499. arr[curByte++] = (tmp >> 8) & 0xFF
  2500. arr[curByte++] = tmp & 0xFF
  2501. }
  2502. return arr
  2503. }
  2504. function tripletToBase64 (num) {
  2505. return lookup[num >> 18 & 0x3F] +
  2506. lookup[num >> 12 & 0x3F] +
  2507. lookup[num >> 6 & 0x3F] +
  2508. lookup[num & 0x3F]
  2509. }
  2510. function encodeChunk (uint8, start, end) {
  2511. var tmp
  2512. var output = []
  2513. for (var i = start; i < end; i += 3) {
  2514. tmp =
  2515. ((uint8[i] << 16) & 0xFF0000) +
  2516. ((uint8[i + 1] << 8) & 0xFF00) +
  2517. (uint8[i + 2] & 0xFF)
  2518. output.push(tripletToBase64(tmp))
  2519. }
  2520. return output.join('')
  2521. }
  2522. function fromByteArray (uint8) {
  2523. var tmp
  2524. var len = uint8.length
  2525. var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
  2526. var parts = []
  2527. var maxChunkLength = 16383 // must be multiple of 3
  2528. // go through the array every three bytes, we'll deal with trailing stuff later
  2529. for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
  2530. parts.push(encodeChunk(
  2531. uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
  2532. ))
  2533. }
  2534. // pad the end with zeros, but make sure to not forget the extra bytes
  2535. if (extraBytes === 1) {
  2536. tmp = uint8[len - 1]
  2537. parts.push(
  2538. lookup[tmp >> 2] +
  2539. lookup[(tmp << 4) & 0x3F] +
  2540. '=='
  2541. )
  2542. } else if (extraBytes === 2) {
  2543. tmp = (uint8[len - 2] << 8) + uint8[len - 1]
  2544. parts.push(
  2545. lookup[tmp >> 10] +
  2546. lookup[(tmp >> 4) & 0x3F] +
  2547. lookup[(tmp << 2) & 0x3F] +
  2548. '='
  2549. )
  2550. }
  2551. return parts.join('')
  2552. }
  2553. /***/ }),
  2554. /***/ "./node_modules/bootstrap/dist/js/bootstrap.js":
  2555. /*!*****************************************************!*\
  2556. !*** ./node_modules/bootstrap/dist/js/bootstrap.js ***!
  2557. \*****************************************************/
  2558. /*! no static exports found */
  2559. /***/ (function(module, exports, __webpack_require__) {
  2560. /*!
  2561. * Bootstrap v4.4.1 (https://getbootstrap.com/)
  2562. * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  2563. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2564. */
  2565. (function (global, factory) {
  2566. true ? factory(exports, __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"), __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")) :
  2567. undefined;
  2568. }(this, (function (exports, $, Popper) { 'use strict';
  2569. $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
  2570. Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper;
  2571. function _defineProperties(target, props) {
  2572. for (var i = 0; i < props.length; i++) {
  2573. var descriptor = props[i];
  2574. descriptor.enumerable = descriptor.enumerable || false;
  2575. descriptor.configurable = true;
  2576. if ("value" in descriptor) descriptor.writable = true;
  2577. Object.defineProperty(target, descriptor.key, descriptor);
  2578. }
  2579. }
  2580. function _createClass(Constructor, protoProps, staticProps) {
  2581. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  2582. if (staticProps) _defineProperties(Constructor, staticProps);
  2583. return Constructor;
  2584. }
  2585. function _defineProperty(obj, key, value) {
  2586. if (key in obj) {
  2587. Object.defineProperty(obj, key, {
  2588. value: value,
  2589. enumerable: true,
  2590. configurable: true,
  2591. writable: true
  2592. });
  2593. } else {
  2594. obj[key] = value;
  2595. }
  2596. return obj;
  2597. }
  2598. function ownKeys(object, enumerableOnly) {
  2599. var keys = Object.keys(object);
  2600. if (Object.getOwnPropertySymbols) {
  2601. var symbols = Object.getOwnPropertySymbols(object);
  2602. if (enumerableOnly) symbols = symbols.filter(function (sym) {
  2603. return Object.getOwnPropertyDescriptor(object, sym).enumerable;
  2604. });
  2605. keys.push.apply(keys, symbols);
  2606. }
  2607. return keys;
  2608. }
  2609. function _objectSpread2(target) {
  2610. for (var i = 1; i < arguments.length; i++) {
  2611. var source = arguments[i] != null ? arguments[i] : {};
  2612. if (i % 2) {
  2613. ownKeys(Object(source), true).forEach(function (key) {
  2614. _defineProperty(target, key, source[key]);
  2615. });
  2616. } else if (Object.getOwnPropertyDescriptors) {
  2617. Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
  2618. } else {
  2619. ownKeys(Object(source)).forEach(function (key) {
  2620. Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
  2621. });
  2622. }
  2623. }
  2624. return target;
  2625. }
  2626. function _inheritsLoose(subClass, superClass) {
  2627. subClass.prototype = Object.create(superClass.prototype);
  2628. subClass.prototype.constructor = subClass;
  2629. subClass.__proto__ = superClass;
  2630. }
  2631. /**
  2632. * --------------------------------------------------------------------------
  2633. * Bootstrap (v4.4.1): util.js
  2634. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2635. * --------------------------------------------------------------------------
  2636. */
  2637. /**
  2638. * ------------------------------------------------------------------------
  2639. * Private TransitionEnd Helpers
  2640. * ------------------------------------------------------------------------
  2641. */
  2642. var TRANSITION_END = 'transitionend';
  2643. var MAX_UID = 1000000;
  2644. var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
  2645. function toType(obj) {
  2646. return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
  2647. }
  2648. function getSpecialTransitionEndEvent() {
  2649. return {
  2650. bindType: TRANSITION_END,
  2651. delegateType: TRANSITION_END,
  2652. handle: function handle(event) {
  2653. if ($(event.target).is(this)) {
  2654. return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
  2655. }
  2656. return undefined; // eslint-disable-line no-undefined
  2657. }
  2658. };
  2659. }
  2660. function transitionEndEmulator(duration) {
  2661. var _this = this;
  2662. var called = false;
  2663. $(this).one(Util.TRANSITION_END, function () {
  2664. called = true;
  2665. });
  2666. setTimeout(function () {
  2667. if (!called) {
  2668. Util.triggerTransitionEnd(_this);
  2669. }
  2670. }, duration);
  2671. return this;
  2672. }
  2673. function setTransitionEndSupport() {
  2674. $.fn.emulateTransitionEnd = transitionEndEmulator;
  2675. $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
  2676. }
  2677. /**
  2678. * --------------------------------------------------------------------------
  2679. * Public Util Api
  2680. * --------------------------------------------------------------------------
  2681. */
  2682. var Util = {
  2683. TRANSITION_END: 'bsTransitionEnd',
  2684. getUID: function getUID(prefix) {
  2685. do {
  2686. // eslint-disable-next-line no-bitwise
  2687. prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
  2688. } while (document.getElementById(prefix));
  2689. return prefix;
  2690. },
  2691. getSelectorFromElement: function getSelectorFromElement(element) {
  2692. var selector = element.getAttribute('data-target');
  2693. if (!selector || selector === '#') {
  2694. var hrefAttr = element.getAttribute('href');
  2695. selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
  2696. }
  2697. try {
  2698. return document.querySelector(selector) ? selector : null;
  2699. } catch (err) {
  2700. return null;
  2701. }
  2702. },
  2703. getTransitionDurationFromElement: function getTransitionDurationFromElement(element) {
  2704. if (!element) {
  2705. return 0;
  2706. } // Get transition-duration of the element
  2707. var transitionDuration = $(element).css('transition-duration');
  2708. var transitionDelay = $(element).css('transition-delay');
  2709. var floatTransitionDuration = parseFloat(transitionDuration);
  2710. var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
  2711. if (!floatTransitionDuration && !floatTransitionDelay) {
  2712. return 0;
  2713. } // If multiple durations are defined, take the first
  2714. transitionDuration = transitionDuration.split(',')[0];
  2715. transitionDelay = transitionDelay.split(',')[0];
  2716. return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
  2717. },
  2718. reflow: function reflow(element) {
  2719. return element.offsetHeight;
  2720. },
  2721. triggerTransitionEnd: function triggerTransitionEnd(element) {
  2722. $(element).trigger(TRANSITION_END);
  2723. },
  2724. // TODO: Remove in v5
  2725. supportsTransitionEnd: function supportsTransitionEnd() {
  2726. return Boolean(TRANSITION_END);
  2727. },
  2728. isElement: function isElement(obj) {
  2729. return (obj[0] || obj).nodeType;
  2730. },
  2731. typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
  2732. for (var property in configTypes) {
  2733. if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
  2734. var expectedTypes = configTypes[property];
  2735. var value = config[property];
  2736. var valueType = value && Util.isElement(value) ? 'element' : toType(value);
  2737. if (!new RegExp(expectedTypes).test(valueType)) {
  2738. throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
  2739. }
  2740. }
  2741. }
  2742. },
  2743. findShadowRoot: function findShadowRoot(element) {
  2744. if (!document.documentElement.attachShadow) {
  2745. return null;
  2746. } // Can find the shadow root otherwise it'll return the document
  2747. if (typeof element.getRootNode === 'function') {
  2748. var root = element.getRootNode();
  2749. return root instanceof ShadowRoot ? root : null;
  2750. }
  2751. if (element instanceof ShadowRoot) {
  2752. return element;
  2753. } // when we don't find a shadow root
  2754. if (!element.parentNode) {
  2755. return null;
  2756. }
  2757. return Util.findShadowRoot(element.parentNode);
  2758. },
  2759. jQueryDetection: function jQueryDetection() {
  2760. if (typeof $ === 'undefined') {
  2761. throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.');
  2762. }
  2763. var version = $.fn.jquery.split(' ')[0].split('.');
  2764. var minMajor = 1;
  2765. var ltMajor = 2;
  2766. var minMinor = 9;
  2767. var minPatch = 1;
  2768. var maxMajor = 4;
  2769. if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
  2770. throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0');
  2771. }
  2772. }
  2773. };
  2774. Util.jQueryDetection();
  2775. setTransitionEndSupport();
  2776. /**
  2777. * ------------------------------------------------------------------------
  2778. * Constants
  2779. * ------------------------------------------------------------------------
  2780. */
  2781. var NAME = 'alert';
  2782. var VERSION = '4.4.1';
  2783. var DATA_KEY = 'bs.alert';
  2784. var EVENT_KEY = "." + DATA_KEY;
  2785. var DATA_API_KEY = '.data-api';
  2786. var JQUERY_NO_CONFLICT = $.fn[NAME];
  2787. var Selector = {
  2788. DISMISS: '[data-dismiss="alert"]'
  2789. };
  2790. var Event = {
  2791. CLOSE: "close" + EVENT_KEY,
  2792. CLOSED: "closed" + EVENT_KEY,
  2793. CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
  2794. };
  2795. var ClassName = {
  2796. ALERT: 'alert',
  2797. FADE: 'fade',
  2798. SHOW: 'show'
  2799. };
  2800. /**
  2801. * ------------------------------------------------------------------------
  2802. * Class Definition
  2803. * ------------------------------------------------------------------------
  2804. */
  2805. var Alert =
  2806. /*#__PURE__*/
  2807. function () {
  2808. function Alert(element) {
  2809. this._element = element;
  2810. } // Getters
  2811. var _proto = Alert.prototype;
  2812. // Public
  2813. _proto.close = function close(element) {
  2814. var rootElement = this._element;
  2815. if (element) {
  2816. rootElement = this._getRootElement(element);
  2817. }
  2818. var customEvent = this._triggerCloseEvent(rootElement);
  2819. if (customEvent.isDefaultPrevented()) {
  2820. return;
  2821. }
  2822. this._removeElement(rootElement);
  2823. };
  2824. _proto.dispose = function dispose() {
  2825. $.removeData(this._element, DATA_KEY);
  2826. this._element = null;
  2827. } // Private
  2828. ;
  2829. _proto._getRootElement = function _getRootElement(element) {
  2830. var selector = Util.getSelectorFromElement(element);
  2831. var parent = false;
  2832. if (selector) {
  2833. parent = document.querySelector(selector);
  2834. }
  2835. if (!parent) {
  2836. parent = $(element).closest("." + ClassName.ALERT)[0];
  2837. }
  2838. return parent;
  2839. };
  2840. _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
  2841. var closeEvent = $.Event(Event.CLOSE);
  2842. $(element).trigger(closeEvent);
  2843. return closeEvent;
  2844. };
  2845. _proto._removeElement = function _removeElement(element) {
  2846. var _this = this;
  2847. $(element).removeClass(ClassName.SHOW);
  2848. if (!$(element).hasClass(ClassName.FADE)) {
  2849. this._destroyElement(element);
  2850. return;
  2851. }
  2852. var transitionDuration = Util.getTransitionDurationFromElement(element);
  2853. $(element).one(Util.TRANSITION_END, function (event) {
  2854. return _this._destroyElement(element, event);
  2855. }).emulateTransitionEnd(transitionDuration);
  2856. };
  2857. _proto._destroyElement = function _destroyElement(element) {
  2858. $(element).detach().trigger(Event.CLOSED).remove();
  2859. } // Static
  2860. ;
  2861. Alert._jQueryInterface = function _jQueryInterface(config) {
  2862. return this.each(function () {
  2863. var $element = $(this);
  2864. var data = $element.data(DATA_KEY);
  2865. if (!data) {
  2866. data = new Alert(this);
  2867. $element.data(DATA_KEY, data);
  2868. }
  2869. if (config === 'close') {
  2870. data[config](this);
  2871. }
  2872. });
  2873. };
  2874. Alert._handleDismiss = function _handleDismiss(alertInstance) {
  2875. return function (event) {
  2876. if (event) {
  2877. event.preventDefault();
  2878. }
  2879. alertInstance.close(this);
  2880. };
  2881. };
  2882. _createClass(Alert, null, [{
  2883. key: "VERSION",
  2884. get: function get() {
  2885. return VERSION;
  2886. }
  2887. }]);
  2888. return Alert;
  2889. }();
  2890. /**
  2891. * ------------------------------------------------------------------------
  2892. * Data Api implementation
  2893. * ------------------------------------------------------------------------
  2894. */
  2895. $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
  2896. /**
  2897. * ------------------------------------------------------------------------
  2898. * jQuery
  2899. * ------------------------------------------------------------------------
  2900. */
  2901. $.fn[NAME] = Alert._jQueryInterface;
  2902. $.fn[NAME].Constructor = Alert;
  2903. $.fn[NAME].noConflict = function () {
  2904. $.fn[NAME] = JQUERY_NO_CONFLICT;
  2905. return Alert._jQueryInterface;
  2906. };
  2907. /**
  2908. * ------------------------------------------------------------------------
  2909. * Constants
  2910. * ------------------------------------------------------------------------
  2911. */
  2912. var NAME$1 = 'button';
  2913. var VERSION$1 = '4.4.1';
  2914. var DATA_KEY$1 = 'bs.button';
  2915. var EVENT_KEY$1 = "." + DATA_KEY$1;
  2916. var DATA_API_KEY$1 = '.data-api';
  2917. var JQUERY_NO_CONFLICT$1 = $.fn[NAME$1];
  2918. var ClassName$1 = {
  2919. ACTIVE: 'active',
  2920. BUTTON: 'btn',
  2921. FOCUS: 'focus'
  2922. };
  2923. var Selector$1 = {
  2924. DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
  2925. DATA_TOGGLES: '[data-toggle="buttons"]',
  2926. DATA_TOGGLE: '[data-toggle="button"]',
  2927. DATA_TOGGLES_BUTTONS: '[data-toggle="buttons"] .btn',
  2928. INPUT: 'input:not([type="hidden"])',
  2929. ACTIVE: '.active',
  2930. BUTTON: '.btn'
  2931. };
  2932. var Event$1 = {
  2933. CLICK_DATA_API: "click" + EVENT_KEY$1 + DATA_API_KEY$1,
  2934. FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1),
  2935. LOAD_DATA_API: "load" + EVENT_KEY$1 + DATA_API_KEY$1
  2936. };
  2937. /**
  2938. * ------------------------------------------------------------------------
  2939. * Class Definition
  2940. * ------------------------------------------------------------------------
  2941. */
  2942. var Button =
  2943. /*#__PURE__*/
  2944. function () {
  2945. function Button(element) {
  2946. this._element = element;
  2947. } // Getters
  2948. var _proto = Button.prototype;
  2949. // Public
  2950. _proto.toggle = function toggle() {
  2951. var triggerChangeEvent = true;
  2952. var addAriaPressed = true;
  2953. var rootElement = $(this._element).closest(Selector$1.DATA_TOGGLES)[0];
  2954. if (rootElement) {
  2955. var input = this._element.querySelector(Selector$1.INPUT);
  2956. if (input) {
  2957. if (input.type === 'radio') {
  2958. if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) {
  2959. triggerChangeEvent = false;
  2960. } else {
  2961. var activeElement = rootElement.querySelector(Selector$1.ACTIVE);
  2962. if (activeElement) {
  2963. $(activeElement).removeClass(ClassName$1.ACTIVE);
  2964. }
  2965. }
  2966. } else if (input.type === 'checkbox') {
  2967. if (this._element.tagName === 'LABEL' && input.checked === this._element.classList.contains(ClassName$1.ACTIVE)) {
  2968. triggerChangeEvent = false;
  2969. }
  2970. } else {
  2971. // if it's not a radio button or checkbox don't add a pointless/invalid checked property to the input
  2972. triggerChangeEvent = false;
  2973. }
  2974. if (triggerChangeEvent) {
  2975. input.checked = !this._element.classList.contains(ClassName$1.ACTIVE);
  2976. $(input).trigger('change');
  2977. }
  2978. input.focus();
  2979. addAriaPressed = false;
  2980. }
  2981. }
  2982. if (!(this._element.hasAttribute('disabled') || this._element.classList.contains('disabled'))) {
  2983. if (addAriaPressed) {
  2984. this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName$1.ACTIVE));
  2985. }
  2986. if (triggerChangeEvent) {
  2987. $(this._element).toggleClass(ClassName$1.ACTIVE);
  2988. }
  2989. }
  2990. };
  2991. _proto.dispose = function dispose() {
  2992. $.removeData(this._element, DATA_KEY$1);
  2993. this._element = null;
  2994. } // Static
  2995. ;
  2996. Button._jQueryInterface = function _jQueryInterface(config) {
  2997. return this.each(function () {
  2998. var data = $(this).data(DATA_KEY$1);
  2999. if (!data) {
  3000. data = new Button(this);
  3001. $(this).data(DATA_KEY$1, data);
  3002. }
  3003. if (config === 'toggle') {
  3004. data[config]();
  3005. }
  3006. });
  3007. };
  3008. _createClass(Button, null, [{
  3009. key: "VERSION",
  3010. get: function get() {
  3011. return VERSION$1;
  3012. }
  3013. }]);
  3014. return Button;
  3015. }();
  3016. /**
  3017. * ------------------------------------------------------------------------
  3018. * Data Api implementation
  3019. * ------------------------------------------------------------------------
  3020. */
  3021. $(document).on(Event$1.CLICK_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  3022. var button = event.target;
  3023. if (!$(button).hasClass(ClassName$1.BUTTON)) {
  3024. button = $(button).closest(Selector$1.BUTTON)[0];
  3025. }
  3026. if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) {
  3027. event.preventDefault(); // work around Firefox bug #1540995
  3028. } else {
  3029. var inputBtn = button.querySelector(Selector$1.INPUT);
  3030. if (inputBtn && (inputBtn.hasAttribute('disabled') || inputBtn.classList.contains('disabled'))) {
  3031. event.preventDefault(); // work around Firefox bug #1540995
  3032. return;
  3033. }
  3034. Button._jQueryInterface.call($(button), 'toggle');
  3035. }
  3036. }).on(Event$1.FOCUS_BLUR_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  3037. var button = $(event.target).closest(Selector$1.BUTTON)[0];
  3038. $(button).toggleClass(ClassName$1.FOCUS, /^focus(in)?$/.test(event.type));
  3039. });
  3040. $(window).on(Event$1.LOAD_DATA_API, function () {
  3041. // ensure correct active class is set to match the controls' actual values/states
  3042. // find all checkboxes/readio buttons inside data-toggle groups
  3043. var buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLES_BUTTONS));
  3044. for (var i = 0, len = buttons.length; i < len; i++) {
  3045. var button = buttons[i];
  3046. var input = button.querySelector(Selector$1.INPUT);
  3047. if (input.checked || input.hasAttribute('checked')) {
  3048. button.classList.add(ClassName$1.ACTIVE);
  3049. } else {
  3050. button.classList.remove(ClassName$1.ACTIVE);
  3051. }
  3052. } // find all button toggles
  3053. buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLE));
  3054. for (var _i = 0, _len = buttons.length; _i < _len; _i++) {
  3055. var _button = buttons[_i];
  3056. if (_button.getAttribute('aria-pressed') === 'true') {
  3057. _button.classList.add(ClassName$1.ACTIVE);
  3058. } else {
  3059. _button.classList.remove(ClassName$1.ACTIVE);
  3060. }
  3061. }
  3062. });
  3063. /**
  3064. * ------------------------------------------------------------------------
  3065. * jQuery
  3066. * ------------------------------------------------------------------------
  3067. */
  3068. $.fn[NAME$1] = Button._jQueryInterface;
  3069. $.fn[NAME$1].Constructor = Button;
  3070. $.fn[NAME$1].noConflict = function () {
  3071. $.fn[NAME$1] = JQUERY_NO_CONFLICT$1;
  3072. return Button._jQueryInterface;
  3073. };
  3074. /**
  3075. * ------------------------------------------------------------------------
  3076. * Constants
  3077. * ------------------------------------------------------------------------
  3078. */
  3079. var NAME$2 = 'carousel';
  3080. var VERSION$2 = '4.4.1';
  3081. var DATA_KEY$2 = 'bs.carousel';
  3082. var EVENT_KEY$2 = "." + DATA_KEY$2;
  3083. var DATA_API_KEY$2 = '.data-api';
  3084. var JQUERY_NO_CONFLICT$2 = $.fn[NAME$2];
  3085. var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
  3086. var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
  3087. var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
  3088. var SWIPE_THRESHOLD = 40;
  3089. var Default = {
  3090. interval: 5000,
  3091. keyboard: true,
  3092. slide: false,
  3093. pause: 'hover',
  3094. wrap: true,
  3095. touch: true
  3096. };
  3097. var DefaultType = {
  3098. interval: '(number|boolean)',
  3099. keyboard: 'boolean',
  3100. slide: '(boolean|string)',
  3101. pause: '(string|boolean)',
  3102. wrap: 'boolean',
  3103. touch: 'boolean'
  3104. };
  3105. var Direction = {
  3106. NEXT: 'next',
  3107. PREV: 'prev',
  3108. LEFT: 'left',
  3109. RIGHT: 'right'
  3110. };
  3111. var Event$2 = {
  3112. SLIDE: "slide" + EVENT_KEY$2,
  3113. SLID: "slid" + EVENT_KEY$2,
  3114. KEYDOWN: "keydown" + EVENT_KEY$2,
  3115. MOUSEENTER: "mouseenter" + EVENT_KEY$2,
  3116. MOUSELEAVE: "mouseleave" + EVENT_KEY$2,
  3117. TOUCHSTART: "touchstart" + EVENT_KEY$2,
  3118. TOUCHMOVE: "touchmove" + EVENT_KEY$2,
  3119. TOUCHEND: "touchend" + EVENT_KEY$2,
  3120. POINTERDOWN: "pointerdown" + EVENT_KEY$2,
  3121. POINTERUP: "pointerup" + EVENT_KEY$2,
  3122. DRAG_START: "dragstart" + EVENT_KEY$2,
  3123. LOAD_DATA_API: "load" + EVENT_KEY$2 + DATA_API_KEY$2,
  3124. CLICK_DATA_API: "click" + EVENT_KEY$2 + DATA_API_KEY$2
  3125. };
  3126. var ClassName$2 = {
  3127. CAROUSEL: 'carousel',
  3128. ACTIVE: 'active',
  3129. SLIDE: 'slide',
  3130. RIGHT: 'carousel-item-right',
  3131. LEFT: 'carousel-item-left',
  3132. NEXT: 'carousel-item-next',
  3133. PREV: 'carousel-item-prev',
  3134. ITEM: 'carousel-item',
  3135. POINTER_EVENT: 'pointer-event'
  3136. };
  3137. var Selector$2 = {
  3138. ACTIVE: '.active',
  3139. ACTIVE_ITEM: '.active.carousel-item',
  3140. ITEM: '.carousel-item',
  3141. ITEM_IMG: '.carousel-item img',
  3142. NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
  3143. INDICATORS: '.carousel-indicators',
  3144. DATA_SLIDE: '[data-slide], [data-slide-to]',
  3145. DATA_RIDE: '[data-ride="carousel"]'
  3146. };
  3147. var PointerType = {
  3148. TOUCH: 'touch',
  3149. PEN: 'pen'
  3150. };
  3151. /**
  3152. * ------------------------------------------------------------------------
  3153. * Class Definition
  3154. * ------------------------------------------------------------------------
  3155. */
  3156. var Carousel =
  3157. /*#__PURE__*/
  3158. function () {
  3159. function Carousel(element, config) {
  3160. this._items = null;
  3161. this._interval = null;
  3162. this._activeElement = null;
  3163. this._isPaused = false;
  3164. this._isSliding = false;
  3165. this.touchTimeout = null;
  3166. this.touchStartX = 0;
  3167. this.touchDeltaX = 0;
  3168. this._config = this._getConfig(config);
  3169. this._element = element;
  3170. this._indicatorsElement = this._element.querySelector(Selector$2.INDICATORS);
  3171. this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
  3172. this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
  3173. this._addEventListeners();
  3174. } // Getters
  3175. var _proto = Carousel.prototype;
  3176. // Public
  3177. _proto.next = function next() {
  3178. if (!this._isSliding) {
  3179. this._slide(Direction.NEXT);
  3180. }
  3181. };
  3182. _proto.nextWhenVisible = function nextWhenVisible() {
  3183. // Don't call next when the page isn't visible
  3184. // or the carousel or its parent isn't visible
  3185. if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') {
  3186. this.next();
  3187. }
  3188. };
  3189. _proto.prev = function prev() {
  3190. if (!this._isSliding) {
  3191. this._slide(Direction.PREV);
  3192. }
  3193. };
  3194. _proto.pause = function pause(event) {
  3195. if (!event) {
  3196. this._isPaused = true;
  3197. }
  3198. if (this._element.querySelector(Selector$2.NEXT_PREV)) {
  3199. Util.triggerTransitionEnd(this._element);
  3200. this.cycle(true);
  3201. }
  3202. clearInterval(this._interval);
  3203. this._interval = null;
  3204. };
  3205. _proto.cycle = function cycle(event) {
  3206. if (!event) {
  3207. this._isPaused = false;
  3208. }
  3209. if (this._interval) {
  3210. clearInterval(this._interval);
  3211. this._interval = null;
  3212. }
  3213. if (this._config.interval && !this._isPaused) {
  3214. this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
  3215. }
  3216. };
  3217. _proto.to = function to(index) {
  3218. var _this = this;
  3219. this._activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  3220. var activeIndex = this._getItemIndex(this._activeElement);
  3221. if (index > this._items.length - 1 || index < 0) {
  3222. return;
  3223. }
  3224. if (this._isSliding) {
  3225. $(this._element).one(Event$2.SLID, function () {
  3226. return _this.to(index);
  3227. });
  3228. return;
  3229. }
  3230. if (activeIndex === index) {
  3231. this.pause();
  3232. this.cycle();
  3233. return;
  3234. }
  3235. var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
  3236. this._slide(direction, this._items[index]);
  3237. };
  3238. _proto.dispose = function dispose() {
  3239. $(this._element).off(EVENT_KEY$2);
  3240. $.removeData(this._element, DATA_KEY$2);
  3241. this._items = null;
  3242. this._config = null;
  3243. this._element = null;
  3244. this._interval = null;
  3245. this._isPaused = null;
  3246. this._isSliding = null;
  3247. this._activeElement = null;
  3248. this._indicatorsElement = null;
  3249. } // Private
  3250. ;
  3251. _proto._getConfig = function _getConfig(config) {
  3252. config = _objectSpread2({}, Default, {}, config);
  3253. Util.typeCheckConfig(NAME$2, config, DefaultType);
  3254. return config;
  3255. };
  3256. _proto._handleSwipe = function _handleSwipe() {
  3257. var absDeltax = Math.abs(this.touchDeltaX);
  3258. if (absDeltax <= SWIPE_THRESHOLD) {
  3259. return;
  3260. }
  3261. var direction = absDeltax / this.touchDeltaX;
  3262. this.touchDeltaX = 0; // swipe left
  3263. if (direction > 0) {
  3264. this.prev();
  3265. } // swipe right
  3266. if (direction < 0) {
  3267. this.next();
  3268. }
  3269. };
  3270. _proto._addEventListeners = function _addEventListeners() {
  3271. var _this2 = this;
  3272. if (this._config.keyboard) {
  3273. $(this._element).on(Event$2.KEYDOWN, function (event) {
  3274. return _this2._keydown(event);
  3275. });
  3276. }
  3277. if (this._config.pause === 'hover') {
  3278. $(this._element).on(Event$2.MOUSEENTER, function (event) {
  3279. return _this2.pause(event);
  3280. }).on(Event$2.MOUSELEAVE, function (event) {
  3281. return _this2.cycle(event);
  3282. });
  3283. }
  3284. if (this._config.touch) {
  3285. this._addTouchEventListeners();
  3286. }
  3287. };
  3288. _proto._addTouchEventListeners = function _addTouchEventListeners() {
  3289. var _this3 = this;
  3290. if (!this._touchSupported) {
  3291. return;
  3292. }
  3293. var start = function start(event) {
  3294. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  3295. _this3.touchStartX = event.originalEvent.clientX;
  3296. } else if (!_this3._pointerEvent) {
  3297. _this3.touchStartX = event.originalEvent.touches[0].clientX;
  3298. }
  3299. };
  3300. var move = function move(event) {
  3301. // ensure swiping with one touch and not pinching
  3302. if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
  3303. _this3.touchDeltaX = 0;
  3304. } else {
  3305. _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX;
  3306. }
  3307. };
  3308. var end = function end(event) {
  3309. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  3310. _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
  3311. }
  3312. _this3._handleSwipe();
  3313. if (_this3._config.pause === 'hover') {
  3314. // If it's a touch-enabled device, mouseenter/leave are fired as
  3315. // part of the mouse compatibility events on first tap - the carousel
  3316. // would stop cycling until user tapped out of it;
  3317. // here, we listen for touchend, explicitly pause the carousel
  3318. // (as if it's the second time we tap on it, mouseenter compat event
  3319. // is NOT fired) and after a timeout (to allow for mouse compatibility
  3320. // events to fire) we explicitly restart cycling
  3321. _this3.pause();
  3322. if (_this3.touchTimeout) {
  3323. clearTimeout(_this3.touchTimeout);
  3324. }
  3325. _this3.touchTimeout = setTimeout(function (event) {
  3326. return _this3.cycle(event);
  3327. }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
  3328. }
  3329. };
  3330. $(this._element.querySelectorAll(Selector$2.ITEM_IMG)).on(Event$2.DRAG_START, function (e) {
  3331. return e.preventDefault();
  3332. });
  3333. if (this._pointerEvent) {
  3334. $(this._element).on(Event$2.POINTERDOWN, function (event) {
  3335. return start(event);
  3336. });
  3337. $(this._element).on(Event$2.POINTERUP, function (event) {
  3338. return end(event);
  3339. });
  3340. this._element.classList.add(ClassName$2.POINTER_EVENT);
  3341. } else {
  3342. $(this._element).on(Event$2.TOUCHSTART, function (event) {
  3343. return start(event);
  3344. });
  3345. $(this._element).on(Event$2.TOUCHMOVE, function (event) {
  3346. return move(event);
  3347. });
  3348. $(this._element).on(Event$2.TOUCHEND, function (event) {
  3349. return end(event);
  3350. });
  3351. }
  3352. };
  3353. _proto._keydown = function _keydown(event) {
  3354. if (/input|textarea/i.test(event.target.tagName)) {
  3355. return;
  3356. }
  3357. switch (event.which) {
  3358. case ARROW_LEFT_KEYCODE:
  3359. event.preventDefault();
  3360. this.prev();
  3361. break;
  3362. case ARROW_RIGHT_KEYCODE:
  3363. event.preventDefault();
  3364. this.next();
  3365. break;
  3366. }
  3367. };
  3368. _proto._getItemIndex = function _getItemIndex(element) {
  3369. this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector$2.ITEM)) : [];
  3370. return this._items.indexOf(element);
  3371. };
  3372. _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
  3373. var isNextDirection = direction === Direction.NEXT;
  3374. var isPrevDirection = direction === Direction.PREV;
  3375. var activeIndex = this._getItemIndex(activeElement);
  3376. var lastItemIndex = this._items.length - 1;
  3377. var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
  3378. if (isGoingToWrap && !this._config.wrap) {
  3379. return activeElement;
  3380. }
  3381. var delta = direction === Direction.PREV ? -1 : 1;
  3382. var itemIndex = (activeIndex + delta) % this._items.length;
  3383. return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
  3384. };
  3385. _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
  3386. var targetIndex = this._getItemIndex(relatedTarget);
  3387. var fromIndex = this._getItemIndex(this._element.querySelector(Selector$2.ACTIVE_ITEM));
  3388. var slideEvent = $.Event(Event$2.SLIDE, {
  3389. relatedTarget: relatedTarget,
  3390. direction: eventDirectionName,
  3391. from: fromIndex,
  3392. to: targetIndex
  3393. });
  3394. $(this._element).trigger(slideEvent);
  3395. return slideEvent;
  3396. };
  3397. _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
  3398. if (this._indicatorsElement) {
  3399. var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector$2.ACTIVE));
  3400. $(indicators).removeClass(ClassName$2.ACTIVE);
  3401. var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
  3402. if (nextIndicator) {
  3403. $(nextIndicator).addClass(ClassName$2.ACTIVE);
  3404. }
  3405. }
  3406. };
  3407. _proto._slide = function _slide(direction, element) {
  3408. var _this4 = this;
  3409. var activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  3410. var activeElementIndex = this._getItemIndex(activeElement);
  3411. var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
  3412. var nextElementIndex = this._getItemIndex(nextElement);
  3413. var isCycling = Boolean(this._interval);
  3414. var directionalClassName;
  3415. var orderClassName;
  3416. var eventDirectionName;
  3417. if (direction === Direction.NEXT) {
  3418. directionalClassName = ClassName$2.LEFT;
  3419. orderClassName = ClassName$2.NEXT;
  3420. eventDirectionName = Direction.LEFT;
  3421. } else {
  3422. directionalClassName = ClassName$2.RIGHT;
  3423. orderClassName = ClassName$2.PREV;
  3424. eventDirectionName = Direction.RIGHT;
  3425. }
  3426. if (nextElement && $(nextElement).hasClass(ClassName$2.ACTIVE)) {
  3427. this._isSliding = false;
  3428. return;
  3429. }
  3430. var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
  3431. if (slideEvent.isDefaultPrevented()) {
  3432. return;
  3433. }
  3434. if (!activeElement || !nextElement) {
  3435. // Some weirdness is happening, so we bail
  3436. return;
  3437. }
  3438. this._isSliding = true;
  3439. if (isCycling) {
  3440. this.pause();
  3441. }
  3442. this._setActiveIndicatorElement(nextElement);
  3443. var slidEvent = $.Event(Event$2.SLID, {
  3444. relatedTarget: nextElement,
  3445. direction: eventDirectionName,
  3446. from: activeElementIndex,
  3447. to: nextElementIndex
  3448. });
  3449. if ($(this._element).hasClass(ClassName$2.SLIDE)) {
  3450. $(nextElement).addClass(orderClassName);
  3451. Util.reflow(nextElement);
  3452. $(activeElement).addClass(directionalClassName);
  3453. $(nextElement).addClass(directionalClassName);
  3454. var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
  3455. if (nextElementInterval) {
  3456. this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
  3457. this._config.interval = nextElementInterval;
  3458. } else {
  3459. this._config.interval = this._config.defaultInterval || this._config.interval;
  3460. }
  3461. var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
  3462. $(activeElement).one(Util.TRANSITION_END, function () {
  3463. $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName$2.ACTIVE);
  3464. $(activeElement).removeClass(ClassName$2.ACTIVE + " " + orderClassName + " " + directionalClassName);
  3465. _this4._isSliding = false;
  3466. setTimeout(function () {
  3467. return $(_this4._element).trigger(slidEvent);
  3468. }, 0);
  3469. }).emulateTransitionEnd(transitionDuration);
  3470. } else {
  3471. $(activeElement).removeClass(ClassName$2.ACTIVE);
  3472. $(nextElement).addClass(ClassName$2.ACTIVE);
  3473. this._isSliding = false;
  3474. $(this._element).trigger(slidEvent);
  3475. }
  3476. if (isCycling) {
  3477. this.cycle();
  3478. }
  3479. } // Static
  3480. ;
  3481. Carousel._jQueryInterface = function _jQueryInterface(config) {
  3482. return this.each(function () {
  3483. var data = $(this).data(DATA_KEY$2);
  3484. var _config = _objectSpread2({}, Default, {}, $(this).data());
  3485. if (typeof config === 'object') {
  3486. _config = _objectSpread2({}, _config, {}, config);
  3487. }
  3488. var action = typeof config === 'string' ? config : _config.slide;
  3489. if (!data) {
  3490. data = new Carousel(this, _config);
  3491. $(this).data(DATA_KEY$2, data);
  3492. }
  3493. if (typeof config === 'number') {
  3494. data.to(config);
  3495. } else if (typeof action === 'string') {
  3496. if (typeof data[action] === 'undefined') {
  3497. throw new TypeError("No method named \"" + action + "\"");
  3498. }
  3499. data[action]();
  3500. } else if (_config.interval && _config.ride) {
  3501. data.pause();
  3502. data.cycle();
  3503. }
  3504. });
  3505. };
  3506. Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
  3507. var selector = Util.getSelectorFromElement(this);
  3508. if (!selector) {
  3509. return;
  3510. }
  3511. var target = $(selector)[0];
  3512. if (!target || !$(target).hasClass(ClassName$2.CAROUSEL)) {
  3513. return;
  3514. }
  3515. var config = _objectSpread2({}, $(target).data(), {}, $(this).data());
  3516. var slideIndex = this.getAttribute('data-slide-to');
  3517. if (slideIndex) {
  3518. config.interval = false;
  3519. }
  3520. Carousel._jQueryInterface.call($(target), config);
  3521. if (slideIndex) {
  3522. $(target).data(DATA_KEY$2).to(slideIndex);
  3523. }
  3524. event.preventDefault();
  3525. };
  3526. _createClass(Carousel, null, [{
  3527. key: "VERSION",
  3528. get: function get() {
  3529. return VERSION$2;
  3530. }
  3531. }, {
  3532. key: "Default",
  3533. get: function get() {
  3534. return Default;
  3535. }
  3536. }]);
  3537. return Carousel;
  3538. }();
  3539. /**
  3540. * ------------------------------------------------------------------------
  3541. * Data Api implementation
  3542. * ------------------------------------------------------------------------
  3543. */
  3544. $(document).on(Event$2.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel._dataApiClickHandler);
  3545. $(window).on(Event$2.LOAD_DATA_API, function () {
  3546. var carousels = [].slice.call(document.querySelectorAll(Selector$2.DATA_RIDE));
  3547. for (var i = 0, len = carousels.length; i < len; i++) {
  3548. var $carousel = $(carousels[i]);
  3549. Carousel._jQueryInterface.call($carousel, $carousel.data());
  3550. }
  3551. });
  3552. /**
  3553. * ------------------------------------------------------------------------
  3554. * jQuery
  3555. * ------------------------------------------------------------------------
  3556. */
  3557. $.fn[NAME$2] = Carousel._jQueryInterface;
  3558. $.fn[NAME$2].Constructor = Carousel;
  3559. $.fn[NAME$2].noConflict = function () {
  3560. $.fn[NAME$2] = JQUERY_NO_CONFLICT$2;
  3561. return Carousel._jQueryInterface;
  3562. };
  3563. /**
  3564. * ------------------------------------------------------------------------
  3565. * Constants
  3566. * ------------------------------------------------------------------------
  3567. */
  3568. var NAME$3 = 'collapse';
  3569. var VERSION$3 = '4.4.1';
  3570. var DATA_KEY$3 = 'bs.collapse';
  3571. var EVENT_KEY$3 = "." + DATA_KEY$3;
  3572. var DATA_API_KEY$3 = '.data-api';
  3573. var JQUERY_NO_CONFLICT$3 = $.fn[NAME$3];
  3574. var Default$1 = {
  3575. toggle: true,
  3576. parent: ''
  3577. };
  3578. var DefaultType$1 = {
  3579. toggle: 'boolean',
  3580. parent: '(string|element)'
  3581. };
  3582. var Event$3 = {
  3583. SHOW: "show" + EVENT_KEY$3,
  3584. SHOWN: "shown" + EVENT_KEY$3,
  3585. HIDE: "hide" + EVENT_KEY$3,
  3586. HIDDEN: "hidden" + EVENT_KEY$3,
  3587. CLICK_DATA_API: "click" + EVENT_KEY$3 + DATA_API_KEY$3
  3588. };
  3589. var ClassName$3 = {
  3590. SHOW: 'show',
  3591. COLLAPSE: 'collapse',
  3592. COLLAPSING: 'collapsing',
  3593. COLLAPSED: 'collapsed'
  3594. };
  3595. var Dimension = {
  3596. WIDTH: 'width',
  3597. HEIGHT: 'height'
  3598. };
  3599. var Selector$3 = {
  3600. ACTIVES: '.show, .collapsing',
  3601. DATA_TOGGLE: '[data-toggle="collapse"]'
  3602. };
  3603. /**
  3604. * ------------------------------------------------------------------------
  3605. * Class Definition
  3606. * ------------------------------------------------------------------------
  3607. */
  3608. var Collapse =
  3609. /*#__PURE__*/
  3610. function () {
  3611. function Collapse(element, config) {
  3612. this._isTransitioning = false;
  3613. this._element = element;
  3614. this._config = this._getConfig(config);
  3615. this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
  3616. var toggleList = [].slice.call(document.querySelectorAll(Selector$3.DATA_TOGGLE));
  3617. for (var i = 0, len = toggleList.length; i < len; i++) {
  3618. var elem = toggleList[i];
  3619. var selector = Util.getSelectorFromElement(elem);
  3620. var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
  3621. return foundElem === element;
  3622. });
  3623. if (selector !== null && filterElement.length > 0) {
  3624. this._selector = selector;
  3625. this._triggerArray.push(elem);
  3626. }
  3627. }
  3628. this._parent = this._config.parent ? this._getParent() : null;
  3629. if (!this._config.parent) {
  3630. this._addAriaAndCollapsedClass(this._element, this._triggerArray);
  3631. }
  3632. if (this._config.toggle) {
  3633. this.toggle();
  3634. }
  3635. } // Getters
  3636. var _proto = Collapse.prototype;
  3637. // Public
  3638. _proto.toggle = function toggle() {
  3639. if ($(this._element).hasClass(ClassName$3.SHOW)) {
  3640. this.hide();
  3641. } else {
  3642. this.show();
  3643. }
  3644. };
  3645. _proto.show = function show() {
  3646. var _this = this;
  3647. if (this._isTransitioning || $(this._element).hasClass(ClassName$3.SHOW)) {
  3648. return;
  3649. }
  3650. var actives;
  3651. var activesData;
  3652. if (this._parent) {
  3653. actives = [].slice.call(this._parent.querySelectorAll(Selector$3.ACTIVES)).filter(function (elem) {
  3654. if (typeof _this._config.parent === 'string') {
  3655. return elem.getAttribute('data-parent') === _this._config.parent;
  3656. }
  3657. return elem.classList.contains(ClassName$3.COLLAPSE);
  3658. });
  3659. if (actives.length === 0) {
  3660. actives = null;
  3661. }
  3662. }
  3663. if (actives) {
  3664. activesData = $(actives).not(this._selector).data(DATA_KEY$3);
  3665. if (activesData && activesData._isTransitioning) {
  3666. return;
  3667. }
  3668. }
  3669. var startEvent = $.Event(Event$3.SHOW);
  3670. $(this._element).trigger(startEvent);
  3671. if (startEvent.isDefaultPrevented()) {
  3672. return;
  3673. }
  3674. if (actives) {
  3675. Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide');
  3676. if (!activesData) {
  3677. $(actives).data(DATA_KEY$3, null);
  3678. }
  3679. }
  3680. var dimension = this._getDimension();
  3681. $(this._element).removeClass(ClassName$3.COLLAPSE).addClass(ClassName$3.COLLAPSING);
  3682. this._element.style[dimension] = 0;
  3683. if (this._triggerArray.length) {
  3684. $(this._triggerArray).removeClass(ClassName$3.COLLAPSED).attr('aria-expanded', true);
  3685. }
  3686. this.setTransitioning(true);
  3687. var complete = function complete() {
  3688. $(_this._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).addClass(ClassName$3.SHOW);
  3689. _this._element.style[dimension] = '';
  3690. _this.setTransitioning(false);
  3691. $(_this._element).trigger(Event$3.SHOWN);
  3692. };
  3693. var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
  3694. var scrollSize = "scroll" + capitalizedDimension;
  3695. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3696. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3697. this._element.style[dimension] = this._element[scrollSize] + "px";
  3698. };
  3699. _proto.hide = function hide() {
  3700. var _this2 = this;
  3701. if (this._isTransitioning || !$(this._element).hasClass(ClassName$3.SHOW)) {
  3702. return;
  3703. }
  3704. var startEvent = $.Event(Event$3.HIDE);
  3705. $(this._element).trigger(startEvent);
  3706. if (startEvent.isDefaultPrevented()) {
  3707. return;
  3708. }
  3709. var dimension = this._getDimension();
  3710. this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
  3711. Util.reflow(this._element);
  3712. $(this._element).addClass(ClassName$3.COLLAPSING).removeClass(ClassName$3.COLLAPSE).removeClass(ClassName$3.SHOW);
  3713. var triggerArrayLength = this._triggerArray.length;
  3714. if (triggerArrayLength > 0) {
  3715. for (var i = 0; i < triggerArrayLength; i++) {
  3716. var trigger = this._triggerArray[i];
  3717. var selector = Util.getSelectorFromElement(trigger);
  3718. if (selector !== null) {
  3719. var $elem = $([].slice.call(document.querySelectorAll(selector)));
  3720. if (!$elem.hasClass(ClassName$3.SHOW)) {
  3721. $(trigger).addClass(ClassName$3.COLLAPSED).attr('aria-expanded', false);
  3722. }
  3723. }
  3724. }
  3725. }
  3726. this.setTransitioning(true);
  3727. var complete = function complete() {
  3728. _this2.setTransitioning(false);
  3729. $(_this2._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).trigger(Event$3.HIDDEN);
  3730. };
  3731. this._element.style[dimension] = '';
  3732. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3733. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3734. };
  3735. _proto.setTransitioning = function setTransitioning(isTransitioning) {
  3736. this._isTransitioning = isTransitioning;
  3737. };
  3738. _proto.dispose = function dispose() {
  3739. $.removeData(this._element, DATA_KEY$3);
  3740. this._config = null;
  3741. this._parent = null;
  3742. this._element = null;
  3743. this._triggerArray = null;
  3744. this._isTransitioning = null;
  3745. } // Private
  3746. ;
  3747. _proto._getConfig = function _getConfig(config) {
  3748. config = _objectSpread2({}, Default$1, {}, config);
  3749. config.toggle = Boolean(config.toggle); // Coerce string values
  3750. Util.typeCheckConfig(NAME$3, config, DefaultType$1);
  3751. return config;
  3752. };
  3753. _proto._getDimension = function _getDimension() {
  3754. var hasWidth = $(this._element).hasClass(Dimension.WIDTH);
  3755. return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
  3756. };
  3757. _proto._getParent = function _getParent() {
  3758. var _this3 = this;
  3759. var parent;
  3760. if (Util.isElement(this._config.parent)) {
  3761. parent = this._config.parent; // It's a jQuery object
  3762. if (typeof this._config.parent.jquery !== 'undefined') {
  3763. parent = this._config.parent[0];
  3764. }
  3765. } else {
  3766. parent = document.querySelector(this._config.parent);
  3767. }
  3768. var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
  3769. var children = [].slice.call(parent.querySelectorAll(selector));
  3770. $(children).each(function (i, element) {
  3771. _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
  3772. });
  3773. return parent;
  3774. };
  3775. _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
  3776. var isOpen = $(element).hasClass(ClassName$3.SHOW);
  3777. if (triggerArray.length) {
  3778. $(triggerArray).toggleClass(ClassName$3.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
  3779. }
  3780. } // Static
  3781. ;
  3782. Collapse._getTargetFromElement = function _getTargetFromElement(element) {
  3783. var selector = Util.getSelectorFromElement(element);
  3784. return selector ? document.querySelector(selector) : null;
  3785. };
  3786. Collapse._jQueryInterface = function _jQueryInterface(config) {
  3787. return this.each(function () {
  3788. var $this = $(this);
  3789. var data = $this.data(DATA_KEY$3);
  3790. var _config = _objectSpread2({}, Default$1, {}, $this.data(), {}, typeof config === 'object' && config ? config : {});
  3791. if (!data && _config.toggle && /show|hide/.test(config)) {
  3792. _config.toggle = false;
  3793. }
  3794. if (!data) {
  3795. data = new Collapse(this, _config);
  3796. $this.data(DATA_KEY$3, data);
  3797. }
  3798. if (typeof config === 'string') {
  3799. if (typeof data[config] === 'undefined') {
  3800. throw new TypeError("No method named \"" + config + "\"");
  3801. }
  3802. data[config]();
  3803. }
  3804. });
  3805. };
  3806. _createClass(Collapse, null, [{
  3807. key: "VERSION",
  3808. get: function get() {
  3809. return VERSION$3;
  3810. }
  3811. }, {
  3812. key: "Default",
  3813. get: function get() {
  3814. return Default$1;
  3815. }
  3816. }]);
  3817. return Collapse;
  3818. }();
  3819. /**
  3820. * ------------------------------------------------------------------------
  3821. * Data Api implementation
  3822. * ------------------------------------------------------------------------
  3823. */
  3824. $(document).on(Event$3.CLICK_DATA_API, Selector$3.DATA_TOGGLE, function (event) {
  3825. // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
  3826. if (event.currentTarget.tagName === 'A') {
  3827. event.preventDefault();
  3828. }
  3829. var $trigger = $(this);
  3830. var selector = Util.getSelectorFromElement(this);
  3831. var selectors = [].slice.call(document.querySelectorAll(selector));
  3832. $(selectors).each(function () {
  3833. var $target = $(this);
  3834. var data = $target.data(DATA_KEY$3);
  3835. var config = data ? 'toggle' : $trigger.data();
  3836. Collapse._jQueryInterface.call($target, config);
  3837. });
  3838. });
  3839. /**
  3840. * ------------------------------------------------------------------------
  3841. * jQuery
  3842. * ------------------------------------------------------------------------
  3843. */
  3844. $.fn[NAME$3] = Collapse._jQueryInterface;
  3845. $.fn[NAME$3].Constructor = Collapse;
  3846. $.fn[NAME$3].noConflict = function () {
  3847. $.fn[NAME$3] = JQUERY_NO_CONFLICT$3;
  3848. return Collapse._jQueryInterface;
  3849. };
  3850. /**
  3851. * ------------------------------------------------------------------------
  3852. * Constants
  3853. * ------------------------------------------------------------------------
  3854. */
  3855. var NAME$4 = 'dropdown';
  3856. var VERSION$4 = '4.4.1';
  3857. var DATA_KEY$4 = 'bs.dropdown';
  3858. var EVENT_KEY$4 = "." + DATA_KEY$4;
  3859. var DATA_API_KEY$4 = '.data-api';
  3860. var JQUERY_NO_CONFLICT$4 = $.fn[NAME$4];
  3861. var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
  3862. var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
  3863. var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
  3864. var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
  3865. var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
  3866. var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
  3867. var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
  3868. var Event$4 = {
  3869. HIDE: "hide" + EVENT_KEY$4,
  3870. HIDDEN: "hidden" + EVENT_KEY$4,
  3871. SHOW: "show" + EVENT_KEY$4,
  3872. SHOWN: "shown" + EVENT_KEY$4,
  3873. CLICK: "click" + EVENT_KEY$4,
  3874. CLICK_DATA_API: "click" + EVENT_KEY$4 + DATA_API_KEY$4,
  3875. KEYDOWN_DATA_API: "keydown" + EVENT_KEY$4 + DATA_API_KEY$4,
  3876. KEYUP_DATA_API: "keyup" + EVENT_KEY$4 + DATA_API_KEY$4
  3877. };
  3878. var ClassName$4 = {
  3879. DISABLED: 'disabled',
  3880. SHOW: 'show',
  3881. DROPUP: 'dropup',
  3882. DROPRIGHT: 'dropright',
  3883. DROPLEFT: 'dropleft',
  3884. MENURIGHT: 'dropdown-menu-right',
  3885. MENULEFT: 'dropdown-menu-left',
  3886. POSITION_STATIC: 'position-static'
  3887. };
  3888. var Selector$4 = {
  3889. DATA_TOGGLE: '[data-toggle="dropdown"]',
  3890. FORM_CHILD: '.dropdown form',
  3891. MENU: '.dropdown-menu',
  3892. NAVBAR_NAV: '.navbar-nav',
  3893. VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'
  3894. };
  3895. var AttachmentMap = {
  3896. TOP: 'top-start',
  3897. TOPEND: 'top-end',
  3898. BOTTOM: 'bottom-start',
  3899. BOTTOMEND: 'bottom-end',
  3900. RIGHT: 'right-start',
  3901. RIGHTEND: 'right-end',
  3902. LEFT: 'left-start',
  3903. LEFTEND: 'left-end'
  3904. };
  3905. var Default$2 = {
  3906. offset: 0,
  3907. flip: true,
  3908. boundary: 'scrollParent',
  3909. reference: 'toggle',
  3910. display: 'dynamic',
  3911. popperConfig: null
  3912. };
  3913. var DefaultType$2 = {
  3914. offset: '(number|string|function)',
  3915. flip: 'boolean',
  3916. boundary: '(string|element)',
  3917. reference: '(string|element)',
  3918. display: 'string',
  3919. popperConfig: '(null|object)'
  3920. };
  3921. /**
  3922. * ------------------------------------------------------------------------
  3923. * Class Definition
  3924. * ------------------------------------------------------------------------
  3925. */
  3926. var Dropdown =
  3927. /*#__PURE__*/
  3928. function () {
  3929. function Dropdown(element, config) {
  3930. this._element = element;
  3931. this._popper = null;
  3932. this._config = this._getConfig(config);
  3933. this._menu = this._getMenuElement();
  3934. this._inNavbar = this._detectNavbar();
  3935. this._addEventListeners();
  3936. } // Getters
  3937. var _proto = Dropdown.prototype;
  3938. // Public
  3939. _proto.toggle = function toggle() {
  3940. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED)) {
  3941. return;
  3942. }
  3943. var isActive = $(this._menu).hasClass(ClassName$4.SHOW);
  3944. Dropdown._clearMenus();
  3945. if (isActive) {
  3946. return;
  3947. }
  3948. this.show(true);
  3949. };
  3950. _proto.show = function show(usePopper) {
  3951. if (usePopper === void 0) {
  3952. usePopper = false;
  3953. }
  3954. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || $(this._menu).hasClass(ClassName$4.SHOW)) {
  3955. return;
  3956. }
  3957. var relatedTarget = {
  3958. relatedTarget: this._element
  3959. };
  3960. var showEvent = $.Event(Event$4.SHOW, relatedTarget);
  3961. var parent = Dropdown._getParentFromElement(this._element);
  3962. $(parent).trigger(showEvent);
  3963. if (showEvent.isDefaultPrevented()) {
  3964. return;
  3965. } // Disable totally Popper.js for Dropdown in Navbar
  3966. if (!this._inNavbar && usePopper) {
  3967. /**
  3968. * Check for Popper dependency
  3969. * Popper - https://popper.js.org
  3970. */
  3971. if (typeof Popper === 'undefined') {
  3972. throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)');
  3973. }
  3974. var referenceElement = this._element;
  3975. if (this._config.reference === 'parent') {
  3976. referenceElement = parent;
  3977. } else if (Util.isElement(this._config.reference)) {
  3978. referenceElement = this._config.reference; // Check if it's jQuery element
  3979. if (typeof this._config.reference.jquery !== 'undefined') {
  3980. referenceElement = this._config.reference[0];
  3981. }
  3982. } // If boundary is not `scrollParent`, then set position to `static`
  3983. // to allow the menu to "escape" the scroll parent's boundaries
  3984. // https://github.com/twbs/bootstrap/issues/24251
  3985. if (this._config.boundary !== 'scrollParent') {
  3986. $(parent).addClass(ClassName$4.POSITION_STATIC);
  3987. }
  3988. this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
  3989. } // If this is a touch-enabled device we add extra
  3990. // empty mouseover listeners to the body's immediate children;
  3991. // only needed because of broken event delegation on iOS
  3992. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  3993. if ('ontouchstart' in document.documentElement && $(parent).closest(Selector$4.NAVBAR_NAV).length === 0) {
  3994. $(document.body).children().on('mouseover', null, $.noop);
  3995. }
  3996. this._element.focus();
  3997. this._element.setAttribute('aria-expanded', true);
  3998. $(this._menu).toggleClass(ClassName$4.SHOW);
  3999. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget));
  4000. };
  4001. _proto.hide = function hide() {
  4002. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || !$(this._menu).hasClass(ClassName$4.SHOW)) {
  4003. return;
  4004. }
  4005. var relatedTarget = {
  4006. relatedTarget: this._element
  4007. };
  4008. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  4009. var parent = Dropdown._getParentFromElement(this._element);
  4010. $(parent).trigger(hideEvent);
  4011. if (hideEvent.isDefaultPrevented()) {
  4012. return;
  4013. }
  4014. if (this._popper) {
  4015. this._popper.destroy();
  4016. }
  4017. $(this._menu).toggleClass(ClassName$4.SHOW);
  4018. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  4019. };
  4020. _proto.dispose = function dispose() {
  4021. $.removeData(this._element, DATA_KEY$4);
  4022. $(this._element).off(EVENT_KEY$4);
  4023. this._element = null;
  4024. this._menu = null;
  4025. if (this._popper !== null) {
  4026. this._popper.destroy();
  4027. this._popper = null;
  4028. }
  4029. };
  4030. _proto.update = function update() {
  4031. this._inNavbar = this._detectNavbar();
  4032. if (this._popper !== null) {
  4033. this._popper.scheduleUpdate();
  4034. }
  4035. } // Private
  4036. ;
  4037. _proto._addEventListeners = function _addEventListeners() {
  4038. var _this = this;
  4039. $(this._element).on(Event$4.CLICK, function (event) {
  4040. event.preventDefault();
  4041. event.stopPropagation();
  4042. _this.toggle();
  4043. });
  4044. };
  4045. _proto._getConfig = function _getConfig(config) {
  4046. config = _objectSpread2({}, this.constructor.Default, {}, $(this._element).data(), {}, config);
  4047. Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
  4048. return config;
  4049. };
  4050. _proto._getMenuElement = function _getMenuElement() {
  4051. if (!this._menu) {
  4052. var parent = Dropdown._getParentFromElement(this._element);
  4053. if (parent) {
  4054. this._menu = parent.querySelector(Selector$4.MENU);
  4055. }
  4056. }
  4057. return this._menu;
  4058. };
  4059. _proto._getPlacement = function _getPlacement() {
  4060. var $parentDropdown = $(this._element.parentNode);
  4061. var placement = AttachmentMap.BOTTOM; // Handle dropup
  4062. if ($parentDropdown.hasClass(ClassName$4.DROPUP)) {
  4063. placement = AttachmentMap.TOP;
  4064. if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  4065. placement = AttachmentMap.TOPEND;
  4066. }
  4067. } else if ($parentDropdown.hasClass(ClassName$4.DROPRIGHT)) {
  4068. placement = AttachmentMap.RIGHT;
  4069. } else if ($parentDropdown.hasClass(ClassName$4.DROPLEFT)) {
  4070. placement = AttachmentMap.LEFT;
  4071. } else if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  4072. placement = AttachmentMap.BOTTOMEND;
  4073. }
  4074. return placement;
  4075. };
  4076. _proto._detectNavbar = function _detectNavbar() {
  4077. return $(this._element).closest('.navbar').length > 0;
  4078. };
  4079. _proto._getOffset = function _getOffset() {
  4080. var _this2 = this;
  4081. var offset = {};
  4082. if (typeof this._config.offset === 'function') {
  4083. offset.fn = function (data) {
  4084. data.offsets = _objectSpread2({}, data.offsets, {}, _this2._config.offset(data.offsets, _this2._element) || {});
  4085. return data;
  4086. };
  4087. } else {
  4088. offset.offset = this._config.offset;
  4089. }
  4090. return offset;
  4091. };
  4092. _proto._getPopperConfig = function _getPopperConfig() {
  4093. var popperConfig = {
  4094. placement: this._getPlacement(),
  4095. modifiers: {
  4096. offset: this._getOffset(),
  4097. flip: {
  4098. enabled: this._config.flip
  4099. },
  4100. preventOverflow: {
  4101. boundariesElement: this._config.boundary
  4102. }
  4103. }
  4104. }; // Disable Popper.js if we have a static display
  4105. if (this._config.display === 'static') {
  4106. popperConfig.modifiers.applyStyle = {
  4107. enabled: false
  4108. };
  4109. }
  4110. return _objectSpread2({}, popperConfig, {}, this._config.popperConfig);
  4111. } // Static
  4112. ;
  4113. Dropdown._jQueryInterface = function _jQueryInterface(config) {
  4114. return this.each(function () {
  4115. var data = $(this).data(DATA_KEY$4);
  4116. var _config = typeof config === 'object' ? config : null;
  4117. if (!data) {
  4118. data = new Dropdown(this, _config);
  4119. $(this).data(DATA_KEY$4, data);
  4120. }
  4121. if (typeof config === 'string') {
  4122. if (typeof data[config] === 'undefined') {
  4123. throw new TypeError("No method named \"" + config + "\"");
  4124. }
  4125. data[config]();
  4126. }
  4127. });
  4128. };
  4129. Dropdown._clearMenus = function _clearMenus(event) {
  4130. if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
  4131. return;
  4132. }
  4133. var toggles = [].slice.call(document.querySelectorAll(Selector$4.DATA_TOGGLE));
  4134. for (var i = 0, len = toggles.length; i < len; i++) {
  4135. var parent = Dropdown._getParentFromElement(toggles[i]);
  4136. var context = $(toggles[i]).data(DATA_KEY$4);
  4137. var relatedTarget = {
  4138. relatedTarget: toggles[i]
  4139. };
  4140. if (event && event.type === 'click') {
  4141. relatedTarget.clickEvent = event;
  4142. }
  4143. if (!context) {
  4144. continue;
  4145. }
  4146. var dropdownMenu = context._menu;
  4147. if (!$(parent).hasClass(ClassName$4.SHOW)) {
  4148. continue;
  4149. }
  4150. if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) {
  4151. continue;
  4152. }
  4153. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  4154. $(parent).trigger(hideEvent);
  4155. if (hideEvent.isDefaultPrevented()) {
  4156. continue;
  4157. } // If this is a touch-enabled device we remove the extra
  4158. // empty mouseover listeners we added for iOS support
  4159. if ('ontouchstart' in document.documentElement) {
  4160. $(document.body).children().off('mouseover', null, $.noop);
  4161. }
  4162. toggles[i].setAttribute('aria-expanded', 'false');
  4163. if (context._popper) {
  4164. context._popper.destroy();
  4165. }
  4166. $(dropdownMenu).removeClass(ClassName$4.SHOW);
  4167. $(parent).removeClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  4168. }
  4169. };
  4170. Dropdown._getParentFromElement = function _getParentFromElement(element) {
  4171. var parent;
  4172. var selector = Util.getSelectorFromElement(element);
  4173. if (selector) {
  4174. parent = document.querySelector(selector);
  4175. }
  4176. return parent || element.parentNode;
  4177. } // eslint-disable-next-line complexity
  4178. ;
  4179. Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
  4180. // If not input/textarea:
  4181. // - And not a key in REGEXP_KEYDOWN => not a dropdown command
  4182. // If input/textarea:
  4183. // - If space key => not a dropdown command
  4184. // - If key is other than escape
  4185. // - If key is not up or down => not a dropdown command
  4186. // - If trigger inside the menu => not a dropdown command
  4187. 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)) {
  4188. return;
  4189. }
  4190. event.preventDefault();
  4191. event.stopPropagation();
  4192. if (this.disabled || $(this).hasClass(ClassName$4.DISABLED)) {
  4193. return;
  4194. }
  4195. var parent = Dropdown._getParentFromElement(this);
  4196. var isActive = $(parent).hasClass(ClassName$4.SHOW);
  4197. if (!isActive && event.which === ESCAPE_KEYCODE) {
  4198. return;
  4199. }
  4200. if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
  4201. if (event.which === ESCAPE_KEYCODE) {
  4202. var toggle = parent.querySelector(Selector$4.DATA_TOGGLE);
  4203. $(toggle).trigger('focus');
  4204. }
  4205. $(this).trigger('click');
  4206. return;
  4207. }
  4208. var items = [].slice.call(parent.querySelectorAll(Selector$4.VISIBLE_ITEMS)).filter(function (item) {
  4209. return $(item).is(':visible');
  4210. });
  4211. if (items.length === 0) {
  4212. return;
  4213. }
  4214. var index = items.indexOf(event.target);
  4215. if (event.which === ARROW_UP_KEYCODE && index > 0) {
  4216. // Up
  4217. index--;
  4218. }
  4219. if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
  4220. // Down
  4221. index++;
  4222. }
  4223. if (index < 0) {
  4224. index = 0;
  4225. }
  4226. items[index].focus();
  4227. };
  4228. _createClass(Dropdown, null, [{
  4229. key: "VERSION",
  4230. get: function get() {
  4231. return VERSION$4;
  4232. }
  4233. }, {
  4234. key: "Default",
  4235. get: function get() {
  4236. return Default$2;
  4237. }
  4238. }, {
  4239. key: "DefaultType",
  4240. get: function get() {
  4241. return DefaultType$2;
  4242. }
  4243. }]);
  4244. return Dropdown;
  4245. }();
  4246. /**
  4247. * ------------------------------------------------------------------------
  4248. * Data Api implementation
  4249. * ------------------------------------------------------------------------
  4250. */
  4251. $(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) {
  4252. event.preventDefault();
  4253. event.stopPropagation();
  4254. Dropdown._jQueryInterface.call($(this), 'toggle');
  4255. }).on(Event$4.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) {
  4256. e.stopPropagation();
  4257. });
  4258. /**
  4259. * ------------------------------------------------------------------------
  4260. * jQuery
  4261. * ------------------------------------------------------------------------
  4262. */
  4263. $.fn[NAME$4] = Dropdown._jQueryInterface;
  4264. $.fn[NAME$4].Constructor = Dropdown;
  4265. $.fn[NAME$4].noConflict = function () {
  4266. $.fn[NAME$4] = JQUERY_NO_CONFLICT$4;
  4267. return Dropdown._jQueryInterface;
  4268. };
  4269. /**
  4270. * ------------------------------------------------------------------------
  4271. * Constants
  4272. * ------------------------------------------------------------------------
  4273. */
  4274. var NAME$5 = 'modal';
  4275. var VERSION$5 = '4.4.1';
  4276. var DATA_KEY$5 = 'bs.modal';
  4277. var EVENT_KEY$5 = "." + DATA_KEY$5;
  4278. var DATA_API_KEY$5 = '.data-api';
  4279. var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5];
  4280. var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key
  4281. var Default$3 = {
  4282. backdrop: true,
  4283. keyboard: true,
  4284. focus: true,
  4285. show: true
  4286. };
  4287. var DefaultType$3 = {
  4288. backdrop: '(boolean|string)',
  4289. keyboard: 'boolean',
  4290. focus: 'boolean',
  4291. show: 'boolean'
  4292. };
  4293. var Event$5 = {
  4294. HIDE: "hide" + EVENT_KEY$5,
  4295. HIDE_PREVENTED: "hidePrevented" + EVENT_KEY$5,
  4296. HIDDEN: "hidden" + EVENT_KEY$5,
  4297. SHOW: "show" + EVENT_KEY$5,
  4298. SHOWN: "shown" + EVENT_KEY$5,
  4299. FOCUSIN: "focusin" + EVENT_KEY$5,
  4300. RESIZE: "resize" + EVENT_KEY$5,
  4301. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$5,
  4302. KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY$5,
  4303. MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY$5,
  4304. MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY$5,
  4305. CLICK_DATA_API: "click" + EVENT_KEY$5 + DATA_API_KEY$5
  4306. };
  4307. var ClassName$5 = {
  4308. SCROLLABLE: 'modal-dialog-scrollable',
  4309. SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
  4310. BACKDROP: 'modal-backdrop',
  4311. OPEN: 'modal-open',
  4312. FADE: 'fade',
  4313. SHOW: 'show',
  4314. STATIC: 'modal-static'
  4315. };
  4316. var Selector$5 = {
  4317. DIALOG: '.modal-dialog',
  4318. MODAL_BODY: '.modal-body',
  4319. DATA_TOGGLE: '[data-toggle="modal"]',
  4320. DATA_DISMISS: '[data-dismiss="modal"]',
  4321. FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
  4322. STICKY_CONTENT: '.sticky-top'
  4323. };
  4324. /**
  4325. * ------------------------------------------------------------------------
  4326. * Class Definition
  4327. * ------------------------------------------------------------------------
  4328. */
  4329. var Modal =
  4330. /*#__PURE__*/
  4331. function () {
  4332. function Modal(element, config) {
  4333. this._config = this._getConfig(config);
  4334. this._element = element;
  4335. this._dialog = element.querySelector(Selector$5.DIALOG);
  4336. this._backdrop = null;
  4337. this._isShown = false;
  4338. this._isBodyOverflowing = false;
  4339. this._ignoreBackdropClick = false;
  4340. this._isTransitioning = false;
  4341. this._scrollbarWidth = 0;
  4342. } // Getters
  4343. var _proto = Modal.prototype;
  4344. // Public
  4345. _proto.toggle = function toggle(relatedTarget) {
  4346. return this._isShown ? this.hide() : this.show(relatedTarget);
  4347. };
  4348. _proto.show = function show(relatedTarget) {
  4349. var _this = this;
  4350. if (this._isShown || this._isTransitioning) {
  4351. return;
  4352. }
  4353. if ($(this._element).hasClass(ClassName$5.FADE)) {
  4354. this._isTransitioning = true;
  4355. }
  4356. var showEvent = $.Event(Event$5.SHOW, {
  4357. relatedTarget: relatedTarget
  4358. });
  4359. $(this._element).trigger(showEvent);
  4360. if (this._isShown || showEvent.isDefaultPrevented()) {
  4361. return;
  4362. }
  4363. this._isShown = true;
  4364. this._checkScrollbar();
  4365. this._setScrollbar();
  4366. this._adjustDialog();
  4367. this._setEscapeEvent();
  4368. this._setResizeEvent();
  4369. $(this._element).on(Event$5.CLICK_DISMISS, Selector$5.DATA_DISMISS, function (event) {
  4370. return _this.hide(event);
  4371. });
  4372. $(this._dialog).on(Event$5.MOUSEDOWN_DISMISS, function () {
  4373. $(_this._element).one(Event$5.MOUSEUP_DISMISS, function (event) {
  4374. if ($(event.target).is(_this._element)) {
  4375. _this._ignoreBackdropClick = true;
  4376. }
  4377. });
  4378. });
  4379. this._showBackdrop(function () {
  4380. return _this._showElement(relatedTarget);
  4381. });
  4382. };
  4383. _proto.hide = function hide(event) {
  4384. var _this2 = this;
  4385. if (event) {
  4386. event.preventDefault();
  4387. }
  4388. if (!this._isShown || this._isTransitioning) {
  4389. return;
  4390. }
  4391. var hideEvent = $.Event(Event$5.HIDE);
  4392. $(this._element).trigger(hideEvent);
  4393. if (!this._isShown || hideEvent.isDefaultPrevented()) {
  4394. return;
  4395. }
  4396. this._isShown = false;
  4397. var transition = $(this._element).hasClass(ClassName$5.FADE);
  4398. if (transition) {
  4399. this._isTransitioning = true;
  4400. }
  4401. this._setEscapeEvent();
  4402. this._setResizeEvent();
  4403. $(document).off(Event$5.FOCUSIN);
  4404. $(this._element).removeClass(ClassName$5.SHOW);
  4405. $(this._element).off(Event$5.CLICK_DISMISS);
  4406. $(this._dialog).off(Event$5.MOUSEDOWN_DISMISS);
  4407. if (transition) {
  4408. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  4409. $(this._element).one(Util.TRANSITION_END, function (event) {
  4410. return _this2._hideModal(event);
  4411. }).emulateTransitionEnd(transitionDuration);
  4412. } else {
  4413. this._hideModal();
  4414. }
  4415. };
  4416. _proto.dispose = function dispose() {
  4417. [window, this._element, this._dialog].forEach(function (htmlElement) {
  4418. return $(htmlElement).off(EVENT_KEY$5);
  4419. });
  4420. /**
  4421. * `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API`
  4422. * Do not move `document` in `htmlElements` array
  4423. * It will remove `Event.CLICK_DATA_API` event that should remain
  4424. */
  4425. $(document).off(Event$5.FOCUSIN);
  4426. $.removeData(this._element, DATA_KEY$5);
  4427. this._config = null;
  4428. this._element = null;
  4429. this._dialog = null;
  4430. this._backdrop = null;
  4431. this._isShown = null;
  4432. this._isBodyOverflowing = null;
  4433. this._ignoreBackdropClick = null;
  4434. this._isTransitioning = null;
  4435. this._scrollbarWidth = null;
  4436. };
  4437. _proto.handleUpdate = function handleUpdate() {
  4438. this._adjustDialog();
  4439. } // Private
  4440. ;
  4441. _proto._getConfig = function _getConfig(config) {
  4442. config = _objectSpread2({}, Default$3, {}, config);
  4443. Util.typeCheckConfig(NAME$5, config, DefaultType$3);
  4444. return config;
  4445. };
  4446. _proto._triggerBackdropTransition = function _triggerBackdropTransition() {
  4447. var _this3 = this;
  4448. if (this._config.backdrop === 'static') {
  4449. var hideEventPrevented = $.Event(Event$5.HIDE_PREVENTED);
  4450. $(this._element).trigger(hideEventPrevented);
  4451. if (hideEventPrevented.defaultPrevented) {
  4452. return;
  4453. }
  4454. this._element.classList.add(ClassName$5.STATIC);
  4455. var modalTransitionDuration = Util.getTransitionDurationFromElement(this._element);
  4456. $(this._element).one(Util.TRANSITION_END, function () {
  4457. _this3._element.classList.remove(ClassName$5.STATIC);
  4458. }).emulateTransitionEnd(modalTransitionDuration);
  4459. this._element.focus();
  4460. } else {
  4461. this.hide();
  4462. }
  4463. };
  4464. _proto._showElement = function _showElement(relatedTarget) {
  4465. var _this4 = this;
  4466. var transition = $(this._element).hasClass(ClassName$5.FADE);
  4467. var modalBody = this._dialog ? this._dialog.querySelector(Selector$5.MODAL_BODY) : null;
  4468. if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
  4469. // Don't move modal's DOM position
  4470. document.body.appendChild(this._element);
  4471. }
  4472. this._element.style.display = 'block';
  4473. this._element.removeAttribute('aria-hidden');
  4474. this._element.setAttribute('aria-modal', true);
  4475. if ($(this._dialog).hasClass(ClassName$5.SCROLLABLE) && modalBody) {
  4476. modalBody.scrollTop = 0;
  4477. } else {
  4478. this._element.scrollTop = 0;
  4479. }
  4480. if (transition) {
  4481. Util.reflow(this._element);
  4482. }
  4483. $(this._element).addClass(ClassName$5.SHOW);
  4484. if (this._config.focus) {
  4485. this._enforceFocus();
  4486. }
  4487. var shownEvent = $.Event(Event$5.SHOWN, {
  4488. relatedTarget: relatedTarget
  4489. });
  4490. var transitionComplete = function transitionComplete() {
  4491. if (_this4._config.focus) {
  4492. _this4._element.focus();
  4493. }
  4494. _this4._isTransitioning = false;
  4495. $(_this4._element).trigger(shownEvent);
  4496. };
  4497. if (transition) {
  4498. var transitionDuration = Util.getTransitionDurationFromElement(this._dialog);
  4499. $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration);
  4500. } else {
  4501. transitionComplete();
  4502. }
  4503. };
  4504. _proto._enforceFocus = function _enforceFocus() {
  4505. var _this5 = this;
  4506. $(document).off(Event$5.FOCUSIN) // Guard against infinite focus loop
  4507. .on(Event$5.FOCUSIN, function (event) {
  4508. if (document !== event.target && _this5._element !== event.target && $(_this5._element).has(event.target).length === 0) {
  4509. _this5._element.focus();
  4510. }
  4511. });
  4512. };
  4513. _proto._setEscapeEvent = function _setEscapeEvent() {
  4514. var _this6 = this;
  4515. if (this._isShown && this._config.keyboard) {
  4516. $(this._element).on(Event$5.KEYDOWN_DISMISS, function (event) {
  4517. if (event.which === ESCAPE_KEYCODE$1) {
  4518. _this6._triggerBackdropTransition();
  4519. }
  4520. });
  4521. } else if (!this._isShown) {
  4522. $(this._element).off(Event$5.KEYDOWN_DISMISS);
  4523. }
  4524. };
  4525. _proto._setResizeEvent = function _setResizeEvent() {
  4526. var _this7 = this;
  4527. if (this._isShown) {
  4528. $(window).on(Event$5.RESIZE, function (event) {
  4529. return _this7.handleUpdate(event);
  4530. });
  4531. } else {
  4532. $(window).off(Event$5.RESIZE);
  4533. }
  4534. };
  4535. _proto._hideModal = function _hideModal() {
  4536. var _this8 = this;
  4537. this._element.style.display = 'none';
  4538. this._element.setAttribute('aria-hidden', true);
  4539. this._element.removeAttribute('aria-modal');
  4540. this._isTransitioning = false;
  4541. this._showBackdrop(function () {
  4542. $(document.body).removeClass(ClassName$5.OPEN);
  4543. _this8._resetAdjustments();
  4544. _this8._resetScrollbar();
  4545. $(_this8._element).trigger(Event$5.HIDDEN);
  4546. });
  4547. };
  4548. _proto._removeBackdrop = function _removeBackdrop() {
  4549. if (this._backdrop) {
  4550. $(this._backdrop).remove();
  4551. this._backdrop = null;
  4552. }
  4553. };
  4554. _proto._showBackdrop = function _showBackdrop(callback) {
  4555. var _this9 = this;
  4556. var animate = $(this._element).hasClass(ClassName$5.FADE) ? ClassName$5.FADE : '';
  4557. if (this._isShown && this._config.backdrop) {
  4558. this._backdrop = document.createElement('div');
  4559. this._backdrop.className = ClassName$5.BACKDROP;
  4560. if (animate) {
  4561. this._backdrop.classList.add(animate);
  4562. }
  4563. $(this._backdrop).appendTo(document.body);
  4564. $(this._element).on(Event$5.CLICK_DISMISS, function (event) {
  4565. if (_this9._ignoreBackdropClick) {
  4566. _this9._ignoreBackdropClick = false;
  4567. return;
  4568. }
  4569. if (event.target !== event.currentTarget) {
  4570. return;
  4571. }
  4572. _this9._triggerBackdropTransition();
  4573. });
  4574. if (animate) {
  4575. Util.reflow(this._backdrop);
  4576. }
  4577. $(this._backdrop).addClass(ClassName$5.SHOW);
  4578. if (!callback) {
  4579. return;
  4580. }
  4581. if (!animate) {
  4582. callback();
  4583. return;
  4584. }
  4585. var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4586. $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration);
  4587. } else if (!this._isShown && this._backdrop) {
  4588. $(this._backdrop).removeClass(ClassName$5.SHOW);
  4589. var callbackRemove = function callbackRemove() {
  4590. _this9._removeBackdrop();
  4591. if (callback) {
  4592. callback();
  4593. }
  4594. };
  4595. if ($(this._element).hasClass(ClassName$5.FADE)) {
  4596. var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4597. $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration);
  4598. } else {
  4599. callbackRemove();
  4600. }
  4601. } else if (callback) {
  4602. callback();
  4603. }
  4604. } // ----------------------------------------------------------------------
  4605. // the following methods are used to handle overflowing modals
  4606. // todo (fat): these should probably be refactored out of modal.js
  4607. // ----------------------------------------------------------------------
  4608. ;
  4609. _proto._adjustDialog = function _adjustDialog() {
  4610. var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  4611. if (!this._isBodyOverflowing && isModalOverflowing) {
  4612. this._element.style.paddingLeft = this._scrollbarWidth + "px";
  4613. }
  4614. if (this._isBodyOverflowing && !isModalOverflowing) {
  4615. this._element.style.paddingRight = this._scrollbarWidth + "px";
  4616. }
  4617. };
  4618. _proto._resetAdjustments = function _resetAdjustments() {
  4619. this._element.style.paddingLeft = '';
  4620. this._element.style.paddingRight = '';
  4621. };
  4622. _proto._checkScrollbar = function _checkScrollbar() {
  4623. var rect = document.body.getBoundingClientRect();
  4624. this._isBodyOverflowing = rect.left + rect.right < window.innerWidth;
  4625. this._scrollbarWidth = this._getScrollbarWidth();
  4626. };
  4627. _proto._setScrollbar = function _setScrollbar() {
  4628. var _this10 = this;
  4629. if (this._isBodyOverflowing) {
  4630. // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
  4631. // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
  4632. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4633. var stickyContent = [].slice.call(document.querySelectorAll(Selector$5.STICKY_CONTENT)); // Adjust fixed content padding
  4634. $(fixedContent).each(function (index, element) {
  4635. var actualPadding = element.style.paddingRight;
  4636. var calculatedPadding = $(element).css('padding-right');
  4637. $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px");
  4638. }); // Adjust sticky content margin
  4639. $(stickyContent).each(function (index, element) {
  4640. var actualMargin = element.style.marginRight;
  4641. var calculatedMargin = $(element).css('margin-right');
  4642. $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px");
  4643. }); // Adjust body padding
  4644. var actualPadding = document.body.style.paddingRight;
  4645. var calculatedPadding = $(document.body).css('padding-right');
  4646. $(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px");
  4647. }
  4648. $(document.body).addClass(ClassName$5.OPEN);
  4649. };
  4650. _proto._resetScrollbar = function _resetScrollbar() {
  4651. // Restore fixed content padding
  4652. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4653. $(fixedContent).each(function (index, element) {
  4654. var padding = $(element).data('padding-right');
  4655. $(element).removeData('padding-right');
  4656. element.style.paddingRight = padding ? padding : '';
  4657. }); // Restore sticky content
  4658. var elements = [].slice.call(document.querySelectorAll("" + Selector$5.STICKY_CONTENT));
  4659. $(elements).each(function (index, element) {
  4660. var margin = $(element).data('margin-right');
  4661. if (typeof margin !== 'undefined') {
  4662. $(element).css('margin-right', margin).removeData('margin-right');
  4663. }
  4664. }); // Restore body padding
  4665. var padding = $(document.body).data('padding-right');
  4666. $(document.body).removeData('padding-right');
  4667. document.body.style.paddingRight = padding ? padding : '';
  4668. };
  4669. _proto._getScrollbarWidth = function _getScrollbarWidth() {
  4670. // thx d.walsh
  4671. var scrollDiv = document.createElement('div');
  4672. scrollDiv.className = ClassName$5.SCROLLBAR_MEASURER;
  4673. document.body.appendChild(scrollDiv);
  4674. var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
  4675. document.body.removeChild(scrollDiv);
  4676. return scrollbarWidth;
  4677. } // Static
  4678. ;
  4679. Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
  4680. return this.each(function () {
  4681. var data = $(this).data(DATA_KEY$5);
  4682. var _config = _objectSpread2({}, Default$3, {}, $(this).data(), {}, typeof config === 'object' && config ? config : {});
  4683. if (!data) {
  4684. data = new Modal(this, _config);
  4685. $(this).data(DATA_KEY$5, data);
  4686. }
  4687. if (typeof config === 'string') {
  4688. if (typeof data[config] === 'undefined') {
  4689. throw new TypeError("No method named \"" + config + "\"");
  4690. }
  4691. data[config](relatedTarget);
  4692. } else if (_config.show) {
  4693. data.show(relatedTarget);
  4694. }
  4695. });
  4696. };
  4697. _createClass(Modal, null, [{
  4698. key: "VERSION",
  4699. get: function get() {
  4700. return VERSION$5;
  4701. }
  4702. }, {
  4703. key: "Default",
  4704. get: function get() {
  4705. return Default$3;
  4706. }
  4707. }]);
  4708. return Modal;
  4709. }();
  4710. /**
  4711. * ------------------------------------------------------------------------
  4712. * Data Api implementation
  4713. * ------------------------------------------------------------------------
  4714. */
  4715. $(document).on(Event$5.CLICK_DATA_API, Selector$5.DATA_TOGGLE, function (event) {
  4716. var _this11 = this;
  4717. var target;
  4718. var selector = Util.getSelectorFromElement(this);
  4719. if (selector) {
  4720. target = document.querySelector(selector);
  4721. }
  4722. var config = $(target).data(DATA_KEY$5) ? 'toggle' : _objectSpread2({}, $(target).data(), {}, $(this).data());
  4723. if (this.tagName === 'A' || this.tagName === 'AREA') {
  4724. event.preventDefault();
  4725. }
  4726. var $target = $(target).one(Event$5.SHOW, function (showEvent) {
  4727. if (showEvent.isDefaultPrevented()) {
  4728. // Only register focus restorer if modal will actually get shown
  4729. return;
  4730. }
  4731. $target.one(Event$5.HIDDEN, function () {
  4732. if ($(_this11).is(':visible')) {
  4733. _this11.focus();
  4734. }
  4735. });
  4736. });
  4737. Modal._jQueryInterface.call($(target), config, this);
  4738. });
  4739. /**
  4740. * ------------------------------------------------------------------------
  4741. * jQuery
  4742. * ------------------------------------------------------------------------
  4743. */
  4744. $.fn[NAME$5] = Modal._jQueryInterface;
  4745. $.fn[NAME$5].Constructor = Modal;
  4746. $.fn[NAME$5].noConflict = function () {
  4747. $.fn[NAME$5] = JQUERY_NO_CONFLICT$5;
  4748. return Modal._jQueryInterface;
  4749. };
  4750. /**
  4751. * --------------------------------------------------------------------------
  4752. * Bootstrap (v4.4.1): tools/sanitizer.js
  4753. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  4754. * --------------------------------------------------------------------------
  4755. */
  4756. var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
  4757. var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
  4758. var DefaultWhitelist = {
  4759. // Global attributes allowed on any supplied element below.
  4760. '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
  4761. a: ['target', 'href', 'title', 'rel'],
  4762. area: [],
  4763. b: [],
  4764. br: [],
  4765. col: [],
  4766. code: [],
  4767. div: [],
  4768. em: [],
  4769. hr: [],
  4770. h1: [],
  4771. h2: [],
  4772. h3: [],
  4773. h4: [],
  4774. h5: [],
  4775. h6: [],
  4776. i: [],
  4777. img: ['src', 'alt', 'title', 'width', 'height'],
  4778. li: [],
  4779. ol: [],
  4780. p: [],
  4781. pre: [],
  4782. s: [],
  4783. small: [],
  4784. span: [],
  4785. sub: [],
  4786. sup: [],
  4787. strong: [],
  4788. u: [],
  4789. ul: []
  4790. };
  4791. /**
  4792. * A pattern that recognizes a commonly useful subset of URLs that are safe.
  4793. *
  4794. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4795. */
  4796. var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi;
  4797. /**
  4798. * A pattern that matches safe data URLs. Only matches image, video and audio types.
  4799. *
  4800. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4801. */
  4802. 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;
  4803. function allowedAttribute(attr, allowedAttributeList) {
  4804. var attrName = attr.nodeName.toLowerCase();
  4805. if (allowedAttributeList.indexOf(attrName) !== -1) {
  4806. if (uriAttrs.indexOf(attrName) !== -1) {
  4807. return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
  4808. }
  4809. return true;
  4810. }
  4811. var regExp = allowedAttributeList.filter(function (attrRegex) {
  4812. return attrRegex instanceof RegExp;
  4813. }); // Check if a regular expression validates the attribute.
  4814. for (var i = 0, l = regExp.length; i < l; i++) {
  4815. if (attrName.match(regExp[i])) {
  4816. return true;
  4817. }
  4818. }
  4819. return false;
  4820. }
  4821. function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
  4822. if (unsafeHtml.length === 0) {
  4823. return unsafeHtml;
  4824. }
  4825. if (sanitizeFn && typeof sanitizeFn === 'function') {
  4826. return sanitizeFn(unsafeHtml);
  4827. }
  4828. var domParser = new window.DOMParser();
  4829. var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
  4830. var whitelistKeys = Object.keys(whiteList);
  4831. var elements = [].slice.call(createdDocument.body.querySelectorAll('*'));
  4832. var _loop = function _loop(i, len) {
  4833. var el = elements[i];
  4834. var elName = el.nodeName.toLowerCase();
  4835. if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) {
  4836. el.parentNode.removeChild(el);
  4837. return "continue";
  4838. }
  4839. var attributeList = [].slice.call(el.attributes);
  4840. var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
  4841. attributeList.forEach(function (attr) {
  4842. if (!allowedAttribute(attr, whitelistedAttributes)) {
  4843. el.removeAttribute(attr.nodeName);
  4844. }
  4845. });
  4846. };
  4847. for (var i = 0, len = elements.length; i < len; i++) {
  4848. var _ret = _loop(i);
  4849. if (_ret === "continue") continue;
  4850. }
  4851. return createdDocument.body.innerHTML;
  4852. }
  4853. /**
  4854. * ------------------------------------------------------------------------
  4855. * Constants
  4856. * ------------------------------------------------------------------------
  4857. */
  4858. var NAME$6 = 'tooltip';
  4859. var VERSION$6 = '4.4.1';
  4860. var DATA_KEY$6 = 'bs.tooltip';
  4861. var EVENT_KEY$6 = "." + DATA_KEY$6;
  4862. var JQUERY_NO_CONFLICT$6 = $.fn[NAME$6];
  4863. var CLASS_PREFIX = 'bs-tooltip';
  4864. var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
  4865. var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
  4866. var DefaultType$4 = {
  4867. animation: 'boolean',
  4868. template: 'string',
  4869. title: '(string|element|function)',
  4870. trigger: 'string',
  4871. delay: '(number|object)',
  4872. html: 'boolean',
  4873. selector: '(string|boolean)',
  4874. placement: '(string|function)',
  4875. offset: '(number|string|function)',
  4876. container: '(string|element|boolean)',
  4877. fallbackPlacement: '(string|array)',
  4878. boundary: '(string|element)',
  4879. sanitize: 'boolean',
  4880. sanitizeFn: '(null|function)',
  4881. whiteList: 'object',
  4882. popperConfig: '(null|object)'
  4883. };
  4884. var AttachmentMap$1 = {
  4885. AUTO: 'auto',
  4886. TOP: 'top',
  4887. RIGHT: 'right',
  4888. BOTTOM: 'bottom',
  4889. LEFT: 'left'
  4890. };
  4891. var Default$4 = {
  4892. animation: true,
  4893. template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
  4894. trigger: 'hover focus',
  4895. title: '',
  4896. delay: 0,
  4897. html: false,
  4898. selector: false,
  4899. placement: 'top',
  4900. offset: 0,
  4901. container: false,
  4902. fallbackPlacement: 'flip',
  4903. boundary: 'scrollParent',
  4904. sanitize: true,
  4905. sanitizeFn: null,
  4906. whiteList: DefaultWhitelist,
  4907. popperConfig: null
  4908. };
  4909. var HoverState = {
  4910. SHOW: 'show',
  4911. OUT: 'out'
  4912. };
  4913. var Event$6 = {
  4914. HIDE: "hide" + EVENT_KEY$6,
  4915. HIDDEN: "hidden" + EVENT_KEY$6,
  4916. SHOW: "show" + EVENT_KEY$6,
  4917. SHOWN: "shown" + EVENT_KEY$6,
  4918. INSERTED: "inserted" + EVENT_KEY$6,
  4919. CLICK: "click" + EVENT_KEY$6,
  4920. FOCUSIN: "focusin" + EVENT_KEY$6,
  4921. FOCUSOUT: "focusout" + EVENT_KEY$6,
  4922. MOUSEENTER: "mouseenter" + EVENT_KEY$6,
  4923. MOUSELEAVE: "mouseleave" + EVENT_KEY$6
  4924. };
  4925. var ClassName$6 = {
  4926. FADE: 'fade',
  4927. SHOW: 'show'
  4928. };
  4929. var Selector$6 = {
  4930. TOOLTIP: '.tooltip',
  4931. TOOLTIP_INNER: '.tooltip-inner',
  4932. ARROW: '.arrow'
  4933. };
  4934. var Trigger = {
  4935. HOVER: 'hover',
  4936. FOCUS: 'focus',
  4937. CLICK: 'click',
  4938. MANUAL: 'manual'
  4939. };
  4940. /**
  4941. * ------------------------------------------------------------------------
  4942. * Class Definition
  4943. * ------------------------------------------------------------------------
  4944. */
  4945. var Tooltip =
  4946. /*#__PURE__*/
  4947. function () {
  4948. function Tooltip(element, config) {
  4949. if (typeof Popper === 'undefined') {
  4950. throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)');
  4951. } // private
  4952. this._isEnabled = true;
  4953. this._timeout = 0;
  4954. this._hoverState = '';
  4955. this._activeTrigger = {};
  4956. this._popper = null; // Protected
  4957. this.element = element;
  4958. this.config = this._getConfig(config);
  4959. this.tip = null;
  4960. this._setListeners();
  4961. } // Getters
  4962. var _proto = Tooltip.prototype;
  4963. // Public
  4964. _proto.enable = function enable() {
  4965. this._isEnabled = true;
  4966. };
  4967. _proto.disable = function disable() {
  4968. this._isEnabled = false;
  4969. };
  4970. _proto.toggleEnabled = function toggleEnabled() {
  4971. this._isEnabled = !this._isEnabled;
  4972. };
  4973. _proto.toggle = function toggle(event) {
  4974. if (!this._isEnabled) {
  4975. return;
  4976. }
  4977. if (event) {
  4978. var dataKey = this.constructor.DATA_KEY;
  4979. var context = $(event.currentTarget).data(dataKey);
  4980. if (!context) {
  4981. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4982. $(event.currentTarget).data(dataKey, context);
  4983. }
  4984. context._activeTrigger.click = !context._activeTrigger.click;
  4985. if (context._isWithActiveTrigger()) {
  4986. context._enter(null, context);
  4987. } else {
  4988. context._leave(null, context);
  4989. }
  4990. } else {
  4991. if ($(this.getTipElement()).hasClass(ClassName$6.SHOW)) {
  4992. this._leave(null, this);
  4993. return;
  4994. }
  4995. this._enter(null, this);
  4996. }
  4997. };
  4998. _proto.dispose = function dispose() {
  4999. clearTimeout(this._timeout);
  5000. $.removeData(this.element, this.constructor.DATA_KEY);
  5001. $(this.element).off(this.constructor.EVENT_KEY);
  5002. $(this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler);
  5003. if (this.tip) {
  5004. $(this.tip).remove();
  5005. }
  5006. this._isEnabled = null;
  5007. this._timeout = null;
  5008. this._hoverState = null;
  5009. this._activeTrigger = null;
  5010. if (this._popper) {
  5011. this._popper.destroy();
  5012. }
  5013. this._popper = null;
  5014. this.element = null;
  5015. this.config = null;
  5016. this.tip = null;
  5017. };
  5018. _proto.show = function show() {
  5019. var _this = this;
  5020. if ($(this.element).css('display') === 'none') {
  5021. throw new Error('Please use show on visible elements');
  5022. }
  5023. var showEvent = $.Event(this.constructor.Event.SHOW);
  5024. if (this.isWithContent() && this._isEnabled) {
  5025. $(this.element).trigger(showEvent);
  5026. var shadowRoot = Util.findShadowRoot(this.element);
  5027. var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element);
  5028. if (showEvent.isDefaultPrevented() || !isInTheDom) {
  5029. return;
  5030. }
  5031. var tip = this.getTipElement();
  5032. var tipId = Util.getUID(this.constructor.NAME);
  5033. tip.setAttribute('id', tipId);
  5034. this.element.setAttribute('aria-describedby', tipId);
  5035. this.setContent();
  5036. if (this.config.animation) {
  5037. $(tip).addClass(ClassName$6.FADE);
  5038. }
  5039. var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
  5040. var attachment = this._getAttachment(placement);
  5041. this.addAttachmentClass(attachment);
  5042. var container = this._getContainer();
  5043. $(tip).data(this.constructor.DATA_KEY, this);
  5044. if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
  5045. $(tip).appendTo(container);
  5046. }
  5047. $(this.element).trigger(this.constructor.Event.INSERTED);
  5048. this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment));
  5049. $(tip).addClass(ClassName$6.SHOW); // If this is a touch-enabled device we add extra
  5050. // empty mouseover listeners to the body's immediate children;
  5051. // only needed because of broken event delegation on iOS
  5052. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  5053. if ('ontouchstart' in document.documentElement) {
  5054. $(document.body).children().on('mouseover', null, $.noop);
  5055. }
  5056. var complete = function complete() {
  5057. if (_this.config.animation) {
  5058. _this._fixTransition();
  5059. }
  5060. var prevHoverState = _this._hoverState;
  5061. _this._hoverState = null;
  5062. $(_this.element).trigger(_this.constructor.Event.SHOWN);
  5063. if (prevHoverState === HoverState.OUT) {
  5064. _this._leave(null, _this);
  5065. }
  5066. };
  5067. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  5068. var transitionDuration = Util.getTransitionDurationFromElement(this.tip);
  5069. $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5070. } else {
  5071. complete();
  5072. }
  5073. }
  5074. };
  5075. _proto.hide = function hide(callback) {
  5076. var _this2 = this;
  5077. var tip = this.getTipElement();
  5078. var hideEvent = $.Event(this.constructor.Event.HIDE);
  5079. var complete = function complete() {
  5080. if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) {
  5081. tip.parentNode.removeChild(tip);
  5082. }
  5083. _this2._cleanTipClass();
  5084. _this2.element.removeAttribute('aria-describedby');
  5085. $(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
  5086. if (_this2._popper !== null) {
  5087. _this2._popper.destroy();
  5088. }
  5089. if (callback) {
  5090. callback();
  5091. }
  5092. };
  5093. $(this.element).trigger(hideEvent);
  5094. if (hideEvent.isDefaultPrevented()) {
  5095. return;
  5096. }
  5097. $(tip).removeClass(ClassName$6.SHOW); // If this is a touch-enabled device we remove the extra
  5098. // empty mouseover listeners we added for iOS support
  5099. if ('ontouchstart' in document.documentElement) {
  5100. $(document.body).children().off('mouseover', null, $.noop);
  5101. }
  5102. this._activeTrigger[Trigger.CLICK] = false;
  5103. this._activeTrigger[Trigger.FOCUS] = false;
  5104. this._activeTrigger[Trigger.HOVER] = false;
  5105. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  5106. var transitionDuration = Util.getTransitionDurationFromElement(tip);
  5107. $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5108. } else {
  5109. complete();
  5110. }
  5111. this._hoverState = '';
  5112. };
  5113. _proto.update = function update() {
  5114. if (this._popper !== null) {
  5115. this._popper.scheduleUpdate();
  5116. }
  5117. } // Protected
  5118. ;
  5119. _proto.isWithContent = function isWithContent() {
  5120. return Boolean(this.getTitle());
  5121. };
  5122. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  5123. $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
  5124. };
  5125. _proto.getTipElement = function getTipElement() {
  5126. this.tip = this.tip || $(this.config.template)[0];
  5127. return this.tip;
  5128. };
  5129. _proto.setContent = function setContent() {
  5130. var tip = this.getTipElement();
  5131. this.setElementContent($(tip.querySelectorAll(Selector$6.TOOLTIP_INNER)), this.getTitle());
  5132. $(tip).removeClass(ClassName$6.FADE + " " + ClassName$6.SHOW);
  5133. };
  5134. _proto.setElementContent = function setElementContent($element, content) {
  5135. if (typeof content === 'object' && (content.nodeType || content.jquery)) {
  5136. // Content is a DOM node or a jQuery
  5137. if (this.config.html) {
  5138. if (!$(content).parent().is($element)) {
  5139. $element.empty().append(content);
  5140. }
  5141. } else {
  5142. $element.text($(content).text());
  5143. }
  5144. return;
  5145. }
  5146. if (this.config.html) {
  5147. if (this.config.sanitize) {
  5148. content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);
  5149. }
  5150. $element.html(content);
  5151. } else {
  5152. $element.text(content);
  5153. }
  5154. };
  5155. _proto.getTitle = function getTitle() {
  5156. var title = this.element.getAttribute('data-original-title');
  5157. if (!title) {
  5158. title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
  5159. }
  5160. return title;
  5161. } // Private
  5162. ;
  5163. _proto._getPopperConfig = function _getPopperConfig(attachment) {
  5164. var _this3 = this;
  5165. var defaultBsConfig = {
  5166. placement: attachment,
  5167. modifiers: {
  5168. offset: this._getOffset(),
  5169. flip: {
  5170. behavior: this.config.fallbackPlacement
  5171. },
  5172. arrow: {
  5173. element: Selector$6.ARROW
  5174. },
  5175. preventOverflow: {
  5176. boundariesElement: this.config.boundary
  5177. }
  5178. },
  5179. onCreate: function onCreate(data) {
  5180. if (data.originalPlacement !== data.placement) {
  5181. _this3._handlePopperPlacementChange(data);
  5182. }
  5183. },
  5184. onUpdate: function onUpdate(data) {
  5185. return _this3._handlePopperPlacementChange(data);
  5186. }
  5187. };
  5188. return _objectSpread2({}, defaultBsConfig, {}, this.config.popperConfig);
  5189. };
  5190. _proto._getOffset = function _getOffset() {
  5191. var _this4 = this;
  5192. var offset = {};
  5193. if (typeof this.config.offset === 'function') {
  5194. offset.fn = function (data) {
  5195. data.offsets = _objectSpread2({}, data.offsets, {}, _this4.config.offset(data.offsets, _this4.element) || {});
  5196. return data;
  5197. };
  5198. } else {
  5199. offset.offset = this.config.offset;
  5200. }
  5201. return offset;
  5202. };
  5203. _proto._getContainer = function _getContainer() {
  5204. if (this.config.container === false) {
  5205. return document.body;
  5206. }
  5207. if (Util.isElement(this.config.container)) {
  5208. return $(this.config.container);
  5209. }
  5210. return $(document).find(this.config.container);
  5211. };
  5212. _proto._getAttachment = function _getAttachment(placement) {
  5213. return AttachmentMap$1[placement.toUpperCase()];
  5214. };
  5215. _proto._setListeners = function _setListeners() {
  5216. var _this5 = this;
  5217. var triggers = this.config.trigger.split(' ');
  5218. triggers.forEach(function (trigger) {
  5219. if (trigger === 'click') {
  5220. $(_this5.element).on(_this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
  5221. return _this5.toggle(event);
  5222. });
  5223. } else if (trigger !== Trigger.MANUAL) {
  5224. var eventIn = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
  5225. var eventOut = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
  5226. $(_this5.element).on(eventIn, _this5.config.selector, function (event) {
  5227. return _this5._enter(event);
  5228. }).on(eventOut, _this5.config.selector, function (event) {
  5229. return _this5._leave(event);
  5230. });
  5231. }
  5232. });
  5233. this._hideModalHandler = function () {
  5234. if (_this5.element) {
  5235. _this5.hide();
  5236. }
  5237. };
  5238. $(this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler);
  5239. if (this.config.selector) {
  5240. this.config = _objectSpread2({}, this.config, {
  5241. trigger: 'manual',
  5242. selector: ''
  5243. });
  5244. } else {
  5245. this._fixTitle();
  5246. }
  5247. };
  5248. _proto._fixTitle = function _fixTitle() {
  5249. var titleType = typeof this.element.getAttribute('data-original-title');
  5250. if (this.element.getAttribute('title') || titleType !== 'string') {
  5251. this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
  5252. this.element.setAttribute('title', '');
  5253. }
  5254. };
  5255. _proto._enter = function _enter(event, context) {
  5256. var dataKey = this.constructor.DATA_KEY;
  5257. context = context || $(event.currentTarget).data(dataKey);
  5258. if (!context) {
  5259. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5260. $(event.currentTarget).data(dataKey, context);
  5261. }
  5262. if (event) {
  5263. context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
  5264. }
  5265. if ($(context.getTipElement()).hasClass(ClassName$6.SHOW) || context._hoverState === HoverState.SHOW) {
  5266. context._hoverState = HoverState.SHOW;
  5267. return;
  5268. }
  5269. clearTimeout(context._timeout);
  5270. context._hoverState = HoverState.SHOW;
  5271. if (!context.config.delay || !context.config.delay.show) {
  5272. context.show();
  5273. return;
  5274. }
  5275. context._timeout = setTimeout(function () {
  5276. if (context._hoverState === HoverState.SHOW) {
  5277. context.show();
  5278. }
  5279. }, context.config.delay.show);
  5280. };
  5281. _proto._leave = function _leave(event, context) {
  5282. var dataKey = this.constructor.DATA_KEY;
  5283. context = context || $(event.currentTarget).data(dataKey);
  5284. if (!context) {
  5285. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5286. $(event.currentTarget).data(dataKey, context);
  5287. }
  5288. if (event) {
  5289. context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
  5290. }
  5291. if (context._isWithActiveTrigger()) {
  5292. return;
  5293. }
  5294. clearTimeout(context._timeout);
  5295. context._hoverState = HoverState.OUT;
  5296. if (!context.config.delay || !context.config.delay.hide) {
  5297. context.hide();
  5298. return;
  5299. }
  5300. context._timeout = setTimeout(function () {
  5301. if (context._hoverState === HoverState.OUT) {
  5302. context.hide();
  5303. }
  5304. }, context.config.delay.hide);
  5305. };
  5306. _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
  5307. for (var trigger in this._activeTrigger) {
  5308. if (this._activeTrigger[trigger]) {
  5309. return true;
  5310. }
  5311. }
  5312. return false;
  5313. };
  5314. _proto._getConfig = function _getConfig(config) {
  5315. var dataAttributes = $(this.element).data();
  5316. Object.keys(dataAttributes).forEach(function (dataAttr) {
  5317. if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
  5318. delete dataAttributes[dataAttr];
  5319. }
  5320. });
  5321. config = _objectSpread2({}, this.constructor.Default, {}, dataAttributes, {}, typeof config === 'object' && config ? config : {});
  5322. if (typeof config.delay === 'number') {
  5323. config.delay = {
  5324. show: config.delay,
  5325. hide: config.delay
  5326. };
  5327. }
  5328. if (typeof config.title === 'number') {
  5329. config.title = config.title.toString();
  5330. }
  5331. if (typeof config.content === 'number') {
  5332. config.content = config.content.toString();
  5333. }
  5334. Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
  5335. if (config.sanitize) {
  5336. config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
  5337. }
  5338. return config;
  5339. };
  5340. _proto._getDelegateConfig = function _getDelegateConfig() {
  5341. var config = {};
  5342. if (this.config) {
  5343. for (var key in this.config) {
  5344. if (this.constructor.Default[key] !== this.config[key]) {
  5345. config[key] = this.config[key];
  5346. }
  5347. }
  5348. }
  5349. return config;
  5350. };
  5351. _proto._cleanTipClass = function _cleanTipClass() {
  5352. var $tip = $(this.getTipElement());
  5353. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
  5354. if (tabClass !== null && tabClass.length) {
  5355. $tip.removeClass(tabClass.join(''));
  5356. }
  5357. };
  5358. _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
  5359. var popperInstance = popperData.instance;
  5360. this.tip = popperInstance.popper;
  5361. this._cleanTipClass();
  5362. this.addAttachmentClass(this._getAttachment(popperData.placement));
  5363. };
  5364. _proto._fixTransition = function _fixTransition() {
  5365. var tip = this.getTipElement();
  5366. var initConfigAnimation = this.config.animation;
  5367. if (tip.getAttribute('x-placement') !== null) {
  5368. return;
  5369. }
  5370. $(tip).removeClass(ClassName$6.FADE);
  5371. this.config.animation = false;
  5372. this.hide();
  5373. this.show();
  5374. this.config.animation = initConfigAnimation;
  5375. } // Static
  5376. ;
  5377. Tooltip._jQueryInterface = function _jQueryInterface(config) {
  5378. return this.each(function () {
  5379. var data = $(this).data(DATA_KEY$6);
  5380. var _config = typeof config === 'object' && config;
  5381. if (!data && /dispose|hide/.test(config)) {
  5382. return;
  5383. }
  5384. if (!data) {
  5385. data = new Tooltip(this, _config);
  5386. $(this).data(DATA_KEY$6, data);
  5387. }
  5388. if (typeof config === 'string') {
  5389. if (typeof data[config] === 'undefined') {
  5390. throw new TypeError("No method named \"" + config + "\"");
  5391. }
  5392. data[config]();
  5393. }
  5394. });
  5395. };
  5396. _createClass(Tooltip, null, [{
  5397. key: "VERSION",
  5398. get: function get() {
  5399. return VERSION$6;
  5400. }
  5401. }, {
  5402. key: "Default",
  5403. get: function get() {
  5404. return Default$4;
  5405. }
  5406. }, {
  5407. key: "NAME",
  5408. get: function get() {
  5409. return NAME$6;
  5410. }
  5411. }, {
  5412. key: "DATA_KEY",
  5413. get: function get() {
  5414. return DATA_KEY$6;
  5415. }
  5416. }, {
  5417. key: "Event",
  5418. get: function get() {
  5419. return Event$6;
  5420. }
  5421. }, {
  5422. key: "EVENT_KEY",
  5423. get: function get() {
  5424. return EVENT_KEY$6;
  5425. }
  5426. }, {
  5427. key: "DefaultType",
  5428. get: function get() {
  5429. return DefaultType$4;
  5430. }
  5431. }]);
  5432. return Tooltip;
  5433. }();
  5434. /**
  5435. * ------------------------------------------------------------------------
  5436. * jQuery
  5437. * ------------------------------------------------------------------------
  5438. */
  5439. $.fn[NAME$6] = Tooltip._jQueryInterface;
  5440. $.fn[NAME$6].Constructor = Tooltip;
  5441. $.fn[NAME$6].noConflict = function () {
  5442. $.fn[NAME$6] = JQUERY_NO_CONFLICT$6;
  5443. return Tooltip._jQueryInterface;
  5444. };
  5445. /**
  5446. * ------------------------------------------------------------------------
  5447. * Constants
  5448. * ------------------------------------------------------------------------
  5449. */
  5450. var NAME$7 = 'popover';
  5451. var VERSION$7 = '4.4.1';
  5452. var DATA_KEY$7 = 'bs.popover';
  5453. var EVENT_KEY$7 = "." + DATA_KEY$7;
  5454. var JQUERY_NO_CONFLICT$7 = $.fn[NAME$7];
  5455. var CLASS_PREFIX$1 = 'bs-popover';
  5456. var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g');
  5457. var Default$5 = _objectSpread2({}, Tooltip.Default, {
  5458. placement: 'right',
  5459. trigger: 'click',
  5460. content: '',
  5461. template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
  5462. });
  5463. var DefaultType$5 = _objectSpread2({}, Tooltip.DefaultType, {
  5464. content: '(string|element|function)'
  5465. });
  5466. var ClassName$7 = {
  5467. FADE: 'fade',
  5468. SHOW: 'show'
  5469. };
  5470. var Selector$7 = {
  5471. TITLE: '.popover-header',
  5472. CONTENT: '.popover-body'
  5473. };
  5474. var Event$7 = {
  5475. HIDE: "hide" + EVENT_KEY$7,
  5476. HIDDEN: "hidden" + EVENT_KEY$7,
  5477. SHOW: "show" + EVENT_KEY$7,
  5478. SHOWN: "shown" + EVENT_KEY$7,
  5479. INSERTED: "inserted" + EVENT_KEY$7,
  5480. CLICK: "click" + EVENT_KEY$7,
  5481. FOCUSIN: "focusin" + EVENT_KEY$7,
  5482. FOCUSOUT: "focusout" + EVENT_KEY$7,
  5483. MOUSEENTER: "mouseenter" + EVENT_KEY$7,
  5484. MOUSELEAVE: "mouseleave" + EVENT_KEY$7
  5485. };
  5486. /**
  5487. * ------------------------------------------------------------------------
  5488. * Class Definition
  5489. * ------------------------------------------------------------------------
  5490. */
  5491. var Popover =
  5492. /*#__PURE__*/
  5493. function (_Tooltip) {
  5494. _inheritsLoose(Popover, _Tooltip);
  5495. function Popover() {
  5496. return _Tooltip.apply(this, arguments) || this;
  5497. }
  5498. var _proto = Popover.prototype;
  5499. // Overrides
  5500. _proto.isWithContent = function isWithContent() {
  5501. return this.getTitle() || this._getContent();
  5502. };
  5503. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  5504. $(this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment);
  5505. };
  5506. _proto.getTipElement = function getTipElement() {
  5507. this.tip = this.tip || $(this.config.template)[0];
  5508. return this.tip;
  5509. };
  5510. _proto.setContent = function setContent() {
  5511. var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events
  5512. this.setElementContent($tip.find(Selector$7.TITLE), this.getTitle());
  5513. var content = this._getContent();
  5514. if (typeof content === 'function') {
  5515. content = content.call(this.element);
  5516. }
  5517. this.setElementContent($tip.find(Selector$7.CONTENT), content);
  5518. $tip.removeClass(ClassName$7.FADE + " " + ClassName$7.SHOW);
  5519. } // Private
  5520. ;
  5521. _proto._getContent = function _getContent() {
  5522. return this.element.getAttribute('data-content') || this.config.content;
  5523. };
  5524. _proto._cleanTipClass = function _cleanTipClass() {
  5525. var $tip = $(this.getTipElement());
  5526. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1);
  5527. if (tabClass !== null && tabClass.length > 0) {
  5528. $tip.removeClass(tabClass.join(''));
  5529. }
  5530. } // Static
  5531. ;
  5532. Popover._jQueryInterface = function _jQueryInterface(config) {
  5533. return this.each(function () {
  5534. var data = $(this).data(DATA_KEY$7);
  5535. var _config = typeof config === 'object' ? config : null;
  5536. if (!data && /dispose|hide/.test(config)) {
  5537. return;
  5538. }
  5539. if (!data) {
  5540. data = new Popover(this, _config);
  5541. $(this).data(DATA_KEY$7, data);
  5542. }
  5543. if (typeof config === 'string') {
  5544. if (typeof data[config] === 'undefined') {
  5545. throw new TypeError("No method named \"" + config + "\"");
  5546. }
  5547. data[config]();
  5548. }
  5549. });
  5550. };
  5551. _createClass(Popover, null, [{
  5552. key: "VERSION",
  5553. // Getters
  5554. get: function get() {
  5555. return VERSION$7;
  5556. }
  5557. }, {
  5558. key: "Default",
  5559. get: function get() {
  5560. return Default$5;
  5561. }
  5562. }, {
  5563. key: "NAME",
  5564. get: function get() {
  5565. return NAME$7;
  5566. }
  5567. }, {
  5568. key: "DATA_KEY",
  5569. get: function get() {
  5570. return DATA_KEY$7;
  5571. }
  5572. }, {
  5573. key: "Event",
  5574. get: function get() {
  5575. return Event$7;
  5576. }
  5577. }, {
  5578. key: "EVENT_KEY",
  5579. get: function get() {
  5580. return EVENT_KEY$7;
  5581. }
  5582. }, {
  5583. key: "DefaultType",
  5584. get: function get() {
  5585. return DefaultType$5;
  5586. }
  5587. }]);
  5588. return Popover;
  5589. }(Tooltip);
  5590. /**
  5591. * ------------------------------------------------------------------------
  5592. * jQuery
  5593. * ------------------------------------------------------------------------
  5594. */
  5595. $.fn[NAME$7] = Popover._jQueryInterface;
  5596. $.fn[NAME$7].Constructor = Popover;
  5597. $.fn[NAME$7].noConflict = function () {
  5598. $.fn[NAME$7] = JQUERY_NO_CONFLICT$7;
  5599. return Popover._jQueryInterface;
  5600. };
  5601. /**
  5602. * ------------------------------------------------------------------------
  5603. * Constants
  5604. * ------------------------------------------------------------------------
  5605. */
  5606. var NAME$8 = 'scrollspy';
  5607. var VERSION$8 = '4.4.1';
  5608. var DATA_KEY$8 = 'bs.scrollspy';
  5609. var EVENT_KEY$8 = "." + DATA_KEY$8;
  5610. var DATA_API_KEY$6 = '.data-api';
  5611. var JQUERY_NO_CONFLICT$8 = $.fn[NAME$8];
  5612. var Default$6 = {
  5613. offset: 10,
  5614. method: 'auto',
  5615. target: ''
  5616. };
  5617. var DefaultType$6 = {
  5618. offset: 'number',
  5619. method: 'string',
  5620. target: '(string|element)'
  5621. };
  5622. var Event$8 = {
  5623. ACTIVATE: "activate" + EVENT_KEY$8,
  5624. SCROLL: "scroll" + EVENT_KEY$8,
  5625. LOAD_DATA_API: "load" + EVENT_KEY$8 + DATA_API_KEY$6
  5626. };
  5627. var ClassName$8 = {
  5628. DROPDOWN_ITEM: 'dropdown-item',
  5629. DROPDOWN_MENU: 'dropdown-menu',
  5630. ACTIVE: 'active'
  5631. };
  5632. var Selector$8 = {
  5633. DATA_SPY: '[data-spy="scroll"]',
  5634. ACTIVE: '.active',
  5635. NAV_LIST_GROUP: '.nav, .list-group',
  5636. NAV_LINKS: '.nav-link',
  5637. NAV_ITEMS: '.nav-item',
  5638. LIST_ITEMS: '.list-group-item',
  5639. DROPDOWN: '.dropdown',
  5640. DROPDOWN_ITEMS: '.dropdown-item',
  5641. DROPDOWN_TOGGLE: '.dropdown-toggle'
  5642. };
  5643. var OffsetMethod = {
  5644. OFFSET: 'offset',
  5645. POSITION: 'position'
  5646. };
  5647. /**
  5648. * ------------------------------------------------------------------------
  5649. * Class Definition
  5650. * ------------------------------------------------------------------------
  5651. */
  5652. var ScrollSpy =
  5653. /*#__PURE__*/
  5654. function () {
  5655. function ScrollSpy(element, config) {
  5656. var _this = this;
  5657. this._element = element;
  5658. this._scrollElement = element.tagName === 'BODY' ? window : element;
  5659. this._config = this._getConfig(config);
  5660. this._selector = this._config.target + " " + Selector$8.NAV_LINKS + "," + (this._config.target + " " + Selector$8.LIST_ITEMS + ",") + (this._config.target + " " + Selector$8.DROPDOWN_ITEMS);
  5661. this._offsets = [];
  5662. this._targets = [];
  5663. this._activeTarget = null;
  5664. this._scrollHeight = 0;
  5665. $(this._scrollElement).on(Event$8.SCROLL, function (event) {
  5666. return _this._process(event);
  5667. });
  5668. this.refresh();
  5669. this._process();
  5670. } // Getters
  5671. var _proto = ScrollSpy.prototype;
  5672. // Public
  5673. _proto.refresh = function refresh() {
  5674. var _this2 = this;
  5675. var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION;
  5676. var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
  5677. var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
  5678. this._offsets = [];
  5679. this._targets = [];
  5680. this._scrollHeight = this._getScrollHeight();
  5681. var targets = [].slice.call(document.querySelectorAll(this._selector));
  5682. targets.map(function (element) {
  5683. var target;
  5684. var targetSelector = Util.getSelectorFromElement(element);
  5685. if (targetSelector) {
  5686. target = document.querySelector(targetSelector);
  5687. }
  5688. if (target) {
  5689. var targetBCR = target.getBoundingClientRect();
  5690. if (targetBCR.width || targetBCR.height) {
  5691. // TODO (fat): remove sketch reliance on jQuery position/offset
  5692. return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
  5693. }
  5694. }
  5695. return null;
  5696. }).filter(function (item) {
  5697. return item;
  5698. }).sort(function (a, b) {
  5699. return a[0] - b[0];
  5700. }).forEach(function (item) {
  5701. _this2._offsets.push(item[0]);
  5702. _this2._targets.push(item[1]);
  5703. });
  5704. };
  5705. _proto.dispose = function dispose() {
  5706. $.removeData(this._element, DATA_KEY$8);
  5707. $(this._scrollElement).off(EVENT_KEY$8);
  5708. this._element = null;
  5709. this._scrollElement = null;
  5710. this._config = null;
  5711. this._selector = null;
  5712. this._offsets = null;
  5713. this._targets = null;
  5714. this._activeTarget = null;
  5715. this._scrollHeight = null;
  5716. } // Private
  5717. ;
  5718. _proto._getConfig = function _getConfig(config) {
  5719. config = _objectSpread2({}, Default$6, {}, typeof config === 'object' && config ? config : {});
  5720. if (typeof config.target !== 'string') {
  5721. var id = $(config.target).attr('id');
  5722. if (!id) {
  5723. id = Util.getUID(NAME$8);
  5724. $(config.target).attr('id', id);
  5725. }
  5726. config.target = "#" + id;
  5727. }
  5728. Util.typeCheckConfig(NAME$8, config, DefaultType$6);
  5729. return config;
  5730. };
  5731. _proto._getScrollTop = function _getScrollTop() {
  5732. return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
  5733. };
  5734. _proto._getScrollHeight = function _getScrollHeight() {
  5735. return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
  5736. };
  5737. _proto._getOffsetHeight = function _getOffsetHeight() {
  5738. return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
  5739. };
  5740. _proto._process = function _process() {
  5741. var scrollTop = this._getScrollTop() + this._config.offset;
  5742. var scrollHeight = this._getScrollHeight();
  5743. var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
  5744. if (this._scrollHeight !== scrollHeight) {
  5745. this.refresh();
  5746. }
  5747. if (scrollTop >= maxScroll) {
  5748. var target = this._targets[this._targets.length - 1];
  5749. if (this._activeTarget !== target) {
  5750. this._activate(target);
  5751. }
  5752. return;
  5753. }
  5754. if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
  5755. this._activeTarget = null;
  5756. this._clear();
  5757. return;
  5758. }
  5759. var offsetLength = this._offsets.length;
  5760. for (var i = offsetLength; i--;) {
  5761. var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
  5762. if (isActiveTarget) {
  5763. this._activate(this._targets[i]);
  5764. }
  5765. }
  5766. };
  5767. _proto._activate = function _activate(target) {
  5768. this._activeTarget = target;
  5769. this._clear();
  5770. var queries = this._selector.split(',').map(function (selector) {
  5771. return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
  5772. });
  5773. var $link = $([].slice.call(document.querySelectorAll(queries.join(','))));
  5774. if ($link.hasClass(ClassName$8.DROPDOWN_ITEM)) {
  5775. $link.closest(Selector$8.DROPDOWN).find(Selector$8.DROPDOWN_TOGGLE).addClass(ClassName$8.ACTIVE);
  5776. $link.addClass(ClassName$8.ACTIVE);
  5777. } else {
  5778. // Set triggered link as active
  5779. $link.addClass(ClassName$8.ACTIVE); // Set triggered links parents as active
  5780. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  5781. $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
  5782. $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_ITEMS).children(Selector$8.NAV_LINKS).addClass(ClassName$8.ACTIVE);
  5783. }
  5784. $(this._scrollElement).trigger(Event$8.ACTIVATE, {
  5785. relatedTarget: target
  5786. });
  5787. };
  5788. _proto._clear = function _clear() {
  5789. [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) {
  5790. return node.classList.contains(ClassName$8.ACTIVE);
  5791. }).forEach(function (node) {
  5792. return node.classList.remove(ClassName$8.ACTIVE);
  5793. });
  5794. } // Static
  5795. ;
  5796. ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
  5797. return this.each(function () {
  5798. var data = $(this).data(DATA_KEY$8);
  5799. var _config = typeof config === 'object' && config;
  5800. if (!data) {
  5801. data = new ScrollSpy(this, _config);
  5802. $(this).data(DATA_KEY$8, data);
  5803. }
  5804. if (typeof config === 'string') {
  5805. if (typeof data[config] === 'undefined') {
  5806. throw new TypeError("No method named \"" + config + "\"");
  5807. }
  5808. data[config]();
  5809. }
  5810. });
  5811. };
  5812. _createClass(ScrollSpy, null, [{
  5813. key: "VERSION",
  5814. get: function get() {
  5815. return VERSION$8;
  5816. }
  5817. }, {
  5818. key: "Default",
  5819. get: function get() {
  5820. return Default$6;
  5821. }
  5822. }]);
  5823. return ScrollSpy;
  5824. }();
  5825. /**
  5826. * ------------------------------------------------------------------------
  5827. * Data Api implementation
  5828. * ------------------------------------------------------------------------
  5829. */
  5830. $(window).on(Event$8.LOAD_DATA_API, function () {
  5831. var scrollSpys = [].slice.call(document.querySelectorAll(Selector$8.DATA_SPY));
  5832. var scrollSpysLength = scrollSpys.length;
  5833. for (var i = scrollSpysLength; i--;) {
  5834. var $spy = $(scrollSpys[i]);
  5835. ScrollSpy._jQueryInterface.call($spy, $spy.data());
  5836. }
  5837. });
  5838. /**
  5839. * ------------------------------------------------------------------------
  5840. * jQuery
  5841. * ------------------------------------------------------------------------
  5842. */
  5843. $.fn[NAME$8] = ScrollSpy._jQueryInterface;
  5844. $.fn[NAME$8].Constructor = ScrollSpy;
  5845. $.fn[NAME$8].noConflict = function () {
  5846. $.fn[NAME$8] = JQUERY_NO_CONFLICT$8;
  5847. return ScrollSpy._jQueryInterface;
  5848. };
  5849. /**
  5850. * ------------------------------------------------------------------------
  5851. * Constants
  5852. * ------------------------------------------------------------------------
  5853. */
  5854. var NAME$9 = 'tab';
  5855. var VERSION$9 = '4.4.1';
  5856. var DATA_KEY$9 = 'bs.tab';
  5857. var EVENT_KEY$9 = "." + DATA_KEY$9;
  5858. var DATA_API_KEY$7 = '.data-api';
  5859. var JQUERY_NO_CONFLICT$9 = $.fn[NAME$9];
  5860. var Event$9 = {
  5861. HIDE: "hide" + EVENT_KEY$9,
  5862. HIDDEN: "hidden" + EVENT_KEY$9,
  5863. SHOW: "show" + EVENT_KEY$9,
  5864. SHOWN: "shown" + EVENT_KEY$9,
  5865. CLICK_DATA_API: "click" + EVENT_KEY$9 + DATA_API_KEY$7
  5866. };
  5867. var ClassName$9 = {
  5868. DROPDOWN_MENU: 'dropdown-menu',
  5869. ACTIVE: 'active',
  5870. DISABLED: 'disabled',
  5871. FADE: 'fade',
  5872. SHOW: 'show'
  5873. };
  5874. var Selector$9 = {
  5875. DROPDOWN: '.dropdown',
  5876. NAV_LIST_GROUP: '.nav, .list-group',
  5877. ACTIVE: '.active',
  5878. ACTIVE_UL: '> li > .active',
  5879. DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
  5880. DROPDOWN_TOGGLE: '.dropdown-toggle',
  5881. DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
  5882. };
  5883. /**
  5884. * ------------------------------------------------------------------------
  5885. * Class Definition
  5886. * ------------------------------------------------------------------------
  5887. */
  5888. var Tab =
  5889. /*#__PURE__*/
  5890. function () {
  5891. function Tab(element) {
  5892. this._element = element;
  5893. } // Getters
  5894. var _proto = Tab.prototype;
  5895. // Public
  5896. _proto.show = function show() {
  5897. var _this = this;
  5898. if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName$9.ACTIVE) || $(this._element).hasClass(ClassName$9.DISABLED)) {
  5899. return;
  5900. }
  5901. var target;
  5902. var previous;
  5903. var listElement = $(this._element).closest(Selector$9.NAV_LIST_GROUP)[0];
  5904. var selector = Util.getSelectorFromElement(this._element);
  5905. if (listElement) {
  5906. var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector$9.ACTIVE_UL : Selector$9.ACTIVE;
  5907. previous = $.makeArray($(listElement).find(itemSelector));
  5908. previous = previous[previous.length - 1];
  5909. }
  5910. var hideEvent = $.Event(Event$9.HIDE, {
  5911. relatedTarget: this._element
  5912. });
  5913. var showEvent = $.Event(Event$9.SHOW, {
  5914. relatedTarget: previous
  5915. });
  5916. if (previous) {
  5917. $(previous).trigger(hideEvent);
  5918. }
  5919. $(this._element).trigger(showEvent);
  5920. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
  5921. return;
  5922. }
  5923. if (selector) {
  5924. target = document.querySelector(selector);
  5925. }
  5926. this._activate(this._element, listElement);
  5927. var complete = function complete() {
  5928. var hiddenEvent = $.Event(Event$9.HIDDEN, {
  5929. relatedTarget: _this._element
  5930. });
  5931. var shownEvent = $.Event(Event$9.SHOWN, {
  5932. relatedTarget: previous
  5933. });
  5934. $(previous).trigger(hiddenEvent);
  5935. $(_this._element).trigger(shownEvent);
  5936. };
  5937. if (target) {
  5938. this._activate(target, target.parentNode, complete);
  5939. } else {
  5940. complete();
  5941. }
  5942. };
  5943. _proto.dispose = function dispose() {
  5944. $.removeData(this._element, DATA_KEY$9);
  5945. this._element = null;
  5946. } // Private
  5947. ;
  5948. _proto._activate = function _activate(element, container, callback) {
  5949. var _this2 = this;
  5950. var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $(container).find(Selector$9.ACTIVE_UL) : $(container).children(Selector$9.ACTIVE);
  5951. var active = activeElements[0];
  5952. var isTransitioning = callback && active && $(active).hasClass(ClassName$9.FADE);
  5953. var complete = function complete() {
  5954. return _this2._transitionComplete(element, active, callback);
  5955. };
  5956. if (active && isTransitioning) {
  5957. var transitionDuration = Util.getTransitionDurationFromElement(active);
  5958. $(active).removeClass(ClassName$9.SHOW).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5959. } else {
  5960. complete();
  5961. }
  5962. };
  5963. _proto._transitionComplete = function _transitionComplete(element, active, callback) {
  5964. if (active) {
  5965. $(active).removeClass(ClassName$9.ACTIVE);
  5966. var dropdownChild = $(active.parentNode).find(Selector$9.DROPDOWN_ACTIVE_CHILD)[0];
  5967. if (dropdownChild) {
  5968. $(dropdownChild).removeClass(ClassName$9.ACTIVE);
  5969. }
  5970. if (active.getAttribute('role') === 'tab') {
  5971. active.setAttribute('aria-selected', false);
  5972. }
  5973. }
  5974. $(element).addClass(ClassName$9.ACTIVE);
  5975. if (element.getAttribute('role') === 'tab') {
  5976. element.setAttribute('aria-selected', true);
  5977. }
  5978. Util.reflow(element);
  5979. if (element.classList.contains(ClassName$9.FADE)) {
  5980. element.classList.add(ClassName$9.SHOW);
  5981. }
  5982. if (element.parentNode && $(element.parentNode).hasClass(ClassName$9.DROPDOWN_MENU)) {
  5983. var dropdownElement = $(element).closest(Selector$9.DROPDOWN)[0];
  5984. if (dropdownElement) {
  5985. var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector$9.DROPDOWN_TOGGLE));
  5986. $(dropdownToggleList).addClass(ClassName$9.ACTIVE);
  5987. }
  5988. element.setAttribute('aria-expanded', true);
  5989. }
  5990. if (callback) {
  5991. callback();
  5992. }
  5993. } // Static
  5994. ;
  5995. Tab._jQueryInterface = function _jQueryInterface(config) {
  5996. return this.each(function () {
  5997. var $this = $(this);
  5998. var data = $this.data(DATA_KEY$9);
  5999. if (!data) {
  6000. data = new Tab(this);
  6001. $this.data(DATA_KEY$9, data);
  6002. }
  6003. if (typeof config === 'string') {
  6004. if (typeof data[config] === 'undefined') {
  6005. throw new TypeError("No method named \"" + config + "\"");
  6006. }
  6007. data[config]();
  6008. }
  6009. });
  6010. };
  6011. _createClass(Tab, null, [{
  6012. key: "VERSION",
  6013. get: function get() {
  6014. return VERSION$9;
  6015. }
  6016. }]);
  6017. return Tab;
  6018. }();
  6019. /**
  6020. * ------------------------------------------------------------------------
  6021. * Data Api implementation
  6022. * ------------------------------------------------------------------------
  6023. */
  6024. $(document).on(Event$9.CLICK_DATA_API, Selector$9.DATA_TOGGLE, function (event) {
  6025. event.preventDefault();
  6026. Tab._jQueryInterface.call($(this), 'show');
  6027. });
  6028. /**
  6029. * ------------------------------------------------------------------------
  6030. * jQuery
  6031. * ------------------------------------------------------------------------
  6032. */
  6033. $.fn[NAME$9] = Tab._jQueryInterface;
  6034. $.fn[NAME$9].Constructor = Tab;
  6035. $.fn[NAME$9].noConflict = function () {
  6036. $.fn[NAME$9] = JQUERY_NO_CONFLICT$9;
  6037. return Tab._jQueryInterface;
  6038. };
  6039. /**
  6040. * ------------------------------------------------------------------------
  6041. * Constants
  6042. * ------------------------------------------------------------------------
  6043. */
  6044. var NAME$a = 'toast';
  6045. var VERSION$a = '4.4.1';
  6046. var DATA_KEY$a = 'bs.toast';
  6047. var EVENT_KEY$a = "." + DATA_KEY$a;
  6048. var JQUERY_NO_CONFLICT$a = $.fn[NAME$a];
  6049. var Event$a = {
  6050. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$a,
  6051. HIDE: "hide" + EVENT_KEY$a,
  6052. HIDDEN: "hidden" + EVENT_KEY$a,
  6053. SHOW: "show" + EVENT_KEY$a,
  6054. SHOWN: "shown" + EVENT_KEY$a
  6055. };
  6056. var ClassName$a = {
  6057. FADE: 'fade',
  6058. HIDE: 'hide',
  6059. SHOW: 'show',
  6060. SHOWING: 'showing'
  6061. };
  6062. var DefaultType$7 = {
  6063. animation: 'boolean',
  6064. autohide: 'boolean',
  6065. delay: 'number'
  6066. };
  6067. var Default$7 = {
  6068. animation: true,
  6069. autohide: true,
  6070. delay: 500
  6071. };
  6072. var Selector$a = {
  6073. DATA_DISMISS: '[data-dismiss="toast"]'
  6074. };
  6075. /**
  6076. * ------------------------------------------------------------------------
  6077. * Class Definition
  6078. * ------------------------------------------------------------------------
  6079. */
  6080. var Toast =
  6081. /*#__PURE__*/
  6082. function () {
  6083. function Toast(element, config) {
  6084. this._element = element;
  6085. this._config = this._getConfig(config);
  6086. this._timeout = null;
  6087. this._setListeners();
  6088. } // Getters
  6089. var _proto = Toast.prototype;
  6090. // Public
  6091. _proto.show = function show() {
  6092. var _this = this;
  6093. var showEvent = $.Event(Event$a.SHOW);
  6094. $(this._element).trigger(showEvent);
  6095. if (showEvent.isDefaultPrevented()) {
  6096. return;
  6097. }
  6098. if (this._config.animation) {
  6099. this._element.classList.add(ClassName$a.FADE);
  6100. }
  6101. var complete = function complete() {
  6102. _this._element.classList.remove(ClassName$a.SHOWING);
  6103. _this._element.classList.add(ClassName$a.SHOW);
  6104. $(_this._element).trigger(Event$a.SHOWN);
  6105. if (_this._config.autohide) {
  6106. _this._timeout = setTimeout(function () {
  6107. _this.hide();
  6108. }, _this._config.delay);
  6109. }
  6110. };
  6111. this._element.classList.remove(ClassName$a.HIDE);
  6112. Util.reflow(this._element);
  6113. this._element.classList.add(ClassName$a.SHOWING);
  6114. if (this._config.animation) {
  6115. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  6116. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  6117. } else {
  6118. complete();
  6119. }
  6120. };
  6121. _proto.hide = function hide() {
  6122. if (!this._element.classList.contains(ClassName$a.SHOW)) {
  6123. return;
  6124. }
  6125. var hideEvent = $.Event(Event$a.HIDE);
  6126. $(this._element).trigger(hideEvent);
  6127. if (hideEvent.isDefaultPrevented()) {
  6128. return;
  6129. }
  6130. this._close();
  6131. };
  6132. _proto.dispose = function dispose() {
  6133. clearTimeout(this._timeout);
  6134. this._timeout = null;
  6135. if (this._element.classList.contains(ClassName$a.SHOW)) {
  6136. this._element.classList.remove(ClassName$a.SHOW);
  6137. }
  6138. $(this._element).off(Event$a.CLICK_DISMISS);
  6139. $.removeData(this._element, DATA_KEY$a);
  6140. this._element = null;
  6141. this._config = null;
  6142. } // Private
  6143. ;
  6144. _proto._getConfig = function _getConfig(config) {
  6145. config = _objectSpread2({}, Default$7, {}, $(this._element).data(), {}, typeof config === 'object' && config ? config : {});
  6146. Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
  6147. return config;
  6148. };
  6149. _proto._setListeners = function _setListeners() {
  6150. var _this2 = this;
  6151. $(this._element).on(Event$a.CLICK_DISMISS, Selector$a.DATA_DISMISS, function () {
  6152. return _this2.hide();
  6153. });
  6154. };
  6155. _proto._close = function _close() {
  6156. var _this3 = this;
  6157. var complete = function complete() {
  6158. _this3._element.classList.add(ClassName$a.HIDE);
  6159. $(_this3._element).trigger(Event$a.HIDDEN);
  6160. };
  6161. this._element.classList.remove(ClassName$a.SHOW);
  6162. if (this._config.animation) {
  6163. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  6164. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  6165. } else {
  6166. complete();
  6167. }
  6168. } // Static
  6169. ;
  6170. Toast._jQueryInterface = function _jQueryInterface(config) {
  6171. return this.each(function () {
  6172. var $element = $(this);
  6173. var data = $element.data(DATA_KEY$a);
  6174. var _config = typeof config === 'object' && config;
  6175. if (!data) {
  6176. data = new Toast(this, _config);
  6177. $element.data(DATA_KEY$a, data);
  6178. }
  6179. if (typeof config === 'string') {
  6180. if (typeof data[config] === 'undefined') {
  6181. throw new TypeError("No method named \"" + config + "\"");
  6182. }
  6183. data[config](this);
  6184. }
  6185. });
  6186. };
  6187. _createClass(Toast, null, [{
  6188. key: "VERSION",
  6189. get: function get() {
  6190. return VERSION$a;
  6191. }
  6192. }, {
  6193. key: "DefaultType",
  6194. get: function get() {
  6195. return DefaultType$7;
  6196. }
  6197. }, {
  6198. key: "Default",
  6199. get: function get() {
  6200. return Default$7;
  6201. }
  6202. }]);
  6203. return Toast;
  6204. }();
  6205. /**
  6206. * ------------------------------------------------------------------------
  6207. * jQuery
  6208. * ------------------------------------------------------------------------
  6209. */
  6210. $.fn[NAME$a] = Toast._jQueryInterface;
  6211. $.fn[NAME$a].Constructor = Toast;
  6212. $.fn[NAME$a].noConflict = function () {
  6213. $.fn[NAME$a] = JQUERY_NO_CONFLICT$a;
  6214. return Toast._jQueryInterface;
  6215. };
  6216. exports.Alert = Alert;
  6217. exports.Button = Button;
  6218. exports.Carousel = Carousel;
  6219. exports.Collapse = Collapse;
  6220. exports.Dropdown = Dropdown;
  6221. exports.Modal = Modal;
  6222. exports.Popover = Popover;
  6223. exports.Scrollspy = ScrollSpy;
  6224. exports.Tab = Tab;
  6225. exports.Toast = Toast;
  6226. exports.Tooltip = Tooltip;
  6227. exports.Util = Util;
  6228. Object.defineProperty(exports, '__esModule', { value: true });
  6229. })));
  6230. //# sourceMappingURL=bootstrap.js.map
  6231. /***/ }),
  6232. /***/ "./node_modules/buffer/index.js":
  6233. /*!**************************************!*\
  6234. !*** ./node_modules/buffer/index.js ***!
  6235. \**************************************/
  6236. /*! no static exports found */
  6237. /***/ (function(module, exports, __webpack_require__) {
  6238. "use strict";
  6239. /* WEBPACK VAR INJECTION */(function(global) {/*!
  6240. * The buffer module from node.js, for the browser.
  6241. *
  6242. * @author Feross Aboukhadijeh <http://feross.org>
  6243. * @license MIT
  6244. */
  6245. /* eslint-disable no-proto */
  6246. var base64 = __webpack_require__(/*! base64-js */ "./node_modules/base64-js/index.js")
  6247. var ieee754 = __webpack_require__(/*! ieee754 */ "./node_modules/ieee754/index.js")
  6248. var isArray = __webpack_require__(/*! isarray */ "./node_modules/isarray/index.js")
  6249. exports.Buffer = Buffer
  6250. exports.SlowBuffer = SlowBuffer
  6251. exports.INSPECT_MAX_BYTES = 50
  6252. /**
  6253. * If `Buffer.TYPED_ARRAY_SUPPORT`:
  6254. * === true Use Uint8Array implementation (fastest)
  6255. * === false Use Object implementation (most compatible, even IE6)
  6256. *
  6257. * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
  6258. * Opera 11.6+, iOS 4.2+.
  6259. *
  6260. * Due to various browser bugs, sometimes the Object implementation will be used even
  6261. * when the browser supports typed arrays.
  6262. *
  6263. * Note:
  6264. *
  6265. * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
  6266. * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
  6267. *
  6268. * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
  6269. *
  6270. * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
  6271. * incorrect length in some situations.
  6272. * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
  6273. * get the Object implementation, which is slower but behaves correctly.
  6274. */
  6275. Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
  6276. ? global.TYPED_ARRAY_SUPPORT
  6277. : typedArraySupport()
  6278. /*
  6279. * Export kMaxLength after typed array support is determined.
  6280. */
  6281. exports.kMaxLength = kMaxLength()
  6282. function typedArraySupport () {
  6283. try {
  6284. var arr = new Uint8Array(1)
  6285. arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
  6286. return arr.foo() === 42 && // typed array instances can be augmented
  6287. typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
  6288. arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
  6289. } catch (e) {
  6290. return false
  6291. }
  6292. }
  6293. function kMaxLength () {
  6294. return Buffer.TYPED_ARRAY_SUPPORT
  6295. ? 0x7fffffff
  6296. : 0x3fffffff
  6297. }
  6298. function createBuffer (that, length) {
  6299. if (kMaxLength() < length) {
  6300. throw new RangeError('Invalid typed array length')
  6301. }
  6302. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6303. // Return an augmented `Uint8Array` instance, for best performance
  6304. that = new Uint8Array(length)
  6305. that.__proto__ = Buffer.prototype
  6306. } else {
  6307. // Fallback: Return an object instance of the Buffer class
  6308. if (that === null) {
  6309. that = new Buffer(length)
  6310. }
  6311. that.length = length
  6312. }
  6313. return that
  6314. }
  6315. /**
  6316. * The Buffer constructor returns instances of `Uint8Array` that have their
  6317. * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
  6318. * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
  6319. * and the `Uint8Array` methods. Square bracket notation works as expected -- it
  6320. * returns a single octet.
  6321. *
  6322. * The `Uint8Array` prototype remains unmodified.
  6323. */
  6324. function Buffer (arg, encodingOrOffset, length) {
  6325. if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
  6326. return new Buffer(arg, encodingOrOffset, length)
  6327. }
  6328. // Common case.
  6329. if (typeof arg === 'number') {
  6330. if (typeof encodingOrOffset === 'string') {
  6331. throw new Error(
  6332. 'If encoding is specified then the first argument must be a string'
  6333. )
  6334. }
  6335. return allocUnsafe(this, arg)
  6336. }
  6337. return from(this, arg, encodingOrOffset, length)
  6338. }
  6339. Buffer.poolSize = 8192 // not used by this implementation
  6340. // TODO: Legacy, not needed anymore. Remove in next major version.
  6341. Buffer._augment = function (arr) {
  6342. arr.__proto__ = Buffer.prototype
  6343. return arr
  6344. }
  6345. function from (that, value, encodingOrOffset, length) {
  6346. if (typeof value === 'number') {
  6347. throw new TypeError('"value" argument must not be a number')
  6348. }
  6349. if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
  6350. return fromArrayBuffer(that, value, encodingOrOffset, length)
  6351. }
  6352. if (typeof value === 'string') {
  6353. return fromString(that, value, encodingOrOffset)
  6354. }
  6355. return fromObject(that, value)
  6356. }
  6357. /**
  6358. * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
  6359. * if value is a number.
  6360. * Buffer.from(str[, encoding])
  6361. * Buffer.from(array)
  6362. * Buffer.from(buffer)
  6363. * Buffer.from(arrayBuffer[, byteOffset[, length]])
  6364. **/
  6365. Buffer.from = function (value, encodingOrOffset, length) {
  6366. return from(null, value, encodingOrOffset, length)
  6367. }
  6368. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6369. Buffer.prototype.__proto__ = Uint8Array.prototype
  6370. Buffer.__proto__ = Uint8Array
  6371. if (typeof Symbol !== 'undefined' && Symbol.species &&
  6372. Buffer[Symbol.species] === Buffer) {
  6373. // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
  6374. Object.defineProperty(Buffer, Symbol.species, {
  6375. value: null,
  6376. configurable: true
  6377. })
  6378. }
  6379. }
  6380. function assertSize (size) {
  6381. if (typeof size !== 'number') {
  6382. throw new TypeError('"size" argument must be a number')
  6383. } else if (size < 0) {
  6384. throw new RangeError('"size" argument must not be negative')
  6385. }
  6386. }
  6387. function alloc (that, size, fill, encoding) {
  6388. assertSize(size)
  6389. if (size <= 0) {
  6390. return createBuffer(that, size)
  6391. }
  6392. if (fill !== undefined) {
  6393. // Only pay attention to encoding if it's a string. This
  6394. // prevents accidentally sending in a number that would
  6395. // be interpretted as a start offset.
  6396. return typeof encoding === 'string'
  6397. ? createBuffer(that, size).fill(fill, encoding)
  6398. : createBuffer(that, size).fill(fill)
  6399. }
  6400. return createBuffer(that, size)
  6401. }
  6402. /**
  6403. * Creates a new filled Buffer instance.
  6404. * alloc(size[, fill[, encoding]])
  6405. **/
  6406. Buffer.alloc = function (size, fill, encoding) {
  6407. return alloc(null, size, fill, encoding)
  6408. }
  6409. function allocUnsafe (that, size) {
  6410. assertSize(size)
  6411. that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
  6412. if (!Buffer.TYPED_ARRAY_SUPPORT) {
  6413. for (var i = 0; i < size; ++i) {
  6414. that[i] = 0
  6415. }
  6416. }
  6417. return that
  6418. }
  6419. /**
  6420. * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
  6421. * */
  6422. Buffer.allocUnsafe = function (size) {
  6423. return allocUnsafe(null, size)
  6424. }
  6425. /**
  6426. * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
  6427. */
  6428. Buffer.allocUnsafeSlow = function (size) {
  6429. return allocUnsafe(null, size)
  6430. }
  6431. function fromString (that, string, encoding) {
  6432. if (typeof encoding !== 'string' || encoding === '') {
  6433. encoding = 'utf8'
  6434. }
  6435. if (!Buffer.isEncoding(encoding)) {
  6436. throw new TypeError('"encoding" must be a valid string encoding')
  6437. }
  6438. var length = byteLength(string, encoding) | 0
  6439. that = createBuffer(that, length)
  6440. var actual = that.write(string, encoding)
  6441. if (actual !== length) {
  6442. // Writing a hex string, for example, that contains invalid characters will
  6443. // cause everything after the first invalid character to be ignored. (e.g.
  6444. // 'abxxcd' will be treated as 'ab')
  6445. that = that.slice(0, actual)
  6446. }
  6447. return that
  6448. }
  6449. function fromArrayLike (that, array) {
  6450. var length = array.length < 0 ? 0 : checked(array.length) | 0
  6451. that = createBuffer(that, length)
  6452. for (var i = 0; i < length; i += 1) {
  6453. that[i] = array[i] & 255
  6454. }
  6455. return that
  6456. }
  6457. function fromArrayBuffer (that, array, byteOffset, length) {
  6458. array.byteLength // this throws if `array` is not a valid ArrayBuffer
  6459. if (byteOffset < 0 || array.byteLength < byteOffset) {
  6460. throw new RangeError('\'offset\' is out of bounds')
  6461. }
  6462. if (array.byteLength < byteOffset + (length || 0)) {
  6463. throw new RangeError('\'length\' is out of bounds')
  6464. }
  6465. if (byteOffset === undefined && length === undefined) {
  6466. array = new Uint8Array(array)
  6467. } else if (length === undefined) {
  6468. array = new Uint8Array(array, byteOffset)
  6469. } else {
  6470. array = new Uint8Array(array, byteOffset, length)
  6471. }
  6472. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6473. // Return an augmented `Uint8Array` instance, for best performance
  6474. that = array
  6475. that.__proto__ = Buffer.prototype
  6476. } else {
  6477. // Fallback: Return an object instance of the Buffer class
  6478. that = fromArrayLike(that, array)
  6479. }
  6480. return that
  6481. }
  6482. function fromObject (that, obj) {
  6483. if (Buffer.isBuffer(obj)) {
  6484. var len = checked(obj.length) | 0
  6485. that = createBuffer(that, len)
  6486. if (that.length === 0) {
  6487. return that
  6488. }
  6489. obj.copy(that, 0, 0, len)
  6490. return that
  6491. }
  6492. if (obj) {
  6493. if ((typeof ArrayBuffer !== 'undefined' &&
  6494. obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
  6495. if (typeof obj.length !== 'number' || isnan(obj.length)) {
  6496. return createBuffer(that, 0)
  6497. }
  6498. return fromArrayLike(that, obj)
  6499. }
  6500. if (obj.type === 'Buffer' && isArray(obj.data)) {
  6501. return fromArrayLike(that, obj.data)
  6502. }
  6503. }
  6504. throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
  6505. }
  6506. function checked (length) {
  6507. // Note: cannot use `length < kMaxLength()` here because that fails when
  6508. // length is NaN (which is otherwise coerced to zero.)
  6509. if (length >= kMaxLength()) {
  6510. throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
  6511. 'size: 0x' + kMaxLength().toString(16) + ' bytes')
  6512. }
  6513. return length | 0
  6514. }
  6515. function SlowBuffer (length) {
  6516. if (+length != length) { // eslint-disable-line eqeqeq
  6517. length = 0
  6518. }
  6519. return Buffer.alloc(+length)
  6520. }
  6521. Buffer.isBuffer = function isBuffer (b) {
  6522. return !!(b != null && b._isBuffer)
  6523. }
  6524. Buffer.compare = function compare (a, b) {
  6525. if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
  6526. throw new TypeError('Arguments must be Buffers')
  6527. }
  6528. if (a === b) return 0
  6529. var x = a.length
  6530. var y = b.length
  6531. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  6532. if (a[i] !== b[i]) {
  6533. x = a[i]
  6534. y = b[i]
  6535. break
  6536. }
  6537. }
  6538. if (x < y) return -1
  6539. if (y < x) return 1
  6540. return 0
  6541. }
  6542. Buffer.isEncoding = function isEncoding (encoding) {
  6543. switch (String(encoding).toLowerCase()) {
  6544. case 'hex':
  6545. case 'utf8':
  6546. case 'utf-8':
  6547. case 'ascii':
  6548. case 'latin1':
  6549. case 'binary':
  6550. case 'base64':
  6551. case 'ucs2':
  6552. case 'ucs-2':
  6553. case 'utf16le':
  6554. case 'utf-16le':
  6555. return true
  6556. default:
  6557. return false
  6558. }
  6559. }
  6560. Buffer.concat = function concat (list, length) {
  6561. if (!isArray(list)) {
  6562. throw new TypeError('"list" argument must be an Array of Buffers')
  6563. }
  6564. if (list.length === 0) {
  6565. return Buffer.alloc(0)
  6566. }
  6567. var i
  6568. if (length === undefined) {
  6569. length = 0
  6570. for (i = 0; i < list.length; ++i) {
  6571. length += list[i].length
  6572. }
  6573. }
  6574. var buffer = Buffer.allocUnsafe(length)
  6575. var pos = 0
  6576. for (i = 0; i < list.length; ++i) {
  6577. var buf = list[i]
  6578. if (!Buffer.isBuffer(buf)) {
  6579. throw new TypeError('"list" argument must be an Array of Buffers')
  6580. }
  6581. buf.copy(buffer, pos)
  6582. pos += buf.length
  6583. }
  6584. return buffer
  6585. }
  6586. function byteLength (string, encoding) {
  6587. if (Buffer.isBuffer(string)) {
  6588. return string.length
  6589. }
  6590. if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
  6591. (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
  6592. return string.byteLength
  6593. }
  6594. if (typeof string !== 'string') {
  6595. string = '' + string
  6596. }
  6597. var len = string.length
  6598. if (len === 0) return 0
  6599. // Use a for loop to avoid recursion
  6600. var loweredCase = false
  6601. for (;;) {
  6602. switch (encoding) {
  6603. case 'ascii':
  6604. case 'latin1':
  6605. case 'binary':
  6606. return len
  6607. case 'utf8':
  6608. case 'utf-8':
  6609. case undefined:
  6610. return utf8ToBytes(string).length
  6611. case 'ucs2':
  6612. case 'ucs-2':
  6613. case 'utf16le':
  6614. case 'utf-16le':
  6615. return len * 2
  6616. case 'hex':
  6617. return len >>> 1
  6618. case 'base64':
  6619. return base64ToBytes(string).length
  6620. default:
  6621. if (loweredCase) return utf8ToBytes(string).length // assume utf8
  6622. encoding = ('' + encoding).toLowerCase()
  6623. loweredCase = true
  6624. }
  6625. }
  6626. }
  6627. Buffer.byteLength = byteLength
  6628. function slowToString (encoding, start, end) {
  6629. var loweredCase = false
  6630. // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  6631. // property of a typed array.
  6632. // This behaves neither like String nor Uint8Array in that we set start/end
  6633. // to their upper/lower bounds if the value passed is out of range.
  6634. // undefined is handled specially as per ECMA-262 6th Edition,
  6635. // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  6636. if (start === undefined || start < 0) {
  6637. start = 0
  6638. }
  6639. // Return early if start > this.length. Done here to prevent potential uint32
  6640. // coercion fail below.
  6641. if (start > this.length) {
  6642. return ''
  6643. }
  6644. if (end === undefined || end > this.length) {
  6645. end = this.length
  6646. }
  6647. if (end <= 0) {
  6648. return ''
  6649. }
  6650. // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  6651. end >>>= 0
  6652. start >>>= 0
  6653. if (end <= start) {
  6654. return ''
  6655. }
  6656. if (!encoding) encoding = 'utf8'
  6657. while (true) {
  6658. switch (encoding) {
  6659. case 'hex':
  6660. return hexSlice(this, start, end)
  6661. case 'utf8':
  6662. case 'utf-8':
  6663. return utf8Slice(this, start, end)
  6664. case 'ascii':
  6665. return asciiSlice(this, start, end)
  6666. case 'latin1':
  6667. case 'binary':
  6668. return latin1Slice(this, start, end)
  6669. case 'base64':
  6670. return base64Slice(this, start, end)
  6671. case 'ucs2':
  6672. case 'ucs-2':
  6673. case 'utf16le':
  6674. case 'utf-16le':
  6675. return utf16leSlice(this, start, end)
  6676. default:
  6677. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  6678. encoding = (encoding + '').toLowerCase()
  6679. loweredCase = true
  6680. }
  6681. }
  6682. }
  6683. // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
  6684. // Buffer instances.
  6685. Buffer.prototype._isBuffer = true
  6686. function swap (b, n, m) {
  6687. var i = b[n]
  6688. b[n] = b[m]
  6689. b[m] = i
  6690. }
  6691. Buffer.prototype.swap16 = function swap16 () {
  6692. var len = this.length
  6693. if (len % 2 !== 0) {
  6694. throw new RangeError('Buffer size must be a multiple of 16-bits')
  6695. }
  6696. for (var i = 0; i < len; i += 2) {
  6697. swap(this, i, i + 1)
  6698. }
  6699. return this
  6700. }
  6701. Buffer.prototype.swap32 = function swap32 () {
  6702. var len = this.length
  6703. if (len % 4 !== 0) {
  6704. throw new RangeError('Buffer size must be a multiple of 32-bits')
  6705. }
  6706. for (var i = 0; i < len; i += 4) {
  6707. swap(this, i, i + 3)
  6708. swap(this, i + 1, i + 2)
  6709. }
  6710. return this
  6711. }
  6712. Buffer.prototype.swap64 = function swap64 () {
  6713. var len = this.length
  6714. if (len % 8 !== 0) {
  6715. throw new RangeError('Buffer size must be a multiple of 64-bits')
  6716. }
  6717. for (var i = 0; i < len; i += 8) {
  6718. swap(this, i, i + 7)
  6719. swap(this, i + 1, i + 6)
  6720. swap(this, i + 2, i + 5)
  6721. swap(this, i + 3, i + 4)
  6722. }
  6723. return this
  6724. }
  6725. Buffer.prototype.toString = function toString () {
  6726. var length = this.length | 0
  6727. if (length === 0) return ''
  6728. if (arguments.length === 0) return utf8Slice(this, 0, length)
  6729. return slowToString.apply(this, arguments)
  6730. }
  6731. Buffer.prototype.equals = function equals (b) {
  6732. if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
  6733. if (this === b) return true
  6734. return Buffer.compare(this, b) === 0
  6735. }
  6736. Buffer.prototype.inspect = function inspect () {
  6737. var str = ''
  6738. var max = exports.INSPECT_MAX_BYTES
  6739. if (this.length > 0) {
  6740. str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
  6741. if (this.length > max) str += ' ... '
  6742. }
  6743. return '<Buffer ' + str + '>'
  6744. }
  6745. Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
  6746. if (!Buffer.isBuffer(target)) {
  6747. throw new TypeError('Argument must be a Buffer')
  6748. }
  6749. if (start === undefined) {
  6750. start = 0
  6751. }
  6752. if (end === undefined) {
  6753. end = target ? target.length : 0
  6754. }
  6755. if (thisStart === undefined) {
  6756. thisStart = 0
  6757. }
  6758. if (thisEnd === undefined) {
  6759. thisEnd = this.length
  6760. }
  6761. if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
  6762. throw new RangeError('out of range index')
  6763. }
  6764. if (thisStart >= thisEnd && start >= end) {
  6765. return 0
  6766. }
  6767. if (thisStart >= thisEnd) {
  6768. return -1
  6769. }
  6770. if (start >= end) {
  6771. return 1
  6772. }
  6773. start >>>= 0
  6774. end >>>= 0
  6775. thisStart >>>= 0
  6776. thisEnd >>>= 0
  6777. if (this === target) return 0
  6778. var x = thisEnd - thisStart
  6779. var y = end - start
  6780. var len = Math.min(x, y)
  6781. var thisCopy = this.slice(thisStart, thisEnd)
  6782. var targetCopy = target.slice(start, end)
  6783. for (var i = 0; i < len; ++i) {
  6784. if (thisCopy[i] !== targetCopy[i]) {
  6785. x = thisCopy[i]
  6786. y = targetCopy[i]
  6787. break
  6788. }
  6789. }
  6790. if (x < y) return -1
  6791. if (y < x) return 1
  6792. return 0
  6793. }
  6794. // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
  6795. // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
  6796. //
  6797. // Arguments:
  6798. // - buffer - a Buffer to search
  6799. // - val - a string, Buffer, or number
  6800. // - byteOffset - an index into `buffer`; will be clamped to an int32
  6801. // - encoding - an optional encoding, relevant is val is a string
  6802. // - dir - true for indexOf, false for lastIndexOf
  6803. function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
  6804. // Empty buffer means no match
  6805. if (buffer.length === 0) return -1
  6806. // Normalize byteOffset
  6807. if (typeof byteOffset === 'string') {
  6808. encoding = byteOffset
  6809. byteOffset = 0
  6810. } else if (byteOffset > 0x7fffffff) {
  6811. byteOffset = 0x7fffffff
  6812. } else if (byteOffset < -0x80000000) {
  6813. byteOffset = -0x80000000
  6814. }
  6815. byteOffset = +byteOffset // Coerce to Number.
  6816. if (isNaN(byteOffset)) {
  6817. // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
  6818. byteOffset = dir ? 0 : (buffer.length - 1)
  6819. }
  6820. // Normalize byteOffset: negative offsets start from the end of the buffer
  6821. if (byteOffset < 0) byteOffset = buffer.length + byteOffset
  6822. if (byteOffset >= buffer.length) {
  6823. if (dir) return -1
  6824. else byteOffset = buffer.length - 1
  6825. } else if (byteOffset < 0) {
  6826. if (dir) byteOffset = 0
  6827. else return -1
  6828. }
  6829. // Normalize val
  6830. if (typeof val === 'string') {
  6831. val = Buffer.from(val, encoding)
  6832. }
  6833. // Finally, search either indexOf (if dir is true) or lastIndexOf
  6834. if (Buffer.isBuffer(val)) {
  6835. // Special case: looking for empty string/buffer always fails
  6836. if (val.length === 0) {
  6837. return -1
  6838. }
  6839. return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
  6840. } else if (typeof val === 'number') {
  6841. val = val & 0xFF // Search for a byte value [0-255]
  6842. if (Buffer.TYPED_ARRAY_SUPPORT &&
  6843. typeof Uint8Array.prototype.indexOf === 'function') {
  6844. if (dir) {
  6845. return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
  6846. } else {
  6847. return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
  6848. }
  6849. }
  6850. return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
  6851. }
  6852. throw new TypeError('val must be string, number or Buffer')
  6853. }
  6854. function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
  6855. var indexSize = 1
  6856. var arrLength = arr.length
  6857. var valLength = val.length
  6858. if (encoding !== undefined) {
  6859. encoding = String(encoding).toLowerCase()
  6860. if (encoding === 'ucs2' || encoding === 'ucs-2' ||
  6861. encoding === 'utf16le' || encoding === 'utf-16le') {
  6862. if (arr.length < 2 || val.length < 2) {
  6863. return -1
  6864. }
  6865. indexSize = 2
  6866. arrLength /= 2
  6867. valLength /= 2
  6868. byteOffset /= 2
  6869. }
  6870. }
  6871. function read (buf, i) {
  6872. if (indexSize === 1) {
  6873. return buf[i]
  6874. } else {
  6875. return buf.readUInt16BE(i * indexSize)
  6876. }
  6877. }
  6878. var i
  6879. if (dir) {
  6880. var foundIndex = -1
  6881. for (i = byteOffset; i < arrLength; i++) {
  6882. if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
  6883. if (foundIndex === -1) foundIndex = i
  6884. if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
  6885. } else {
  6886. if (foundIndex !== -1) i -= i - foundIndex
  6887. foundIndex = -1
  6888. }
  6889. }
  6890. } else {
  6891. if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
  6892. for (i = byteOffset; i >= 0; i--) {
  6893. var found = true
  6894. for (var j = 0; j < valLength; j++) {
  6895. if (read(arr, i + j) !== read(val, j)) {
  6896. found = false
  6897. break
  6898. }
  6899. }
  6900. if (found) return i
  6901. }
  6902. }
  6903. return -1
  6904. }
  6905. Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
  6906. return this.indexOf(val, byteOffset, encoding) !== -1
  6907. }
  6908. Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
  6909. return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
  6910. }
  6911. Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
  6912. return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
  6913. }
  6914. function hexWrite (buf, string, offset, length) {
  6915. offset = Number(offset) || 0
  6916. var remaining = buf.length - offset
  6917. if (!length) {
  6918. length = remaining
  6919. } else {
  6920. length = Number(length)
  6921. if (length > remaining) {
  6922. length = remaining
  6923. }
  6924. }
  6925. // must be an even number of digits
  6926. var strLen = string.length
  6927. if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
  6928. if (length > strLen / 2) {
  6929. length = strLen / 2
  6930. }
  6931. for (var i = 0; i < length; ++i) {
  6932. var parsed = parseInt(string.substr(i * 2, 2), 16)
  6933. if (isNaN(parsed)) return i
  6934. buf[offset + i] = parsed
  6935. }
  6936. return i
  6937. }
  6938. function utf8Write (buf, string, offset, length) {
  6939. return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
  6940. }
  6941. function asciiWrite (buf, string, offset, length) {
  6942. return blitBuffer(asciiToBytes(string), buf, offset, length)
  6943. }
  6944. function latin1Write (buf, string, offset, length) {
  6945. return asciiWrite(buf, string, offset, length)
  6946. }
  6947. function base64Write (buf, string, offset, length) {
  6948. return blitBuffer(base64ToBytes(string), buf, offset, length)
  6949. }
  6950. function ucs2Write (buf, string, offset, length) {
  6951. return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
  6952. }
  6953. Buffer.prototype.write = function write (string, offset, length, encoding) {
  6954. // Buffer#write(string)
  6955. if (offset === undefined) {
  6956. encoding = 'utf8'
  6957. length = this.length
  6958. offset = 0
  6959. // Buffer#write(string, encoding)
  6960. } else if (length === undefined && typeof offset === 'string') {
  6961. encoding = offset
  6962. length = this.length
  6963. offset = 0
  6964. // Buffer#write(string, offset[, length][, encoding])
  6965. } else if (isFinite(offset)) {
  6966. offset = offset | 0
  6967. if (isFinite(length)) {
  6968. length = length | 0
  6969. if (encoding === undefined) encoding = 'utf8'
  6970. } else {
  6971. encoding = length
  6972. length = undefined
  6973. }
  6974. // legacy write(string, encoding, offset, length) - remove in v0.13
  6975. } else {
  6976. throw new Error(
  6977. 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
  6978. )
  6979. }
  6980. var remaining = this.length - offset
  6981. if (length === undefined || length > remaining) length = remaining
  6982. if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
  6983. throw new RangeError('Attempt to write outside buffer bounds')
  6984. }
  6985. if (!encoding) encoding = 'utf8'
  6986. var loweredCase = false
  6987. for (;;) {
  6988. switch (encoding) {
  6989. case 'hex':
  6990. return hexWrite(this, string, offset, length)
  6991. case 'utf8':
  6992. case 'utf-8':
  6993. return utf8Write(this, string, offset, length)
  6994. case 'ascii':
  6995. return asciiWrite(this, string, offset, length)
  6996. case 'latin1':
  6997. case 'binary':
  6998. return latin1Write(this, string, offset, length)
  6999. case 'base64':
  7000. // Warning: maxLength not taken into account in base64Write
  7001. return base64Write(this, string, offset, length)
  7002. case 'ucs2':
  7003. case 'ucs-2':
  7004. case 'utf16le':
  7005. case 'utf-16le':
  7006. return ucs2Write(this, string, offset, length)
  7007. default:
  7008. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  7009. encoding = ('' + encoding).toLowerCase()
  7010. loweredCase = true
  7011. }
  7012. }
  7013. }
  7014. Buffer.prototype.toJSON = function toJSON () {
  7015. return {
  7016. type: 'Buffer',
  7017. data: Array.prototype.slice.call(this._arr || this, 0)
  7018. }
  7019. }
  7020. function base64Slice (buf, start, end) {
  7021. if (start === 0 && end === buf.length) {
  7022. return base64.fromByteArray(buf)
  7023. } else {
  7024. return base64.fromByteArray(buf.slice(start, end))
  7025. }
  7026. }
  7027. function utf8Slice (buf, start, end) {
  7028. end = Math.min(buf.length, end)
  7029. var res = []
  7030. var i = start
  7031. while (i < end) {
  7032. var firstByte = buf[i]
  7033. var codePoint = null
  7034. var bytesPerSequence = (firstByte > 0xEF) ? 4
  7035. : (firstByte > 0xDF) ? 3
  7036. : (firstByte > 0xBF) ? 2
  7037. : 1
  7038. if (i + bytesPerSequence <= end) {
  7039. var secondByte, thirdByte, fourthByte, tempCodePoint
  7040. switch (bytesPerSequence) {
  7041. case 1:
  7042. if (firstByte < 0x80) {
  7043. codePoint = firstByte
  7044. }
  7045. break
  7046. case 2:
  7047. secondByte = buf[i + 1]
  7048. if ((secondByte & 0xC0) === 0x80) {
  7049. tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
  7050. if (tempCodePoint > 0x7F) {
  7051. codePoint = tempCodePoint
  7052. }
  7053. }
  7054. break
  7055. case 3:
  7056. secondByte = buf[i + 1]
  7057. thirdByte = buf[i + 2]
  7058. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
  7059. tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
  7060. if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
  7061. codePoint = tempCodePoint
  7062. }
  7063. }
  7064. break
  7065. case 4:
  7066. secondByte = buf[i + 1]
  7067. thirdByte = buf[i + 2]
  7068. fourthByte = buf[i + 3]
  7069. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
  7070. tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
  7071. if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
  7072. codePoint = tempCodePoint
  7073. }
  7074. }
  7075. }
  7076. }
  7077. if (codePoint === null) {
  7078. // we did not generate a valid codePoint so insert a
  7079. // replacement char (U+FFFD) and advance only 1 byte
  7080. codePoint = 0xFFFD
  7081. bytesPerSequence = 1
  7082. } else if (codePoint > 0xFFFF) {
  7083. // encode to utf16 (surrogate pair dance)
  7084. codePoint -= 0x10000
  7085. res.push(codePoint >>> 10 & 0x3FF | 0xD800)
  7086. codePoint = 0xDC00 | codePoint & 0x3FF
  7087. }
  7088. res.push(codePoint)
  7089. i += bytesPerSequence
  7090. }
  7091. return decodeCodePointsArray(res)
  7092. }
  7093. // Based on http://stackoverflow.com/a/22747272/680742, the browser with
  7094. // the lowest limit is Chrome, with 0x10000 args.
  7095. // We go 1 magnitude less, for safety
  7096. var MAX_ARGUMENTS_LENGTH = 0x1000
  7097. function decodeCodePointsArray (codePoints) {
  7098. var len = codePoints.length
  7099. if (len <= MAX_ARGUMENTS_LENGTH) {
  7100. return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
  7101. }
  7102. // Decode in chunks to avoid "call stack size exceeded".
  7103. var res = ''
  7104. var i = 0
  7105. while (i < len) {
  7106. res += String.fromCharCode.apply(
  7107. String,
  7108. codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
  7109. )
  7110. }
  7111. return res
  7112. }
  7113. function asciiSlice (buf, start, end) {
  7114. var ret = ''
  7115. end = Math.min(buf.length, end)
  7116. for (var i = start; i < end; ++i) {
  7117. ret += String.fromCharCode(buf[i] & 0x7F)
  7118. }
  7119. return ret
  7120. }
  7121. function latin1Slice (buf, start, end) {
  7122. var ret = ''
  7123. end = Math.min(buf.length, end)
  7124. for (var i = start; i < end; ++i) {
  7125. ret += String.fromCharCode(buf[i])
  7126. }
  7127. return ret
  7128. }
  7129. function hexSlice (buf, start, end) {
  7130. var len = buf.length
  7131. if (!start || start < 0) start = 0
  7132. if (!end || end < 0 || end > len) end = len
  7133. var out = ''
  7134. for (var i = start; i < end; ++i) {
  7135. out += toHex(buf[i])
  7136. }
  7137. return out
  7138. }
  7139. function utf16leSlice (buf, start, end) {
  7140. var bytes = buf.slice(start, end)
  7141. var res = ''
  7142. for (var i = 0; i < bytes.length; i += 2) {
  7143. res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
  7144. }
  7145. return res
  7146. }
  7147. Buffer.prototype.slice = function slice (start, end) {
  7148. var len = this.length
  7149. start = ~~start
  7150. end = end === undefined ? len : ~~end
  7151. if (start < 0) {
  7152. start += len
  7153. if (start < 0) start = 0
  7154. } else if (start > len) {
  7155. start = len
  7156. }
  7157. if (end < 0) {
  7158. end += len
  7159. if (end < 0) end = 0
  7160. } else if (end > len) {
  7161. end = len
  7162. }
  7163. if (end < start) end = start
  7164. var newBuf
  7165. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7166. newBuf = this.subarray(start, end)
  7167. newBuf.__proto__ = Buffer.prototype
  7168. } else {
  7169. var sliceLen = end - start
  7170. newBuf = new Buffer(sliceLen, undefined)
  7171. for (var i = 0; i < sliceLen; ++i) {
  7172. newBuf[i] = this[i + start]
  7173. }
  7174. }
  7175. return newBuf
  7176. }
  7177. /*
  7178. * Need to make sure that buffer isn't trying to write out of bounds.
  7179. */
  7180. function checkOffset (offset, ext, length) {
  7181. if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
  7182. if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
  7183. }
  7184. Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
  7185. offset = offset | 0
  7186. byteLength = byteLength | 0
  7187. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7188. var val = this[offset]
  7189. var mul = 1
  7190. var i = 0
  7191. while (++i < byteLength && (mul *= 0x100)) {
  7192. val += this[offset + i] * mul
  7193. }
  7194. return val
  7195. }
  7196. Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
  7197. offset = offset | 0
  7198. byteLength = byteLength | 0
  7199. if (!noAssert) {
  7200. checkOffset(offset, byteLength, this.length)
  7201. }
  7202. var val = this[offset + --byteLength]
  7203. var mul = 1
  7204. while (byteLength > 0 && (mul *= 0x100)) {
  7205. val += this[offset + --byteLength] * mul
  7206. }
  7207. return val
  7208. }
  7209. Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
  7210. if (!noAssert) checkOffset(offset, 1, this.length)
  7211. return this[offset]
  7212. }
  7213. Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
  7214. if (!noAssert) checkOffset(offset, 2, this.length)
  7215. return this[offset] | (this[offset + 1] << 8)
  7216. }
  7217. Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
  7218. if (!noAssert) checkOffset(offset, 2, this.length)
  7219. return (this[offset] << 8) | this[offset + 1]
  7220. }
  7221. Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
  7222. if (!noAssert) checkOffset(offset, 4, this.length)
  7223. return ((this[offset]) |
  7224. (this[offset + 1] << 8) |
  7225. (this[offset + 2] << 16)) +
  7226. (this[offset + 3] * 0x1000000)
  7227. }
  7228. Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
  7229. if (!noAssert) checkOffset(offset, 4, this.length)
  7230. return (this[offset] * 0x1000000) +
  7231. ((this[offset + 1] << 16) |
  7232. (this[offset + 2] << 8) |
  7233. this[offset + 3])
  7234. }
  7235. Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
  7236. offset = offset | 0
  7237. byteLength = byteLength | 0
  7238. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7239. var val = this[offset]
  7240. var mul = 1
  7241. var i = 0
  7242. while (++i < byteLength && (mul *= 0x100)) {
  7243. val += this[offset + i] * mul
  7244. }
  7245. mul *= 0x80
  7246. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  7247. return val
  7248. }
  7249. Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
  7250. offset = offset | 0
  7251. byteLength = byteLength | 0
  7252. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7253. var i = byteLength
  7254. var mul = 1
  7255. var val = this[offset + --i]
  7256. while (i > 0 && (mul *= 0x100)) {
  7257. val += this[offset + --i] * mul
  7258. }
  7259. mul *= 0x80
  7260. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  7261. return val
  7262. }
  7263. Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
  7264. if (!noAssert) checkOffset(offset, 1, this.length)
  7265. if (!(this[offset] & 0x80)) return (this[offset])
  7266. return ((0xff - this[offset] + 1) * -1)
  7267. }
  7268. Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
  7269. if (!noAssert) checkOffset(offset, 2, this.length)
  7270. var val = this[offset] | (this[offset + 1] << 8)
  7271. return (val & 0x8000) ? val | 0xFFFF0000 : val
  7272. }
  7273. Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
  7274. if (!noAssert) checkOffset(offset, 2, this.length)
  7275. var val = this[offset + 1] | (this[offset] << 8)
  7276. return (val & 0x8000) ? val | 0xFFFF0000 : val
  7277. }
  7278. Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
  7279. if (!noAssert) checkOffset(offset, 4, this.length)
  7280. return (this[offset]) |
  7281. (this[offset + 1] << 8) |
  7282. (this[offset + 2] << 16) |
  7283. (this[offset + 3] << 24)
  7284. }
  7285. Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
  7286. if (!noAssert) checkOffset(offset, 4, this.length)
  7287. return (this[offset] << 24) |
  7288. (this[offset + 1] << 16) |
  7289. (this[offset + 2] << 8) |
  7290. (this[offset + 3])
  7291. }
  7292. Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
  7293. if (!noAssert) checkOffset(offset, 4, this.length)
  7294. return ieee754.read(this, offset, true, 23, 4)
  7295. }
  7296. Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
  7297. if (!noAssert) checkOffset(offset, 4, this.length)
  7298. return ieee754.read(this, offset, false, 23, 4)
  7299. }
  7300. Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
  7301. if (!noAssert) checkOffset(offset, 8, this.length)
  7302. return ieee754.read(this, offset, true, 52, 8)
  7303. }
  7304. Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
  7305. if (!noAssert) checkOffset(offset, 8, this.length)
  7306. return ieee754.read(this, offset, false, 52, 8)
  7307. }
  7308. function checkInt (buf, value, offset, ext, max, min) {
  7309. if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
  7310. if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
  7311. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  7312. }
  7313. Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
  7314. value = +value
  7315. offset = offset | 0
  7316. byteLength = byteLength | 0
  7317. if (!noAssert) {
  7318. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  7319. checkInt(this, value, offset, byteLength, maxBytes, 0)
  7320. }
  7321. var mul = 1
  7322. var i = 0
  7323. this[offset] = value & 0xFF
  7324. while (++i < byteLength && (mul *= 0x100)) {
  7325. this[offset + i] = (value / mul) & 0xFF
  7326. }
  7327. return offset + byteLength
  7328. }
  7329. Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
  7330. value = +value
  7331. offset = offset | 0
  7332. byteLength = byteLength | 0
  7333. if (!noAssert) {
  7334. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  7335. checkInt(this, value, offset, byteLength, maxBytes, 0)
  7336. }
  7337. var i = byteLength - 1
  7338. var mul = 1
  7339. this[offset + i] = value & 0xFF
  7340. while (--i >= 0 && (mul *= 0x100)) {
  7341. this[offset + i] = (value / mul) & 0xFF
  7342. }
  7343. return offset + byteLength
  7344. }
  7345. Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
  7346. value = +value
  7347. offset = offset | 0
  7348. if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
  7349. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  7350. this[offset] = (value & 0xff)
  7351. return offset + 1
  7352. }
  7353. function objectWriteUInt16 (buf, value, offset, littleEndian) {
  7354. if (value < 0) value = 0xffff + value + 1
  7355. for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
  7356. buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
  7357. (littleEndian ? i : 1 - i) * 8
  7358. }
  7359. }
  7360. Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
  7361. value = +value
  7362. offset = offset | 0
  7363. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  7364. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7365. this[offset] = (value & 0xff)
  7366. this[offset + 1] = (value >>> 8)
  7367. } else {
  7368. objectWriteUInt16(this, value, offset, true)
  7369. }
  7370. return offset + 2
  7371. }
  7372. Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
  7373. value = +value
  7374. offset = offset | 0
  7375. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  7376. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7377. this[offset] = (value >>> 8)
  7378. this[offset + 1] = (value & 0xff)
  7379. } else {
  7380. objectWriteUInt16(this, value, offset, false)
  7381. }
  7382. return offset + 2
  7383. }
  7384. function objectWriteUInt32 (buf, value, offset, littleEndian) {
  7385. if (value < 0) value = 0xffffffff + value + 1
  7386. for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
  7387. buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
  7388. }
  7389. }
  7390. Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
  7391. value = +value
  7392. offset = offset | 0
  7393. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  7394. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7395. this[offset + 3] = (value >>> 24)
  7396. this[offset + 2] = (value >>> 16)
  7397. this[offset + 1] = (value >>> 8)
  7398. this[offset] = (value & 0xff)
  7399. } else {
  7400. objectWriteUInt32(this, value, offset, true)
  7401. }
  7402. return offset + 4
  7403. }
  7404. Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
  7405. value = +value
  7406. offset = offset | 0
  7407. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  7408. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7409. this[offset] = (value >>> 24)
  7410. this[offset + 1] = (value >>> 16)
  7411. this[offset + 2] = (value >>> 8)
  7412. this[offset + 3] = (value & 0xff)
  7413. } else {
  7414. objectWriteUInt32(this, value, offset, false)
  7415. }
  7416. return offset + 4
  7417. }
  7418. Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
  7419. value = +value
  7420. offset = offset | 0
  7421. if (!noAssert) {
  7422. var limit = Math.pow(2, 8 * byteLength - 1)
  7423. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  7424. }
  7425. var i = 0
  7426. var mul = 1
  7427. var sub = 0
  7428. this[offset] = value & 0xFF
  7429. while (++i < byteLength && (mul *= 0x100)) {
  7430. if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
  7431. sub = 1
  7432. }
  7433. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  7434. }
  7435. return offset + byteLength
  7436. }
  7437. Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
  7438. value = +value
  7439. offset = offset | 0
  7440. if (!noAssert) {
  7441. var limit = Math.pow(2, 8 * byteLength - 1)
  7442. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  7443. }
  7444. var i = byteLength - 1
  7445. var mul = 1
  7446. var sub = 0
  7447. this[offset + i] = value & 0xFF
  7448. while (--i >= 0 && (mul *= 0x100)) {
  7449. if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
  7450. sub = 1
  7451. }
  7452. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  7453. }
  7454. return offset + byteLength
  7455. }
  7456. Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
  7457. value = +value
  7458. offset = offset | 0
  7459. if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
  7460. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  7461. if (value < 0) value = 0xff + value + 1
  7462. this[offset] = (value & 0xff)
  7463. return offset + 1
  7464. }
  7465. Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
  7466. value = +value
  7467. offset = offset | 0
  7468. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  7469. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7470. this[offset] = (value & 0xff)
  7471. this[offset + 1] = (value >>> 8)
  7472. } else {
  7473. objectWriteUInt16(this, value, offset, true)
  7474. }
  7475. return offset + 2
  7476. }
  7477. Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
  7478. value = +value
  7479. offset = offset | 0
  7480. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  7481. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7482. this[offset] = (value >>> 8)
  7483. this[offset + 1] = (value & 0xff)
  7484. } else {
  7485. objectWriteUInt16(this, value, offset, false)
  7486. }
  7487. return offset + 2
  7488. }
  7489. Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
  7490. value = +value
  7491. offset = offset | 0
  7492. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  7493. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7494. this[offset] = (value & 0xff)
  7495. this[offset + 1] = (value >>> 8)
  7496. this[offset + 2] = (value >>> 16)
  7497. this[offset + 3] = (value >>> 24)
  7498. } else {
  7499. objectWriteUInt32(this, value, offset, true)
  7500. }
  7501. return offset + 4
  7502. }
  7503. Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
  7504. value = +value
  7505. offset = offset | 0
  7506. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  7507. if (value < 0) value = 0xffffffff + value + 1
  7508. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7509. this[offset] = (value >>> 24)
  7510. this[offset + 1] = (value >>> 16)
  7511. this[offset + 2] = (value >>> 8)
  7512. this[offset + 3] = (value & 0xff)
  7513. } else {
  7514. objectWriteUInt32(this, value, offset, false)
  7515. }
  7516. return offset + 4
  7517. }
  7518. function checkIEEE754 (buf, value, offset, ext, max, min) {
  7519. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  7520. if (offset < 0) throw new RangeError('Index out of range')
  7521. }
  7522. function writeFloat (buf, value, offset, littleEndian, noAssert) {
  7523. if (!noAssert) {
  7524. checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
  7525. }
  7526. ieee754.write(buf, value, offset, littleEndian, 23, 4)
  7527. return offset + 4
  7528. }
  7529. Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
  7530. return writeFloat(this, value, offset, true, noAssert)
  7531. }
  7532. Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
  7533. return writeFloat(this, value, offset, false, noAssert)
  7534. }
  7535. function writeDouble (buf, value, offset, littleEndian, noAssert) {
  7536. if (!noAssert) {
  7537. checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
  7538. }
  7539. ieee754.write(buf, value, offset, littleEndian, 52, 8)
  7540. return offset + 8
  7541. }
  7542. Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
  7543. return writeDouble(this, value, offset, true, noAssert)
  7544. }
  7545. Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
  7546. return writeDouble(this, value, offset, false, noAssert)
  7547. }
  7548. // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
  7549. Buffer.prototype.copy = function copy (target, targetStart, start, end) {
  7550. if (!start) start = 0
  7551. if (!end && end !== 0) end = this.length
  7552. if (targetStart >= target.length) targetStart = target.length
  7553. if (!targetStart) targetStart = 0
  7554. if (end > 0 && end < start) end = start
  7555. // Copy 0 bytes; we're done
  7556. if (end === start) return 0
  7557. if (target.length === 0 || this.length === 0) return 0
  7558. // Fatal error conditions
  7559. if (targetStart < 0) {
  7560. throw new RangeError('targetStart out of bounds')
  7561. }
  7562. if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
  7563. if (end < 0) throw new RangeError('sourceEnd out of bounds')
  7564. // Are we oob?
  7565. if (end > this.length) end = this.length
  7566. if (target.length - targetStart < end - start) {
  7567. end = target.length - targetStart + start
  7568. }
  7569. var len = end - start
  7570. var i
  7571. if (this === target && start < targetStart && targetStart < end) {
  7572. // descending copy from end
  7573. for (i = len - 1; i >= 0; --i) {
  7574. target[i + targetStart] = this[i + start]
  7575. }
  7576. } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
  7577. // ascending copy from start
  7578. for (i = 0; i < len; ++i) {
  7579. target[i + targetStart] = this[i + start]
  7580. }
  7581. } else {
  7582. Uint8Array.prototype.set.call(
  7583. target,
  7584. this.subarray(start, start + len),
  7585. targetStart
  7586. )
  7587. }
  7588. return len
  7589. }
  7590. // Usage:
  7591. // buffer.fill(number[, offset[, end]])
  7592. // buffer.fill(buffer[, offset[, end]])
  7593. // buffer.fill(string[, offset[, end]][, encoding])
  7594. Buffer.prototype.fill = function fill (val, start, end, encoding) {
  7595. // Handle string cases:
  7596. if (typeof val === 'string') {
  7597. if (typeof start === 'string') {
  7598. encoding = start
  7599. start = 0
  7600. end = this.length
  7601. } else if (typeof end === 'string') {
  7602. encoding = end
  7603. end = this.length
  7604. }
  7605. if (val.length === 1) {
  7606. var code = val.charCodeAt(0)
  7607. if (code < 256) {
  7608. val = code
  7609. }
  7610. }
  7611. if (encoding !== undefined && typeof encoding !== 'string') {
  7612. throw new TypeError('encoding must be a string')
  7613. }
  7614. if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
  7615. throw new TypeError('Unknown encoding: ' + encoding)
  7616. }
  7617. } else if (typeof val === 'number') {
  7618. val = val & 255
  7619. }
  7620. // Invalid ranges are not set to a default, so can range check early.
  7621. if (start < 0 || this.length < start || this.length < end) {
  7622. throw new RangeError('Out of range index')
  7623. }
  7624. if (end <= start) {
  7625. return this
  7626. }
  7627. start = start >>> 0
  7628. end = end === undefined ? this.length : end >>> 0
  7629. if (!val) val = 0
  7630. var i
  7631. if (typeof val === 'number') {
  7632. for (i = start; i < end; ++i) {
  7633. this[i] = val
  7634. }
  7635. } else {
  7636. var bytes = Buffer.isBuffer(val)
  7637. ? val
  7638. : utf8ToBytes(new Buffer(val, encoding).toString())
  7639. var len = bytes.length
  7640. for (i = 0; i < end - start; ++i) {
  7641. this[i + start] = bytes[i % len]
  7642. }
  7643. }
  7644. return this
  7645. }
  7646. // HELPER FUNCTIONS
  7647. // ================
  7648. var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
  7649. function base64clean (str) {
  7650. // Node strips out invalid characters like \n and \t from the string, base64-js does not
  7651. str = stringtrim(str).replace(INVALID_BASE64_RE, '')
  7652. // Node converts strings with length < 2 to ''
  7653. if (str.length < 2) return ''
  7654. // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  7655. while (str.length % 4 !== 0) {
  7656. str = str + '='
  7657. }
  7658. return str
  7659. }
  7660. function stringtrim (str) {
  7661. if (str.trim) return str.trim()
  7662. return str.replace(/^\s+|\s+$/g, '')
  7663. }
  7664. function toHex (n) {
  7665. if (n < 16) return '0' + n.toString(16)
  7666. return n.toString(16)
  7667. }
  7668. function utf8ToBytes (string, units) {
  7669. units = units || Infinity
  7670. var codePoint
  7671. var length = string.length
  7672. var leadSurrogate = null
  7673. var bytes = []
  7674. for (var i = 0; i < length; ++i) {
  7675. codePoint = string.charCodeAt(i)
  7676. // is surrogate component
  7677. if (codePoint > 0xD7FF && codePoint < 0xE000) {
  7678. // last char was a lead
  7679. if (!leadSurrogate) {
  7680. // no lead yet
  7681. if (codePoint > 0xDBFF) {
  7682. // unexpected trail
  7683. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7684. continue
  7685. } else if (i + 1 === length) {
  7686. // unpaired lead
  7687. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7688. continue
  7689. }
  7690. // valid lead
  7691. leadSurrogate = codePoint
  7692. continue
  7693. }
  7694. // 2 leads in a row
  7695. if (codePoint < 0xDC00) {
  7696. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7697. leadSurrogate = codePoint
  7698. continue
  7699. }
  7700. // valid surrogate pair
  7701. codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
  7702. } else if (leadSurrogate) {
  7703. // valid bmp char, but last char was a lead
  7704. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7705. }
  7706. leadSurrogate = null
  7707. // encode utf8
  7708. if (codePoint < 0x80) {
  7709. if ((units -= 1) < 0) break
  7710. bytes.push(codePoint)
  7711. } else if (codePoint < 0x800) {
  7712. if ((units -= 2) < 0) break
  7713. bytes.push(
  7714. codePoint >> 0x6 | 0xC0,
  7715. codePoint & 0x3F | 0x80
  7716. )
  7717. } else if (codePoint < 0x10000) {
  7718. if ((units -= 3) < 0) break
  7719. bytes.push(
  7720. codePoint >> 0xC | 0xE0,
  7721. codePoint >> 0x6 & 0x3F | 0x80,
  7722. codePoint & 0x3F | 0x80
  7723. )
  7724. } else if (codePoint < 0x110000) {
  7725. if ((units -= 4) < 0) break
  7726. bytes.push(
  7727. codePoint >> 0x12 | 0xF0,
  7728. codePoint >> 0xC & 0x3F | 0x80,
  7729. codePoint >> 0x6 & 0x3F | 0x80,
  7730. codePoint & 0x3F | 0x80
  7731. )
  7732. } else {
  7733. throw new Error('Invalid code point')
  7734. }
  7735. }
  7736. return bytes
  7737. }
  7738. function asciiToBytes (str) {
  7739. var byteArray = []
  7740. for (var i = 0; i < str.length; ++i) {
  7741. // Node's code seems to be doing this and not & 0x7F..
  7742. byteArray.push(str.charCodeAt(i) & 0xFF)
  7743. }
  7744. return byteArray
  7745. }
  7746. function utf16leToBytes (str, units) {
  7747. var c, hi, lo
  7748. var byteArray = []
  7749. for (var i = 0; i < str.length; ++i) {
  7750. if ((units -= 2) < 0) break
  7751. c = str.charCodeAt(i)
  7752. hi = c >> 8
  7753. lo = c % 256
  7754. byteArray.push(lo)
  7755. byteArray.push(hi)
  7756. }
  7757. return byteArray
  7758. }
  7759. function base64ToBytes (str) {
  7760. return base64.toByteArray(base64clean(str))
  7761. }
  7762. function blitBuffer (src, dst, offset, length) {
  7763. for (var i = 0; i < length; ++i) {
  7764. if ((i + offset >= dst.length) || (i >= src.length)) break
  7765. dst[i + offset] = src[i]
  7766. }
  7767. return i
  7768. }
  7769. function isnan (val) {
  7770. return val !== val // eslint-disable-line no-self-compare
  7771. }
  7772. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  7773. /***/ }),
  7774. /***/ "./node_modules/clipboard/dist/clipboard.js":
  7775. /*!**************************************************!*\
  7776. !*** ./node_modules/clipboard/dist/clipboard.js ***!
  7777. \**************************************************/
  7778. /*! no static exports found */
  7779. /***/ (function(module, exports, __webpack_require__) {
  7780. /*!
  7781. * clipboard.js v2.0.4
  7782. * https://zenorocha.github.io/clipboard.js
  7783. *
  7784. * Licensed MIT © Zeno Rocha
  7785. */
  7786. (function webpackUniversalModuleDefinition(root, factory) {
  7787. if(true)
  7788. module.exports = factory();
  7789. else {}
  7790. })(this, function() {
  7791. return /******/ (function(modules) { // webpackBootstrap
  7792. /******/ // The module cache
  7793. /******/ var installedModules = {};
  7794. /******/
  7795. /******/ // The require function
  7796. /******/ function __webpack_require__(moduleId) {
  7797. /******/
  7798. /******/ // Check if module is in cache
  7799. /******/ if(installedModules[moduleId]) {
  7800. /******/ return installedModules[moduleId].exports;
  7801. /******/ }
  7802. /******/ // Create a new module (and put it into the cache)
  7803. /******/ var module = installedModules[moduleId] = {
  7804. /******/ i: moduleId,
  7805. /******/ l: false,
  7806. /******/ exports: {}
  7807. /******/ };
  7808. /******/
  7809. /******/ // Execute the module function
  7810. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  7811. /******/
  7812. /******/ // Flag the module as loaded
  7813. /******/ module.l = true;
  7814. /******/
  7815. /******/ // Return the exports of the module
  7816. /******/ return module.exports;
  7817. /******/ }
  7818. /******/
  7819. /******/
  7820. /******/ // expose the modules object (__webpack_modules__)
  7821. /******/ __webpack_require__.m = modules;
  7822. /******/
  7823. /******/ // expose the module cache
  7824. /******/ __webpack_require__.c = installedModules;
  7825. /******/
  7826. /******/ // define getter function for harmony exports
  7827. /******/ __webpack_require__.d = function(exports, name, getter) {
  7828. /******/ if(!__webpack_require__.o(exports, name)) {
  7829. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  7830. /******/ }
  7831. /******/ };
  7832. /******/
  7833. /******/ // define __esModule on exports
  7834. /******/ __webpack_require__.r = function(exports) {
  7835. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  7836. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  7837. /******/ }
  7838. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  7839. /******/ };
  7840. /******/
  7841. /******/ // create a fake namespace object
  7842. /******/ // mode & 1: value is a module id, require it
  7843. /******/ // mode & 2: merge all properties of value into the ns
  7844. /******/ // mode & 4: return value when already ns object
  7845. /******/ // mode & 8|1: behave like require
  7846. /******/ __webpack_require__.t = function(value, mode) {
  7847. /******/ if(mode & 1) value = __webpack_require__(value);
  7848. /******/ if(mode & 8) return value;
  7849. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  7850. /******/ var ns = Object.create(null);
  7851. /******/ __webpack_require__.r(ns);
  7852. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  7853. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  7854. /******/ return ns;
  7855. /******/ };
  7856. /******/
  7857. /******/ // getDefaultExport function for compatibility with non-harmony modules
  7858. /******/ __webpack_require__.n = function(module) {
  7859. /******/ var getter = module && module.__esModule ?
  7860. /******/ function getDefault() { return module['default']; } :
  7861. /******/ function getModuleExports() { return module; };
  7862. /******/ __webpack_require__.d(getter, 'a', getter);
  7863. /******/ return getter;
  7864. /******/ };
  7865. /******/
  7866. /******/ // Object.prototype.hasOwnProperty.call
  7867. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  7868. /******/
  7869. /******/ // __webpack_public_path__
  7870. /******/ __webpack_require__.p = "";
  7871. /******/
  7872. /******/
  7873. /******/ // Load entry module and return exports
  7874. /******/ return __webpack_require__(__webpack_require__.s = 0);
  7875. /******/ })
  7876. /************************************************************************/
  7877. /******/ ([
  7878. /* 0 */
  7879. /***/ (function(module, exports, __webpack_require__) {
  7880. "use strict";
  7881. 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; };
  7882. 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; }; }();
  7883. var _clipboardAction = __webpack_require__(1);
  7884. var _clipboardAction2 = _interopRequireDefault(_clipboardAction);
  7885. var _tinyEmitter = __webpack_require__(3);
  7886. var _tinyEmitter2 = _interopRequireDefault(_tinyEmitter);
  7887. var _goodListener = __webpack_require__(4);
  7888. var _goodListener2 = _interopRequireDefault(_goodListener);
  7889. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7890. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7891. 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; }
  7892. 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; }
  7893. /**
  7894. * Base class which takes one or more elements, adds event listeners to them,
  7895. * and instantiates a new `ClipboardAction` on each click.
  7896. */
  7897. var Clipboard = function (_Emitter) {
  7898. _inherits(Clipboard, _Emitter);
  7899. /**
  7900. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  7901. * @param {Object} options
  7902. */
  7903. function Clipboard(trigger, options) {
  7904. _classCallCheck(this, Clipboard);
  7905. var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this));
  7906. _this.resolveOptions(options);
  7907. _this.listenClick(trigger);
  7908. return _this;
  7909. }
  7910. /**
  7911. * Defines if attributes would be resolved using internal setter functions
  7912. * or custom functions that were passed in the constructor.
  7913. * @param {Object} options
  7914. */
  7915. _createClass(Clipboard, [{
  7916. key: 'resolveOptions',
  7917. value: function resolveOptions() {
  7918. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  7919. this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
  7920. this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
  7921. this.text = typeof options.text === 'function' ? options.text : this.defaultText;
  7922. this.container = _typeof(options.container) === 'object' ? options.container : document.body;
  7923. }
  7924. /**
  7925. * Adds a click event listener to the passed trigger.
  7926. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  7927. */
  7928. }, {
  7929. key: 'listenClick',
  7930. value: function listenClick(trigger) {
  7931. var _this2 = this;
  7932. this.listener = (0, _goodListener2.default)(trigger, 'click', function (e) {
  7933. return _this2.onClick(e);
  7934. });
  7935. }
  7936. /**
  7937. * Defines a new `ClipboardAction` on each click event.
  7938. * @param {Event} e
  7939. */
  7940. }, {
  7941. key: 'onClick',
  7942. value: function onClick(e) {
  7943. var trigger = e.delegateTarget || e.currentTarget;
  7944. if (this.clipboardAction) {
  7945. this.clipboardAction = null;
  7946. }
  7947. this.clipboardAction = new _clipboardAction2.default({
  7948. action: this.action(trigger),
  7949. target: this.target(trigger),
  7950. text: this.text(trigger),
  7951. container: this.container,
  7952. trigger: trigger,
  7953. emitter: this
  7954. });
  7955. }
  7956. /**
  7957. * Default `action` lookup function.
  7958. * @param {Element} trigger
  7959. */
  7960. }, {
  7961. key: 'defaultAction',
  7962. value: function defaultAction(trigger) {
  7963. return getAttributeValue('action', trigger);
  7964. }
  7965. /**
  7966. * Default `target` lookup function.
  7967. * @param {Element} trigger
  7968. */
  7969. }, {
  7970. key: 'defaultTarget',
  7971. value: function defaultTarget(trigger) {
  7972. var selector = getAttributeValue('target', trigger);
  7973. if (selector) {
  7974. return document.querySelector(selector);
  7975. }
  7976. }
  7977. /**
  7978. * Returns the support of the given action, or all actions if no action is
  7979. * given.
  7980. * @param {String} [action]
  7981. */
  7982. }, {
  7983. key: 'defaultText',
  7984. /**
  7985. * Default `text` lookup function.
  7986. * @param {Element} trigger
  7987. */
  7988. value: function defaultText(trigger) {
  7989. return getAttributeValue('text', trigger);
  7990. }
  7991. /**
  7992. * Destroy lifecycle.
  7993. */
  7994. }, {
  7995. key: 'destroy',
  7996. value: function destroy() {
  7997. this.listener.destroy();
  7998. if (this.clipboardAction) {
  7999. this.clipboardAction.destroy();
  8000. this.clipboardAction = null;
  8001. }
  8002. }
  8003. }], [{
  8004. key: 'isSupported',
  8005. value: function isSupported() {
  8006. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut'];
  8007. var actions = typeof action === 'string' ? [action] : action;
  8008. var support = !!document.queryCommandSupported;
  8009. actions.forEach(function (action) {
  8010. support = support && !!document.queryCommandSupported(action);
  8011. });
  8012. return support;
  8013. }
  8014. }]);
  8015. return Clipboard;
  8016. }(_tinyEmitter2.default);
  8017. /**
  8018. * Helper function to retrieve attribute value.
  8019. * @param {String} suffix
  8020. * @param {Element} element
  8021. */
  8022. function getAttributeValue(suffix, element) {
  8023. var attribute = 'data-clipboard-' + suffix;
  8024. if (!element.hasAttribute(attribute)) {
  8025. return;
  8026. }
  8027. return element.getAttribute(attribute);
  8028. }
  8029. module.exports = Clipboard;
  8030. /***/ }),
  8031. /* 1 */
  8032. /***/ (function(module, exports, __webpack_require__) {
  8033. "use strict";
  8034. 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; };
  8035. 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; }; }();
  8036. var _select = __webpack_require__(2);
  8037. var _select2 = _interopRequireDefault(_select);
  8038. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8039. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8040. /**
  8041. * Inner class which performs selection from either `text` or `target`
  8042. * properties and then executes copy or cut operations.
  8043. */
  8044. var ClipboardAction = function () {
  8045. /**
  8046. * @param {Object} options
  8047. */
  8048. function ClipboardAction(options) {
  8049. _classCallCheck(this, ClipboardAction);
  8050. this.resolveOptions(options);
  8051. this.initSelection();
  8052. }
  8053. /**
  8054. * Defines base properties passed from constructor.
  8055. * @param {Object} options
  8056. */
  8057. _createClass(ClipboardAction, [{
  8058. key: 'resolveOptions',
  8059. value: function resolveOptions() {
  8060. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  8061. this.action = options.action;
  8062. this.container = options.container;
  8063. this.emitter = options.emitter;
  8064. this.target = options.target;
  8065. this.text = options.text;
  8066. this.trigger = options.trigger;
  8067. this.selectedText = '';
  8068. }
  8069. /**
  8070. * Decides which selection strategy is going to be applied based
  8071. * on the existence of `text` and `target` properties.
  8072. */
  8073. }, {
  8074. key: 'initSelection',
  8075. value: function initSelection() {
  8076. if (this.text) {
  8077. this.selectFake();
  8078. } else if (this.target) {
  8079. this.selectTarget();
  8080. }
  8081. }
  8082. /**
  8083. * Creates a fake textarea element, sets its value from `text` property,
  8084. * and makes a selection on it.
  8085. */
  8086. }, {
  8087. key: 'selectFake',
  8088. value: function selectFake() {
  8089. var _this = this;
  8090. var isRTL = document.documentElement.getAttribute('dir') == 'rtl';
  8091. this.removeFake();
  8092. this.fakeHandlerCallback = function () {
  8093. return _this.removeFake();
  8094. };
  8095. this.fakeHandler = this.container.addEventListener('click', this.fakeHandlerCallback) || true;
  8096. this.fakeElem = document.createElement('textarea');
  8097. // Prevent zooming on iOS
  8098. this.fakeElem.style.fontSize = '12pt';
  8099. // Reset box model
  8100. this.fakeElem.style.border = '0';
  8101. this.fakeElem.style.padding = '0';
  8102. this.fakeElem.style.margin = '0';
  8103. // Move element out of screen horizontally
  8104. this.fakeElem.style.position = 'absolute';
  8105. this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
  8106. // Move element to the same position vertically
  8107. var yPosition = window.pageYOffset || document.documentElement.scrollTop;
  8108. this.fakeElem.style.top = yPosition + 'px';
  8109. this.fakeElem.setAttribute('readonly', '');
  8110. this.fakeElem.value = this.text;
  8111. this.container.appendChild(this.fakeElem);
  8112. this.selectedText = (0, _select2.default)(this.fakeElem);
  8113. this.copyText();
  8114. }
  8115. /**
  8116. * Only removes the fake element after another click event, that way
  8117. * a user can hit `Ctrl+C` to copy because selection still exists.
  8118. */
  8119. }, {
  8120. key: 'removeFake',
  8121. value: function removeFake() {
  8122. if (this.fakeHandler) {
  8123. this.container.removeEventListener('click', this.fakeHandlerCallback);
  8124. this.fakeHandler = null;
  8125. this.fakeHandlerCallback = null;
  8126. }
  8127. if (this.fakeElem) {
  8128. this.container.removeChild(this.fakeElem);
  8129. this.fakeElem = null;
  8130. }
  8131. }
  8132. /**
  8133. * Selects the content from element passed on `target` property.
  8134. */
  8135. }, {
  8136. key: 'selectTarget',
  8137. value: function selectTarget() {
  8138. this.selectedText = (0, _select2.default)(this.target);
  8139. this.copyText();
  8140. }
  8141. /**
  8142. * Executes the copy operation based on the current selection.
  8143. */
  8144. }, {
  8145. key: 'copyText',
  8146. value: function copyText() {
  8147. var succeeded = void 0;
  8148. try {
  8149. succeeded = document.execCommand(this.action);
  8150. } catch (err) {
  8151. succeeded = false;
  8152. }
  8153. this.handleResult(succeeded);
  8154. }
  8155. /**
  8156. * Fires an event based on the copy operation result.
  8157. * @param {Boolean} succeeded
  8158. */
  8159. }, {
  8160. key: 'handleResult',
  8161. value: function handleResult(succeeded) {
  8162. this.emitter.emit(succeeded ? 'success' : 'error', {
  8163. action: this.action,
  8164. text: this.selectedText,
  8165. trigger: this.trigger,
  8166. clearSelection: this.clearSelection.bind(this)
  8167. });
  8168. }
  8169. /**
  8170. * Moves focus away from `target` and back to the trigger, removes current selection.
  8171. */
  8172. }, {
  8173. key: 'clearSelection',
  8174. value: function clearSelection() {
  8175. if (this.trigger) {
  8176. this.trigger.focus();
  8177. }
  8178. window.getSelection().removeAllRanges();
  8179. }
  8180. /**
  8181. * Sets the `action` to be performed which can be either 'copy' or 'cut'.
  8182. * @param {String} action
  8183. */
  8184. }, {
  8185. key: 'destroy',
  8186. /**
  8187. * Destroy lifecycle.
  8188. */
  8189. value: function destroy() {
  8190. this.removeFake();
  8191. }
  8192. }, {
  8193. key: 'action',
  8194. set: function set() {
  8195. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy';
  8196. this._action = action;
  8197. if (this._action !== 'copy' && this._action !== 'cut') {
  8198. throw new Error('Invalid "action" value, use either "copy" or "cut"');
  8199. }
  8200. }
  8201. /**
  8202. * Gets the `action` property.
  8203. * @return {String}
  8204. */
  8205. ,
  8206. get: function get() {
  8207. return this._action;
  8208. }
  8209. /**
  8210. * Sets the `target` property using an element
  8211. * that will be have its content copied.
  8212. * @param {Element} target
  8213. */
  8214. }, {
  8215. key: 'target',
  8216. set: function set(target) {
  8217. if (target !== undefined) {
  8218. if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target.nodeType === 1) {
  8219. if (this.action === 'copy' && target.hasAttribute('disabled')) {
  8220. throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');
  8221. }
  8222. if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) {
  8223. throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');
  8224. }
  8225. this._target = target;
  8226. } else {
  8227. throw new Error('Invalid "target" value, use a valid Element');
  8228. }
  8229. }
  8230. }
  8231. /**
  8232. * Gets the `target` property.
  8233. * @return {String|HTMLElement}
  8234. */
  8235. ,
  8236. get: function get() {
  8237. return this._target;
  8238. }
  8239. }]);
  8240. return ClipboardAction;
  8241. }();
  8242. module.exports = ClipboardAction;
  8243. /***/ }),
  8244. /* 2 */
  8245. /***/ (function(module, exports) {
  8246. function select(element) {
  8247. var selectedText;
  8248. if (element.nodeName === 'SELECT') {
  8249. element.focus();
  8250. selectedText = element.value;
  8251. }
  8252. else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
  8253. var isReadOnly = element.hasAttribute('readonly');
  8254. if (!isReadOnly) {
  8255. element.setAttribute('readonly', '');
  8256. }
  8257. element.select();
  8258. element.setSelectionRange(0, element.value.length);
  8259. if (!isReadOnly) {
  8260. element.removeAttribute('readonly');
  8261. }
  8262. selectedText = element.value;
  8263. }
  8264. else {
  8265. if (element.hasAttribute('contenteditable')) {
  8266. element.focus();
  8267. }
  8268. var selection = window.getSelection();
  8269. var range = document.createRange();
  8270. range.selectNodeContents(element);
  8271. selection.removeAllRanges();
  8272. selection.addRange(range);
  8273. selectedText = selection.toString();
  8274. }
  8275. return selectedText;
  8276. }
  8277. module.exports = select;
  8278. /***/ }),
  8279. /* 3 */
  8280. /***/ (function(module, exports) {
  8281. function E () {
  8282. // Keep this empty so it's easier to inherit from
  8283. // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
  8284. }
  8285. E.prototype = {
  8286. on: function (name, callback, ctx) {
  8287. var e = this.e || (this.e = {});
  8288. (e[name] || (e[name] = [])).push({
  8289. fn: callback,
  8290. ctx: ctx
  8291. });
  8292. return this;
  8293. },
  8294. once: function (name, callback, ctx) {
  8295. var self = this;
  8296. function listener () {
  8297. self.off(name, listener);
  8298. callback.apply(ctx, arguments);
  8299. };
  8300. listener._ = callback
  8301. return this.on(name, listener, ctx);
  8302. },
  8303. emit: function (name) {
  8304. var data = [].slice.call(arguments, 1);
  8305. var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
  8306. var i = 0;
  8307. var len = evtArr.length;
  8308. for (i; i < len; i++) {
  8309. evtArr[i].fn.apply(evtArr[i].ctx, data);
  8310. }
  8311. return this;
  8312. },
  8313. off: function (name, callback) {
  8314. var e = this.e || (this.e = {});
  8315. var evts = e[name];
  8316. var liveEvents = [];
  8317. if (evts && callback) {
  8318. for (var i = 0, len = evts.length; i < len; i++) {
  8319. if (evts[i].fn !== callback && evts[i].fn._ !== callback)
  8320. liveEvents.push(evts[i]);
  8321. }
  8322. }
  8323. // Remove event from queue to prevent memory leak
  8324. // Suggested by https://github.com/lazd
  8325. // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
  8326. (liveEvents.length)
  8327. ? e[name] = liveEvents
  8328. : delete e[name];
  8329. return this;
  8330. }
  8331. };
  8332. module.exports = E;
  8333. /***/ }),
  8334. /* 4 */
  8335. /***/ (function(module, exports, __webpack_require__) {
  8336. var is = __webpack_require__(5);
  8337. var delegate = __webpack_require__(6);
  8338. /**
  8339. * Validates all params and calls the right
  8340. * listener function based on its target type.
  8341. *
  8342. * @param {String|HTMLElement|HTMLCollection|NodeList} target
  8343. * @param {String} type
  8344. * @param {Function} callback
  8345. * @return {Object}
  8346. */
  8347. function listen(target, type, callback) {
  8348. if (!target && !type && !callback) {
  8349. throw new Error('Missing required arguments');
  8350. }
  8351. if (!is.string(type)) {
  8352. throw new TypeError('Second argument must be a String');
  8353. }
  8354. if (!is.fn(callback)) {
  8355. throw new TypeError('Third argument must be a Function');
  8356. }
  8357. if (is.node(target)) {
  8358. return listenNode(target, type, callback);
  8359. }
  8360. else if (is.nodeList(target)) {
  8361. return listenNodeList(target, type, callback);
  8362. }
  8363. else if (is.string(target)) {
  8364. return listenSelector(target, type, callback);
  8365. }
  8366. else {
  8367. throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList');
  8368. }
  8369. }
  8370. /**
  8371. * Adds an event listener to a HTML element
  8372. * and returns a remove listener function.
  8373. *
  8374. * @param {HTMLElement} node
  8375. * @param {String} type
  8376. * @param {Function} callback
  8377. * @return {Object}
  8378. */
  8379. function listenNode(node, type, callback) {
  8380. node.addEventListener(type, callback);
  8381. return {
  8382. destroy: function() {
  8383. node.removeEventListener(type, callback);
  8384. }
  8385. }
  8386. }
  8387. /**
  8388. * Add an event listener to a list of HTML elements
  8389. * and returns a remove listener function.
  8390. *
  8391. * @param {NodeList|HTMLCollection} nodeList
  8392. * @param {String} type
  8393. * @param {Function} callback
  8394. * @return {Object}
  8395. */
  8396. function listenNodeList(nodeList, type, callback) {
  8397. Array.prototype.forEach.call(nodeList, function(node) {
  8398. node.addEventListener(type, callback);
  8399. });
  8400. return {
  8401. destroy: function() {
  8402. Array.prototype.forEach.call(nodeList, function(node) {
  8403. node.removeEventListener(type, callback);
  8404. });
  8405. }
  8406. }
  8407. }
  8408. /**
  8409. * Add an event listener to a selector
  8410. * and returns a remove listener function.
  8411. *
  8412. * @param {String} selector
  8413. * @param {String} type
  8414. * @param {Function} callback
  8415. * @return {Object}
  8416. */
  8417. function listenSelector(selector, type, callback) {
  8418. return delegate(document.body, selector, type, callback);
  8419. }
  8420. module.exports = listen;
  8421. /***/ }),
  8422. /* 5 */
  8423. /***/ (function(module, exports) {
  8424. /**
  8425. * Check if argument is a HTML element.
  8426. *
  8427. * @param {Object} value
  8428. * @return {Boolean}
  8429. */
  8430. exports.node = function(value) {
  8431. return value !== undefined
  8432. && value instanceof HTMLElement
  8433. && value.nodeType === 1;
  8434. };
  8435. /**
  8436. * Check if argument is a list of HTML elements.
  8437. *
  8438. * @param {Object} value
  8439. * @return {Boolean}
  8440. */
  8441. exports.nodeList = function(value) {
  8442. var type = Object.prototype.toString.call(value);
  8443. return value !== undefined
  8444. && (type === '[object NodeList]' || type === '[object HTMLCollection]')
  8445. && ('length' in value)
  8446. && (value.length === 0 || exports.node(value[0]));
  8447. };
  8448. /**
  8449. * Check if argument is a string.
  8450. *
  8451. * @param {Object} value
  8452. * @return {Boolean}
  8453. */
  8454. exports.string = function(value) {
  8455. return typeof value === 'string'
  8456. || value instanceof String;
  8457. };
  8458. /**
  8459. * Check if argument is a function.
  8460. *
  8461. * @param {Object} value
  8462. * @return {Boolean}
  8463. */
  8464. exports.fn = function(value) {
  8465. var type = Object.prototype.toString.call(value);
  8466. return type === '[object Function]';
  8467. };
  8468. /***/ }),
  8469. /* 6 */
  8470. /***/ (function(module, exports, __webpack_require__) {
  8471. var closest = __webpack_require__(7);
  8472. /**
  8473. * Delegates event to a selector.
  8474. *
  8475. * @param {Element} element
  8476. * @param {String} selector
  8477. * @param {String} type
  8478. * @param {Function} callback
  8479. * @param {Boolean} useCapture
  8480. * @return {Object}
  8481. */
  8482. function _delegate(element, selector, type, callback, useCapture) {
  8483. var listenerFn = listener.apply(this, arguments);
  8484. element.addEventListener(type, listenerFn, useCapture);
  8485. return {
  8486. destroy: function() {
  8487. element.removeEventListener(type, listenerFn, useCapture);
  8488. }
  8489. }
  8490. }
  8491. /**
  8492. * Delegates event to a selector.
  8493. *
  8494. * @param {Element|String|Array} [elements]
  8495. * @param {String} selector
  8496. * @param {String} type
  8497. * @param {Function} callback
  8498. * @param {Boolean} useCapture
  8499. * @return {Object}
  8500. */
  8501. function delegate(elements, selector, type, callback, useCapture) {
  8502. // Handle the regular Element usage
  8503. if (typeof elements.addEventListener === 'function') {
  8504. return _delegate.apply(null, arguments);
  8505. }
  8506. // Handle Element-less usage, it defaults to global delegation
  8507. if (typeof type === 'function') {
  8508. // Use `document` as the first parameter, then apply arguments
  8509. // This is a short way to .unshift `arguments` without running into deoptimizations
  8510. return _delegate.bind(null, document).apply(null, arguments);
  8511. }
  8512. // Handle Selector-based usage
  8513. if (typeof elements === 'string') {
  8514. elements = document.querySelectorAll(elements);
  8515. }
  8516. // Handle Array-like based usage
  8517. return Array.prototype.map.call(elements, function (element) {
  8518. return _delegate(element, selector, type, callback, useCapture);
  8519. });
  8520. }
  8521. /**
  8522. * Finds closest match and invokes callback.
  8523. *
  8524. * @param {Element} element
  8525. * @param {String} selector
  8526. * @param {String} type
  8527. * @param {Function} callback
  8528. * @return {Function}
  8529. */
  8530. function listener(element, selector, type, callback) {
  8531. return function(e) {
  8532. e.delegateTarget = closest(e.target, selector);
  8533. if (e.delegateTarget) {
  8534. callback.call(element, e);
  8535. }
  8536. }
  8537. }
  8538. module.exports = delegate;
  8539. /***/ }),
  8540. /* 7 */
  8541. /***/ (function(module, exports) {
  8542. var DOCUMENT_NODE_TYPE = 9;
  8543. /**
  8544. * A polyfill for Element.matches()
  8545. */
  8546. if (typeof Element !== 'undefined' && !Element.prototype.matches) {
  8547. var proto = Element.prototype;
  8548. proto.matches = proto.matchesSelector ||
  8549. proto.mozMatchesSelector ||
  8550. proto.msMatchesSelector ||
  8551. proto.oMatchesSelector ||
  8552. proto.webkitMatchesSelector;
  8553. }
  8554. /**
  8555. * Finds the closest parent that matches a selector.
  8556. *
  8557. * @param {Element} element
  8558. * @param {String} selector
  8559. * @return {Function}
  8560. */
  8561. function closest (element, selector) {
  8562. while (element && element.nodeType !== DOCUMENT_NODE_TYPE) {
  8563. if (typeof element.matches === 'function' &&
  8564. element.matches(selector)) {
  8565. return element;
  8566. }
  8567. element = element.parentNode;
  8568. }
  8569. }
  8570. module.exports = closest;
  8571. /***/ })
  8572. /******/ ]);
  8573. });
  8574. /***/ }),
  8575. /***/ "./node_modules/ieee754/index.js":
  8576. /*!***************************************!*\
  8577. !*** ./node_modules/ieee754/index.js ***!
  8578. \***************************************/
  8579. /*! no static exports found */
  8580. /***/ (function(module, exports) {
  8581. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  8582. var e, m
  8583. var eLen = (nBytes * 8) - mLen - 1
  8584. var eMax = (1 << eLen) - 1
  8585. var eBias = eMax >> 1
  8586. var nBits = -7
  8587. var i = isLE ? (nBytes - 1) : 0
  8588. var d = isLE ? -1 : 1
  8589. var s = buffer[offset + i]
  8590. i += d
  8591. e = s & ((1 << (-nBits)) - 1)
  8592. s >>= (-nBits)
  8593. nBits += eLen
  8594. for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  8595. m = e & ((1 << (-nBits)) - 1)
  8596. e >>= (-nBits)
  8597. nBits += mLen
  8598. for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  8599. if (e === 0) {
  8600. e = 1 - eBias
  8601. } else if (e === eMax) {
  8602. return m ? NaN : ((s ? -1 : 1) * Infinity)
  8603. } else {
  8604. m = m + Math.pow(2, mLen)
  8605. e = e - eBias
  8606. }
  8607. return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  8608. }
  8609. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  8610. var e, m, c
  8611. var eLen = (nBytes * 8) - mLen - 1
  8612. var eMax = (1 << eLen) - 1
  8613. var eBias = eMax >> 1
  8614. var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  8615. var i = isLE ? 0 : (nBytes - 1)
  8616. var d = isLE ? 1 : -1
  8617. var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
  8618. value = Math.abs(value)
  8619. if (isNaN(value) || value === Infinity) {
  8620. m = isNaN(value) ? 1 : 0
  8621. e = eMax
  8622. } else {
  8623. e = Math.floor(Math.log(value) / Math.LN2)
  8624. if (value * (c = Math.pow(2, -e)) < 1) {
  8625. e--
  8626. c *= 2
  8627. }
  8628. if (e + eBias >= 1) {
  8629. value += rt / c
  8630. } else {
  8631. value += rt * Math.pow(2, 1 - eBias)
  8632. }
  8633. if (value * c >= 2) {
  8634. e++
  8635. c /= 2
  8636. }
  8637. if (e + eBias >= eMax) {
  8638. m = 0
  8639. e = eMax
  8640. } else if (e + eBias >= 1) {
  8641. m = ((value * c) - 1) * Math.pow(2, mLen)
  8642. e = e + eBias
  8643. } else {
  8644. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
  8645. e = 0
  8646. }
  8647. }
  8648. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  8649. e = (e << mLen) | m
  8650. eLen += mLen
  8651. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  8652. buffer[offset + i - d] |= s * 128
  8653. }
  8654. /***/ }),
  8655. /***/ "./node_modules/isarray/index.js":
  8656. /*!***************************************!*\
  8657. !*** ./node_modules/isarray/index.js ***!
  8658. \***************************************/
  8659. /*! no static exports found */
  8660. /***/ (function(module, exports) {
  8661. var toString = {}.toString;
  8662. module.exports = Array.isArray || function (arr) {
  8663. return toString.call(arr) == '[object Array]';
  8664. };
  8665. /***/ }),
  8666. /***/ "./node_modules/jquery/dist/jquery.js":
  8667. /*!********************************************!*\
  8668. !*** ./node_modules/jquery/dist/jquery.js ***!
  8669. \********************************************/
  8670. /*! no static exports found */
  8671. /***/ (function(module, exports, __webpack_require__) {
  8672. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  8673. * jQuery JavaScript Library v3.4.1
  8674. * https://jquery.com/
  8675. *
  8676. * Includes Sizzle.js
  8677. * https://sizzlejs.com/
  8678. *
  8679. * Copyright JS Foundation and other contributors
  8680. * Released under the MIT license
  8681. * https://jquery.org/license
  8682. *
  8683. * Date: 2019-05-01T21:04Z
  8684. */
  8685. ( function( global, factory ) {
  8686. "use strict";
  8687. if ( true && typeof module.exports === "object" ) {
  8688. // For CommonJS and CommonJS-like environments where a proper `window`
  8689. // is present, execute the factory and get jQuery.
  8690. // For environments that do not have a `window` with a `document`
  8691. // (such as Node.js), expose a factory as module.exports.
  8692. // This accentuates the need for the creation of a real `window`.
  8693. // e.g. var jQuery = require("jquery")(window);
  8694. // See ticket #14549 for more info.
  8695. module.exports = global.document ?
  8696. factory( global, true ) :
  8697. function( w ) {
  8698. if ( !w.document ) {
  8699. throw new Error( "jQuery requires a window with a document" );
  8700. }
  8701. return factory( w );
  8702. };
  8703. } else {
  8704. factory( global );
  8705. }
  8706. // Pass this if window is not defined yet
  8707. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  8708. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  8709. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  8710. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  8711. // enough that all such attempts are guarded in a try block.
  8712. "use strict";
  8713. var arr = [];
  8714. var document = window.document;
  8715. var getProto = Object.getPrototypeOf;
  8716. var slice = arr.slice;
  8717. var concat = arr.concat;
  8718. var push = arr.push;
  8719. var indexOf = arr.indexOf;
  8720. var class2type = {};
  8721. var toString = class2type.toString;
  8722. var hasOwn = class2type.hasOwnProperty;
  8723. var fnToString = hasOwn.toString;
  8724. var ObjectFunctionString = fnToString.call( Object );
  8725. var support = {};
  8726. var isFunction = function isFunction( obj ) {
  8727. // Support: Chrome <=57, Firefox <=52
  8728. // In some browsers, typeof returns "function" for HTML <object> elements
  8729. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  8730. // We don't want to classify *any* DOM node as a function.
  8731. return typeof obj === "function" && typeof obj.nodeType !== "number";
  8732. };
  8733. var isWindow = function isWindow( obj ) {
  8734. return obj != null && obj === obj.window;
  8735. };
  8736. var preservedScriptAttributes = {
  8737. type: true,
  8738. src: true,
  8739. nonce: true,
  8740. noModule: true
  8741. };
  8742. function DOMEval( code, node, doc ) {
  8743. doc = doc || document;
  8744. var i, val,
  8745. script = doc.createElement( "script" );
  8746. script.text = code;
  8747. if ( node ) {
  8748. for ( i in preservedScriptAttributes ) {
  8749. // Support: Firefox 64+, Edge 18+
  8750. // Some browsers don't support the "nonce" property on scripts.
  8751. // On the other hand, just using `getAttribute` is not enough as
  8752. // the `nonce` attribute is reset to an empty string whenever it
  8753. // becomes browsing-context connected.
  8754. // See https://github.com/whatwg/html/issues/2369
  8755. // See https://html.spec.whatwg.org/#nonce-attributes
  8756. // The `node.getAttribute` check was added for the sake of
  8757. // `jQuery.globalEval` so that it can fake a nonce-containing node
  8758. // via an object.
  8759. val = node[ i ] || node.getAttribute && node.getAttribute( i );
  8760. if ( val ) {
  8761. script.setAttribute( i, val );
  8762. }
  8763. }
  8764. }
  8765. doc.head.appendChild( script ).parentNode.removeChild( script );
  8766. }
  8767. function toType( obj ) {
  8768. if ( obj == null ) {
  8769. return obj + "";
  8770. }
  8771. // Support: Android <=2.3 only (functionish RegExp)
  8772. return typeof obj === "object" || typeof obj === "function" ?
  8773. class2type[ toString.call( obj ) ] || "object" :
  8774. typeof obj;
  8775. }
  8776. /* global Symbol */
  8777. // Defining this global in .eslintrc.json would create a danger of using the global
  8778. // unguarded in another place, it seems safer to define global only for this module
  8779. var
  8780. version = "3.4.1",
  8781. // Define a local copy of jQuery
  8782. jQuery = function( selector, context ) {
  8783. // The jQuery object is actually just the init constructor 'enhanced'
  8784. // Need init if jQuery is called (just allow error to be thrown if not included)
  8785. return new jQuery.fn.init( selector, context );
  8786. },
  8787. // Support: Android <=4.0 only
  8788. // Make sure we trim BOM and NBSP
  8789. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  8790. jQuery.fn = jQuery.prototype = {
  8791. // The current version of jQuery being used
  8792. jquery: version,
  8793. constructor: jQuery,
  8794. // The default length of a jQuery object is 0
  8795. length: 0,
  8796. toArray: function() {
  8797. return slice.call( this );
  8798. },
  8799. // Get the Nth element in the matched element set OR
  8800. // Get the whole matched element set as a clean array
  8801. get: function( num ) {
  8802. // Return all the elements in a clean array
  8803. if ( num == null ) {
  8804. return slice.call( this );
  8805. }
  8806. // Return just the one element from the set
  8807. return num < 0 ? this[ num + this.length ] : this[ num ];
  8808. },
  8809. // Take an array of elements and push it onto the stack
  8810. // (returning the new matched element set)
  8811. pushStack: function( elems ) {
  8812. // Build a new jQuery matched element set
  8813. var ret = jQuery.merge( this.constructor(), elems );
  8814. // Add the old object onto the stack (as a reference)
  8815. ret.prevObject = this;
  8816. // Return the newly-formed element set
  8817. return ret;
  8818. },
  8819. // Execute a callback for every element in the matched set.
  8820. each: function( callback ) {
  8821. return jQuery.each( this, callback );
  8822. },
  8823. map: function( callback ) {
  8824. return this.pushStack( jQuery.map( this, function( elem, i ) {
  8825. return callback.call( elem, i, elem );
  8826. } ) );
  8827. },
  8828. slice: function() {
  8829. return this.pushStack( slice.apply( this, arguments ) );
  8830. },
  8831. first: function() {
  8832. return this.eq( 0 );
  8833. },
  8834. last: function() {
  8835. return this.eq( -1 );
  8836. },
  8837. eq: function( i ) {
  8838. var len = this.length,
  8839. j = +i + ( i < 0 ? len : 0 );
  8840. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  8841. },
  8842. end: function() {
  8843. return this.prevObject || this.constructor();
  8844. },
  8845. // For internal use only.
  8846. // Behaves like an Array's method, not like a jQuery method.
  8847. push: push,
  8848. sort: arr.sort,
  8849. splice: arr.splice
  8850. };
  8851. jQuery.extend = jQuery.fn.extend = function() {
  8852. var options, name, src, copy, copyIsArray, clone,
  8853. target = arguments[ 0 ] || {},
  8854. i = 1,
  8855. length = arguments.length,
  8856. deep = false;
  8857. // Handle a deep copy situation
  8858. if ( typeof target === "boolean" ) {
  8859. deep = target;
  8860. // Skip the boolean and the target
  8861. target = arguments[ i ] || {};
  8862. i++;
  8863. }
  8864. // Handle case when target is a string or something (possible in deep copy)
  8865. if ( typeof target !== "object" && !isFunction( target ) ) {
  8866. target = {};
  8867. }
  8868. // Extend jQuery itself if only one argument is passed
  8869. if ( i === length ) {
  8870. target = this;
  8871. i--;
  8872. }
  8873. for ( ; i < length; i++ ) {
  8874. // Only deal with non-null/undefined values
  8875. if ( ( options = arguments[ i ] ) != null ) {
  8876. // Extend the base object
  8877. for ( name in options ) {
  8878. copy = options[ name ];
  8879. // Prevent Object.prototype pollution
  8880. // Prevent never-ending loop
  8881. if ( name === "__proto__" || target === copy ) {
  8882. continue;
  8883. }
  8884. // Recurse if we're merging plain objects or arrays
  8885. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  8886. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  8887. src = target[ name ];
  8888. // Ensure proper type for the source value
  8889. if ( copyIsArray && !Array.isArray( src ) ) {
  8890. clone = [];
  8891. } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
  8892. clone = {};
  8893. } else {
  8894. clone = src;
  8895. }
  8896. copyIsArray = false;
  8897. // Never move original objects, clone them
  8898. target[ name ] = jQuery.extend( deep, clone, copy );
  8899. // Don't bring in undefined values
  8900. } else if ( copy !== undefined ) {
  8901. target[ name ] = copy;
  8902. }
  8903. }
  8904. }
  8905. }
  8906. // Return the modified object
  8907. return target;
  8908. };
  8909. jQuery.extend( {
  8910. // Unique for each copy of jQuery on the page
  8911. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  8912. // Assume jQuery is ready without the ready module
  8913. isReady: true,
  8914. error: function( msg ) {
  8915. throw new Error( msg );
  8916. },
  8917. noop: function() {},
  8918. isPlainObject: function( obj ) {
  8919. var proto, Ctor;
  8920. // Detect obvious negatives
  8921. // Use toString instead of jQuery.type to catch host objects
  8922. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  8923. return false;
  8924. }
  8925. proto = getProto( obj );
  8926. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  8927. if ( !proto ) {
  8928. return true;
  8929. }
  8930. // Objects with prototype are plain iff they were constructed by a global Object function
  8931. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  8932. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  8933. },
  8934. isEmptyObject: function( obj ) {
  8935. var name;
  8936. for ( name in obj ) {
  8937. return false;
  8938. }
  8939. return true;
  8940. },
  8941. // Evaluates a script in a global context
  8942. globalEval: function( code, options ) {
  8943. DOMEval( code, { nonce: options && options.nonce } );
  8944. },
  8945. each: function( obj, callback ) {
  8946. var length, i = 0;
  8947. if ( isArrayLike( obj ) ) {
  8948. length = obj.length;
  8949. for ( ; i < length; i++ ) {
  8950. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  8951. break;
  8952. }
  8953. }
  8954. } else {
  8955. for ( i in obj ) {
  8956. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  8957. break;
  8958. }
  8959. }
  8960. }
  8961. return obj;
  8962. },
  8963. // Support: Android <=4.0 only
  8964. trim: function( text ) {
  8965. return text == null ?
  8966. "" :
  8967. ( text + "" ).replace( rtrim, "" );
  8968. },
  8969. // results is for internal usage only
  8970. makeArray: function( arr, results ) {
  8971. var ret = results || [];
  8972. if ( arr != null ) {
  8973. if ( isArrayLike( Object( arr ) ) ) {
  8974. jQuery.merge( ret,
  8975. typeof arr === "string" ?
  8976. [ arr ] : arr
  8977. );
  8978. } else {
  8979. push.call( ret, arr );
  8980. }
  8981. }
  8982. return ret;
  8983. },
  8984. inArray: function( elem, arr, i ) {
  8985. return arr == null ? -1 : indexOf.call( arr, elem, i );
  8986. },
  8987. // Support: Android <=4.0 only, PhantomJS 1 only
  8988. // push.apply(_, arraylike) throws on ancient WebKit
  8989. merge: function( first, second ) {
  8990. var len = +second.length,
  8991. j = 0,
  8992. i = first.length;
  8993. for ( ; j < len; j++ ) {
  8994. first[ i++ ] = second[ j ];
  8995. }
  8996. first.length = i;
  8997. return first;
  8998. },
  8999. grep: function( elems, callback, invert ) {
  9000. var callbackInverse,
  9001. matches = [],
  9002. i = 0,
  9003. length = elems.length,
  9004. callbackExpect = !invert;
  9005. // Go through the array, only saving the items
  9006. // that pass the validator function
  9007. for ( ; i < length; i++ ) {
  9008. callbackInverse = !callback( elems[ i ], i );
  9009. if ( callbackInverse !== callbackExpect ) {
  9010. matches.push( elems[ i ] );
  9011. }
  9012. }
  9013. return matches;
  9014. },
  9015. // arg is for internal usage only
  9016. map: function( elems, callback, arg ) {
  9017. var length, value,
  9018. i = 0,
  9019. ret = [];
  9020. // Go through the array, translating each of the items to their new values
  9021. if ( isArrayLike( elems ) ) {
  9022. length = elems.length;
  9023. for ( ; i < length; i++ ) {
  9024. value = callback( elems[ i ], i, arg );
  9025. if ( value != null ) {
  9026. ret.push( value );
  9027. }
  9028. }
  9029. // Go through every key on the object,
  9030. } else {
  9031. for ( i in elems ) {
  9032. value = callback( elems[ i ], i, arg );
  9033. if ( value != null ) {
  9034. ret.push( value );
  9035. }
  9036. }
  9037. }
  9038. // Flatten any nested arrays
  9039. return concat.apply( [], ret );
  9040. },
  9041. // A global GUID counter for objects
  9042. guid: 1,
  9043. // jQuery.support is not used in Core but other projects attach their
  9044. // properties to it so it needs to exist.
  9045. support: support
  9046. } );
  9047. if ( typeof Symbol === "function" ) {
  9048. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  9049. }
  9050. // Populate the class2type map
  9051. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  9052. function( i, name ) {
  9053. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  9054. } );
  9055. function isArrayLike( obj ) {
  9056. // Support: real iOS 8.2 only (not reproducible in simulator)
  9057. // `in` check used to prevent JIT error (gh-2145)
  9058. // hasOwn isn't used here due to false negatives
  9059. // regarding Nodelist length in IE
  9060. var length = !!obj && "length" in obj && obj.length,
  9061. type = toType( obj );
  9062. if ( isFunction( obj ) || isWindow( obj ) ) {
  9063. return false;
  9064. }
  9065. return type === "array" || length === 0 ||
  9066. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  9067. }
  9068. var Sizzle =
  9069. /*!
  9070. * Sizzle CSS Selector Engine v2.3.4
  9071. * https://sizzlejs.com/
  9072. *
  9073. * Copyright JS Foundation and other contributors
  9074. * Released under the MIT license
  9075. * https://js.foundation/
  9076. *
  9077. * Date: 2019-04-08
  9078. */
  9079. (function( window ) {
  9080. var i,
  9081. support,
  9082. Expr,
  9083. getText,
  9084. isXML,
  9085. tokenize,
  9086. compile,
  9087. select,
  9088. outermostContext,
  9089. sortInput,
  9090. hasDuplicate,
  9091. // Local document vars
  9092. setDocument,
  9093. document,
  9094. docElem,
  9095. documentIsHTML,
  9096. rbuggyQSA,
  9097. rbuggyMatches,
  9098. matches,
  9099. contains,
  9100. // Instance-specific data
  9101. expando = "sizzle" + 1 * new Date(),
  9102. preferredDoc = window.document,
  9103. dirruns = 0,
  9104. done = 0,
  9105. classCache = createCache(),
  9106. tokenCache = createCache(),
  9107. compilerCache = createCache(),
  9108. nonnativeSelectorCache = createCache(),
  9109. sortOrder = function( a, b ) {
  9110. if ( a === b ) {
  9111. hasDuplicate = true;
  9112. }
  9113. return 0;
  9114. },
  9115. // Instance methods
  9116. hasOwn = ({}).hasOwnProperty,
  9117. arr = [],
  9118. pop = arr.pop,
  9119. push_native = arr.push,
  9120. push = arr.push,
  9121. slice = arr.slice,
  9122. // Use a stripped-down indexOf as it's faster than native
  9123. // https://jsperf.com/thor-indexof-vs-for/5
  9124. indexOf = function( list, elem ) {
  9125. var i = 0,
  9126. len = list.length;
  9127. for ( ; i < len; i++ ) {
  9128. if ( list[i] === elem ) {
  9129. return i;
  9130. }
  9131. }
  9132. return -1;
  9133. },
  9134. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  9135. // Regular expressions
  9136. // http://www.w3.org/TR/css3-selectors/#whitespace
  9137. whitespace = "[\\x20\\t\\r\\n\\f]",
  9138. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  9139. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  9140. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  9141. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  9142. // Operator (capture 2)
  9143. "*([*^$|!~]?=)" + whitespace +
  9144. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  9145. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  9146. "*\\]",
  9147. pseudos = ":(" + identifier + ")(?:\\((" +
  9148. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  9149. // 1. quoted (capture 3; capture 4 or capture 5)
  9150. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  9151. // 2. simple (capture 6)
  9152. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  9153. // 3. anything else (capture 2)
  9154. ".*" +
  9155. ")\\)|)",
  9156. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  9157. rwhitespace = new RegExp( whitespace + "+", "g" ),
  9158. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  9159. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  9160. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  9161. rdescend = new RegExp( whitespace + "|>" ),
  9162. rpseudo = new RegExp( pseudos ),
  9163. ridentifier = new RegExp( "^" + identifier + "$" ),
  9164. matchExpr = {
  9165. "ID": new RegExp( "^#(" + identifier + ")" ),
  9166. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  9167. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  9168. "ATTR": new RegExp( "^" + attributes ),
  9169. "PSEUDO": new RegExp( "^" + pseudos ),
  9170. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  9171. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  9172. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  9173. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  9174. // For use in libraries implementing .is()
  9175. // We use this for POS matching in `select`
  9176. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  9177. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  9178. },
  9179. rhtml = /HTML$/i,
  9180. rinputs = /^(?:input|select|textarea|button)$/i,
  9181. rheader = /^h\d$/i,
  9182. rnative = /^[^{]+\{\s*\[native \w/,
  9183. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  9184. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  9185. rsibling = /[+~]/,
  9186. // CSS escapes
  9187. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  9188. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  9189. funescape = function( _, escaped, escapedWhitespace ) {
  9190. var high = "0x" + escaped - 0x10000;
  9191. // NaN means non-codepoint
  9192. // Support: Firefox<24
  9193. // Workaround erroneous numeric interpretation of +"0x"
  9194. return high !== high || escapedWhitespace ?
  9195. escaped :
  9196. high < 0 ?
  9197. // BMP codepoint
  9198. String.fromCharCode( high + 0x10000 ) :
  9199. // Supplemental Plane codepoint (surrogate pair)
  9200. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  9201. },
  9202. // CSS string/identifier serialization
  9203. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  9204. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  9205. fcssescape = function( ch, asCodePoint ) {
  9206. if ( asCodePoint ) {
  9207. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  9208. if ( ch === "\0" ) {
  9209. return "\uFFFD";
  9210. }
  9211. // Control characters and (dependent upon position) numbers get escaped as code points
  9212. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  9213. }
  9214. // Other potentially-special ASCII characters get backslash-escaped
  9215. return "\\" + ch;
  9216. },
  9217. // Used for iframes
  9218. // See setDocument()
  9219. // Removing the function wrapper causes a "Permission Denied"
  9220. // error in IE
  9221. unloadHandler = function() {
  9222. setDocument();
  9223. },
  9224. inDisabledFieldset = addCombinator(
  9225. function( elem ) {
  9226. return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset";
  9227. },
  9228. { dir: "parentNode", next: "legend" }
  9229. );
  9230. // Optimize for push.apply( _, NodeList )
  9231. try {
  9232. push.apply(
  9233. (arr = slice.call( preferredDoc.childNodes )),
  9234. preferredDoc.childNodes
  9235. );
  9236. // Support: Android<4.0
  9237. // Detect silently failing push.apply
  9238. arr[ preferredDoc.childNodes.length ].nodeType;
  9239. } catch ( e ) {
  9240. push = { apply: arr.length ?
  9241. // Leverage slice if possible
  9242. function( target, els ) {
  9243. push_native.apply( target, slice.call(els) );
  9244. } :
  9245. // Support: IE<9
  9246. // Otherwise append directly
  9247. function( target, els ) {
  9248. var j = target.length,
  9249. i = 0;
  9250. // Can't trust NodeList.length
  9251. while ( (target[j++] = els[i++]) ) {}
  9252. target.length = j - 1;
  9253. }
  9254. };
  9255. }
  9256. function Sizzle( selector, context, results, seed ) {
  9257. var m, i, elem, nid, match, groups, newSelector,
  9258. newContext = context && context.ownerDocument,
  9259. // nodeType defaults to 9, since context defaults to document
  9260. nodeType = context ? context.nodeType : 9;
  9261. results = results || [];
  9262. // Return early from calls with invalid selector or context
  9263. if ( typeof selector !== "string" || !selector ||
  9264. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  9265. return results;
  9266. }
  9267. // Try to shortcut find operations (as opposed to filters) in HTML documents
  9268. if ( !seed ) {
  9269. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  9270. setDocument( context );
  9271. }
  9272. context = context || document;
  9273. if ( documentIsHTML ) {
  9274. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  9275. // (excepting DocumentFragment context, where the methods don't exist)
  9276. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  9277. // ID selector
  9278. if ( (m = match[1]) ) {
  9279. // Document context
  9280. if ( nodeType === 9 ) {
  9281. if ( (elem = context.getElementById( m )) ) {
  9282. // Support: IE, Opera, Webkit
  9283. // TODO: identify versions
  9284. // getElementById can match elements by name instead of ID
  9285. if ( elem.id === m ) {
  9286. results.push( elem );
  9287. return results;
  9288. }
  9289. } else {
  9290. return results;
  9291. }
  9292. // Element context
  9293. } else {
  9294. // Support: IE, Opera, Webkit
  9295. // TODO: identify versions
  9296. // getElementById can match elements by name instead of ID
  9297. if ( newContext && (elem = newContext.getElementById( m )) &&
  9298. contains( context, elem ) &&
  9299. elem.id === m ) {
  9300. results.push( elem );
  9301. return results;
  9302. }
  9303. }
  9304. // Type selector
  9305. } else if ( match[2] ) {
  9306. push.apply( results, context.getElementsByTagName( selector ) );
  9307. return results;
  9308. // Class selector
  9309. } else if ( (m = match[3]) && support.getElementsByClassName &&
  9310. context.getElementsByClassName ) {
  9311. push.apply( results, context.getElementsByClassName( m ) );
  9312. return results;
  9313. }
  9314. }
  9315. // Take advantage of querySelectorAll
  9316. if ( support.qsa &&
  9317. !nonnativeSelectorCache[ selector + " " ] &&
  9318. (!rbuggyQSA || !rbuggyQSA.test( selector )) &&
  9319. // Support: IE 8 only
  9320. // Exclude object elements
  9321. (nodeType !== 1 || context.nodeName.toLowerCase() !== "object") ) {
  9322. newSelector = selector;
  9323. newContext = context;
  9324. // qSA considers elements outside a scoping root when evaluating child or
  9325. // descendant combinators, which is not what we want.
  9326. // In such cases, we work around the behavior by prefixing every selector in the
  9327. // list with an ID selector referencing the scope context.
  9328. // Thanks to Andrew Dupont for this technique.
  9329. if ( nodeType === 1 && rdescend.test( selector ) ) {
  9330. // Capture the context ID, setting it first if necessary
  9331. if ( (nid = context.getAttribute( "id" )) ) {
  9332. nid = nid.replace( rcssescape, fcssescape );
  9333. } else {
  9334. context.setAttribute( "id", (nid = expando) );
  9335. }
  9336. // Prefix every selector in the list
  9337. groups = tokenize( selector );
  9338. i = groups.length;
  9339. while ( i-- ) {
  9340. groups[i] = "#" + nid + " " + toSelector( groups[i] );
  9341. }
  9342. newSelector = groups.join( "," );
  9343. // Expand context for sibling selectors
  9344. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  9345. context;
  9346. }
  9347. try {
  9348. push.apply( results,
  9349. newContext.querySelectorAll( newSelector )
  9350. );
  9351. return results;
  9352. } catch ( qsaError ) {
  9353. nonnativeSelectorCache( selector, true );
  9354. } finally {
  9355. if ( nid === expando ) {
  9356. context.removeAttribute( "id" );
  9357. }
  9358. }
  9359. }
  9360. }
  9361. }
  9362. // All others
  9363. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  9364. }
  9365. /**
  9366. * Create key-value caches of limited size
  9367. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  9368. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  9369. * deleting the oldest entry
  9370. */
  9371. function createCache() {
  9372. var keys = [];
  9373. function cache( key, value ) {
  9374. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  9375. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  9376. // Only keep the most recent entries
  9377. delete cache[ keys.shift() ];
  9378. }
  9379. return (cache[ key + " " ] = value);
  9380. }
  9381. return cache;
  9382. }
  9383. /**
  9384. * Mark a function for special use by Sizzle
  9385. * @param {Function} fn The function to mark
  9386. */
  9387. function markFunction( fn ) {
  9388. fn[ expando ] = true;
  9389. return fn;
  9390. }
  9391. /**
  9392. * Support testing using an element
  9393. * @param {Function} fn Passed the created element and returns a boolean result
  9394. */
  9395. function assert( fn ) {
  9396. var el = document.createElement("fieldset");
  9397. try {
  9398. return !!fn( el );
  9399. } catch (e) {
  9400. return false;
  9401. } finally {
  9402. // Remove from its parent by default
  9403. if ( el.parentNode ) {
  9404. el.parentNode.removeChild( el );
  9405. }
  9406. // release memory in IE
  9407. el = null;
  9408. }
  9409. }
  9410. /**
  9411. * Adds the same handler for all of the specified attrs
  9412. * @param {String} attrs Pipe-separated list of attributes
  9413. * @param {Function} handler The method that will be applied
  9414. */
  9415. function addHandle( attrs, handler ) {
  9416. var arr = attrs.split("|"),
  9417. i = arr.length;
  9418. while ( i-- ) {
  9419. Expr.attrHandle[ arr[i] ] = handler;
  9420. }
  9421. }
  9422. /**
  9423. * Checks document order of two siblings
  9424. * @param {Element} a
  9425. * @param {Element} b
  9426. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  9427. */
  9428. function siblingCheck( a, b ) {
  9429. var cur = b && a,
  9430. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  9431. a.sourceIndex - b.sourceIndex;
  9432. // Use IE sourceIndex if available on both nodes
  9433. if ( diff ) {
  9434. return diff;
  9435. }
  9436. // Check if b follows a
  9437. if ( cur ) {
  9438. while ( (cur = cur.nextSibling) ) {
  9439. if ( cur === b ) {
  9440. return -1;
  9441. }
  9442. }
  9443. }
  9444. return a ? 1 : -1;
  9445. }
  9446. /**
  9447. * Returns a function to use in pseudos for input types
  9448. * @param {String} type
  9449. */
  9450. function createInputPseudo( type ) {
  9451. return function( elem ) {
  9452. var name = elem.nodeName.toLowerCase();
  9453. return name === "input" && elem.type === type;
  9454. };
  9455. }
  9456. /**
  9457. * Returns a function to use in pseudos for buttons
  9458. * @param {String} type
  9459. */
  9460. function createButtonPseudo( type ) {
  9461. return function( elem ) {
  9462. var name = elem.nodeName.toLowerCase();
  9463. return (name === "input" || name === "button") && elem.type === type;
  9464. };
  9465. }
  9466. /**
  9467. * Returns a function to use in pseudos for :enabled/:disabled
  9468. * @param {Boolean} disabled true for :disabled; false for :enabled
  9469. */
  9470. function createDisabledPseudo( disabled ) {
  9471. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  9472. return function( elem ) {
  9473. // Only certain elements can match :enabled or :disabled
  9474. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  9475. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  9476. if ( "form" in elem ) {
  9477. // Check for inherited disabledness on relevant non-disabled elements:
  9478. // * listed form-associated elements in a disabled fieldset
  9479. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  9480. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  9481. // * option elements in a disabled optgroup
  9482. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  9483. // All such elements have a "form" property.
  9484. if ( elem.parentNode && elem.disabled === false ) {
  9485. // Option elements defer to a parent optgroup if present
  9486. if ( "label" in elem ) {
  9487. if ( "label" in elem.parentNode ) {
  9488. return elem.parentNode.disabled === disabled;
  9489. } else {
  9490. return elem.disabled === disabled;
  9491. }
  9492. }
  9493. // Support: IE 6 - 11
  9494. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  9495. return elem.isDisabled === disabled ||
  9496. // Where there is no isDisabled, check manually
  9497. /* jshint -W018 */
  9498. elem.isDisabled !== !disabled &&
  9499. inDisabledFieldset( elem ) === disabled;
  9500. }
  9501. return elem.disabled === disabled;
  9502. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  9503. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  9504. // even exist on them, let alone have a boolean value.
  9505. } else if ( "label" in elem ) {
  9506. return elem.disabled === disabled;
  9507. }
  9508. // Remaining elements are neither :enabled nor :disabled
  9509. return false;
  9510. };
  9511. }
  9512. /**
  9513. * Returns a function to use in pseudos for positionals
  9514. * @param {Function} fn
  9515. */
  9516. function createPositionalPseudo( fn ) {
  9517. return markFunction(function( argument ) {
  9518. argument = +argument;
  9519. return markFunction(function( seed, matches ) {
  9520. var j,
  9521. matchIndexes = fn( [], seed.length, argument ),
  9522. i = matchIndexes.length;
  9523. // Match elements found at the specified indexes
  9524. while ( i-- ) {
  9525. if ( seed[ (j = matchIndexes[i]) ] ) {
  9526. seed[j] = !(matches[j] = seed[j]);
  9527. }
  9528. }
  9529. });
  9530. });
  9531. }
  9532. /**
  9533. * Checks a node for validity as a Sizzle context
  9534. * @param {Element|Object=} context
  9535. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  9536. */
  9537. function testContext( context ) {
  9538. return context && typeof context.getElementsByTagName !== "undefined" && context;
  9539. }
  9540. // Expose support vars for convenience
  9541. support = Sizzle.support = {};
  9542. /**
  9543. * Detects XML nodes
  9544. * @param {Element|Object} elem An element or a document
  9545. * @returns {Boolean} True iff elem is a non-HTML XML node
  9546. */
  9547. isXML = Sizzle.isXML = function( elem ) {
  9548. var namespace = elem.namespaceURI,
  9549. docElem = (elem.ownerDocument || elem).documentElement;
  9550. // Support: IE <=8
  9551. // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
  9552. // https://bugs.jquery.com/ticket/4833
  9553. return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" );
  9554. };
  9555. /**
  9556. * Sets document-related variables once based on the current document
  9557. * @param {Element|Object} [doc] An element or document object to use to set the document
  9558. * @returns {Object} Returns the current document
  9559. */
  9560. setDocument = Sizzle.setDocument = function( node ) {
  9561. var hasCompare, subWindow,
  9562. doc = node ? node.ownerDocument || node : preferredDoc;
  9563. // Return early if doc is invalid or already selected
  9564. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  9565. return document;
  9566. }
  9567. // Update global variables
  9568. document = doc;
  9569. docElem = document.documentElement;
  9570. documentIsHTML = !isXML( document );
  9571. // Support: IE 9-11, Edge
  9572. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  9573. if ( preferredDoc !== document &&
  9574. (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
  9575. // Support: IE 11, Edge
  9576. if ( subWindow.addEventListener ) {
  9577. subWindow.addEventListener( "unload", unloadHandler, false );
  9578. // Support: IE 9 - 10 only
  9579. } else if ( subWindow.attachEvent ) {
  9580. subWindow.attachEvent( "onunload", unloadHandler );
  9581. }
  9582. }
  9583. /* Attributes
  9584. ---------------------------------------------------------------------- */
  9585. // Support: IE<8
  9586. // Verify that getAttribute really returns attributes and not properties
  9587. // (excepting IE8 booleans)
  9588. support.attributes = assert(function( el ) {
  9589. el.className = "i";
  9590. return !el.getAttribute("className");
  9591. });
  9592. /* getElement(s)By*
  9593. ---------------------------------------------------------------------- */
  9594. // Check if getElementsByTagName("*") returns only elements
  9595. support.getElementsByTagName = assert(function( el ) {
  9596. el.appendChild( document.createComment("") );
  9597. return !el.getElementsByTagName("*").length;
  9598. });
  9599. // Support: IE<9
  9600. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  9601. // Support: IE<10
  9602. // Check if getElementById returns elements by name
  9603. // The broken getElementById methods don't pick up programmatically-set names,
  9604. // so use a roundabout getElementsByName test
  9605. support.getById = assert(function( el ) {
  9606. docElem.appendChild( el ).id = expando;
  9607. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  9608. });
  9609. // ID filter and find
  9610. if ( support.getById ) {
  9611. Expr.filter["ID"] = function( id ) {
  9612. var attrId = id.replace( runescape, funescape );
  9613. return function( elem ) {
  9614. return elem.getAttribute("id") === attrId;
  9615. };
  9616. };
  9617. Expr.find["ID"] = function( id, context ) {
  9618. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  9619. var elem = context.getElementById( id );
  9620. return elem ? [ elem ] : [];
  9621. }
  9622. };
  9623. } else {
  9624. Expr.filter["ID"] = function( id ) {
  9625. var attrId = id.replace( runescape, funescape );
  9626. return function( elem ) {
  9627. var node = typeof elem.getAttributeNode !== "undefined" &&
  9628. elem.getAttributeNode("id");
  9629. return node && node.value === attrId;
  9630. };
  9631. };
  9632. // Support: IE 6 - 7 only
  9633. // getElementById is not reliable as a find shortcut
  9634. Expr.find["ID"] = function( id, context ) {
  9635. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  9636. var node, i, elems,
  9637. elem = context.getElementById( id );
  9638. if ( elem ) {
  9639. // Verify the id attribute
  9640. node = elem.getAttributeNode("id");
  9641. if ( node && node.value === id ) {
  9642. return [ elem ];
  9643. }
  9644. // Fall back on getElementsByName
  9645. elems = context.getElementsByName( id );
  9646. i = 0;
  9647. while ( (elem = elems[i++]) ) {
  9648. node = elem.getAttributeNode("id");
  9649. if ( node && node.value === id ) {
  9650. return [ elem ];
  9651. }
  9652. }
  9653. }
  9654. return [];
  9655. }
  9656. };
  9657. }
  9658. // Tag
  9659. Expr.find["TAG"] = support.getElementsByTagName ?
  9660. function( tag, context ) {
  9661. if ( typeof context.getElementsByTagName !== "undefined" ) {
  9662. return context.getElementsByTagName( tag );
  9663. // DocumentFragment nodes don't have gEBTN
  9664. } else if ( support.qsa ) {
  9665. return context.querySelectorAll( tag );
  9666. }
  9667. } :
  9668. function( tag, context ) {
  9669. var elem,
  9670. tmp = [],
  9671. i = 0,
  9672. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  9673. results = context.getElementsByTagName( tag );
  9674. // Filter out possible comments
  9675. if ( tag === "*" ) {
  9676. while ( (elem = results[i++]) ) {
  9677. if ( elem.nodeType === 1 ) {
  9678. tmp.push( elem );
  9679. }
  9680. }
  9681. return tmp;
  9682. }
  9683. return results;
  9684. };
  9685. // Class
  9686. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  9687. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  9688. return context.getElementsByClassName( className );
  9689. }
  9690. };
  9691. /* QSA/matchesSelector
  9692. ---------------------------------------------------------------------- */
  9693. // QSA and matchesSelector support
  9694. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  9695. rbuggyMatches = [];
  9696. // qSa(:focus) reports false when true (Chrome 21)
  9697. // We allow this because of a bug in IE8/9 that throws an error
  9698. // whenever `document.activeElement` is accessed on an iframe
  9699. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  9700. // See https://bugs.jquery.com/ticket/13378
  9701. rbuggyQSA = [];
  9702. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  9703. // Build QSA regex
  9704. // Regex strategy adopted from Diego Perini
  9705. assert(function( el ) {
  9706. // Select is set to empty string on purpose
  9707. // This is to test IE's treatment of not explicitly
  9708. // setting a boolean content attribute,
  9709. // since its presence should be enough
  9710. // https://bugs.jquery.com/ticket/12359
  9711. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  9712. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  9713. "<option selected=''></option></select>";
  9714. // Support: IE8, Opera 11-12.16
  9715. // Nothing should be selected when empty strings follow ^= or $= or *=
  9716. // The test attribute must be unknown in Opera but "safe" for WinRT
  9717. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  9718. if ( el.querySelectorAll("[msallowcapture^='']").length ) {
  9719. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  9720. }
  9721. // Support: IE8
  9722. // Boolean attributes and "value" are not treated correctly
  9723. if ( !el.querySelectorAll("[selected]").length ) {
  9724. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  9725. }
  9726. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  9727. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  9728. rbuggyQSA.push("~=");
  9729. }
  9730. // Webkit/Opera - :checked should return selected option elements
  9731. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  9732. // IE8 throws error here and will not see later tests
  9733. if ( !el.querySelectorAll(":checked").length ) {
  9734. rbuggyQSA.push(":checked");
  9735. }
  9736. // Support: Safari 8+, iOS 8+
  9737. // https://bugs.webkit.org/show_bug.cgi?id=136851
  9738. // In-page `selector#id sibling-combinator selector` fails
  9739. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  9740. rbuggyQSA.push(".#.+[+~]");
  9741. }
  9742. });
  9743. assert(function( el ) {
  9744. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  9745. "<select disabled='disabled'><option/></select>";
  9746. // Support: Windows 8 Native Apps
  9747. // The type and name attributes are restricted during .innerHTML assignment
  9748. var input = document.createElement("input");
  9749. input.setAttribute( "type", "hidden" );
  9750. el.appendChild( input ).setAttribute( "name", "D" );
  9751. // Support: IE8
  9752. // Enforce case-sensitivity of name attribute
  9753. if ( el.querySelectorAll("[name=d]").length ) {
  9754. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  9755. }
  9756. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  9757. // IE8 throws error here and will not see later tests
  9758. if ( el.querySelectorAll(":enabled").length !== 2 ) {
  9759. rbuggyQSA.push( ":enabled", ":disabled" );
  9760. }
  9761. // Support: IE9-11+
  9762. // IE's :disabled selector does not pick up the children of disabled fieldsets
  9763. docElem.appendChild( el ).disabled = true;
  9764. if ( el.querySelectorAll(":disabled").length !== 2 ) {
  9765. rbuggyQSA.push( ":enabled", ":disabled" );
  9766. }
  9767. // Opera 10-11 does not throw on post-comma invalid pseudos
  9768. el.querySelectorAll("*,:x");
  9769. rbuggyQSA.push(",.*:");
  9770. });
  9771. }
  9772. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  9773. docElem.webkitMatchesSelector ||
  9774. docElem.mozMatchesSelector ||
  9775. docElem.oMatchesSelector ||
  9776. docElem.msMatchesSelector) )) ) {
  9777. assert(function( el ) {
  9778. // Check to see if it's possible to do matchesSelector
  9779. // on a disconnected node (IE 9)
  9780. support.disconnectedMatch = matches.call( el, "*" );
  9781. // This should fail with an exception
  9782. // Gecko does not error, returns false instead
  9783. matches.call( el, "[s!='']:x" );
  9784. rbuggyMatches.push( "!=", pseudos );
  9785. });
  9786. }
  9787. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  9788. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  9789. /* Contains
  9790. ---------------------------------------------------------------------- */
  9791. hasCompare = rnative.test( docElem.compareDocumentPosition );
  9792. // Element contains another
  9793. // Purposefully self-exclusive
  9794. // As in, an element does not contain itself
  9795. contains = hasCompare || rnative.test( docElem.contains ) ?
  9796. function( a, b ) {
  9797. var adown = a.nodeType === 9 ? a.documentElement : a,
  9798. bup = b && b.parentNode;
  9799. return a === bup || !!( bup && bup.nodeType === 1 && (
  9800. adown.contains ?
  9801. adown.contains( bup ) :
  9802. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  9803. ));
  9804. } :
  9805. function( a, b ) {
  9806. if ( b ) {
  9807. while ( (b = b.parentNode) ) {
  9808. if ( b === a ) {
  9809. return true;
  9810. }
  9811. }
  9812. }
  9813. return false;
  9814. };
  9815. /* Sorting
  9816. ---------------------------------------------------------------------- */
  9817. // Document order sorting
  9818. sortOrder = hasCompare ?
  9819. function( a, b ) {
  9820. // Flag for duplicate removal
  9821. if ( a === b ) {
  9822. hasDuplicate = true;
  9823. return 0;
  9824. }
  9825. // Sort on method existence if only one input has compareDocumentPosition
  9826. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  9827. if ( compare ) {
  9828. return compare;
  9829. }
  9830. // Calculate position if both inputs belong to the same document
  9831. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  9832. a.compareDocumentPosition( b ) :
  9833. // Otherwise we know they are disconnected
  9834. 1;
  9835. // Disconnected nodes
  9836. if ( compare & 1 ||
  9837. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  9838. // Choose the first element that is related to our preferred document
  9839. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  9840. return -1;
  9841. }
  9842. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  9843. return 1;
  9844. }
  9845. // Maintain original order
  9846. return sortInput ?
  9847. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  9848. 0;
  9849. }
  9850. return compare & 4 ? -1 : 1;
  9851. } :
  9852. function( a, b ) {
  9853. // Exit early if the nodes are identical
  9854. if ( a === b ) {
  9855. hasDuplicate = true;
  9856. return 0;
  9857. }
  9858. var cur,
  9859. i = 0,
  9860. aup = a.parentNode,
  9861. bup = b.parentNode,
  9862. ap = [ a ],
  9863. bp = [ b ];
  9864. // Parentless nodes are either documents or disconnected
  9865. if ( !aup || !bup ) {
  9866. return a === document ? -1 :
  9867. b === document ? 1 :
  9868. aup ? -1 :
  9869. bup ? 1 :
  9870. sortInput ?
  9871. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  9872. 0;
  9873. // If the nodes are siblings, we can do a quick check
  9874. } else if ( aup === bup ) {
  9875. return siblingCheck( a, b );
  9876. }
  9877. // Otherwise we need full lists of their ancestors for comparison
  9878. cur = a;
  9879. while ( (cur = cur.parentNode) ) {
  9880. ap.unshift( cur );
  9881. }
  9882. cur = b;
  9883. while ( (cur = cur.parentNode) ) {
  9884. bp.unshift( cur );
  9885. }
  9886. // Walk down the tree looking for a discrepancy
  9887. while ( ap[i] === bp[i] ) {
  9888. i++;
  9889. }
  9890. return i ?
  9891. // Do a sibling check if the nodes have a common ancestor
  9892. siblingCheck( ap[i], bp[i] ) :
  9893. // Otherwise nodes in our document sort first
  9894. ap[i] === preferredDoc ? -1 :
  9895. bp[i] === preferredDoc ? 1 :
  9896. 0;
  9897. };
  9898. return document;
  9899. };
  9900. Sizzle.matches = function( expr, elements ) {
  9901. return Sizzle( expr, null, null, elements );
  9902. };
  9903. Sizzle.matchesSelector = function( elem, expr ) {
  9904. // Set document vars if needed
  9905. if ( ( elem.ownerDocument || elem ) !== document ) {
  9906. setDocument( elem );
  9907. }
  9908. if ( support.matchesSelector && documentIsHTML &&
  9909. !nonnativeSelectorCache[ expr + " " ] &&
  9910. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  9911. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  9912. try {
  9913. var ret = matches.call( elem, expr );
  9914. // IE 9's matchesSelector returns false on disconnected nodes
  9915. if ( ret || support.disconnectedMatch ||
  9916. // As well, disconnected nodes are said to be in a document
  9917. // fragment in IE 9
  9918. elem.document && elem.document.nodeType !== 11 ) {
  9919. return ret;
  9920. }
  9921. } catch (e) {
  9922. nonnativeSelectorCache( expr, true );
  9923. }
  9924. }
  9925. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  9926. };
  9927. Sizzle.contains = function( context, elem ) {
  9928. // Set document vars if needed
  9929. if ( ( context.ownerDocument || context ) !== document ) {
  9930. setDocument( context );
  9931. }
  9932. return contains( context, elem );
  9933. };
  9934. Sizzle.attr = function( elem, name ) {
  9935. // Set document vars if needed
  9936. if ( ( elem.ownerDocument || elem ) !== document ) {
  9937. setDocument( elem );
  9938. }
  9939. var fn = Expr.attrHandle[ name.toLowerCase() ],
  9940. // Don't get fooled by Object.prototype properties (jQuery #13807)
  9941. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  9942. fn( elem, name, !documentIsHTML ) :
  9943. undefined;
  9944. return val !== undefined ?
  9945. val :
  9946. support.attributes || !documentIsHTML ?
  9947. elem.getAttribute( name ) :
  9948. (val = elem.getAttributeNode(name)) && val.specified ?
  9949. val.value :
  9950. null;
  9951. };
  9952. Sizzle.escape = function( sel ) {
  9953. return (sel + "").replace( rcssescape, fcssescape );
  9954. };
  9955. Sizzle.error = function( msg ) {
  9956. throw new Error( "Syntax error, unrecognized expression: " + msg );
  9957. };
  9958. /**
  9959. * Document sorting and removing duplicates
  9960. * @param {ArrayLike} results
  9961. */
  9962. Sizzle.uniqueSort = function( results ) {
  9963. var elem,
  9964. duplicates = [],
  9965. j = 0,
  9966. i = 0;
  9967. // Unless we *know* we can detect duplicates, assume their presence
  9968. hasDuplicate = !support.detectDuplicates;
  9969. sortInput = !support.sortStable && results.slice( 0 );
  9970. results.sort( sortOrder );
  9971. if ( hasDuplicate ) {
  9972. while ( (elem = results[i++]) ) {
  9973. if ( elem === results[ i ] ) {
  9974. j = duplicates.push( i );
  9975. }
  9976. }
  9977. while ( j-- ) {
  9978. results.splice( duplicates[ j ], 1 );
  9979. }
  9980. }
  9981. // Clear input after sorting to release objects
  9982. // See https://github.com/jquery/sizzle/pull/225
  9983. sortInput = null;
  9984. return results;
  9985. };
  9986. /**
  9987. * Utility function for retrieving the text value of an array of DOM nodes
  9988. * @param {Array|Element} elem
  9989. */
  9990. getText = Sizzle.getText = function( elem ) {
  9991. var node,
  9992. ret = "",
  9993. i = 0,
  9994. nodeType = elem.nodeType;
  9995. if ( !nodeType ) {
  9996. // If no nodeType, this is expected to be an array
  9997. while ( (node = elem[i++]) ) {
  9998. // Do not traverse comment nodes
  9999. ret += getText( node );
  10000. }
  10001. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  10002. // Use textContent for elements
  10003. // innerText usage removed for consistency of new lines (jQuery #11153)
  10004. if ( typeof elem.textContent === "string" ) {
  10005. return elem.textContent;
  10006. } else {
  10007. // Traverse its children
  10008. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  10009. ret += getText( elem );
  10010. }
  10011. }
  10012. } else if ( nodeType === 3 || nodeType === 4 ) {
  10013. return elem.nodeValue;
  10014. }
  10015. // Do not include comment or processing instruction nodes
  10016. return ret;
  10017. };
  10018. Expr = Sizzle.selectors = {
  10019. // Can be adjusted by the user
  10020. cacheLength: 50,
  10021. createPseudo: markFunction,
  10022. match: matchExpr,
  10023. attrHandle: {},
  10024. find: {},
  10025. relative: {
  10026. ">": { dir: "parentNode", first: true },
  10027. " ": { dir: "parentNode" },
  10028. "+": { dir: "previousSibling", first: true },
  10029. "~": { dir: "previousSibling" }
  10030. },
  10031. preFilter: {
  10032. "ATTR": function( match ) {
  10033. match[1] = match[1].replace( runescape, funescape );
  10034. // Move the given value to match[3] whether quoted or unquoted
  10035. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  10036. if ( match[2] === "~=" ) {
  10037. match[3] = " " + match[3] + " ";
  10038. }
  10039. return match.slice( 0, 4 );
  10040. },
  10041. "CHILD": function( match ) {
  10042. /* matches from matchExpr["CHILD"]
  10043. 1 type (only|nth|...)
  10044. 2 what (child|of-type)
  10045. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  10046. 4 xn-component of xn+y argument ([+-]?\d*n|)
  10047. 5 sign of xn-component
  10048. 6 x of xn-component
  10049. 7 sign of y-component
  10050. 8 y of y-component
  10051. */
  10052. match[1] = match[1].toLowerCase();
  10053. if ( match[1].slice( 0, 3 ) === "nth" ) {
  10054. // nth-* requires argument
  10055. if ( !match[3] ) {
  10056. Sizzle.error( match[0] );
  10057. }
  10058. // numeric x and y parameters for Expr.filter.CHILD
  10059. // remember that false/true cast respectively to 0/1
  10060. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  10061. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  10062. // other types prohibit arguments
  10063. } else if ( match[3] ) {
  10064. Sizzle.error( match[0] );
  10065. }
  10066. return match;
  10067. },
  10068. "PSEUDO": function( match ) {
  10069. var excess,
  10070. unquoted = !match[6] && match[2];
  10071. if ( matchExpr["CHILD"].test( match[0] ) ) {
  10072. return null;
  10073. }
  10074. // Accept quoted arguments as-is
  10075. if ( match[3] ) {
  10076. match[2] = match[4] || match[5] || "";
  10077. // Strip excess characters from unquoted arguments
  10078. } else if ( unquoted && rpseudo.test( unquoted ) &&
  10079. // Get excess from tokenize (recursively)
  10080. (excess = tokenize( unquoted, true )) &&
  10081. // advance to the next closing parenthesis
  10082. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  10083. // excess is a negative index
  10084. match[0] = match[0].slice( 0, excess );
  10085. match[2] = unquoted.slice( 0, excess );
  10086. }
  10087. // Return only captures needed by the pseudo filter method (type and argument)
  10088. return match.slice( 0, 3 );
  10089. }
  10090. },
  10091. filter: {
  10092. "TAG": function( nodeNameSelector ) {
  10093. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  10094. return nodeNameSelector === "*" ?
  10095. function() { return true; } :
  10096. function( elem ) {
  10097. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  10098. };
  10099. },
  10100. "CLASS": function( className ) {
  10101. var pattern = classCache[ className + " " ];
  10102. return pattern ||
  10103. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  10104. classCache( className, function( elem ) {
  10105. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  10106. });
  10107. },
  10108. "ATTR": function( name, operator, check ) {
  10109. return function( elem ) {
  10110. var result = Sizzle.attr( elem, name );
  10111. if ( result == null ) {
  10112. return operator === "!=";
  10113. }
  10114. if ( !operator ) {
  10115. return true;
  10116. }
  10117. result += "";
  10118. return operator === "=" ? result === check :
  10119. operator === "!=" ? result !== check :
  10120. operator === "^=" ? check && result.indexOf( check ) === 0 :
  10121. operator === "*=" ? check && result.indexOf( check ) > -1 :
  10122. operator === "$=" ? check && result.slice( -check.length ) === check :
  10123. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  10124. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  10125. false;
  10126. };
  10127. },
  10128. "CHILD": function( type, what, argument, first, last ) {
  10129. var simple = type.slice( 0, 3 ) !== "nth",
  10130. forward = type.slice( -4 ) !== "last",
  10131. ofType = what === "of-type";
  10132. return first === 1 && last === 0 ?
  10133. // Shortcut for :nth-*(n)
  10134. function( elem ) {
  10135. return !!elem.parentNode;
  10136. } :
  10137. function( elem, context, xml ) {
  10138. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  10139. dir = simple !== forward ? "nextSibling" : "previousSibling",
  10140. parent = elem.parentNode,
  10141. name = ofType && elem.nodeName.toLowerCase(),
  10142. useCache = !xml && !ofType,
  10143. diff = false;
  10144. if ( parent ) {
  10145. // :(first|last|only)-(child|of-type)
  10146. if ( simple ) {
  10147. while ( dir ) {
  10148. node = elem;
  10149. while ( (node = node[ dir ]) ) {
  10150. if ( ofType ?
  10151. node.nodeName.toLowerCase() === name :
  10152. node.nodeType === 1 ) {
  10153. return false;
  10154. }
  10155. }
  10156. // Reverse direction for :only-* (if we haven't yet done so)
  10157. start = dir = type === "only" && !start && "nextSibling";
  10158. }
  10159. return true;
  10160. }
  10161. start = [ forward ? parent.firstChild : parent.lastChild ];
  10162. // non-xml :nth-child(...) stores cache data on `parent`
  10163. if ( forward && useCache ) {
  10164. // Seek `elem` from a previously-cached index
  10165. // ...in a gzip-friendly way
  10166. node = parent;
  10167. outerCache = node[ expando ] || (node[ expando ] = {});
  10168. // Support: IE <9 only
  10169. // Defend against cloned attroperties (jQuery gh-1709)
  10170. uniqueCache = outerCache[ node.uniqueID ] ||
  10171. (outerCache[ node.uniqueID ] = {});
  10172. cache = uniqueCache[ type ] || [];
  10173. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  10174. diff = nodeIndex && cache[ 2 ];
  10175. node = nodeIndex && parent.childNodes[ nodeIndex ];
  10176. while ( (node = ++nodeIndex && node && node[ dir ] ||
  10177. // Fallback to seeking `elem` from the start
  10178. (diff = nodeIndex = 0) || start.pop()) ) {
  10179. // When found, cache indexes on `parent` and break
  10180. if ( node.nodeType === 1 && ++diff && node === elem ) {
  10181. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  10182. break;
  10183. }
  10184. }
  10185. } else {
  10186. // Use previously-cached element index if available
  10187. if ( useCache ) {
  10188. // ...in a gzip-friendly way
  10189. node = elem;
  10190. outerCache = node[ expando ] || (node[ expando ] = {});
  10191. // Support: IE <9 only
  10192. // Defend against cloned attroperties (jQuery gh-1709)
  10193. uniqueCache = outerCache[ node.uniqueID ] ||
  10194. (outerCache[ node.uniqueID ] = {});
  10195. cache = uniqueCache[ type ] || [];
  10196. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  10197. diff = nodeIndex;
  10198. }
  10199. // xml :nth-child(...)
  10200. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  10201. if ( diff === false ) {
  10202. // Use the same loop as above to seek `elem` from the start
  10203. while ( (node = ++nodeIndex && node && node[ dir ] ||
  10204. (diff = nodeIndex = 0) || start.pop()) ) {
  10205. if ( ( ofType ?
  10206. node.nodeName.toLowerCase() === name :
  10207. node.nodeType === 1 ) &&
  10208. ++diff ) {
  10209. // Cache the index of each encountered element
  10210. if ( useCache ) {
  10211. outerCache = node[ expando ] || (node[ expando ] = {});
  10212. // Support: IE <9 only
  10213. // Defend against cloned attroperties (jQuery gh-1709)
  10214. uniqueCache = outerCache[ node.uniqueID ] ||
  10215. (outerCache[ node.uniqueID ] = {});
  10216. uniqueCache[ type ] = [ dirruns, diff ];
  10217. }
  10218. if ( node === elem ) {
  10219. break;
  10220. }
  10221. }
  10222. }
  10223. }
  10224. }
  10225. // Incorporate the offset, then check against cycle size
  10226. diff -= last;
  10227. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  10228. }
  10229. };
  10230. },
  10231. "PSEUDO": function( pseudo, argument ) {
  10232. // pseudo-class names are case-insensitive
  10233. // http://www.w3.org/TR/selectors/#pseudo-classes
  10234. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  10235. // Remember that setFilters inherits from pseudos
  10236. var args,
  10237. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  10238. Sizzle.error( "unsupported pseudo: " + pseudo );
  10239. // The user may use createPseudo to indicate that
  10240. // arguments are needed to create the filter function
  10241. // just as Sizzle does
  10242. if ( fn[ expando ] ) {
  10243. return fn( argument );
  10244. }
  10245. // But maintain support for old signatures
  10246. if ( fn.length > 1 ) {
  10247. args = [ pseudo, pseudo, "", argument ];
  10248. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  10249. markFunction(function( seed, matches ) {
  10250. var idx,
  10251. matched = fn( seed, argument ),
  10252. i = matched.length;
  10253. while ( i-- ) {
  10254. idx = indexOf( seed, matched[i] );
  10255. seed[ idx ] = !( matches[ idx ] = matched[i] );
  10256. }
  10257. }) :
  10258. function( elem ) {
  10259. return fn( elem, 0, args );
  10260. };
  10261. }
  10262. return fn;
  10263. }
  10264. },
  10265. pseudos: {
  10266. // Potentially complex pseudos
  10267. "not": markFunction(function( selector ) {
  10268. // Trim the selector passed to compile
  10269. // to avoid treating leading and trailing
  10270. // spaces as combinators
  10271. var input = [],
  10272. results = [],
  10273. matcher = compile( selector.replace( rtrim, "$1" ) );
  10274. return matcher[ expando ] ?
  10275. markFunction(function( seed, matches, context, xml ) {
  10276. var elem,
  10277. unmatched = matcher( seed, null, xml, [] ),
  10278. i = seed.length;
  10279. // Match elements unmatched by `matcher`
  10280. while ( i-- ) {
  10281. if ( (elem = unmatched[i]) ) {
  10282. seed[i] = !(matches[i] = elem);
  10283. }
  10284. }
  10285. }) :
  10286. function( elem, context, xml ) {
  10287. input[0] = elem;
  10288. matcher( input, null, xml, results );
  10289. // Don't keep the element (issue #299)
  10290. input[0] = null;
  10291. return !results.pop();
  10292. };
  10293. }),
  10294. "has": markFunction(function( selector ) {
  10295. return function( elem ) {
  10296. return Sizzle( selector, elem ).length > 0;
  10297. };
  10298. }),
  10299. "contains": markFunction(function( text ) {
  10300. text = text.replace( runescape, funescape );
  10301. return function( elem ) {
  10302. return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1;
  10303. };
  10304. }),
  10305. // "Whether an element is represented by a :lang() selector
  10306. // is based solely on the element's language value
  10307. // being equal to the identifier C,
  10308. // or beginning with the identifier C immediately followed by "-".
  10309. // The matching of C against the element's language value is performed case-insensitively.
  10310. // The identifier C does not have to be a valid language name."
  10311. // http://www.w3.org/TR/selectors/#lang-pseudo
  10312. "lang": markFunction( function( lang ) {
  10313. // lang value must be a valid identifier
  10314. if ( !ridentifier.test(lang || "") ) {
  10315. Sizzle.error( "unsupported lang: " + lang );
  10316. }
  10317. lang = lang.replace( runescape, funescape ).toLowerCase();
  10318. return function( elem ) {
  10319. var elemLang;
  10320. do {
  10321. if ( (elemLang = documentIsHTML ?
  10322. elem.lang :
  10323. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  10324. elemLang = elemLang.toLowerCase();
  10325. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  10326. }
  10327. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  10328. return false;
  10329. };
  10330. }),
  10331. // Miscellaneous
  10332. "target": function( elem ) {
  10333. var hash = window.location && window.location.hash;
  10334. return hash && hash.slice( 1 ) === elem.id;
  10335. },
  10336. "root": function( elem ) {
  10337. return elem === docElem;
  10338. },
  10339. "focus": function( elem ) {
  10340. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  10341. },
  10342. // Boolean properties
  10343. "enabled": createDisabledPseudo( false ),
  10344. "disabled": createDisabledPseudo( true ),
  10345. "checked": function( elem ) {
  10346. // In CSS3, :checked should return both checked and selected elements
  10347. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  10348. var nodeName = elem.nodeName.toLowerCase();
  10349. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  10350. },
  10351. "selected": function( elem ) {
  10352. // Accessing this property makes selected-by-default
  10353. // options in Safari work properly
  10354. if ( elem.parentNode ) {
  10355. elem.parentNode.selectedIndex;
  10356. }
  10357. return elem.selected === true;
  10358. },
  10359. // Contents
  10360. "empty": function( elem ) {
  10361. // http://www.w3.org/TR/selectors/#empty-pseudo
  10362. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  10363. // but not by others (comment: 8; processing instruction: 7; etc.)
  10364. // nodeType < 6 works because attributes (2) do not appear as children
  10365. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  10366. if ( elem.nodeType < 6 ) {
  10367. return false;
  10368. }
  10369. }
  10370. return true;
  10371. },
  10372. "parent": function( elem ) {
  10373. return !Expr.pseudos["empty"]( elem );
  10374. },
  10375. // Element/input types
  10376. "header": function( elem ) {
  10377. return rheader.test( elem.nodeName );
  10378. },
  10379. "input": function( elem ) {
  10380. return rinputs.test( elem.nodeName );
  10381. },
  10382. "button": function( elem ) {
  10383. var name = elem.nodeName.toLowerCase();
  10384. return name === "input" && elem.type === "button" || name === "button";
  10385. },
  10386. "text": function( elem ) {
  10387. var attr;
  10388. return elem.nodeName.toLowerCase() === "input" &&
  10389. elem.type === "text" &&
  10390. // Support: IE<8
  10391. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  10392. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  10393. },
  10394. // Position-in-collection
  10395. "first": createPositionalPseudo(function() {
  10396. return [ 0 ];
  10397. }),
  10398. "last": createPositionalPseudo(function( matchIndexes, length ) {
  10399. return [ length - 1 ];
  10400. }),
  10401. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10402. return [ argument < 0 ? argument + length : argument ];
  10403. }),
  10404. "even": createPositionalPseudo(function( matchIndexes, length ) {
  10405. var i = 0;
  10406. for ( ; i < length; i += 2 ) {
  10407. matchIndexes.push( i );
  10408. }
  10409. return matchIndexes;
  10410. }),
  10411. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  10412. var i = 1;
  10413. for ( ; i < length; i += 2 ) {
  10414. matchIndexes.push( i );
  10415. }
  10416. return matchIndexes;
  10417. }),
  10418. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10419. var i = argument < 0 ?
  10420. argument + length :
  10421. argument > length ?
  10422. length :
  10423. argument;
  10424. for ( ; --i >= 0; ) {
  10425. matchIndexes.push( i );
  10426. }
  10427. return matchIndexes;
  10428. }),
  10429. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10430. var i = argument < 0 ? argument + length : argument;
  10431. for ( ; ++i < length; ) {
  10432. matchIndexes.push( i );
  10433. }
  10434. return matchIndexes;
  10435. })
  10436. }
  10437. };
  10438. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  10439. // Add button/input type pseudos
  10440. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  10441. Expr.pseudos[ i ] = createInputPseudo( i );
  10442. }
  10443. for ( i in { submit: true, reset: true } ) {
  10444. Expr.pseudos[ i ] = createButtonPseudo( i );
  10445. }
  10446. // Easy API for creating new setFilters
  10447. function setFilters() {}
  10448. setFilters.prototype = Expr.filters = Expr.pseudos;
  10449. Expr.setFilters = new setFilters();
  10450. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  10451. var matched, match, tokens, type,
  10452. soFar, groups, preFilters,
  10453. cached = tokenCache[ selector + " " ];
  10454. if ( cached ) {
  10455. return parseOnly ? 0 : cached.slice( 0 );
  10456. }
  10457. soFar = selector;
  10458. groups = [];
  10459. preFilters = Expr.preFilter;
  10460. while ( soFar ) {
  10461. // Comma and first run
  10462. if ( !matched || (match = rcomma.exec( soFar )) ) {
  10463. if ( match ) {
  10464. // Don't consume trailing commas as valid
  10465. soFar = soFar.slice( match[0].length ) || soFar;
  10466. }
  10467. groups.push( (tokens = []) );
  10468. }
  10469. matched = false;
  10470. // Combinators
  10471. if ( (match = rcombinators.exec( soFar )) ) {
  10472. matched = match.shift();
  10473. tokens.push({
  10474. value: matched,
  10475. // Cast descendant combinators to space
  10476. type: match[0].replace( rtrim, " " )
  10477. });
  10478. soFar = soFar.slice( matched.length );
  10479. }
  10480. // Filters
  10481. for ( type in Expr.filter ) {
  10482. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  10483. (match = preFilters[ type ]( match ))) ) {
  10484. matched = match.shift();
  10485. tokens.push({
  10486. value: matched,
  10487. type: type,
  10488. matches: match
  10489. });
  10490. soFar = soFar.slice( matched.length );
  10491. }
  10492. }
  10493. if ( !matched ) {
  10494. break;
  10495. }
  10496. }
  10497. // Return the length of the invalid excess
  10498. // if we're just parsing
  10499. // Otherwise, throw an error or return tokens
  10500. return parseOnly ?
  10501. soFar.length :
  10502. soFar ?
  10503. Sizzle.error( selector ) :
  10504. // Cache the tokens
  10505. tokenCache( selector, groups ).slice( 0 );
  10506. };
  10507. function toSelector( tokens ) {
  10508. var i = 0,
  10509. len = tokens.length,
  10510. selector = "";
  10511. for ( ; i < len; i++ ) {
  10512. selector += tokens[i].value;
  10513. }
  10514. return selector;
  10515. }
  10516. function addCombinator( matcher, combinator, base ) {
  10517. var dir = combinator.dir,
  10518. skip = combinator.next,
  10519. key = skip || dir,
  10520. checkNonElements = base && key === "parentNode",
  10521. doneName = done++;
  10522. return combinator.first ?
  10523. // Check against closest ancestor/preceding element
  10524. function( elem, context, xml ) {
  10525. while ( (elem = elem[ dir ]) ) {
  10526. if ( elem.nodeType === 1 || checkNonElements ) {
  10527. return matcher( elem, context, xml );
  10528. }
  10529. }
  10530. return false;
  10531. } :
  10532. // Check against all ancestor/preceding elements
  10533. function( elem, context, xml ) {
  10534. var oldCache, uniqueCache, outerCache,
  10535. newCache = [ dirruns, doneName ];
  10536. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  10537. if ( xml ) {
  10538. while ( (elem = elem[ dir ]) ) {
  10539. if ( elem.nodeType === 1 || checkNonElements ) {
  10540. if ( matcher( elem, context, xml ) ) {
  10541. return true;
  10542. }
  10543. }
  10544. }
  10545. } else {
  10546. while ( (elem = elem[ dir ]) ) {
  10547. if ( elem.nodeType === 1 || checkNonElements ) {
  10548. outerCache = elem[ expando ] || (elem[ expando ] = {});
  10549. // Support: IE <9 only
  10550. // Defend against cloned attroperties (jQuery gh-1709)
  10551. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  10552. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  10553. elem = elem[ dir ] || elem;
  10554. } else if ( (oldCache = uniqueCache[ key ]) &&
  10555. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  10556. // Assign to newCache so results back-propagate to previous elements
  10557. return (newCache[ 2 ] = oldCache[ 2 ]);
  10558. } else {
  10559. // Reuse newcache so results back-propagate to previous elements
  10560. uniqueCache[ key ] = newCache;
  10561. // A match means we're done; a fail means we have to keep checking
  10562. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  10563. return true;
  10564. }
  10565. }
  10566. }
  10567. }
  10568. }
  10569. return false;
  10570. };
  10571. }
  10572. function elementMatcher( matchers ) {
  10573. return matchers.length > 1 ?
  10574. function( elem, context, xml ) {
  10575. var i = matchers.length;
  10576. while ( i-- ) {
  10577. if ( !matchers[i]( elem, context, xml ) ) {
  10578. return false;
  10579. }
  10580. }
  10581. return true;
  10582. } :
  10583. matchers[0];
  10584. }
  10585. function multipleContexts( selector, contexts, results ) {
  10586. var i = 0,
  10587. len = contexts.length;
  10588. for ( ; i < len; i++ ) {
  10589. Sizzle( selector, contexts[i], results );
  10590. }
  10591. return results;
  10592. }
  10593. function condense( unmatched, map, filter, context, xml ) {
  10594. var elem,
  10595. newUnmatched = [],
  10596. i = 0,
  10597. len = unmatched.length,
  10598. mapped = map != null;
  10599. for ( ; i < len; i++ ) {
  10600. if ( (elem = unmatched[i]) ) {
  10601. if ( !filter || filter( elem, context, xml ) ) {
  10602. newUnmatched.push( elem );
  10603. if ( mapped ) {
  10604. map.push( i );
  10605. }
  10606. }
  10607. }
  10608. }
  10609. return newUnmatched;
  10610. }
  10611. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  10612. if ( postFilter && !postFilter[ expando ] ) {
  10613. postFilter = setMatcher( postFilter );
  10614. }
  10615. if ( postFinder && !postFinder[ expando ] ) {
  10616. postFinder = setMatcher( postFinder, postSelector );
  10617. }
  10618. return markFunction(function( seed, results, context, xml ) {
  10619. var temp, i, elem,
  10620. preMap = [],
  10621. postMap = [],
  10622. preexisting = results.length,
  10623. // Get initial elements from seed or context
  10624. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  10625. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  10626. matcherIn = preFilter && ( seed || !selector ) ?
  10627. condense( elems, preMap, preFilter, context, xml ) :
  10628. elems,
  10629. matcherOut = matcher ?
  10630. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  10631. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  10632. // ...intermediate processing is necessary
  10633. [] :
  10634. // ...otherwise use results directly
  10635. results :
  10636. matcherIn;
  10637. // Find primary matches
  10638. if ( matcher ) {
  10639. matcher( matcherIn, matcherOut, context, xml );
  10640. }
  10641. // Apply postFilter
  10642. if ( postFilter ) {
  10643. temp = condense( matcherOut, postMap );
  10644. postFilter( temp, [], context, xml );
  10645. // Un-match failing elements by moving them back to matcherIn
  10646. i = temp.length;
  10647. while ( i-- ) {
  10648. if ( (elem = temp[i]) ) {
  10649. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  10650. }
  10651. }
  10652. }
  10653. if ( seed ) {
  10654. if ( postFinder || preFilter ) {
  10655. if ( postFinder ) {
  10656. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  10657. temp = [];
  10658. i = matcherOut.length;
  10659. while ( i-- ) {
  10660. if ( (elem = matcherOut[i]) ) {
  10661. // Restore matcherIn since elem is not yet a final match
  10662. temp.push( (matcherIn[i] = elem) );
  10663. }
  10664. }
  10665. postFinder( null, (matcherOut = []), temp, xml );
  10666. }
  10667. // Move matched elements from seed to results to keep them synchronized
  10668. i = matcherOut.length;
  10669. while ( i-- ) {
  10670. if ( (elem = matcherOut[i]) &&
  10671. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  10672. seed[temp] = !(results[temp] = elem);
  10673. }
  10674. }
  10675. }
  10676. // Add elements to results, through postFinder if defined
  10677. } else {
  10678. matcherOut = condense(
  10679. matcherOut === results ?
  10680. matcherOut.splice( preexisting, matcherOut.length ) :
  10681. matcherOut
  10682. );
  10683. if ( postFinder ) {
  10684. postFinder( null, results, matcherOut, xml );
  10685. } else {
  10686. push.apply( results, matcherOut );
  10687. }
  10688. }
  10689. });
  10690. }
  10691. function matcherFromTokens( tokens ) {
  10692. var checkContext, matcher, j,
  10693. len = tokens.length,
  10694. leadingRelative = Expr.relative[ tokens[0].type ],
  10695. implicitRelative = leadingRelative || Expr.relative[" "],
  10696. i = leadingRelative ? 1 : 0,
  10697. // The foundational matcher ensures that elements are reachable from top-level context(s)
  10698. matchContext = addCombinator( function( elem ) {
  10699. return elem === checkContext;
  10700. }, implicitRelative, true ),
  10701. matchAnyContext = addCombinator( function( elem ) {
  10702. return indexOf( checkContext, elem ) > -1;
  10703. }, implicitRelative, true ),
  10704. matchers = [ function( elem, context, xml ) {
  10705. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  10706. (checkContext = context).nodeType ?
  10707. matchContext( elem, context, xml ) :
  10708. matchAnyContext( elem, context, xml ) );
  10709. // Avoid hanging onto element (issue #299)
  10710. checkContext = null;
  10711. return ret;
  10712. } ];
  10713. for ( ; i < len; i++ ) {
  10714. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  10715. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  10716. } else {
  10717. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  10718. // Return special upon seeing a positional matcher
  10719. if ( matcher[ expando ] ) {
  10720. // Find the next relative operator (if any) for proper handling
  10721. j = ++i;
  10722. for ( ; j < len; j++ ) {
  10723. if ( Expr.relative[ tokens[j].type ] ) {
  10724. break;
  10725. }
  10726. }
  10727. return setMatcher(
  10728. i > 1 && elementMatcher( matchers ),
  10729. i > 1 && toSelector(
  10730. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  10731. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  10732. ).replace( rtrim, "$1" ),
  10733. matcher,
  10734. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  10735. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  10736. j < len && toSelector( tokens )
  10737. );
  10738. }
  10739. matchers.push( matcher );
  10740. }
  10741. }
  10742. return elementMatcher( matchers );
  10743. }
  10744. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  10745. var bySet = setMatchers.length > 0,
  10746. byElement = elementMatchers.length > 0,
  10747. superMatcher = function( seed, context, xml, results, outermost ) {
  10748. var elem, j, matcher,
  10749. matchedCount = 0,
  10750. i = "0",
  10751. unmatched = seed && [],
  10752. setMatched = [],
  10753. contextBackup = outermostContext,
  10754. // We must always have either seed elements or outermost context
  10755. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  10756. // Use integer dirruns iff this is the outermost matcher
  10757. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  10758. len = elems.length;
  10759. if ( outermost ) {
  10760. outermostContext = context === document || context || outermost;
  10761. }
  10762. // Add elements passing elementMatchers directly to results
  10763. // Support: IE<9, Safari
  10764. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  10765. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  10766. if ( byElement && elem ) {
  10767. j = 0;
  10768. if ( !context && elem.ownerDocument !== document ) {
  10769. setDocument( elem );
  10770. xml = !documentIsHTML;
  10771. }
  10772. while ( (matcher = elementMatchers[j++]) ) {
  10773. if ( matcher( elem, context || document, xml) ) {
  10774. results.push( elem );
  10775. break;
  10776. }
  10777. }
  10778. if ( outermost ) {
  10779. dirruns = dirrunsUnique;
  10780. }
  10781. }
  10782. // Track unmatched elements for set filters
  10783. if ( bySet ) {
  10784. // They will have gone through all possible matchers
  10785. if ( (elem = !matcher && elem) ) {
  10786. matchedCount--;
  10787. }
  10788. // Lengthen the array for every element, matched or not
  10789. if ( seed ) {
  10790. unmatched.push( elem );
  10791. }
  10792. }
  10793. }
  10794. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  10795. // makes the latter nonnegative.
  10796. matchedCount += i;
  10797. // Apply set filters to unmatched elements
  10798. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  10799. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  10800. // no element matchers and no seed.
  10801. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  10802. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  10803. // numerically zero.
  10804. if ( bySet && i !== matchedCount ) {
  10805. j = 0;
  10806. while ( (matcher = setMatchers[j++]) ) {
  10807. matcher( unmatched, setMatched, context, xml );
  10808. }
  10809. if ( seed ) {
  10810. // Reintegrate element matches to eliminate the need for sorting
  10811. if ( matchedCount > 0 ) {
  10812. while ( i-- ) {
  10813. if ( !(unmatched[i] || setMatched[i]) ) {
  10814. setMatched[i] = pop.call( results );
  10815. }
  10816. }
  10817. }
  10818. // Discard index placeholder values to get only actual matches
  10819. setMatched = condense( setMatched );
  10820. }
  10821. // Add matches to results
  10822. push.apply( results, setMatched );
  10823. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  10824. if ( outermost && !seed && setMatched.length > 0 &&
  10825. ( matchedCount + setMatchers.length ) > 1 ) {
  10826. Sizzle.uniqueSort( results );
  10827. }
  10828. }
  10829. // Override manipulation of globals by nested matchers
  10830. if ( outermost ) {
  10831. dirruns = dirrunsUnique;
  10832. outermostContext = contextBackup;
  10833. }
  10834. return unmatched;
  10835. };
  10836. return bySet ?
  10837. markFunction( superMatcher ) :
  10838. superMatcher;
  10839. }
  10840. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  10841. var i,
  10842. setMatchers = [],
  10843. elementMatchers = [],
  10844. cached = compilerCache[ selector + " " ];
  10845. if ( !cached ) {
  10846. // Generate a function of recursive functions that can be used to check each element
  10847. if ( !match ) {
  10848. match = tokenize( selector );
  10849. }
  10850. i = match.length;
  10851. while ( i-- ) {
  10852. cached = matcherFromTokens( match[i] );
  10853. if ( cached[ expando ] ) {
  10854. setMatchers.push( cached );
  10855. } else {
  10856. elementMatchers.push( cached );
  10857. }
  10858. }
  10859. // Cache the compiled function
  10860. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  10861. // Save selector and tokenization
  10862. cached.selector = selector;
  10863. }
  10864. return cached;
  10865. };
  10866. /**
  10867. * A low-level selection function that works with Sizzle's compiled
  10868. * selector functions
  10869. * @param {String|Function} selector A selector or a pre-compiled
  10870. * selector function built with Sizzle.compile
  10871. * @param {Element} context
  10872. * @param {Array} [results]
  10873. * @param {Array} [seed] A set of elements to match against
  10874. */
  10875. select = Sizzle.select = function( selector, context, results, seed ) {
  10876. var i, tokens, token, type, find,
  10877. compiled = typeof selector === "function" && selector,
  10878. match = !seed && tokenize( (selector = compiled.selector || selector) );
  10879. results = results || [];
  10880. // Try to minimize operations if there is only one selector in the list and no seed
  10881. // (the latter of which guarantees us context)
  10882. if ( match.length === 1 ) {
  10883. // Reduce context if the leading compound selector is an ID
  10884. tokens = match[0] = match[0].slice( 0 );
  10885. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  10886. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
  10887. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  10888. if ( !context ) {
  10889. return results;
  10890. // Precompiled matchers will still verify ancestry, so step up a level
  10891. } else if ( compiled ) {
  10892. context = context.parentNode;
  10893. }
  10894. selector = selector.slice( tokens.shift().value.length );
  10895. }
  10896. // Fetch a seed set for right-to-left matching
  10897. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  10898. while ( i-- ) {
  10899. token = tokens[i];
  10900. // Abort if we hit a combinator
  10901. if ( Expr.relative[ (type = token.type) ] ) {
  10902. break;
  10903. }
  10904. if ( (find = Expr.find[ type ]) ) {
  10905. // Search, expanding context for leading sibling combinators
  10906. if ( (seed = find(
  10907. token.matches[0].replace( runescape, funescape ),
  10908. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  10909. )) ) {
  10910. // If seed is empty or no tokens remain, we can return early
  10911. tokens.splice( i, 1 );
  10912. selector = seed.length && toSelector( tokens );
  10913. if ( !selector ) {
  10914. push.apply( results, seed );
  10915. return results;
  10916. }
  10917. break;
  10918. }
  10919. }
  10920. }
  10921. }
  10922. // Compile and execute a filtering function if one is not provided
  10923. // Provide `match` to avoid retokenization if we modified the selector above
  10924. ( compiled || compile( selector, match ) )(
  10925. seed,
  10926. context,
  10927. !documentIsHTML,
  10928. results,
  10929. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  10930. );
  10931. return results;
  10932. };
  10933. // One-time assignments
  10934. // Sort stability
  10935. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  10936. // Support: Chrome 14-35+
  10937. // Always assume duplicates if they aren't passed to the comparison function
  10938. support.detectDuplicates = !!hasDuplicate;
  10939. // Initialize against the default document
  10940. setDocument();
  10941. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  10942. // Detached nodes confoundingly follow *each other*
  10943. support.sortDetached = assert(function( el ) {
  10944. // Should return 1, but returns 4 (following)
  10945. return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
  10946. });
  10947. // Support: IE<8
  10948. // Prevent attribute/property "interpolation"
  10949. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  10950. if ( !assert(function( el ) {
  10951. el.innerHTML = "<a href='#'></a>";
  10952. return el.firstChild.getAttribute("href") === "#" ;
  10953. }) ) {
  10954. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  10955. if ( !isXML ) {
  10956. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  10957. }
  10958. });
  10959. }
  10960. // Support: IE<9
  10961. // Use defaultValue in place of getAttribute("value")
  10962. if ( !support.attributes || !assert(function( el ) {
  10963. el.innerHTML = "<input/>";
  10964. el.firstChild.setAttribute( "value", "" );
  10965. return el.firstChild.getAttribute( "value" ) === "";
  10966. }) ) {
  10967. addHandle( "value", function( elem, name, isXML ) {
  10968. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  10969. return elem.defaultValue;
  10970. }
  10971. });
  10972. }
  10973. // Support: IE<9
  10974. // Use getAttributeNode to fetch booleans when getAttribute lies
  10975. if ( !assert(function( el ) {
  10976. return el.getAttribute("disabled") == null;
  10977. }) ) {
  10978. addHandle( booleans, function( elem, name, isXML ) {
  10979. var val;
  10980. if ( !isXML ) {
  10981. return elem[ name ] === true ? name.toLowerCase() :
  10982. (val = elem.getAttributeNode( name )) && val.specified ?
  10983. val.value :
  10984. null;
  10985. }
  10986. });
  10987. }
  10988. return Sizzle;
  10989. })( window );
  10990. jQuery.find = Sizzle;
  10991. jQuery.expr = Sizzle.selectors;
  10992. // Deprecated
  10993. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  10994. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  10995. jQuery.text = Sizzle.getText;
  10996. jQuery.isXMLDoc = Sizzle.isXML;
  10997. jQuery.contains = Sizzle.contains;
  10998. jQuery.escapeSelector = Sizzle.escape;
  10999. var dir = function( elem, dir, until ) {
  11000. var matched = [],
  11001. truncate = until !== undefined;
  11002. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  11003. if ( elem.nodeType === 1 ) {
  11004. if ( truncate && jQuery( elem ).is( until ) ) {
  11005. break;
  11006. }
  11007. matched.push( elem );
  11008. }
  11009. }
  11010. return matched;
  11011. };
  11012. var siblings = function( n, elem ) {
  11013. var matched = [];
  11014. for ( ; n; n = n.nextSibling ) {
  11015. if ( n.nodeType === 1 && n !== elem ) {
  11016. matched.push( n );
  11017. }
  11018. }
  11019. return matched;
  11020. };
  11021. var rneedsContext = jQuery.expr.match.needsContext;
  11022. function nodeName( elem, name ) {
  11023. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  11024. };
  11025. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  11026. // Implement the identical functionality for filter and not
  11027. function winnow( elements, qualifier, not ) {
  11028. if ( isFunction( qualifier ) ) {
  11029. return jQuery.grep( elements, function( elem, i ) {
  11030. return !!qualifier.call( elem, i, elem ) !== not;
  11031. } );
  11032. }
  11033. // Single element
  11034. if ( qualifier.nodeType ) {
  11035. return jQuery.grep( elements, function( elem ) {
  11036. return ( elem === qualifier ) !== not;
  11037. } );
  11038. }
  11039. // Arraylike of elements (jQuery, arguments, Array)
  11040. if ( typeof qualifier !== "string" ) {
  11041. return jQuery.grep( elements, function( elem ) {
  11042. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  11043. } );
  11044. }
  11045. // Filtered directly for both simple and complex selectors
  11046. return jQuery.filter( qualifier, elements, not );
  11047. }
  11048. jQuery.filter = function( expr, elems, not ) {
  11049. var elem = elems[ 0 ];
  11050. if ( not ) {
  11051. expr = ":not(" + expr + ")";
  11052. }
  11053. if ( elems.length === 1 && elem.nodeType === 1 ) {
  11054. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  11055. }
  11056. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  11057. return elem.nodeType === 1;
  11058. } ) );
  11059. };
  11060. jQuery.fn.extend( {
  11061. find: function( selector ) {
  11062. var i, ret,
  11063. len = this.length,
  11064. self = this;
  11065. if ( typeof selector !== "string" ) {
  11066. return this.pushStack( jQuery( selector ).filter( function() {
  11067. for ( i = 0; i < len; i++ ) {
  11068. if ( jQuery.contains( self[ i ], this ) ) {
  11069. return true;
  11070. }
  11071. }
  11072. } ) );
  11073. }
  11074. ret = this.pushStack( [] );
  11075. for ( i = 0; i < len; i++ ) {
  11076. jQuery.find( selector, self[ i ], ret );
  11077. }
  11078. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  11079. },
  11080. filter: function( selector ) {
  11081. return this.pushStack( winnow( this, selector || [], false ) );
  11082. },
  11083. not: function( selector ) {
  11084. return this.pushStack( winnow( this, selector || [], true ) );
  11085. },
  11086. is: function( selector ) {
  11087. return !!winnow(
  11088. this,
  11089. // If this is a positional/relative selector, check membership in the returned set
  11090. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  11091. typeof selector === "string" && rneedsContext.test( selector ) ?
  11092. jQuery( selector ) :
  11093. selector || [],
  11094. false
  11095. ).length;
  11096. }
  11097. } );
  11098. // Initialize a jQuery object
  11099. // A central reference to the root jQuery(document)
  11100. var rootjQuery,
  11101. // A simple way to check for HTML strings
  11102. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  11103. // Strict HTML recognition (#11290: must start with <)
  11104. // Shortcut simple #id case for speed
  11105. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  11106. init = jQuery.fn.init = function( selector, context, root ) {
  11107. var match, elem;
  11108. // HANDLE: $(""), $(null), $(undefined), $(false)
  11109. if ( !selector ) {
  11110. return this;
  11111. }
  11112. // Method init() accepts an alternate rootjQuery
  11113. // so migrate can support jQuery.sub (gh-2101)
  11114. root = root || rootjQuery;
  11115. // Handle HTML strings
  11116. if ( typeof selector === "string" ) {
  11117. if ( selector[ 0 ] === "<" &&
  11118. selector[ selector.length - 1 ] === ">" &&
  11119. selector.length >= 3 ) {
  11120. // Assume that strings that start and end with <> are HTML and skip the regex check
  11121. match = [ null, selector, null ];
  11122. } else {
  11123. match = rquickExpr.exec( selector );
  11124. }
  11125. // Match html or make sure no context is specified for #id
  11126. if ( match && ( match[ 1 ] || !context ) ) {
  11127. // HANDLE: $(html) -> $(array)
  11128. if ( match[ 1 ] ) {
  11129. context = context instanceof jQuery ? context[ 0 ] : context;
  11130. // Option to run scripts is true for back-compat
  11131. // Intentionally let the error be thrown if parseHTML is not present
  11132. jQuery.merge( this, jQuery.parseHTML(
  11133. match[ 1 ],
  11134. context && context.nodeType ? context.ownerDocument || context : document,
  11135. true
  11136. ) );
  11137. // HANDLE: $(html, props)
  11138. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  11139. for ( match in context ) {
  11140. // Properties of context are called as methods if possible
  11141. if ( isFunction( this[ match ] ) ) {
  11142. this[ match ]( context[ match ] );
  11143. // ...and otherwise set as attributes
  11144. } else {
  11145. this.attr( match, context[ match ] );
  11146. }
  11147. }
  11148. }
  11149. return this;
  11150. // HANDLE: $(#id)
  11151. } else {
  11152. elem = document.getElementById( match[ 2 ] );
  11153. if ( elem ) {
  11154. // Inject the element directly into the jQuery object
  11155. this[ 0 ] = elem;
  11156. this.length = 1;
  11157. }
  11158. return this;
  11159. }
  11160. // HANDLE: $(expr, $(...))
  11161. } else if ( !context || context.jquery ) {
  11162. return ( context || root ).find( selector );
  11163. // HANDLE: $(expr, context)
  11164. // (which is just equivalent to: $(context).find(expr)
  11165. } else {
  11166. return this.constructor( context ).find( selector );
  11167. }
  11168. // HANDLE: $(DOMElement)
  11169. } else if ( selector.nodeType ) {
  11170. this[ 0 ] = selector;
  11171. this.length = 1;
  11172. return this;
  11173. // HANDLE: $(function)
  11174. // Shortcut for document ready
  11175. } else if ( isFunction( selector ) ) {
  11176. return root.ready !== undefined ?
  11177. root.ready( selector ) :
  11178. // Execute immediately if ready is not present
  11179. selector( jQuery );
  11180. }
  11181. return jQuery.makeArray( selector, this );
  11182. };
  11183. // Give the init function the jQuery prototype for later instantiation
  11184. init.prototype = jQuery.fn;
  11185. // Initialize central reference
  11186. rootjQuery = jQuery( document );
  11187. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  11188. // Methods guaranteed to produce a unique set when starting from a unique set
  11189. guaranteedUnique = {
  11190. children: true,
  11191. contents: true,
  11192. next: true,
  11193. prev: true
  11194. };
  11195. jQuery.fn.extend( {
  11196. has: function( target ) {
  11197. var targets = jQuery( target, this ),
  11198. l = targets.length;
  11199. return this.filter( function() {
  11200. var i = 0;
  11201. for ( ; i < l; i++ ) {
  11202. if ( jQuery.contains( this, targets[ i ] ) ) {
  11203. return true;
  11204. }
  11205. }
  11206. } );
  11207. },
  11208. closest: function( selectors, context ) {
  11209. var cur,
  11210. i = 0,
  11211. l = this.length,
  11212. matched = [],
  11213. targets = typeof selectors !== "string" && jQuery( selectors );
  11214. // Positional selectors never match, since there's no _selection_ context
  11215. if ( !rneedsContext.test( selectors ) ) {
  11216. for ( ; i < l; i++ ) {
  11217. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  11218. // Always skip document fragments
  11219. if ( cur.nodeType < 11 && ( targets ?
  11220. targets.index( cur ) > -1 :
  11221. // Don't pass non-elements to Sizzle
  11222. cur.nodeType === 1 &&
  11223. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  11224. matched.push( cur );
  11225. break;
  11226. }
  11227. }
  11228. }
  11229. }
  11230. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  11231. },
  11232. // Determine the position of an element within the set
  11233. index: function( elem ) {
  11234. // No argument, return index in parent
  11235. if ( !elem ) {
  11236. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  11237. }
  11238. // Index in selector
  11239. if ( typeof elem === "string" ) {
  11240. return indexOf.call( jQuery( elem ), this[ 0 ] );
  11241. }
  11242. // Locate the position of the desired element
  11243. return indexOf.call( this,
  11244. // If it receives a jQuery object, the first element is used
  11245. elem.jquery ? elem[ 0 ] : elem
  11246. );
  11247. },
  11248. add: function( selector, context ) {
  11249. return this.pushStack(
  11250. jQuery.uniqueSort(
  11251. jQuery.merge( this.get(), jQuery( selector, context ) )
  11252. )
  11253. );
  11254. },
  11255. addBack: function( selector ) {
  11256. return this.add( selector == null ?
  11257. this.prevObject : this.prevObject.filter( selector )
  11258. );
  11259. }
  11260. } );
  11261. function sibling( cur, dir ) {
  11262. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  11263. return cur;
  11264. }
  11265. jQuery.each( {
  11266. parent: function( elem ) {
  11267. var parent = elem.parentNode;
  11268. return parent && parent.nodeType !== 11 ? parent : null;
  11269. },
  11270. parents: function( elem ) {
  11271. return dir( elem, "parentNode" );
  11272. },
  11273. parentsUntil: function( elem, i, until ) {
  11274. return dir( elem, "parentNode", until );
  11275. },
  11276. next: function( elem ) {
  11277. return sibling( elem, "nextSibling" );
  11278. },
  11279. prev: function( elem ) {
  11280. return sibling( elem, "previousSibling" );
  11281. },
  11282. nextAll: function( elem ) {
  11283. return dir( elem, "nextSibling" );
  11284. },
  11285. prevAll: function( elem ) {
  11286. return dir( elem, "previousSibling" );
  11287. },
  11288. nextUntil: function( elem, i, until ) {
  11289. return dir( elem, "nextSibling", until );
  11290. },
  11291. prevUntil: function( elem, i, until ) {
  11292. return dir( elem, "previousSibling", until );
  11293. },
  11294. siblings: function( elem ) {
  11295. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  11296. },
  11297. children: function( elem ) {
  11298. return siblings( elem.firstChild );
  11299. },
  11300. contents: function( elem ) {
  11301. if ( typeof elem.contentDocument !== "undefined" ) {
  11302. return elem.contentDocument;
  11303. }
  11304. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  11305. // Treat the template element as a regular one in browsers that
  11306. // don't support it.
  11307. if ( nodeName( elem, "template" ) ) {
  11308. elem = elem.content || elem;
  11309. }
  11310. return jQuery.merge( [], elem.childNodes );
  11311. }
  11312. }, function( name, fn ) {
  11313. jQuery.fn[ name ] = function( until, selector ) {
  11314. var matched = jQuery.map( this, fn, until );
  11315. if ( name.slice( -5 ) !== "Until" ) {
  11316. selector = until;
  11317. }
  11318. if ( selector && typeof selector === "string" ) {
  11319. matched = jQuery.filter( selector, matched );
  11320. }
  11321. if ( this.length > 1 ) {
  11322. // Remove duplicates
  11323. if ( !guaranteedUnique[ name ] ) {
  11324. jQuery.uniqueSort( matched );
  11325. }
  11326. // Reverse order for parents* and prev-derivatives
  11327. if ( rparentsprev.test( name ) ) {
  11328. matched.reverse();
  11329. }
  11330. }
  11331. return this.pushStack( matched );
  11332. };
  11333. } );
  11334. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  11335. // Convert String-formatted options into Object-formatted ones
  11336. function createOptions( options ) {
  11337. var object = {};
  11338. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  11339. object[ flag ] = true;
  11340. } );
  11341. return object;
  11342. }
  11343. /*
  11344. * Create a callback list using the following parameters:
  11345. *
  11346. * options: an optional list of space-separated options that will change how
  11347. * the callback list behaves or a more traditional option object
  11348. *
  11349. * By default a callback list will act like an event callback list and can be
  11350. * "fired" multiple times.
  11351. *
  11352. * Possible options:
  11353. *
  11354. * once: will ensure the callback list can only be fired once (like a Deferred)
  11355. *
  11356. * memory: will keep track of previous values and will call any callback added
  11357. * after the list has been fired right away with the latest "memorized"
  11358. * values (like a Deferred)
  11359. *
  11360. * unique: will ensure a callback can only be added once (no duplicate in the list)
  11361. *
  11362. * stopOnFalse: interrupt callings when a callback returns false
  11363. *
  11364. */
  11365. jQuery.Callbacks = function( options ) {
  11366. // Convert options from String-formatted to Object-formatted if needed
  11367. // (we check in cache first)
  11368. options = typeof options === "string" ?
  11369. createOptions( options ) :
  11370. jQuery.extend( {}, options );
  11371. var // Flag to know if list is currently firing
  11372. firing,
  11373. // Last fire value for non-forgettable lists
  11374. memory,
  11375. // Flag to know if list was already fired
  11376. fired,
  11377. // Flag to prevent firing
  11378. locked,
  11379. // Actual callback list
  11380. list = [],
  11381. // Queue of execution data for repeatable lists
  11382. queue = [],
  11383. // Index of currently firing callback (modified by add/remove as needed)
  11384. firingIndex = -1,
  11385. // Fire callbacks
  11386. fire = function() {
  11387. // Enforce single-firing
  11388. locked = locked || options.once;
  11389. // Execute callbacks for all pending executions,
  11390. // respecting firingIndex overrides and runtime changes
  11391. fired = firing = true;
  11392. for ( ; queue.length; firingIndex = -1 ) {
  11393. memory = queue.shift();
  11394. while ( ++firingIndex < list.length ) {
  11395. // Run callback and check for early termination
  11396. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  11397. options.stopOnFalse ) {
  11398. // Jump to end and forget the data so .add doesn't re-fire
  11399. firingIndex = list.length;
  11400. memory = false;
  11401. }
  11402. }
  11403. }
  11404. // Forget the data if we're done with it
  11405. if ( !options.memory ) {
  11406. memory = false;
  11407. }
  11408. firing = false;
  11409. // Clean up if we're done firing for good
  11410. if ( locked ) {
  11411. // Keep an empty list if we have data for future add calls
  11412. if ( memory ) {
  11413. list = [];
  11414. // Otherwise, this object is spent
  11415. } else {
  11416. list = "";
  11417. }
  11418. }
  11419. },
  11420. // Actual Callbacks object
  11421. self = {
  11422. // Add a callback or a collection of callbacks to the list
  11423. add: function() {
  11424. if ( list ) {
  11425. // If we have memory from a past run, we should fire after adding
  11426. if ( memory && !firing ) {
  11427. firingIndex = list.length - 1;
  11428. queue.push( memory );
  11429. }
  11430. ( function add( args ) {
  11431. jQuery.each( args, function( _, arg ) {
  11432. if ( isFunction( arg ) ) {
  11433. if ( !options.unique || !self.has( arg ) ) {
  11434. list.push( arg );
  11435. }
  11436. } else if ( arg && arg.length && toType( arg ) !== "string" ) {
  11437. // Inspect recursively
  11438. add( arg );
  11439. }
  11440. } );
  11441. } )( arguments );
  11442. if ( memory && !firing ) {
  11443. fire();
  11444. }
  11445. }
  11446. return this;
  11447. },
  11448. // Remove a callback from the list
  11449. remove: function() {
  11450. jQuery.each( arguments, function( _, arg ) {
  11451. var index;
  11452. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  11453. list.splice( index, 1 );
  11454. // Handle firing indexes
  11455. if ( index <= firingIndex ) {
  11456. firingIndex--;
  11457. }
  11458. }
  11459. } );
  11460. return this;
  11461. },
  11462. // Check if a given callback is in the list.
  11463. // If no argument is given, return whether or not list has callbacks attached.
  11464. has: function( fn ) {
  11465. return fn ?
  11466. jQuery.inArray( fn, list ) > -1 :
  11467. list.length > 0;
  11468. },
  11469. // Remove all callbacks from the list
  11470. empty: function() {
  11471. if ( list ) {
  11472. list = [];
  11473. }
  11474. return this;
  11475. },
  11476. // Disable .fire and .add
  11477. // Abort any current/pending executions
  11478. // Clear all callbacks and values
  11479. disable: function() {
  11480. locked = queue = [];
  11481. list = memory = "";
  11482. return this;
  11483. },
  11484. disabled: function() {
  11485. return !list;
  11486. },
  11487. // Disable .fire
  11488. // Also disable .add unless we have memory (since it would have no effect)
  11489. // Abort any pending executions
  11490. lock: function() {
  11491. locked = queue = [];
  11492. if ( !memory && !firing ) {
  11493. list = memory = "";
  11494. }
  11495. return this;
  11496. },
  11497. locked: function() {
  11498. return !!locked;
  11499. },
  11500. // Call all callbacks with the given context and arguments
  11501. fireWith: function( context, args ) {
  11502. if ( !locked ) {
  11503. args = args || [];
  11504. args = [ context, args.slice ? args.slice() : args ];
  11505. queue.push( args );
  11506. if ( !firing ) {
  11507. fire();
  11508. }
  11509. }
  11510. return this;
  11511. },
  11512. // Call all the callbacks with the given arguments
  11513. fire: function() {
  11514. self.fireWith( this, arguments );
  11515. return this;
  11516. },
  11517. // To know if the callbacks have already been called at least once
  11518. fired: function() {
  11519. return !!fired;
  11520. }
  11521. };
  11522. return self;
  11523. };
  11524. function Identity( v ) {
  11525. return v;
  11526. }
  11527. function Thrower( ex ) {
  11528. throw ex;
  11529. }
  11530. function adoptValue( value, resolve, reject, noValue ) {
  11531. var method;
  11532. try {
  11533. // Check for promise aspect first to privilege synchronous behavior
  11534. if ( value && isFunction( ( method = value.promise ) ) ) {
  11535. method.call( value ).done( resolve ).fail( reject );
  11536. // Other thenables
  11537. } else if ( value && isFunction( ( method = value.then ) ) ) {
  11538. method.call( value, resolve, reject );
  11539. // Other non-thenables
  11540. } else {
  11541. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  11542. // * false: [ value ].slice( 0 ) => resolve( value )
  11543. // * true: [ value ].slice( 1 ) => resolve()
  11544. resolve.apply( undefined, [ value ].slice( noValue ) );
  11545. }
  11546. // For Promises/A+, convert exceptions into rejections
  11547. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  11548. // Deferred#then to conditionally suppress rejection.
  11549. } catch ( value ) {
  11550. // Support: Android 4.0 only
  11551. // Strict mode functions invoked without .call/.apply get global-object context
  11552. reject.apply( undefined, [ value ] );
  11553. }
  11554. }
  11555. jQuery.extend( {
  11556. Deferred: function( func ) {
  11557. var tuples = [
  11558. // action, add listener, callbacks,
  11559. // ... .then handlers, argument index, [final state]
  11560. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  11561. jQuery.Callbacks( "memory" ), 2 ],
  11562. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  11563. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  11564. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  11565. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  11566. ],
  11567. state = "pending",
  11568. promise = {
  11569. state: function() {
  11570. return state;
  11571. },
  11572. always: function() {
  11573. deferred.done( arguments ).fail( arguments );
  11574. return this;
  11575. },
  11576. "catch": function( fn ) {
  11577. return promise.then( null, fn );
  11578. },
  11579. // Keep pipe for back-compat
  11580. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  11581. var fns = arguments;
  11582. return jQuery.Deferred( function( newDefer ) {
  11583. jQuery.each( tuples, function( i, tuple ) {
  11584. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  11585. var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  11586. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  11587. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  11588. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  11589. deferred[ tuple[ 1 ] ]( function() {
  11590. var returned = fn && fn.apply( this, arguments );
  11591. if ( returned && isFunction( returned.promise ) ) {
  11592. returned.promise()
  11593. .progress( newDefer.notify )
  11594. .done( newDefer.resolve )
  11595. .fail( newDefer.reject );
  11596. } else {
  11597. newDefer[ tuple[ 0 ] + "With" ](
  11598. this,
  11599. fn ? [ returned ] : arguments
  11600. );
  11601. }
  11602. } );
  11603. } );
  11604. fns = null;
  11605. } ).promise();
  11606. },
  11607. then: function( onFulfilled, onRejected, onProgress ) {
  11608. var maxDepth = 0;
  11609. function resolve( depth, deferred, handler, special ) {
  11610. return function() {
  11611. var that = this,
  11612. args = arguments,
  11613. mightThrow = function() {
  11614. var returned, then;
  11615. // Support: Promises/A+ section 2.3.3.3.3
  11616. // https://promisesaplus.com/#point-59
  11617. // Ignore double-resolution attempts
  11618. if ( depth < maxDepth ) {
  11619. return;
  11620. }
  11621. returned = handler.apply( that, args );
  11622. // Support: Promises/A+ section 2.3.1
  11623. // https://promisesaplus.com/#point-48
  11624. if ( returned === deferred.promise() ) {
  11625. throw new TypeError( "Thenable self-resolution" );
  11626. }
  11627. // Support: Promises/A+ sections 2.3.3.1, 3.5
  11628. // https://promisesaplus.com/#point-54
  11629. // https://promisesaplus.com/#point-75
  11630. // Retrieve `then` only once
  11631. then = returned &&
  11632. // Support: Promises/A+ section 2.3.4
  11633. // https://promisesaplus.com/#point-64
  11634. // Only check objects and functions for thenability
  11635. ( typeof returned === "object" ||
  11636. typeof returned === "function" ) &&
  11637. returned.then;
  11638. // Handle a returned thenable
  11639. if ( isFunction( then ) ) {
  11640. // Special processors (notify) just wait for resolution
  11641. if ( special ) {
  11642. then.call(
  11643. returned,
  11644. resolve( maxDepth, deferred, Identity, special ),
  11645. resolve( maxDepth, deferred, Thrower, special )
  11646. );
  11647. // Normal processors (resolve) also hook into progress
  11648. } else {
  11649. // ...and disregard older resolution values
  11650. maxDepth++;
  11651. then.call(
  11652. returned,
  11653. resolve( maxDepth, deferred, Identity, special ),
  11654. resolve( maxDepth, deferred, Thrower, special ),
  11655. resolve( maxDepth, deferred, Identity,
  11656. deferred.notifyWith )
  11657. );
  11658. }
  11659. // Handle all other returned values
  11660. } else {
  11661. // Only substitute handlers pass on context
  11662. // and multiple values (non-spec behavior)
  11663. if ( handler !== Identity ) {
  11664. that = undefined;
  11665. args = [ returned ];
  11666. }
  11667. // Process the value(s)
  11668. // Default process is resolve
  11669. ( special || deferred.resolveWith )( that, args );
  11670. }
  11671. },
  11672. // Only normal processors (resolve) catch and reject exceptions
  11673. process = special ?
  11674. mightThrow :
  11675. function() {
  11676. try {
  11677. mightThrow();
  11678. } catch ( e ) {
  11679. if ( jQuery.Deferred.exceptionHook ) {
  11680. jQuery.Deferred.exceptionHook( e,
  11681. process.stackTrace );
  11682. }
  11683. // Support: Promises/A+ section 2.3.3.3.4.1
  11684. // https://promisesaplus.com/#point-61
  11685. // Ignore post-resolution exceptions
  11686. if ( depth + 1 >= maxDepth ) {
  11687. // Only substitute handlers pass on context
  11688. // and multiple values (non-spec behavior)
  11689. if ( handler !== Thrower ) {
  11690. that = undefined;
  11691. args = [ e ];
  11692. }
  11693. deferred.rejectWith( that, args );
  11694. }
  11695. }
  11696. };
  11697. // Support: Promises/A+ section 2.3.3.3.1
  11698. // https://promisesaplus.com/#point-57
  11699. // Re-resolve promises immediately to dodge false rejection from
  11700. // subsequent errors
  11701. if ( depth ) {
  11702. process();
  11703. } else {
  11704. // Call an optional hook to record the stack, in case of exception
  11705. // since it's otherwise lost when execution goes async
  11706. if ( jQuery.Deferred.getStackHook ) {
  11707. process.stackTrace = jQuery.Deferred.getStackHook();
  11708. }
  11709. window.setTimeout( process );
  11710. }
  11711. };
  11712. }
  11713. return jQuery.Deferred( function( newDefer ) {
  11714. // progress_handlers.add( ... )
  11715. tuples[ 0 ][ 3 ].add(
  11716. resolve(
  11717. 0,
  11718. newDefer,
  11719. isFunction( onProgress ) ?
  11720. onProgress :
  11721. Identity,
  11722. newDefer.notifyWith
  11723. )
  11724. );
  11725. // fulfilled_handlers.add( ... )
  11726. tuples[ 1 ][ 3 ].add(
  11727. resolve(
  11728. 0,
  11729. newDefer,
  11730. isFunction( onFulfilled ) ?
  11731. onFulfilled :
  11732. Identity
  11733. )
  11734. );
  11735. // rejected_handlers.add( ... )
  11736. tuples[ 2 ][ 3 ].add(
  11737. resolve(
  11738. 0,
  11739. newDefer,
  11740. isFunction( onRejected ) ?
  11741. onRejected :
  11742. Thrower
  11743. )
  11744. );
  11745. } ).promise();
  11746. },
  11747. // Get a promise for this deferred
  11748. // If obj is provided, the promise aspect is added to the object
  11749. promise: function( obj ) {
  11750. return obj != null ? jQuery.extend( obj, promise ) : promise;
  11751. }
  11752. },
  11753. deferred = {};
  11754. // Add list-specific methods
  11755. jQuery.each( tuples, function( i, tuple ) {
  11756. var list = tuple[ 2 ],
  11757. stateString = tuple[ 5 ];
  11758. // promise.progress = list.add
  11759. // promise.done = list.add
  11760. // promise.fail = list.add
  11761. promise[ tuple[ 1 ] ] = list.add;
  11762. // Handle state
  11763. if ( stateString ) {
  11764. list.add(
  11765. function() {
  11766. // state = "resolved" (i.e., fulfilled)
  11767. // state = "rejected"
  11768. state = stateString;
  11769. },
  11770. // rejected_callbacks.disable
  11771. // fulfilled_callbacks.disable
  11772. tuples[ 3 - i ][ 2 ].disable,
  11773. // rejected_handlers.disable
  11774. // fulfilled_handlers.disable
  11775. tuples[ 3 - i ][ 3 ].disable,
  11776. // progress_callbacks.lock
  11777. tuples[ 0 ][ 2 ].lock,
  11778. // progress_handlers.lock
  11779. tuples[ 0 ][ 3 ].lock
  11780. );
  11781. }
  11782. // progress_handlers.fire
  11783. // fulfilled_handlers.fire
  11784. // rejected_handlers.fire
  11785. list.add( tuple[ 3 ].fire );
  11786. // deferred.notify = function() { deferred.notifyWith(...) }
  11787. // deferred.resolve = function() { deferred.resolveWith(...) }
  11788. // deferred.reject = function() { deferred.rejectWith(...) }
  11789. deferred[ tuple[ 0 ] ] = function() {
  11790. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  11791. return this;
  11792. };
  11793. // deferred.notifyWith = list.fireWith
  11794. // deferred.resolveWith = list.fireWith
  11795. // deferred.rejectWith = list.fireWith
  11796. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  11797. } );
  11798. // Make the deferred a promise
  11799. promise.promise( deferred );
  11800. // Call given func if any
  11801. if ( func ) {
  11802. func.call( deferred, deferred );
  11803. }
  11804. // All done!
  11805. return deferred;
  11806. },
  11807. // Deferred helper
  11808. when: function( singleValue ) {
  11809. var
  11810. // count of uncompleted subordinates
  11811. remaining = arguments.length,
  11812. // count of unprocessed arguments
  11813. i = remaining,
  11814. // subordinate fulfillment data
  11815. resolveContexts = Array( i ),
  11816. resolveValues = slice.call( arguments ),
  11817. // the master Deferred
  11818. master = jQuery.Deferred(),
  11819. // subordinate callback factory
  11820. updateFunc = function( i ) {
  11821. return function( value ) {
  11822. resolveContexts[ i ] = this;
  11823. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  11824. if ( !( --remaining ) ) {
  11825. master.resolveWith( resolveContexts, resolveValues );
  11826. }
  11827. };
  11828. };
  11829. // Single- and empty arguments are adopted like Promise.resolve
  11830. if ( remaining <= 1 ) {
  11831. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
  11832. !remaining );
  11833. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  11834. if ( master.state() === "pending" ||
  11835. isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  11836. return master.then();
  11837. }
  11838. }
  11839. // Multiple arguments are aggregated like Promise.all array elements
  11840. while ( i-- ) {
  11841. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  11842. }
  11843. return master.promise();
  11844. }
  11845. } );
  11846. // These usually indicate a programmer mistake during development,
  11847. // warn about them ASAP rather than swallowing them by default.
  11848. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  11849. jQuery.Deferred.exceptionHook = function( error, stack ) {
  11850. // Support: IE 8 - 9 only
  11851. // Console exists when dev tools are open, which can happen at any time
  11852. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  11853. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  11854. }
  11855. };
  11856. jQuery.readyException = function( error ) {
  11857. window.setTimeout( function() {
  11858. throw error;
  11859. } );
  11860. };
  11861. // The deferred used on DOM ready
  11862. var readyList = jQuery.Deferred();
  11863. jQuery.fn.ready = function( fn ) {
  11864. readyList
  11865. .then( fn )
  11866. // Wrap jQuery.readyException in a function so that the lookup
  11867. // happens at the time of error handling instead of callback
  11868. // registration.
  11869. .catch( function( error ) {
  11870. jQuery.readyException( error );
  11871. } );
  11872. return this;
  11873. };
  11874. jQuery.extend( {
  11875. // Is the DOM ready to be used? Set to true once it occurs.
  11876. isReady: false,
  11877. // A counter to track how many items to wait for before
  11878. // the ready event fires. See #6781
  11879. readyWait: 1,
  11880. // Handle when the DOM is ready
  11881. ready: function( wait ) {
  11882. // Abort if there are pending holds or we're already ready
  11883. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  11884. return;
  11885. }
  11886. // Remember that the DOM is ready
  11887. jQuery.isReady = true;
  11888. // If a normal DOM Ready event fired, decrement, and wait if need be
  11889. if ( wait !== true && --jQuery.readyWait > 0 ) {
  11890. return;
  11891. }
  11892. // If there are functions bound, to execute
  11893. readyList.resolveWith( document, [ jQuery ] );
  11894. }
  11895. } );
  11896. jQuery.ready.then = readyList.then;
  11897. // The ready event handler and self cleanup method
  11898. function completed() {
  11899. document.removeEventListener( "DOMContentLoaded", completed );
  11900. window.removeEventListener( "load", completed );
  11901. jQuery.ready();
  11902. }
  11903. // Catch cases where $(document).ready() is called
  11904. // after the browser event has already occurred.
  11905. // Support: IE <=9 - 10 only
  11906. // Older IE sometimes signals "interactive" too soon
  11907. if ( document.readyState === "complete" ||
  11908. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  11909. // Handle it asynchronously to allow scripts the opportunity to delay ready
  11910. window.setTimeout( jQuery.ready );
  11911. } else {
  11912. // Use the handy event callback
  11913. document.addEventListener( "DOMContentLoaded", completed );
  11914. // A fallback to window.onload, that will always work
  11915. window.addEventListener( "load", completed );
  11916. }
  11917. // Multifunctional method to get and set values of a collection
  11918. // The value/s can optionally be executed if it's a function
  11919. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  11920. var i = 0,
  11921. len = elems.length,
  11922. bulk = key == null;
  11923. // Sets many values
  11924. if ( toType( key ) === "object" ) {
  11925. chainable = true;
  11926. for ( i in key ) {
  11927. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  11928. }
  11929. // Sets one value
  11930. } else if ( value !== undefined ) {
  11931. chainable = true;
  11932. if ( !isFunction( value ) ) {
  11933. raw = true;
  11934. }
  11935. if ( bulk ) {
  11936. // Bulk operations run against the entire set
  11937. if ( raw ) {
  11938. fn.call( elems, value );
  11939. fn = null;
  11940. // ...except when executing function values
  11941. } else {
  11942. bulk = fn;
  11943. fn = function( elem, key, value ) {
  11944. return bulk.call( jQuery( elem ), value );
  11945. };
  11946. }
  11947. }
  11948. if ( fn ) {
  11949. for ( ; i < len; i++ ) {
  11950. fn(
  11951. elems[ i ], key, raw ?
  11952. value :
  11953. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  11954. );
  11955. }
  11956. }
  11957. }
  11958. if ( chainable ) {
  11959. return elems;
  11960. }
  11961. // Gets
  11962. if ( bulk ) {
  11963. return fn.call( elems );
  11964. }
  11965. return len ? fn( elems[ 0 ], key ) : emptyGet;
  11966. };
  11967. // Matches dashed string for camelizing
  11968. var rmsPrefix = /^-ms-/,
  11969. rdashAlpha = /-([a-z])/g;
  11970. // Used by camelCase as callback to replace()
  11971. function fcamelCase( all, letter ) {
  11972. return letter.toUpperCase();
  11973. }
  11974. // Convert dashed to camelCase; used by the css and data modules
  11975. // Support: IE <=9 - 11, Edge 12 - 15
  11976. // Microsoft forgot to hump their vendor prefix (#9572)
  11977. function camelCase( string ) {
  11978. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  11979. }
  11980. var acceptData = function( owner ) {
  11981. // Accepts only:
  11982. // - Node
  11983. // - Node.ELEMENT_NODE
  11984. // - Node.DOCUMENT_NODE
  11985. // - Object
  11986. // - Any
  11987. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  11988. };
  11989. function Data() {
  11990. this.expando = jQuery.expando + Data.uid++;
  11991. }
  11992. Data.uid = 1;
  11993. Data.prototype = {
  11994. cache: function( owner ) {
  11995. // Check if the owner object already has a cache
  11996. var value = owner[ this.expando ];
  11997. // If not, create one
  11998. if ( !value ) {
  11999. value = {};
  12000. // We can accept data for non-element nodes in modern browsers,
  12001. // but we should not, see #8335.
  12002. // Always return an empty object.
  12003. if ( acceptData( owner ) ) {
  12004. // If it is a node unlikely to be stringify-ed or looped over
  12005. // use plain assignment
  12006. if ( owner.nodeType ) {
  12007. owner[ this.expando ] = value;
  12008. // Otherwise secure it in a non-enumerable property
  12009. // configurable must be true to allow the property to be
  12010. // deleted when data is removed
  12011. } else {
  12012. Object.defineProperty( owner, this.expando, {
  12013. value: value,
  12014. configurable: true
  12015. } );
  12016. }
  12017. }
  12018. }
  12019. return value;
  12020. },
  12021. set: function( owner, data, value ) {
  12022. var prop,
  12023. cache = this.cache( owner );
  12024. // Handle: [ owner, key, value ] args
  12025. // Always use camelCase key (gh-2257)
  12026. if ( typeof data === "string" ) {
  12027. cache[ camelCase( data ) ] = value;
  12028. // Handle: [ owner, { properties } ] args
  12029. } else {
  12030. // Copy the properties one-by-one to the cache object
  12031. for ( prop in data ) {
  12032. cache[ camelCase( prop ) ] = data[ prop ];
  12033. }
  12034. }
  12035. return cache;
  12036. },
  12037. get: function( owner, key ) {
  12038. return key === undefined ?
  12039. this.cache( owner ) :
  12040. // Always use camelCase key (gh-2257)
  12041. owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
  12042. },
  12043. access: function( owner, key, value ) {
  12044. // In cases where either:
  12045. //
  12046. // 1. No key was specified
  12047. // 2. A string key was specified, but no value provided
  12048. //
  12049. // Take the "read" path and allow the get method to determine
  12050. // which value to return, respectively either:
  12051. //
  12052. // 1. The entire cache object
  12053. // 2. The data stored at the key
  12054. //
  12055. if ( key === undefined ||
  12056. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  12057. return this.get( owner, key );
  12058. }
  12059. // When the key is not a string, or both a key and value
  12060. // are specified, set or extend (existing objects) with either:
  12061. //
  12062. // 1. An object of properties
  12063. // 2. A key and value
  12064. //
  12065. this.set( owner, key, value );
  12066. // Since the "set" path can have two possible entry points
  12067. // return the expected data based on which path was taken[*]
  12068. return value !== undefined ? value : key;
  12069. },
  12070. remove: function( owner, key ) {
  12071. var i,
  12072. cache = owner[ this.expando ];
  12073. if ( cache === undefined ) {
  12074. return;
  12075. }
  12076. if ( key !== undefined ) {
  12077. // Support array or space separated string of keys
  12078. if ( Array.isArray( key ) ) {
  12079. // If key is an array of keys...
  12080. // We always set camelCase keys, so remove that.
  12081. key = key.map( camelCase );
  12082. } else {
  12083. key = camelCase( key );
  12084. // If a key with the spaces exists, use it.
  12085. // Otherwise, create an array by matching non-whitespace
  12086. key = key in cache ?
  12087. [ key ] :
  12088. ( key.match( rnothtmlwhite ) || [] );
  12089. }
  12090. i = key.length;
  12091. while ( i-- ) {
  12092. delete cache[ key[ i ] ];
  12093. }
  12094. }
  12095. // Remove the expando if there's no more data
  12096. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  12097. // Support: Chrome <=35 - 45
  12098. // Webkit & Blink performance suffers when deleting properties
  12099. // from DOM nodes, so set to undefined instead
  12100. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  12101. if ( owner.nodeType ) {
  12102. owner[ this.expando ] = undefined;
  12103. } else {
  12104. delete owner[ this.expando ];
  12105. }
  12106. }
  12107. },
  12108. hasData: function( owner ) {
  12109. var cache = owner[ this.expando ];
  12110. return cache !== undefined && !jQuery.isEmptyObject( cache );
  12111. }
  12112. };
  12113. var dataPriv = new Data();
  12114. var dataUser = new Data();
  12115. // Implementation Summary
  12116. //
  12117. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  12118. // 2. Improve the module's maintainability by reducing the storage
  12119. // paths to a single mechanism.
  12120. // 3. Use the same single mechanism to support "private" and "user" data.
  12121. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  12122. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  12123. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  12124. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  12125. rmultiDash = /[A-Z]/g;
  12126. function getData( data ) {
  12127. if ( data === "true" ) {
  12128. return true;
  12129. }
  12130. if ( data === "false" ) {
  12131. return false;
  12132. }
  12133. if ( data === "null" ) {
  12134. return null;
  12135. }
  12136. // Only convert to a number if it doesn't change the string
  12137. if ( data === +data + "" ) {
  12138. return +data;
  12139. }
  12140. if ( rbrace.test( data ) ) {
  12141. return JSON.parse( data );
  12142. }
  12143. return data;
  12144. }
  12145. function dataAttr( elem, key, data ) {
  12146. var name;
  12147. // If nothing was found internally, try to fetch any
  12148. // data from the HTML5 data-* attribute
  12149. if ( data === undefined && elem.nodeType === 1 ) {
  12150. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  12151. data = elem.getAttribute( name );
  12152. if ( typeof data === "string" ) {
  12153. try {
  12154. data = getData( data );
  12155. } catch ( e ) {}
  12156. // Make sure we set the data so it isn't changed later
  12157. dataUser.set( elem, key, data );
  12158. } else {
  12159. data = undefined;
  12160. }
  12161. }
  12162. return data;
  12163. }
  12164. jQuery.extend( {
  12165. hasData: function( elem ) {
  12166. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  12167. },
  12168. data: function( elem, name, data ) {
  12169. return dataUser.access( elem, name, data );
  12170. },
  12171. removeData: function( elem, name ) {
  12172. dataUser.remove( elem, name );
  12173. },
  12174. // TODO: Now that all calls to _data and _removeData have been replaced
  12175. // with direct calls to dataPriv methods, these can be deprecated.
  12176. _data: function( elem, name, data ) {
  12177. return dataPriv.access( elem, name, data );
  12178. },
  12179. _removeData: function( elem, name ) {
  12180. dataPriv.remove( elem, name );
  12181. }
  12182. } );
  12183. jQuery.fn.extend( {
  12184. data: function( key, value ) {
  12185. var i, name, data,
  12186. elem = this[ 0 ],
  12187. attrs = elem && elem.attributes;
  12188. // Gets all values
  12189. if ( key === undefined ) {
  12190. if ( this.length ) {
  12191. data = dataUser.get( elem );
  12192. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  12193. i = attrs.length;
  12194. while ( i-- ) {
  12195. // Support: IE 11 only
  12196. // The attrs elements can be null (#14894)
  12197. if ( attrs[ i ] ) {
  12198. name = attrs[ i ].name;
  12199. if ( name.indexOf( "data-" ) === 0 ) {
  12200. name = camelCase( name.slice( 5 ) );
  12201. dataAttr( elem, name, data[ name ] );
  12202. }
  12203. }
  12204. }
  12205. dataPriv.set( elem, "hasDataAttrs", true );
  12206. }
  12207. }
  12208. return data;
  12209. }
  12210. // Sets multiple values
  12211. if ( typeof key === "object" ) {
  12212. return this.each( function() {
  12213. dataUser.set( this, key );
  12214. } );
  12215. }
  12216. return access( this, function( value ) {
  12217. var data;
  12218. // The calling jQuery object (element matches) is not empty
  12219. // (and therefore has an element appears at this[ 0 ]) and the
  12220. // `value` parameter was not undefined. An empty jQuery object
  12221. // will result in `undefined` for elem = this[ 0 ] which will
  12222. // throw an exception if an attempt to read a data cache is made.
  12223. if ( elem && value === undefined ) {
  12224. // Attempt to get data from the cache
  12225. // The key will always be camelCased in Data
  12226. data = dataUser.get( elem, key );
  12227. if ( data !== undefined ) {
  12228. return data;
  12229. }
  12230. // Attempt to "discover" the data in
  12231. // HTML5 custom data-* attrs
  12232. data = dataAttr( elem, key );
  12233. if ( data !== undefined ) {
  12234. return data;
  12235. }
  12236. // We tried really hard, but the data doesn't exist.
  12237. return;
  12238. }
  12239. // Set the data...
  12240. this.each( function() {
  12241. // We always store the camelCased key
  12242. dataUser.set( this, key, value );
  12243. } );
  12244. }, null, value, arguments.length > 1, null, true );
  12245. },
  12246. removeData: function( key ) {
  12247. return this.each( function() {
  12248. dataUser.remove( this, key );
  12249. } );
  12250. }
  12251. } );
  12252. jQuery.extend( {
  12253. queue: function( elem, type, data ) {
  12254. var queue;
  12255. if ( elem ) {
  12256. type = ( type || "fx" ) + "queue";
  12257. queue = dataPriv.get( elem, type );
  12258. // Speed up dequeue by getting out quickly if this is just a lookup
  12259. if ( data ) {
  12260. if ( !queue || Array.isArray( data ) ) {
  12261. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  12262. } else {
  12263. queue.push( data );
  12264. }
  12265. }
  12266. return queue || [];
  12267. }
  12268. },
  12269. dequeue: function( elem, type ) {
  12270. type = type || "fx";
  12271. var queue = jQuery.queue( elem, type ),
  12272. startLength = queue.length,
  12273. fn = queue.shift(),
  12274. hooks = jQuery._queueHooks( elem, type ),
  12275. next = function() {
  12276. jQuery.dequeue( elem, type );
  12277. };
  12278. // If the fx queue is dequeued, always remove the progress sentinel
  12279. if ( fn === "inprogress" ) {
  12280. fn = queue.shift();
  12281. startLength--;
  12282. }
  12283. if ( fn ) {
  12284. // Add a progress sentinel to prevent the fx queue from being
  12285. // automatically dequeued
  12286. if ( type === "fx" ) {
  12287. queue.unshift( "inprogress" );
  12288. }
  12289. // Clear up the last queue stop function
  12290. delete hooks.stop;
  12291. fn.call( elem, next, hooks );
  12292. }
  12293. if ( !startLength && hooks ) {
  12294. hooks.empty.fire();
  12295. }
  12296. },
  12297. // Not public - generate a queueHooks object, or return the current one
  12298. _queueHooks: function( elem, type ) {
  12299. var key = type + "queueHooks";
  12300. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  12301. empty: jQuery.Callbacks( "once memory" ).add( function() {
  12302. dataPriv.remove( elem, [ type + "queue", key ] );
  12303. } )
  12304. } );
  12305. }
  12306. } );
  12307. jQuery.fn.extend( {
  12308. queue: function( type, data ) {
  12309. var setter = 2;
  12310. if ( typeof type !== "string" ) {
  12311. data = type;
  12312. type = "fx";
  12313. setter--;
  12314. }
  12315. if ( arguments.length < setter ) {
  12316. return jQuery.queue( this[ 0 ], type );
  12317. }
  12318. return data === undefined ?
  12319. this :
  12320. this.each( function() {
  12321. var queue = jQuery.queue( this, type, data );
  12322. // Ensure a hooks for this queue
  12323. jQuery._queueHooks( this, type );
  12324. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  12325. jQuery.dequeue( this, type );
  12326. }
  12327. } );
  12328. },
  12329. dequeue: function( type ) {
  12330. return this.each( function() {
  12331. jQuery.dequeue( this, type );
  12332. } );
  12333. },
  12334. clearQueue: function( type ) {
  12335. return this.queue( type || "fx", [] );
  12336. },
  12337. // Get a promise resolved when queues of a certain type
  12338. // are emptied (fx is the type by default)
  12339. promise: function( type, obj ) {
  12340. var tmp,
  12341. count = 1,
  12342. defer = jQuery.Deferred(),
  12343. elements = this,
  12344. i = this.length,
  12345. resolve = function() {
  12346. if ( !( --count ) ) {
  12347. defer.resolveWith( elements, [ elements ] );
  12348. }
  12349. };
  12350. if ( typeof type !== "string" ) {
  12351. obj = type;
  12352. type = undefined;
  12353. }
  12354. type = type || "fx";
  12355. while ( i-- ) {
  12356. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  12357. if ( tmp && tmp.empty ) {
  12358. count++;
  12359. tmp.empty.add( resolve );
  12360. }
  12361. }
  12362. resolve();
  12363. return defer.promise( obj );
  12364. }
  12365. } );
  12366. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  12367. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  12368. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  12369. var documentElement = document.documentElement;
  12370. var isAttached = function( elem ) {
  12371. return jQuery.contains( elem.ownerDocument, elem );
  12372. },
  12373. composed = { composed: true };
  12374. // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
  12375. // Check attachment across shadow DOM boundaries when possible (gh-3504)
  12376. // Support: iOS 10.0-10.2 only
  12377. // Early iOS 10 versions support `attachShadow` but not `getRootNode`,
  12378. // leading to errors. We need to check for `getRootNode`.
  12379. if ( documentElement.getRootNode ) {
  12380. isAttached = function( elem ) {
  12381. return jQuery.contains( elem.ownerDocument, elem ) ||
  12382. elem.getRootNode( composed ) === elem.ownerDocument;
  12383. };
  12384. }
  12385. var isHiddenWithinTree = function( elem, el ) {
  12386. // isHiddenWithinTree might be called from jQuery#filter function;
  12387. // in that case, element will be second argument
  12388. elem = el || elem;
  12389. // Inline style trumps all
  12390. return elem.style.display === "none" ||
  12391. elem.style.display === "" &&
  12392. // Otherwise, check computed style
  12393. // Support: Firefox <=43 - 45
  12394. // Disconnected elements can have computed display: none, so first confirm that elem is
  12395. // in the document.
  12396. isAttached( elem ) &&
  12397. jQuery.css( elem, "display" ) === "none";
  12398. };
  12399. var swap = function( elem, options, callback, args ) {
  12400. var ret, name,
  12401. old = {};
  12402. // Remember the old values, and insert the new ones
  12403. for ( name in options ) {
  12404. old[ name ] = elem.style[ name ];
  12405. elem.style[ name ] = options[ name ];
  12406. }
  12407. ret = callback.apply( elem, args || [] );
  12408. // Revert the old values
  12409. for ( name in options ) {
  12410. elem.style[ name ] = old[ name ];
  12411. }
  12412. return ret;
  12413. };
  12414. function adjustCSS( elem, prop, valueParts, tween ) {
  12415. var adjusted, scale,
  12416. maxIterations = 20,
  12417. currentValue = tween ?
  12418. function() {
  12419. return tween.cur();
  12420. } :
  12421. function() {
  12422. return jQuery.css( elem, prop, "" );
  12423. },
  12424. initial = currentValue(),
  12425. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  12426. // Starting value computation is required for potential unit mismatches
  12427. initialInUnit = elem.nodeType &&
  12428. ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  12429. rcssNum.exec( jQuery.css( elem, prop ) );
  12430. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  12431. // Support: Firefox <=54
  12432. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  12433. initial = initial / 2;
  12434. // Trust units reported by jQuery.css
  12435. unit = unit || initialInUnit[ 3 ];
  12436. // Iteratively approximate from a nonzero starting point
  12437. initialInUnit = +initial || 1;
  12438. while ( maxIterations-- ) {
  12439. // Evaluate and update our best guess (doubling guesses that zero out).
  12440. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  12441. jQuery.style( elem, prop, initialInUnit + unit );
  12442. if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
  12443. maxIterations = 0;
  12444. }
  12445. initialInUnit = initialInUnit / scale;
  12446. }
  12447. initialInUnit = initialInUnit * 2;
  12448. jQuery.style( elem, prop, initialInUnit + unit );
  12449. // Make sure we update the tween properties later on
  12450. valueParts = valueParts || [];
  12451. }
  12452. if ( valueParts ) {
  12453. initialInUnit = +initialInUnit || +initial || 0;
  12454. // Apply relative offset (+=/-=) if specified
  12455. adjusted = valueParts[ 1 ] ?
  12456. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  12457. +valueParts[ 2 ];
  12458. if ( tween ) {
  12459. tween.unit = unit;
  12460. tween.start = initialInUnit;
  12461. tween.end = adjusted;
  12462. }
  12463. }
  12464. return adjusted;
  12465. }
  12466. var defaultDisplayMap = {};
  12467. function getDefaultDisplay( elem ) {
  12468. var temp,
  12469. doc = elem.ownerDocument,
  12470. nodeName = elem.nodeName,
  12471. display = defaultDisplayMap[ nodeName ];
  12472. if ( display ) {
  12473. return display;
  12474. }
  12475. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  12476. display = jQuery.css( temp, "display" );
  12477. temp.parentNode.removeChild( temp );
  12478. if ( display === "none" ) {
  12479. display = "block";
  12480. }
  12481. defaultDisplayMap[ nodeName ] = display;
  12482. return display;
  12483. }
  12484. function showHide( elements, show ) {
  12485. var display, elem,
  12486. values = [],
  12487. index = 0,
  12488. length = elements.length;
  12489. // Determine new display value for elements that need to change
  12490. for ( ; index < length; index++ ) {
  12491. elem = elements[ index ];
  12492. if ( !elem.style ) {
  12493. continue;
  12494. }
  12495. display = elem.style.display;
  12496. if ( show ) {
  12497. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  12498. // check is required in this first loop unless we have a nonempty display value (either
  12499. // inline or about-to-be-restored)
  12500. if ( display === "none" ) {
  12501. values[ index ] = dataPriv.get( elem, "display" ) || null;
  12502. if ( !values[ index ] ) {
  12503. elem.style.display = "";
  12504. }
  12505. }
  12506. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  12507. values[ index ] = getDefaultDisplay( elem );
  12508. }
  12509. } else {
  12510. if ( display !== "none" ) {
  12511. values[ index ] = "none";
  12512. // Remember what we're overwriting
  12513. dataPriv.set( elem, "display", display );
  12514. }
  12515. }
  12516. }
  12517. // Set the display of the elements in a second loop to avoid constant reflow
  12518. for ( index = 0; index < length; index++ ) {
  12519. if ( values[ index ] != null ) {
  12520. elements[ index ].style.display = values[ index ];
  12521. }
  12522. }
  12523. return elements;
  12524. }
  12525. jQuery.fn.extend( {
  12526. show: function() {
  12527. return showHide( this, true );
  12528. },
  12529. hide: function() {
  12530. return showHide( this );
  12531. },
  12532. toggle: function( state ) {
  12533. if ( typeof state === "boolean" ) {
  12534. return state ? this.show() : this.hide();
  12535. }
  12536. return this.each( function() {
  12537. if ( isHiddenWithinTree( this ) ) {
  12538. jQuery( this ).show();
  12539. } else {
  12540. jQuery( this ).hide();
  12541. }
  12542. } );
  12543. }
  12544. } );
  12545. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  12546. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );
  12547. var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
  12548. // We have to close these tags to support XHTML (#13200)
  12549. var wrapMap = {
  12550. // Support: IE <=9 only
  12551. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  12552. // XHTML parsers do not magically insert elements in the
  12553. // same way that tag soup parsers do. So we cannot shorten
  12554. // this by omitting <tbody> or other required elements.
  12555. thead: [ 1, "<table>", "</table>" ],
  12556. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  12557. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  12558. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  12559. _default: [ 0, "", "" ]
  12560. };
  12561. // Support: IE <=9 only
  12562. wrapMap.optgroup = wrapMap.option;
  12563. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  12564. wrapMap.th = wrapMap.td;
  12565. function getAll( context, tag ) {
  12566. // Support: IE <=9 - 11 only
  12567. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  12568. var ret;
  12569. if ( typeof context.getElementsByTagName !== "undefined" ) {
  12570. ret = context.getElementsByTagName( tag || "*" );
  12571. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  12572. ret = context.querySelectorAll( tag || "*" );
  12573. } else {
  12574. ret = [];
  12575. }
  12576. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  12577. return jQuery.merge( [ context ], ret );
  12578. }
  12579. return ret;
  12580. }
  12581. // Mark scripts as having already been evaluated
  12582. function setGlobalEval( elems, refElements ) {
  12583. var i = 0,
  12584. l = elems.length;
  12585. for ( ; i < l; i++ ) {
  12586. dataPriv.set(
  12587. elems[ i ],
  12588. "globalEval",
  12589. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  12590. );
  12591. }
  12592. }
  12593. var rhtml = /<|&#?\w+;/;
  12594. function buildFragment( elems, context, scripts, selection, ignored ) {
  12595. var elem, tmp, tag, wrap, attached, j,
  12596. fragment = context.createDocumentFragment(),
  12597. nodes = [],
  12598. i = 0,
  12599. l = elems.length;
  12600. for ( ; i < l; i++ ) {
  12601. elem = elems[ i ];
  12602. if ( elem || elem === 0 ) {
  12603. // Add nodes directly
  12604. if ( toType( elem ) === "object" ) {
  12605. // Support: Android <=4.0 only, PhantomJS 1 only
  12606. // push.apply(_, arraylike) throws on ancient WebKit
  12607. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  12608. // Convert non-html into a text node
  12609. } else if ( !rhtml.test( elem ) ) {
  12610. nodes.push( context.createTextNode( elem ) );
  12611. // Convert html into DOM nodes
  12612. } else {
  12613. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  12614. // Deserialize a standard representation
  12615. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  12616. wrap = wrapMap[ tag ] || wrapMap._default;
  12617. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  12618. // Descend through wrappers to the right content
  12619. j = wrap[ 0 ];
  12620. while ( j-- ) {
  12621. tmp = tmp.lastChild;
  12622. }
  12623. // Support: Android <=4.0 only, PhantomJS 1 only
  12624. // push.apply(_, arraylike) throws on ancient WebKit
  12625. jQuery.merge( nodes, tmp.childNodes );
  12626. // Remember the top-level container
  12627. tmp = fragment.firstChild;
  12628. // Ensure the created nodes are orphaned (#12392)
  12629. tmp.textContent = "";
  12630. }
  12631. }
  12632. }
  12633. // Remove wrapper from fragment
  12634. fragment.textContent = "";
  12635. i = 0;
  12636. while ( ( elem = nodes[ i++ ] ) ) {
  12637. // Skip elements already in the context collection (trac-4087)
  12638. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  12639. if ( ignored ) {
  12640. ignored.push( elem );
  12641. }
  12642. continue;
  12643. }
  12644. attached = isAttached( elem );
  12645. // Append to fragment
  12646. tmp = getAll( fragment.appendChild( elem ), "script" );
  12647. // Preserve script evaluation history
  12648. if ( attached ) {
  12649. setGlobalEval( tmp );
  12650. }
  12651. // Capture executables
  12652. if ( scripts ) {
  12653. j = 0;
  12654. while ( ( elem = tmp[ j++ ] ) ) {
  12655. if ( rscriptType.test( elem.type || "" ) ) {
  12656. scripts.push( elem );
  12657. }
  12658. }
  12659. }
  12660. }
  12661. return fragment;
  12662. }
  12663. ( function() {
  12664. var fragment = document.createDocumentFragment(),
  12665. div = fragment.appendChild( document.createElement( "div" ) ),
  12666. input = document.createElement( "input" );
  12667. // Support: Android 4.0 - 4.3 only
  12668. // Check state lost if the name is set (#11217)
  12669. // Support: Windows Web Apps (WWA)
  12670. // `name` and `type` must use .setAttribute for WWA (#14901)
  12671. input.setAttribute( "type", "radio" );
  12672. input.setAttribute( "checked", "checked" );
  12673. input.setAttribute( "name", "t" );
  12674. div.appendChild( input );
  12675. // Support: Android <=4.1 only
  12676. // Older WebKit doesn't clone checked state correctly in fragments
  12677. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  12678. // Support: IE <=11 only
  12679. // Make sure textarea (and checkbox) defaultValue is properly cloned
  12680. div.innerHTML = "<textarea>x</textarea>";
  12681. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  12682. } )();
  12683. var
  12684. rkeyEvent = /^key/,
  12685. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  12686. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  12687. function returnTrue() {
  12688. return true;
  12689. }
  12690. function returnFalse() {
  12691. return false;
  12692. }
  12693. // Support: IE <=9 - 11+
  12694. // focus() and blur() are asynchronous, except when they are no-op.
  12695. // So expect focus to be synchronous when the element is already active,
  12696. // and blur to be synchronous when the element is not already active.
  12697. // (focus and blur are always synchronous in other supported browsers,
  12698. // this just defines when we can count on it).
  12699. function expectSync( elem, type ) {
  12700. return ( elem === safeActiveElement() ) === ( type === "focus" );
  12701. }
  12702. // Support: IE <=9 only
  12703. // Accessing document.activeElement can throw unexpectedly
  12704. // https://bugs.jquery.com/ticket/13393
  12705. function safeActiveElement() {
  12706. try {
  12707. return document.activeElement;
  12708. } catch ( err ) { }
  12709. }
  12710. function on( elem, types, selector, data, fn, one ) {
  12711. var origFn, type;
  12712. // Types can be a map of types/handlers
  12713. if ( typeof types === "object" ) {
  12714. // ( types-Object, selector, data )
  12715. if ( typeof selector !== "string" ) {
  12716. // ( types-Object, data )
  12717. data = data || selector;
  12718. selector = undefined;
  12719. }
  12720. for ( type in types ) {
  12721. on( elem, type, selector, data, types[ type ], one );
  12722. }
  12723. return elem;
  12724. }
  12725. if ( data == null && fn == null ) {
  12726. // ( types, fn )
  12727. fn = selector;
  12728. data = selector = undefined;
  12729. } else if ( fn == null ) {
  12730. if ( typeof selector === "string" ) {
  12731. // ( types, selector, fn )
  12732. fn = data;
  12733. data = undefined;
  12734. } else {
  12735. // ( types, data, fn )
  12736. fn = data;
  12737. data = selector;
  12738. selector = undefined;
  12739. }
  12740. }
  12741. if ( fn === false ) {
  12742. fn = returnFalse;
  12743. } else if ( !fn ) {
  12744. return elem;
  12745. }
  12746. if ( one === 1 ) {
  12747. origFn = fn;
  12748. fn = function( event ) {
  12749. // Can use an empty set, since event contains the info
  12750. jQuery().off( event );
  12751. return origFn.apply( this, arguments );
  12752. };
  12753. // Use same guid so caller can remove using origFn
  12754. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  12755. }
  12756. return elem.each( function() {
  12757. jQuery.event.add( this, types, fn, data, selector );
  12758. } );
  12759. }
  12760. /*
  12761. * Helper functions for managing events -- not part of the public interface.
  12762. * Props to Dean Edwards' addEvent library for many of the ideas.
  12763. */
  12764. jQuery.event = {
  12765. global: {},
  12766. add: function( elem, types, handler, data, selector ) {
  12767. var handleObjIn, eventHandle, tmp,
  12768. events, t, handleObj,
  12769. special, handlers, type, namespaces, origType,
  12770. elemData = dataPriv.get( elem );
  12771. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  12772. if ( !elemData ) {
  12773. return;
  12774. }
  12775. // Caller can pass in an object of custom data in lieu of the handler
  12776. if ( handler.handler ) {
  12777. handleObjIn = handler;
  12778. handler = handleObjIn.handler;
  12779. selector = handleObjIn.selector;
  12780. }
  12781. // Ensure that invalid selectors throw exceptions at attach time
  12782. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  12783. if ( selector ) {
  12784. jQuery.find.matchesSelector( documentElement, selector );
  12785. }
  12786. // Make sure that the handler has a unique ID, used to find/remove it later
  12787. if ( !handler.guid ) {
  12788. handler.guid = jQuery.guid++;
  12789. }
  12790. // Init the element's event structure and main handler, if this is the first
  12791. if ( !( events = elemData.events ) ) {
  12792. events = elemData.events = {};
  12793. }
  12794. if ( !( eventHandle = elemData.handle ) ) {
  12795. eventHandle = elemData.handle = function( e ) {
  12796. // Discard the second event of a jQuery.event.trigger() and
  12797. // when an event is called after a page has unloaded
  12798. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  12799. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  12800. };
  12801. }
  12802. // Handle multiple events separated by a space
  12803. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  12804. t = types.length;
  12805. while ( t-- ) {
  12806. tmp = rtypenamespace.exec( types[ t ] ) || [];
  12807. type = origType = tmp[ 1 ];
  12808. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  12809. // There *must* be a type, no attaching namespace-only handlers
  12810. if ( !type ) {
  12811. continue;
  12812. }
  12813. // If event changes its type, use the special event handlers for the changed type
  12814. special = jQuery.event.special[ type ] || {};
  12815. // If selector defined, determine special event api type, otherwise given type
  12816. type = ( selector ? special.delegateType : special.bindType ) || type;
  12817. // Update special based on newly reset type
  12818. special = jQuery.event.special[ type ] || {};
  12819. // handleObj is passed to all event handlers
  12820. handleObj = jQuery.extend( {
  12821. type: type,
  12822. origType: origType,
  12823. data: data,
  12824. handler: handler,
  12825. guid: handler.guid,
  12826. selector: selector,
  12827. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  12828. namespace: namespaces.join( "." )
  12829. }, handleObjIn );
  12830. // Init the event handler queue if we're the first
  12831. if ( !( handlers = events[ type ] ) ) {
  12832. handlers = events[ type ] = [];
  12833. handlers.delegateCount = 0;
  12834. // Only use addEventListener if the special events handler returns false
  12835. if ( !special.setup ||
  12836. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  12837. if ( elem.addEventListener ) {
  12838. elem.addEventListener( type, eventHandle );
  12839. }
  12840. }
  12841. }
  12842. if ( special.add ) {
  12843. special.add.call( elem, handleObj );
  12844. if ( !handleObj.handler.guid ) {
  12845. handleObj.handler.guid = handler.guid;
  12846. }
  12847. }
  12848. // Add to the element's handler list, delegates in front
  12849. if ( selector ) {
  12850. handlers.splice( handlers.delegateCount++, 0, handleObj );
  12851. } else {
  12852. handlers.push( handleObj );
  12853. }
  12854. // Keep track of which events have ever been used, for event optimization
  12855. jQuery.event.global[ type ] = true;
  12856. }
  12857. },
  12858. // Detach an event or set of events from an element
  12859. remove: function( elem, types, handler, selector, mappedTypes ) {
  12860. var j, origCount, tmp,
  12861. events, t, handleObj,
  12862. special, handlers, type, namespaces, origType,
  12863. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  12864. if ( !elemData || !( events = elemData.events ) ) {
  12865. return;
  12866. }
  12867. // Once for each type.namespace in types; type may be omitted
  12868. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  12869. t = types.length;
  12870. while ( t-- ) {
  12871. tmp = rtypenamespace.exec( types[ t ] ) || [];
  12872. type = origType = tmp[ 1 ];
  12873. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  12874. // Unbind all events (on this namespace, if provided) for the element
  12875. if ( !type ) {
  12876. for ( type in events ) {
  12877. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  12878. }
  12879. continue;
  12880. }
  12881. special = jQuery.event.special[ type ] || {};
  12882. type = ( selector ? special.delegateType : special.bindType ) || type;
  12883. handlers = events[ type ] || [];
  12884. tmp = tmp[ 2 ] &&
  12885. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  12886. // Remove matching events
  12887. origCount = j = handlers.length;
  12888. while ( j-- ) {
  12889. handleObj = handlers[ j ];
  12890. if ( ( mappedTypes || origType === handleObj.origType ) &&
  12891. ( !handler || handler.guid === handleObj.guid ) &&
  12892. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  12893. ( !selector || selector === handleObj.selector ||
  12894. selector === "**" && handleObj.selector ) ) {
  12895. handlers.splice( j, 1 );
  12896. if ( handleObj.selector ) {
  12897. handlers.delegateCount--;
  12898. }
  12899. if ( special.remove ) {
  12900. special.remove.call( elem, handleObj );
  12901. }
  12902. }
  12903. }
  12904. // Remove generic event handler if we removed something and no more handlers exist
  12905. // (avoids potential for endless recursion during removal of special event handlers)
  12906. if ( origCount && !handlers.length ) {
  12907. if ( !special.teardown ||
  12908. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  12909. jQuery.removeEvent( elem, type, elemData.handle );
  12910. }
  12911. delete events[ type ];
  12912. }
  12913. }
  12914. // Remove data and the expando if it's no longer used
  12915. if ( jQuery.isEmptyObject( events ) ) {
  12916. dataPriv.remove( elem, "handle events" );
  12917. }
  12918. },
  12919. dispatch: function( nativeEvent ) {
  12920. // Make a writable jQuery.Event from the native event object
  12921. var event = jQuery.event.fix( nativeEvent );
  12922. var i, j, ret, matched, handleObj, handlerQueue,
  12923. args = new Array( arguments.length ),
  12924. handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
  12925. special = jQuery.event.special[ event.type ] || {};
  12926. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  12927. args[ 0 ] = event;
  12928. for ( i = 1; i < arguments.length; i++ ) {
  12929. args[ i ] = arguments[ i ];
  12930. }
  12931. event.delegateTarget = this;
  12932. // Call the preDispatch hook for the mapped type, and let it bail if desired
  12933. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  12934. return;
  12935. }
  12936. // Determine handlers
  12937. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  12938. // Run delegates first; they may want to stop propagation beneath us
  12939. i = 0;
  12940. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  12941. event.currentTarget = matched.elem;
  12942. j = 0;
  12943. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  12944. !event.isImmediatePropagationStopped() ) {
  12945. // If the event is namespaced, then each handler is only invoked if it is
  12946. // specially universal or its namespaces are a superset of the event's.
  12947. if ( !event.rnamespace || handleObj.namespace === false ||
  12948. event.rnamespace.test( handleObj.namespace ) ) {
  12949. event.handleObj = handleObj;
  12950. event.data = handleObj.data;
  12951. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  12952. handleObj.handler ).apply( matched.elem, args );
  12953. if ( ret !== undefined ) {
  12954. if ( ( event.result = ret ) === false ) {
  12955. event.preventDefault();
  12956. event.stopPropagation();
  12957. }
  12958. }
  12959. }
  12960. }
  12961. }
  12962. // Call the postDispatch hook for the mapped type
  12963. if ( special.postDispatch ) {
  12964. special.postDispatch.call( this, event );
  12965. }
  12966. return event.result;
  12967. },
  12968. handlers: function( event, handlers ) {
  12969. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  12970. handlerQueue = [],
  12971. delegateCount = handlers.delegateCount,
  12972. cur = event.target;
  12973. // Find delegate handlers
  12974. if ( delegateCount &&
  12975. // Support: IE <=9
  12976. // Black-hole SVG <use> instance trees (trac-13180)
  12977. cur.nodeType &&
  12978. // Support: Firefox <=42
  12979. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  12980. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  12981. // Support: IE 11 only
  12982. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  12983. !( event.type === "click" && event.button >= 1 ) ) {
  12984. for ( ; cur !== this; cur = cur.parentNode || this ) {
  12985. // Don't check non-elements (#13208)
  12986. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  12987. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  12988. matchedHandlers = [];
  12989. matchedSelectors = {};
  12990. for ( i = 0; i < delegateCount; i++ ) {
  12991. handleObj = handlers[ i ];
  12992. // Don't conflict with Object.prototype properties (#13203)
  12993. sel = handleObj.selector + " ";
  12994. if ( matchedSelectors[ sel ] === undefined ) {
  12995. matchedSelectors[ sel ] = handleObj.needsContext ?
  12996. jQuery( sel, this ).index( cur ) > -1 :
  12997. jQuery.find( sel, this, null, [ cur ] ).length;
  12998. }
  12999. if ( matchedSelectors[ sel ] ) {
  13000. matchedHandlers.push( handleObj );
  13001. }
  13002. }
  13003. if ( matchedHandlers.length ) {
  13004. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  13005. }
  13006. }
  13007. }
  13008. }
  13009. // Add the remaining (directly-bound) handlers
  13010. cur = this;
  13011. if ( delegateCount < handlers.length ) {
  13012. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  13013. }
  13014. return handlerQueue;
  13015. },
  13016. addProp: function( name, hook ) {
  13017. Object.defineProperty( jQuery.Event.prototype, name, {
  13018. enumerable: true,
  13019. configurable: true,
  13020. get: isFunction( hook ) ?
  13021. function() {
  13022. if ( this.originalEvent ) {
  13023. return hook( this.originalEvent );
  13024. }
  13025. } :
  13026. function() {
  13027. if ( this.originalEvent ) {
  13028. return this.originalEvent[ name ];
  13029. }
  13030. },
  13031. set: function( value ) {
  13032. Object.defineProperty( this, name, {
  13033. enumerable: true,
  13034. configurable: true,
  13035. writable: true,
  13036. value: value
  13037. } );
  13038. }
  13039. } );
  13040. },
  13041. fix: function( originalEvent ) {
  13042. return originalEvent[ jQuery.expando ] ?
  13043. originalEvent :
  13044. new jQuery.Event( originalEvent );
  13045. },
  13046. special: {
  13047. load: {
  13048. // Prevent triggered image.load events from bubbling to window.load
  13049. noBubble: true
  13050. },
  13051. click: {
  13052. // Utilize native event to ensure correct state for checkable inputs
  13053. setup: function( data ) {
  13054. // For mutual compressibility with _default, replace `this` access with a local var.
  13055. // `|| data` is dead code meant only to preserve the variable through minification.
  13056. var el = this || data;
  13057. // Claim the first handler
  13058. if ( rcheckableType.test( el.type ) &&
  13059. el.click && nodeName( el, "input" ) ) {
  13060. // dataPriv.set( el, "click", ... )
  13061. leverageNative( el, "click", returnTrue );
  13062. }
  13063. // Return false to allow normal processing in the caller
  13064. return false;
  13065. },
  13066. trigger: function( data ) {
  13067. // For mutual compressibility with _default, replace `this` access with a local var.
  13068. // `|| data` is dead code meant only to preserve the variable through minification.
  13069. var el = this || data;
  13070. // Force setup before triggering a click
  13071. if ( rcheckableType.test( el.type ) &&
  13072. el.click && nodeName( el, "input" ) ) {
  13073. leverageNative( el, "click" );
  13074. }
  13075. // Return non-false to allow normal event-path propagation
  13076. return true;
  13077. },
  13078. // For cross-browser consistency, suppress native .click() on links
  13079. // Also prevent it if we're currently inside a leveraged native-event stack
  13080. _default: function( event ) {
  13081. var target = event.target;
  13082. return rcheckableType.test( target.type ) &&
  13083. target.click && nodeName( target, "input" ) &&
  13084. dataPriv.get( target, "click" ) ||
  13085. nodeName( target, "a" );
  13086. }
  13087. },
  13088. beforeunload: {
  13089. postDispatch: function( event ) {
  13090. // Support: Firefox 20+
  13091. // Firefox doesn't alert if the returnValue field is not set.
  13092. if ( event.result !== undefined && event.originalEvent ) {
  13093. event.originalEvent.returnValue = event.result;
  13094. }
  13095. }
  13096. }
  13097. }
  13098. };
  13099. // Ensure the presence of an event listener that handles manually-triggered
  13100. // synthetic events by interrupting progress until reinvoked in response to
  13101. // *native* events that it fires directly, ensuring that state changes have
  13102. // already occurred before other listeners are invoked.
  13103. function leverageNative( el, type, expectSync ) {
  13104. // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
  13105. if ( !expectSync ) {
  13106. if ( dataPriv.get( el, type ) === undefined ) {
  13107. jQuery.event.add( el, type, returnTrue );
  13108. }
  13109. return;
  13110. }
  13111. // Register the controller as a special universal handler for all event namespaces
  13112. dataPriv.set( el, type, false );
  13113. jQuery.event.add( el, type, {
  13114. namespace: false,
  13115. handler: function( event ) {
  13116. var notAsync, result,
  13117. saved = dataPriv.get( this, type );
  13118. if ( ( event.isTrigger & 1 ) && this[ type ] ) {
  13119. // Interrupt processing of the outer synthetic .trigger()ed event
  13120. // Saved data should be false in such cases, but might be a leftover capture object
  13121. // from an async native handler (gh-4350)
  13122. if ( !saved.length ) {
  13123. // Store arguments for use when handling the inner native event
  13124. // There will always be at least one argument (an event object), so this array
  13125. // will not be confused with a leftover capture object.
  13126. saved = slice.call( arguments );
  13127. dataPriv.set( this, type, saved );
  13128. // Trigger the native event and capture its result
  13129. // Support: IE <=9 - 11+
  13130. // focus() and blur() are asynchronous
  13131. notAsync = expectSync( this, type );
  13132. this[ type ]();
  13133. result = dataPriv.get( this, type );
  13134. if ( saved !== result || notAsync ) {
  13135. dataPriv.set( this, type, false );
  13136. } else {
  13137. result = {};
  13138. }
  13139. if ( saved !== result ) {
  13140. // Cancel the outer synthetic event
  13141. event.stopImmediatePropagation();
  13142. event.preventDefault();
  13143. return result.value;
  13144. }
  13145. // If this is an inner synthetic event for an event with a bubbling surrogate
  13146. // (focus or blur), assume that the surrogate already propagated from triggering the
  13147. // native event and prevent that from happening again here.
  13148. // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
  13149. // bubbling surrogate propagates *after* the non-bubbling base), but that seems
  13150. // less bad than duplication.
  13151. } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) {
  13152. event.stopPropagation();
  13153. }
  13154. // If this is a native event triggered above, everything is now in order
  13155. // Fire an inner synthetic event with the original arguments
  13156. } else if ( saved.length ) {
  13157. // ...and capture the result
  13158. dataPriv.set( this, type, {
  13159. value: jQuery.event.trigger(
  13160. // Support: IE <=9 - 11+
  13161. // Extend with the prototype to reset the above stopImmediatePropagation()
  13162. jQuery.extend( saved[ 0 ], jQuery.Event.prototype ),
  13163. saved.slice( 1 ),
  13164. this
  13165. )
  13166. } );
  13167. // Abort handling of the native event
  13168. event.stopImmediatePropagation();
  13169. }
  13170. }
  13171. } );
  13172. }
  13173. jQuery.removeEvent = function( elem, type, handle ) {
  13174. // This "if" is needed for plain objects
  13175. if ( elem.removeEventListener ) {
  13176. elem.removeEventListener( type, handle );
  13177. }
  13178. };
  13179. jQuery.Event = function( src, props ) {
  13180. // Allow instantiation without the 'new' keyword
  13181. if ( !( this instanceof jQuery.Event ) ) {
  13182. return new jQuery.Event( src, props );
  13183. }
  13184. // Event object
  13185. if ( src && src.type ) {
  13186. this.originalEvent = src;
  13187. this.type = src.type;
  13188. // Events bubbling up the document may have been marked as prevented
  13189. // by a handler lower down the tree; reflect the correct value.
  13190. this.isDefaultPrevented = src.defaultPrevented ||
  13191. src.defaultPrevented === undefined &&
  13192. // Support: Android <=2.3 only
  13193. src.returnValue === false ?
  13194. returnTrue :
  13195. returnFalse;
  13196. // Create target properties
  13197. // Support: Safari <=6 - 7 only
  13198. // Target should not be a text node (#504, #13143)
  13199. this.target = ( src.target && src.target.nodeType === 3 ) ?
  13200. src.target.parentNode :
  13201. src.target;
  13202. this.currentTarget = src.currentTarget;
  13203. this.relatedTarget = src.relatedTarget;
  13204. // Event type
  13205. } else {
  13206. this.type = src;
  13207. }
  13208. // Put explicitly provided properties onto the event object
  13209. if ( props ) {
  13210. jQuery.extend( this, props );
  13211. }
  13212. // Create a timestamp if incoming event doesn't have one
  13213. this.timeStamp = src && src.timeStamp || Date.now();
  13214. // Mark it as fixed
  13215. this[ jQuery.expando ] = true;
  13216. };
  13217. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  13218. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  13219. jQuery.Event.prototype = {
  13220. constructor: jQuery.Event,
  13221. isDefaultPrevented: returnFalse,
  13222. isPropagationStopped: returnFalse,
  13223. isImmediatePropagationStopped: returnFalse,
  13224. isSimulated: false,
  13225. preventDefault: function() {
  13226. var e = this.originalEvent;
  13227. this.isDefaultPrevented = returnTrue;
  13228. if ( e && !this.isSimulated ) {
  13229. e.preventDefault();
  13230. }
  13231. },
  13232. stopPropagation: function() {
  13233. var e = this.originalEvent;
  13234. this.isPropagationStopped = returnTrue;
  13235. if ( e && !this.isSimulated ) {
  13236. e.stopPropagation();
  13237. }
  13238. },
  13239. stopImmediatePropagation: function() {
  13240. var e = this.originalEvent;
  13241. this.isImmediatePropagationStopped = returnTrue;
  13242. if ( e && !this.isSimulated ) {
  13243. e.stopImmediatePropagation();
  13244. }
  13245. this.stopPropagation();
  13246. }
  13247. };
  13248. // Includes all common event props including KeyEvent and MouseEvent specific props
  13249. jQuery.each( {
  13250. altKey: true,
  13251. bubbles: true,
  13252. cancelable: true,
  13253. changedTouches: true,
  13254. ctrlKey: true,
  13255. detail: true,
  13256. eventPhase: true,
  13257. metaKey: true,
  13258. pageX: true,
  13259. pageY: true,
  13260. shiftKey: true,
  13261. view: true,
  13262. "char": true,
  13263. code: true,
  13264. charCode: true,
  13265. key: true,
  13266. keyCode: true,
  13267. button: true,
  13268. buttons: true,
  13269. clientX: true,
  13270. clientY: true,
  13271. offsetX: true,
  13272. offsetY: true,
  13273. pointerId: true,
  13274. pointerType: true,
  13275. screenX: true,
  13276. screenY: true,
  13277. targetTouches: true,
  13278. toElement: true,
  13279. touches: true,
  13280. which: function( event ) {
  13281. var button = event.button;
  13282. // Add which for key events
  13283. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  13284. return event.charCode != null ? event.charCode : event.keyCode;
  13285. }
  13286. // Add which for click: 1 === left; 2 === middle; 3 === right
  13287. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  13288. if ( button & 1 ) {
  13289. return 1;
  13290. }
  13291. if ( button & 2 ) {
  13292. return 3;
  13293. }
  13294. if ( button & 4 ) {
  13295. return 2;
  13296. }
  13297. return 0;
  13298. }
  13299. return event.which;
  13300. }
  13301. }, jQuery.event.addProp );
  13302. jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
  13303. jQuery.event.special[ type ] = {
  13304. // Utilize native event if possible so blur/focus sequence is correct
  13305. setup: function() {
  13306. // Claim the first handler
  13307. // dataPriv.set( this, "focus", ... )
  13308. // dataPriv.set( this, "blur", ... )
  13309. leverageNative( this, type, expectSync );
  13310. // Return false to allow normal processing in the caller
  13311. return false;
  13312. },
  13313. trigger: function() {
  13314. // Force setup before trigger
  13315. leverageNative( this, type );
  13316. // Return non-false to allow normal event-path propagation
  13317. return true;
  13318. },
  13319. delegateType: delegateType
  13320. };
  13321. } );
  13322. // Create mouseenter/leave events using mouseover/out and event-time checks
  13323. // so that event delegation works in jQuery.
  13324. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  13325. //
  13326. // Support: Safari 7 only
  13327. // Safari sends mouseenter too often; see:
  13328. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  13329. // for the description of the bug (it existed in older Chrome versions as well).
  13330. jQuery.each( {
  13331. mouseenter: "mouseover",
  13332. mouseleave: "mouseout",
  13333. pointerenter: "pointerover",
  13334. pointerleave: "pointerout"
  13335. }, function( orig, fix ) {
  13336. jQuery.event.special[ orig ] = {
  13337. delegateType: fix,
  13338. bindType: fix,
  13339. handle: function( event ) {
  13340. var ret,
  13341. target = this,
  13342. related = event.relatedTarget,
  13343. handleObj = event.handleObj;
  13344. // For mouseenter/leave call the handler if related is outside the target.
  13345. // NB: No relatedTarget if the mouse left/entered the browser window
  13346. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  13347. event.type = handleObj.origType;
  13348. ret = handleObj.handler.apply( this, arguments );
  13349. event.type = fix;
  13350. }
  13351. return ret;
  13352. }
  13353. };
  13354. } );
  13355. jQuery.fn.extend( {
  13356. on: function( types, selector, data, fn ) {
  13357. return on( this, types, selector, data, fn );
  13358. },
  13359. one: function( types, selector, data, fn ) {
  13360. return on( this, types, selector, data, fn, 1 );
  13361. },
  13362. off: function( types, selector, fn ) {
  13363. var handleObj, type;
  13364. if ( types && types.preventDefault && types.handleObj ) {
  13365. // ( event ) dispatched jQuery.Event
  13366. handleObj = types.handleObj;
  13367. jQuery( types.delegateTarget ).off(
  13368. handleObj.namespace ?
  13369. handleObj.origType + "." + handleObj.namespace :
  13370. handleObj.origType,
  13371. handleObj.selector,
  13372. handleObj.handler
  13373. );
  13374. return this;
  13375. }
  13376. if ( typeof types === "object" ) {
  13377. // ( types-object [, selector] )
  13378. for ( type in types ) {
  13379. this.off( type, selector, types[ type ] );
  13380. }
  13381. return this;
  13382. }
  13383. if ( selector === false || typeof selector === "function" ) {
  13384. // ( types [, fn] )
  13385. fn = selector;
  13386. selector = undefined;
  13387. }
  13388. if ( fn === false ) {
  13389. fn = returnFalse;
  13390. }
  13391. return this.each( function() {
  13392. jQuery.event.remove( this, types, fn, selector );
  13393. } );
  13394. }
  13395. } );
  13396. var
  13397. /* eslint-disable max-len */
  13398. // See https://github.com/eslint/eslint/issues/3229
  13399. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  13400. /* eslint-enable */
  13401. // Support: IE <=10 - 11, Edge 12 - 13 only
  13402. // In IE/Edge using regex groups here causes severe slowdowns.
  13403. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  13404. rnoInnerhtml = /<script|<style|<link/i,
  13405. // checked="checked" or checked
  13406. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  13407. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  13408. // Prefer a tbody over its parent table for containing new rows
  13409. function manipulationTarget( elem, content ) {
  13410. if ( nodeName( elem, "table" ) &&
  13411. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  13412. return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
  13413. }
  13414. return elem;
  13415. }
  13416. // Replace/restore the type attribute of script elements for safe DOM manipulation
  13417. function disableScript( elem ) {
  13418. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  13419. return elem;
  13420. }
  13421. function restoreScript( elem ) {
  13422. if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
  13423. elem.type = elem.type.slice( 5 );
  13424. } else {
  13425. elem.removeAttribute( "type" );
  13426. }
  13427. return elem;
  13428. }
  13429. function cloneCopyEvent( src, dest ) {
  13430. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  13431. if ( dest.nodeType !== 1 ) {
  13432. return;
  13433. }
  13434. // 1. Copy private data: events, handlers, etc.
  13435. if ( dataPriv.hasData( src ) ) {
  13436. pdataOld = dataPriv.access( src );
  13437. pdataCur = dataPriv.set( dest, pdataOld );
  13438. events = pdataOld.events;
  13439. if ( events ) {
  13440. delete pdataCur.handle;
  13441. pdataCur.events = {};
  13442. for ( type in events ) {
  13443. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  13444. jQuery.event.add( dest, type, events[ type ][ i ] );
  13445. }
  13446. }
  13447. }
  13448. }
  13449. // 2. Copy user data
  13450. if ( dataUser.hasData( src ) ) {
  13451. udataOld = dataUser.access( src );
  13452. udataCur = jQuery.extend( {}, udataOld );
  13453. dataUser.set( dest, udataCur );
  13454. }
  13455. }
  13456. // Fix IE bugs, see support tests
  13457. function fixInput( src, dest ) {
  13458. var nodeName = dest.nodeName.toLowerCase();
  13459. // Fails to persist the checked state of a cloned checkbox or radio button.
  13460. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  13461. dest.checked = src.checked;
  13462. // Fails to return the selected option to the default selected state when cloning options
  13463. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  13464. dest.defaultValue = src.defaultValue;
  13465. }
  13466. }
  13467. function domManip( collection, args, callback, ignored ) {
  13468. // Flatten any nested arrays
  13469. args = concat.apply( [], args );
  13470. var fragment, first, scripts, hasScripts, node, doc,
  13471. i = 0,
  13472. l = collection.length,
  13473. iNoClone = l - 1,
  13474. value = args[ 0 ],
  13475. valueIsFunction = isFunction( value );
  13476. // We can't cloneNode fragments that contain checked, in WebKit
  13477. if ( valueIsFunction ||
  13478. ( l > 1 && typeof value === "string" &&
  13479. !support.checkClone && rchecked.test( value ) ) ) {
  13480. return collection.each( function( index ) {
  13481. var self = collection.eq( index );
  13482. if ( valueIsFunction ) {
  13483. args[ 0 ] = value.call( this, index, self.html() );
  13484. }
  13485. domManip( self, args, callback, ignored );
  13486. } );
  13487. }
  13488. if ( l ) {
  13489. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  13490. first = fragment.firstChild;
  13491. if ( fragment.childNodes.length === 1 ) {
  13492. fragment = first;
  13493. }
  13494. // Require either new content or an interest in ignored elements to invoke the callback
  13495. if ( first || ignored ) {
  13496. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  13497. hasScripts = scripts.length;
  13498. // Use the original fragment for the last item
  13499. // instead of the first because it can end up
  13500. // being emptied incorrectly in certain situations (#8070).
  13501. for ( ; i < l; i++ ) {
  13502. node = fragment;
  13503. if ( i !== iNoClone ) {
  13504. node = jQuery.clone( node, true, true );
  13505. // Keep references to cloned scripts for later restoration
  13506. if ( hasScripts ) {
  13507. // Support: Android <=4.0 only, PhantomJS 1 only
  13508. // push.apply(_, arraylike) throws on ancient WebKit
  13509. jQuery.merge( scripts, getAll( node, "script" ) );
  13510. }
  13511. }
  13512. callback.call( collection[ i ], node, i );
  13513. }
  13514. if ( hasScripts ) {
  13515. doc = scripts[ scripts.length - 1 ].ownerDocument;
  13516. // Reenable scripts
  13517. jQuery.map( scripts, restoreScript );
  13518. // Evaluate executable scripts on first document insertion
  13519. for ( i = 0; i < hasScripts; i++ ) {
  13520. node = scripts[ i ];
  13521. if ( rscriptType.test( node.type || "" ) &&
  13522. !dataPriv.access( node, "globalEval" ) &&
  13523. jQuery.contains( doc, node ) ) {
  13524. if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
  13525. // Optional AJAX dependency, but won't run scripts if not present
  13526. if ( jQuery._evalUrl && !node.noModule ) {
  13527. jQuery._evalUrl( node.src, {
  13528. nonce: node.nonce || node.getAttribute( "nonce" )
  13529. } );
  13530. }
  13531. } else {
  13532. DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc );
  13533. }
  13534. }
  13535. }
  13536. }
  13537. }
  13538. }
  13539. return collection;
  13540. }
  13541. function remove( elem, selector, keepData ) {
  13542. var node,
  13543. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  13544. i = 0;
  13545. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  13546. if ( !keepData && node.nodeType === 1 ) {
  13547. jQuery.cleanData( getAll( node ) );
  13548. }
  13549. if ( node.parentNode ) {
  13550. if ( keepData && isAttached( node ) ) {
  13551. setGlobalEval( getAll( node, "script" ) );
  13552. }
  13553. node.parentNode.removeChild( node );
  13554. }
  13555. }
  13556. return elem;
  13557. }
  13558. jQuery.extend( {
  13559. htmlPrefilter: function( html ) {
  13560. return html.replace( rxhtmlTag, "<$1></$2>" );
  13561. },
  13562. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  13563. var i, l, srcElements, destElements,
  13564. clone = elem.cloneNode( true ),
  13565. inPage = isAttached( elem );
  13566. // Fix IE cloning issues
  13567. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  13568. !jQuery.isXMLDoc( elem ) ) {
  13569. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  13570. destElements = getAll( clone );
  13571. srcElements = getAll( elem );
  13572. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  13573. fixInput( srcElements[ i ], destElements[ i ] );
  13574. }
  13575. }
  13576. // Copy the events from the original to the clone
  13577. if ( dataAndEvents ) {
  13578. if ( deepDataAndEvents ) {
  13579. srcElements = srcElements || getAll( elem );
  13580. destElements = destElements || getAll( clone );
  13581. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  13582. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  13583. }
  13584. } else {
  13585. cloneCopyEvent( elem, clone );
  13586. }
  13587. }
  13588. // Preserve script evaluation history
  13589. destElements = getAll( clone, "script" );
  13590. if ( destElements.length > 0 ) {
  13591. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  13592. }
  13593. // Return the cloned set
  13594. return clone;
  13595. },
  13596. cleanData: function( elems ) {
  13597. var data, elem, type,
  13598. special = jQuery.event.special,
  13599. i = 0;
  13600. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  13601. if ( acceptData( elem ) ) {
  13602. if ( ( data = elem[ dataPriv.expando ] ) ) {
  13603. if ( data.events ) {
  13604. for ( type in data.events ) {
  13605. if ( special[ type ] ) {
  13606. jQuery.event.remove( elem, type );
  13607. // This is a shortcut to avoid jQuery.event.remove's overhead
  13608. } else {
  13609. jQuery.removeEvent( elem, type, data.handle );
  13610. }
  13611. }
  13612. }
  13613. // Support: Chrome <=35 - 45+
  13614. // Assign undefined instead of using delete, see Data#remove
  13615. elem[ dataPriv.expando ] = undefined;
  13616. }
  13617. if ( elem[ dataUser.expando ] ) {
  13618. // Support: Chrome <=35 - 45+
  13619. // Assign undefined instead of using delete, see Data#remove
  13620. elem[ dataUser.expando ] = undefined;
  13621. }
  13622. }
  13623. }
  13624. }
  13625. } );
  13626. jQuery.fn.extend( {
  13627. detach: function( selector ) {
  13628. return remove( this, selector, true );
  13629. },
  13630. remove: function( selector ) {
  13631. return remove( this, selector );
  13632. },
  13633. text: function( value ) {
  13634. return access( this, function( value ) {
  13635. return value === undefined ?
  13636. jQuery.text( this ) :
  13637. this.empty().each( function() {
  13638. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13639. this.textContent = value;
  13640. }
  13641. } );
  13642. }, null, value, arguments.length );
  13643. },
  13644. append: function() {
  13645. return domManip( this, arguments, function( elem ) {
  13646. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13647. var target = manipulationTarget( this, elem );
  13648. target.appendChild( elem );
  13649. }
  13650. } );
  13651. },
  13652. prepend: function() {
  13653. return domManip( this, arguments, function( elem ) {
  13654. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13655. var target = manipulationTarget( this, elem );
  13656. target.insertBefore( elem, target.firstChild );
  13657. }
  13658. } );
  13659. },
  13660. before: function() {
  13661. return domManip( this, arguments, function( elem ) {
  13662. if ( this.parentNode ) {
  13663. this.parentNode.insertBefore( elem, this );
  13664. }
  13665. } );
  13666. },
  13667. after: function() {
  13668. return domManip( this, arguments, function( elem ) {
  13669. if ( this.parentNode ) {
  13670. this.parentNode.insertBefore( elem, this.nextSibling );
  13671. }
  13672. } );
  13673. },
  13674. empty: function() {
  13675. var elem,
  13676. i = 0;
  13677. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  13678. if ( elem.nodeType === 1 ) {
  13679. // Prevent memory leaks
  13680. jQuery.cleanData( getAll( elem, false ) );
  13681. // Remove any remaining nodes
  13682. elem.textContent = "";
  13683. }
  13684. }
  13685. return this;
  13686. },
  13687. clone: function( dataAndEvents, deepDataAndEvents ) {
  13688. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  13689. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  13690. return this.map( function() {
  13691. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  13692. } );
  13693. },
  13694. html: function( value ) {
  13695. return access( this, function( value ) {
  13696. var elem = this[ 0 ] || {},
  13697. i = 0,
  13698. l = this.length;
  13699. if ( value === undefined && elem.nodeType === 1 ) {
  13700. return elem.innerHTML;
  13701. }
  13702. // See if we can take a shortcut and just use innerHTML
  13703. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  13704. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  13705. value = jQuery.htmlPrefilter( value );
  13706. try {
  13707. for ( ; i < l; i++ ) {
  13708. elem = this[ i ] || {};
  13709. // Remove element nodes and prevent memory leaks
  13710. if ( elem.nodeType === 1 ) {
  13711. jQuery.cleanData( getAll( elem, false ) );
  13712. elem.innerHTML = value;
  13713. }
  13714. }
  13715. elem = 0;
  13716. // If using innerHTML throws an exception, use the fallback method
  13717. } catch ( e ) {}
  13718. }
  13719. if ( elem ) {
  13720. this.empty().append( value );
  13721. }
  13722. }, null, value, arguments.length );
  13723. },
  13724. replaceWith: function() {
  13725. var ignored = [];
  13726. // Make the changes, replacing each non-ignored context element with the new content
  13727. return domManip( this, arguments, function( elem ) {
  13728. var parent = this.parentNode;
  13729. if ( jQuery.inArray( this, ignored ) < 0 ) {
  13730. jQuery.cleanData( getAll( this ) );
  13731. if ( parent ) {
  13732. parent.replaceChild( elem, this );
  13733. }
  13734. }
  13735. // Force callback invocation
  13736. }, ignored );
  13737. }
  13738. } );
  13739. jQuery.each( {
  13740. appendTo: "append",
  13741. prependTo: "prepend",
  13742. insertBefore: "before",
  13743. insertAfter: "after",
  13744. replaceAll: "replaceWith"
  13745. }, function( name, original ) {
  13746. jQuery.fn[ name ] = function( selector ) {
  13747. var elems,
  13748. ret = [],
  13749. insert = jQuery( selector ),
  13750. last = insert.length - 1,
  13751. i = 0;
  13752. for ( ; i <= last; i++ ) {
  13753. elems = i === last ? this : this.clone( true );
  13754. jQuery( insert[ i ] )[ original ]( elems );
  13755. // Support: Android <=4.0 only, PhantomJS 1 only
  13756. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  13757. push.apply( ret, elems.get() );
  13758. }
  13759. return this.pushStack( ret );
  13760. };
  13761. } );
  13762. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  13763. var getStyles = function( elem ) {
  13764. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  13765. // IE throws on elements created in popups
  13766. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  13767. var view = elem.ownerDocument.defaultView;
  13768. if ( !view || !view.opener ) {
  13769. view = window;
  13770. }
  13771. return view.getComputedStyle( elem );
  13772. };
  13773. var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
  13774. ( function() {
  13775. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  13776. // so they're executed at the same time to save the second computation.
  13777. function computeStyleTests() {
  13778. // This is a singleton, we need to execute it only once
  13779. if ( !div ) {
  13780. return;
  13781. }
  13782. container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
  13783. "margin-top:1px;padding:0;border:0";
  13784. div.style.cssText =
  13785. "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
  13786. "margin:auto;border:1px;padding:1px;" +
  13787. "width:60%;top:1%";
  13788. documentElement.appendChild( container ).appendChild( div );
  13789. var divStyle = window.getComputedStyle( div );
  13790. pixelPositionVal = divStyle.top !== "1%";
  13791. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  13792. reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
  13793. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  13794. // Some styles come back with percentage values, even though they shouldn't
  13795. div.style.right = "60%";
  13796. pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
  13797. // Support: IE 9 - 11 only
  13798. // Detect misreporting of content dimensions for box-sizing:border-box elements
  13799. boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
  13800. // Support: IE 9 only
  13801. // Detect overflow:scroll screwiness (gh-3699)
  13802. // Support: Chrome <=64
  13803. // Don't get tricked when zoom affects offsetWidth (gh-4029)
  13804. div.style.position = "absolute";
  13805. scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12;
  13806. documentElement.removeChild( container );
  13807. // Nullify the div so it wouldn't be stored in the memory and
  13808. // it will also be a sign that checks already performed
  13809. div = null;
  13810. }
  13811. function roundPixelMeasures( measure ) {
  13812. return Math.round( parseFloat( measure ) );
  13813. }
  13814. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
  13815. reliableMarginLeftVal,
  13816. container = document.createElement( "div" ),
  13817. div = document.createElement( "div" );
  13818. // Finish early in limited (non-browser) environments
  13819. if ( !div.style ) {
  13820. return;
  13821. }
  13822. // Support: IE <=9 - 11 only
  13823. // Style of cloned element affects source element cloned (#8908)
  13824. div.style.backgroundClip = "content-box";
  13825. div.cloneNode( true ).style.backgroundClip = "";
  13826. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  13827. jQuery.extend( support, {
  13828. boxSizingReliable: function() {
  13829. computeStyleTests();
  13830. return boxSizingReliableVal;
  13831. },
  13832. pixelBoxStyles: function() {
  13833. computeStyleTests();
  13834. return pixelBoxStylesVal;
  13835. },
  13836. pixelPosition: function() {
  13837. computeStyleTests();
  13838. return pixelPositionVal;
  13839. },
  13840. reliableMarginLeft: function() {
  13841. computeStyleTests();
  13842. return reliableMarginLeftVal;
  13843. },
  13844. scrollboxSize: function() {
  13845. computeStyleTests();
  13846. return scrollboxSizeVal;
  13847. }
  13848. } );
  13849. } )();
  13850. function curCSS( elem, name, computed ) {
  13851. var width, minWidth, maxWidth, ret,
  13852. // Support: Firefox 51+
  13853. // Retrieving style before computed somehow
  13854. // fixes an issue with getting wrong values
  13855. // on detached elements
  13856. style = elem.style;
  13857. computed = computed || getStyles( elem );
  13858. // getPropertyValue is needed for:
  13859. // .css('filter') (IE 9 only, #12537)
  13860. // .css('--customProperty) (#3144)
  13861. if ( computed ) {
  13862. ret = computed.getPropertyValue( name ) || computed[ name ];
  13863. if ( ret === "" && !isAttached( elem ) ) {
  13864. ret = jQuery.style( elem, name );
  13865. }
  13866. // A tribute to the "awesome hack by Dean Edwards"
  13867. // Android Browser returns percentage for some values,
  13868. // but width seems to be reliably pixels.
  13869. // This is against the CSSOM draft spec:
  13870. // https://drafts.csswg.org/cssom/#resolved-values
  13871. if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
  13872. // Remember the original values
  13873. width = style.width;
  13874. minWidth = style.minWidth;
  13875. maxWidth = style.maxWidth;
  13876. // Put in the new values to get a computed value out
  13877. style.minWidth = style.maxWidth = style.width = ret;
  13878. ret = computed.width;
  13879. // Revert the changed values
  13880. style.width = width;
  13881. style.minWidth = minWidth;
  13882. style.maxWidth = maxWidth;
  13883. }
  13884. }
  13885. return ret !== undefined ?
  13886. // Support: IE <=9 - 11 only
  13887. // IE returns zIndex value as an integer.
  13888. ret + "" :
  13889. ret;
  13890. }
  13891. function addGetHookIf( conditionFn, hookFn ) {
  13892. // Define the hook, we'll check on the first run if it's really needed.
  13893. return {
  13894. get: function() {
  13895. if ( conditionFn() ) {
  13896. // Hook not needed (or it's not possible to use it due
  13897. // to missing dependency), remove it.
  13898. delete this.get;
  13899. return;
  13900. }
  13901. // Hook needed; redefine it so that the support test is not executed again.
  13902. return ( this.get = hookFn ).apply( this, arguments );
  13903. }
  13904. };
  13905. }
  13906. var cssPrefixes = [ "Webkit", "Moz", "ms" ],
  13907. emptyStyle = document.createElement( "div" ).style,
  13908. vendorProps = {};
  13909. // Return a vendor-prefixed property or undefined
  13910. function vendorPropName( name ) {
  13911. // Check for vendor prefixed names
  13912. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  13913. i = cssPrefixes.length;
  13914. while ( i-- ) {
  13915. name = cssPrefixes[ i ] + capName;
  13916. if ( name in emptyStyle ) {
  13917. return name;
  13918. }
  13919. }
  13920. }
  13921. // Return a potentially-mapped jQuery.cssProps or vendor prefixed property
  13922. function finalPropName( name ) {
  13923. var final = jQuery.cssProps[ name ] || vendorProps[ name ];
  13924. if ( final ) {
  13925. return final;
  13926. }
  13927. if ( name in emptyStyle ) {
  13928. return name;
  13929. }
  13930. return vendorProps[ name ] = vendorPropName( name ) || name;
  13931. }
  13932. var
  13933. // Swappable if display is none or starts with table
  13934. // except "table", "table-cell", or "table-caption"
  13935. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  13936. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  13937. rcustomProp = /^--/,
  13938. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  13939. cssNormalTransform = {
  13940. letterSpacing: "0",
  13941. fontWeight: "400"
  13942. };
  13943. function setPositiveNumber( elem, value, subtract ) {
  13944. // Any relative (+/-) values have already been
  13945. // normalized at this point
  13946. var matches = rcssNum.exec( value );
  13947. return matches ?
  13948. // Guard against undefined "subtract", e.g., when used as in cssHooks
  13949. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  13950. value;
  13951. }
  13952. function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
  13953. var i = dimension === "width" ? 1 : 0,
  13954. extra = 0,
  13955. delta = 0;
  13956. // Adjustment may not be necessary
  13957. if ( box === ( isBorderBox ? "border" : "content" ) ) {
  13958. return 0;
  13959. }
  13960. for ( ; i < 4; i += 2 ) {
  13961. // Both box models exclude margin
  13962. if ( box === "margin" ) {
  13963. delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
  13964. }
  13965. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  13966. if ( !isBorderBox ) {
  13967. // Add padding
  13968. delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  13969. // For "border" or "margin", add border
  13970. if ( box !== "padding" ) {
  13971. delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13972. // But still keep track of it otherwise
  13973. } else {
  13974. extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13975. }
  13976. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  13977. // "padding" or "margin"
  13978. } else {
  13979. // For "content", subtract padding
  13980. if ( box === "content" ) {
  13981. delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  13982. }
  13983. // For "content" or "padding", subtract border
  13984. if ( box !== "margin" ) {
  13985. delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13986. }
  13987. }
  13988. }
  13989. // Account for positive content-box scroll gutter when requested by providing computedVal
  13990. if ( !isBorderBox && computedVal >= 0 ) {
  13991. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  13992. // Assuming integer scroll gutter, subtract the rest and round down
  13993. delta += Math.max( 0, Math.ceil(
  13994. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  13995. computedVal -
  13996. delta -
  13997. extra -
  13998. 0.5
  13999. // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
  14000. // Use an explicit zero to avoid NaN (gh-3964)
  14001. ) ) || 0;
  14002. }
  14003. return delta;
  14004. }
  14005. function getWidthOrHeight( elem, dimension, extra ) {
  14006. // Start with computed style
  14007. var styles = getStyles( elem ),
  14008. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
  14009. // Fake content-box until we know it's needed to know the true value.
  14010. boxSizingNeeded = !support.boxSizingReliable() || extra,
  14011. isBorderBox = boxSizingNeeded &&
  14012. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  14013. valueIsBorderBox = isBorderBox,
  14014. val = curCSS( elem, dimension, styles ),
  14015. offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );
  14016. // Support: Firefox <=54
  14017. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  14018. if ( rnumnonpx.test( val ) ) {
  14019. if ( !extra ) {
  14020. return val;
  14021. }
  14022. val = "auto";
  14023. }
  14024. // Fall back to offsetWidth/offsetHeight when value is "auto"
  14025. // This happens for inline elements with no explicit setting (gh-3571)
  14026. // Support: Android <=4.1 - 4.3 only
  14027. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  14028. // Support: IE 9-11 only
  14029. // Also use offsetWidth/offsetHeight for when box sizing is unreliable
  14030. // We use getClientRects() to check for hidden/disconnected.
  14031. // In those cases, the computed value can be trusted to be border-box
  14032. if ( ( !support.boxSizingReliable() && isBorderBox ||
  14033. val === "auto" ||
  14034. !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&
  14035. elem.getClientRects().length ) {
  14036. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
  14037. // Where available, offsetWidth/offsetHeight approximate border box dimensions.
  14038. // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
  14039. // retrieved value as a content box dimension.
  14040. valueIsBorderBox = offsetProp in elem;
  14041. if ( valueIsBorderBox ) {
  14042. val = elem[ offsetProp ];
  14043. }
  14044. }
  14045. // Normalize "" and auto
  14046. val = parseFloat( val ) || 0;
  14047. // Adjust for the element's box model
  14048. return ( val +
  14049. boxModelAdjustment(
  14050. elem,
  14051. dimension,
  14052. extra || ( isBorderBox ? "border" : "content" ),
  14053. valueIsBorderBox,
  14054. styles,
  14055. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  14056. val
  14057. )
  14058. ) + "px";
  14059. }
  14060. jQuery.extend( {
  14061. // Add in style property hooks for overriding the default
  14062. // behavior of getting and setting a style property
  14063. cssHooks: {
  14064. opacity: {
  14065. get: function( elem, computed ) {
  14066. if ( computed ) {
  14067. // We should always get a number back from opacity
  14068. var ret = curCSS( elem, "opacity" );
  14069. return ret === "" ? "1" : ret;
  14070. }
  14071. }
  14072. }
  14073. },
  14074. // Don't automatically add "px" to these possibly-unitless properties
  14075. cssNumber: {
  14076. "animationIterationCount": true,
  14077. "columnCount": true,
  14078. "fillOpacity": true,
  14079. "flexGrow": true,
  14080. "flexShrink": true,
  14081. "fontWeight": true,
  14082. "gridArea": true,
  14083. "gridColumn": true,
  14084. "gridColumnEnd": true,
  14085. "gridColumnStart": true,
  14086. "gridRow": true,
  14087. "gridRowEnd": true,
  14088. "gridRowStart": true,
  14089. "lineHeight": true,
  14090. "opacity": true,
  14091. "order": true,
  14092. "orphans": true,
  14093. "widows": true,
  14094. "zIndex": true,
  14095. "zoom": true
  14096. },
  14097. // Add in properties whose names you wish to fix before
  14098. // setting or getting the value
  14099. cssProps: {},
  14100. // Get and set the style property on a DOM Node
  14101. style: function( elem, name, value, extra ) {
  14102. // Don't set styles on text and comment nodes
  14103. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  14104. return;
  14105. }
  14106. // Make sure that we're working with the right name
  14107. var ret, type, hooks,
  14108. origName = camelCase( name ),
  14109. isCustomProp = rcustomProp.test( name ),
  14110. style = elem.style;
  14111. // Make sure that we're working with the right name. We don't
  14112. // want to query the value if it is a CSS custom property
  14113. // since they are user-defined.
  14114. if ( !isCustomProp ) {
  14115. name = finalPropName( origName );
  14116. }
  14117. // Gets hook for the prefixed version, then unprefixed version
  14118. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  14119. // Check if we're setting a value
  14120. if ( value !== undefined ) {
  14121. type = typeof value;
  14122. // Convert "+=" or "-=" to relative numbers (#7345)
  14123. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  14124. value = adjustCSS( elem, name, ret );
  14125. // Fixes bug #9237
  14126. type = "number";
  14127. }
  14128. // Make sure that null and NaN values aren't set (#7116)
  14129. if ( value == null || value !== value ) {
  14130. return;
  14131. }
  14132. // If a number was passed in, add the unit (except for certain CSS properties)
  14133. // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append
  14134. // "px" to a few hardcoded values.
  14135. if ( type === "number" && !isCustomProp ) {
  14136. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  14137. }
  14138. // background-* props affect original clone's values
  14139. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  14140. style[ name ] = "inherit";
  14141. }
  14142. // If a hook was provided, use that value, otherwise just set the specified value
  14143. if ( !hooks || !( "set" in hooks ) ||
  14144. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  14145. if ( isCustomProp ) {
  14146. style.setProperty( name, value );
  14147. } else {
  14148. style[ name ] = value;
  14149. }
  14150. }
  14151. } else {
  14152. // If a hook was provided get the non-computed value from there
  14153. if ( hooks && "get" in hooks &&
  14154. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  14155. return ret;
  14156. }
  14157. // Otherwise just get the value from the style object
  14158. return style[ name ];
  14159. }
  14160. },
  14161. css: function( elem, name, extra, styles ) {
  14162. var val, num, hooks,
  14163. origName = camelCase( name ),
  14164. isCustomProp = rcustomProp.test( name );
  14165. // Make sure that we're working with the right name. We don't
  14166. // want to modify the value if it is a CSS custom property
  14167. // since they are user-defined.
  14168. if ( !isCustomProp ) {
  14169. name = finalPropName( origName );
  14170. }
  14171. // Try prefixed name followed by the unprefixed name
  14172. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  14173. // If a hook was provided get the computed value from there
  14174. if ( hooks && "get" in hooks ) {
  14175. val = hooks.get( elem, true, extra );
  14176. }
  14177. // Otherwise, if a way to get the computed value exists, use that
  14178. if ( val === undefined ) {
  14179. val = curCSS( elem, name, styles );
  14180. }
  14181. // Convert "normal" to computed value
  14182. if ( val === "normal" && name in cssNormalTransform ) {
  14183. val = cssNormalTransform[ name ];
  14184. }
  14185. // Make numeric if forced or a qualifier was provided and val looks numeric
  14186. if ( extra === "" || extra ) {
  14187. num = parseFloat( val );
  14188. return extra === true || isFinite( num ) ? num || 0 : val;
  14189. }
  14190. return val;
  14191. }
  14192. } );
  14193. jQuery.each( [ "height", "width" ], function( i, dimension ) {
  14194. jQuery.cssHooks[ dimension ] = {
  14195. get: function( elem, computed, extra ) {
  14196. if ( computed ) {
  14197. // Certain elements can have dimension info if we invisibly show them
  14198. // but it must have a current display style that would benefit
  14199. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  14200. // Support: Safari 8+
  14201. // Table columns in Safari have non-zero offsetWidth & zero
  14202. // getBoundingClientRect().width unless display is changed.
  14203. // Support: IE <=11 only
  14204. // Running getBoundingClientRect on a disconnected node
  14205. // in IE throws an error.
  14206. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  14207. swap( elem, cssShow, function() {
  14208. return getWidthOrHeight( elem, dimension, extra );
  14209. } ) :
  14210. getWidthOrHeight( elem, dimension, extra );
  14211. }
  14212. },
  14213. set: function( elem, value, extra ) {
  14214. var matches,
  14215. styles = getStyles( elem ),
  14216. // Only read styles.position if the test has a chance to fail
  14217. // to avoid forcing a reflow.
  14218. scrollboxSizeBuggy = !support.scrollboxSize() &&
  14219. styles.position === "absolute",
  14220. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
  14221. boxSizingNeeded = scrollboxSizeBuggy || extra,
  14222. isBorderBox = boxSizingNeeded &&
  14223. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  14224. subtract = extra ?
  14225. boxModelAdjustment(
  14226. elem,
  14227. dimension,
  14228. extra,
  14229. isBorderBox,
  14230. styles
  14231. ) :
  14232. 0;
  14233. // Account for unreliable border-box dimensions by comparing offset* to computed and
  14234. // faking a content-box to get border and padding (gh-3699)
  14235. if ( isBorderBox && scrollboxSizeBuggy ) {
  14236. subtract -= Math.ceil(
  14237. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  14238. parseFloat( styles[ dimension ] ) -
  14239. boxModelAdjustment( elem, dimension, "border", false, styles ) -
  14240. 0.5
  14241. );
  14242. }
  14243. // Convert to pixels if value adjustment is needed
  14244. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  14245. ( matches[ 3 ] || "px" ) !== "px" ) {
  14246. elem.style[ dimension ] = value;
  14247. value = jQuery.css( elem, dimension );
  14248. }
  14249. return setPositiveNumber( elem, value, subtract );
  14250. }
  14251. };
  14252. } );
  14253. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  14254. function( elem, computed ) {
  14255. if ( computed ) {
  14256. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  14257. elem.getBoundingClientRect().left -
  14258. swap( elem, { marginLeft: 0 }, function() {
  14259. return elem.getBoundingClientRect().left;
  14260. } )
  14261. ) + "px";
  14262. }
  14263. }
  14264. );
  14265. // These hooks are used by animate to expand properties
  14266. jQuery.each( {
  14267. margin: "",
  14268. padding: "",
  14269. border: "Width"
  14270. }, function( prefix, suffix ) {
  14271. jQuery.cssHooks[ prefix + suffix ] = {
  14272. expand: function( value ) {
  14273. var i = 0,
  14274. expanded = {},
  14275. // Assumes a single number if not a string
  14276. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  14277. for ( ; i < 4; i++ ) {
  14278. expanded[ prefix + cssExpand[ i ] + suffix ] =
  14279. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  14280. }
  14281. return expanded;
  14282. }
  14283. };
  14284. if ( prefix !== "margin" ) {
  14285. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  14286. }
  14287. } );
  14288. jQuery.fn.extend( {
  14289. css: function( name, value ) {
  14290. return access( this, function( elem, name, value ) {
  14291. var styles, len,
  14292. map = {},
  14293. i = 0;
  14294. if ( Array.isArray( name ) ) {
  14295. styles = getStyles( elem );
  14296. len = name.length;
  14297. for ( ; i < len; i++ ) {
  14298. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  14299. }
  14300. return map;
  14301. }
  14302. return value !== undefined ?
  14303. jQuery.style( elem, name, value ) :
  14304. jQuery.css( elem, name );
  14305. }, name, value, arguments.length > 1 );
  14306. }
  14307. } );
  14308. function Tween( elem, options, prop, end, easing ) {
  14309. return new Tween.prototype.init( elem, options, prop, end, easing );
  14310. }
  14311. jQuery.Tween = Tween;
  14312. Tween.prototype = {
  14313. constructor: Tween,
  14314. init: function( elem, options, prop, end, easing, unit ) {
  14315. this.elem = elem;
  14316. this.prop = prop;
  14317. this.easing = easing || jQuery.easing._default;
  14318. this.options = options;
  14319. this.start = this.now = this.cur();
  14320. this.end = end;
  14321. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  14322. },
  14323. cur: function() {
  14324. var hooks = Tween.propHooks[ this.prop ];
  14325. return hooks && hooks.get ?
  14326. hooks.get( this ) :
  14327. Tween.propHooks._default.get( this );
  14328. },
  14329. run: function( percent ) {
  14330. var eased,
  14331. hooks = Tween.propHooks[ this.prop ];
  14332. if ( this.options.duration ) {
  14333. this.pos = eased = jQuery.easing[ this.easing ](
  14334. percent, this.options.duration * percent, 0, 1, this.options.duration
  14335. );
  14336. } else {
  14337. this.pos = eased = percent;
  14338. }
  14339. this.now = ( this.end - this.start ) * eased + this.start;
  14340. if ( this.options.step ) {
  14341. this.options.step.call( this.elem, this.now, this );
  14342. }
  14343. if ( hooks && hooks.set ) {
  14344. hooks.set( this );
  14345. } else {
  14346. Tween.propHooks._default.set( this );
  14347. }
  14348. return this;
  14349. }
  14350. };
  14351. Tween.prototype.init.prototype = Tween.prototype;
  14352. Tween.propHooks = {
  14353. _default: {
  14354. get: function( tween ) {
  14355. var result;
  14356. // Use a property on the element directly when it is not a DOM element,
  14357. // or when there is no matching style property that exists.
  14358. if ( tween.elem.nodeType !== 1 ||
  14359. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  14360. return tween.elem[ tween.prop ];
  14361. }
  14362. // Passing an empty string as a 3rd parameter to .css will automatically
  14363. // attempt a parseFloat and fallback to a string if the parse fails.
  14364. // Simple values such as "10px" are parsed to Float;
  14365. // complex values such as "rotate(1rad)" are returned as-is.
  14366. result = jQuery.css( tween.elem, tween.prop, "" );
  14367. // Empty strings, null, undefined and "auto" are converted to 0.
  14368. return !result || result === "auto" ? 0 : result;
  14369. },
  14370. set: function( tween ) {
  14371. // Use step hook for back compat.
  14372. // Use cssHook if its there.
  14373. // Use .style if available and use plain properties where available.
  14374. if ( jQuery.fx.step[ tween.prop ] ) {
  14375. jQuery.fx.step[ tween.prop ]( tween );
  14376. } else if ( tween.elem.nodeType === 1 && (
  14377. jQuery.cssHooks[ tween.prop ] ||
  14378. tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) {
  14379. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  14380. } else {
  14381. tween.elem[ tween.prop ] = tween.now;
  14382. }
  14383. }
  14384. }
  14385. };
  14386. // Support: IE <=9 only
  14387. // Panic based approach to setting things on disconnected nodes
  14388. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  14389. set: function( tween ) {
  14390. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  14391. tween.elem[ tween.prop ] = tween.now;
  14392. }
  14393. }
  14394. };
  14395. jQuery.easing = {
  14396. linear: function( p ) {
  14397. return p;
  14398. },
  14399. swing: function( p ) {
  14400. return 0.5 - Math.cos( p * Math.PI ) / 2;
  14401. },
  14402. _default: "swing"
  14403. };
  14404. jQuery.fx = Tween.prototype.init;
  14405. // Back compat <1.8 extension point
  14406. jQuery.fx.step = {};
  14407. var
  14408. fxNow, inProgress,
  14409. rfxtypes = /^(?:toggle|show|hide)$/,
  14410. rrun = /queueHooks$/;
  14411. function schedule() {
  14412. if ( inProgress ) {
  14413. if ( document.hidden === false && window.requestAnimationFrame ) {
  14414. window.requestAnimationFrame( schedule );
  14415. } else {
  14416. window.setTimeout( schedule, jQuery.fx.interval );
  14417. }
  14418. jQuery.fx.tick();
  14419. }
  14420. }
  14421. // Animations created synchronously will run synchronously
  14422. function createFxNow() {
  14423. window.setTimeout( function() {
  14424. fxNow = undefined;
  14425. } );
  14426. return ( fxNow = Date.now() );
  14427. }
  14428. // Generate parameters to create a standard animation
  14429. function genFx( type, includeWidth ) {
  14430. var which,
  14431. i = 0,
  14432. attrs = { height: type };
  14433. // If we include width, step value is 1 to do all cssExpand values,
  14434. // otherwise step value is 2 to skip over Left and Right
  14435. includeWidth = includeWidth ? 1 : 0;
  14436. for ( ; i < 4; i += 2 - includeWidth ) {
  14437. which = cssExpand[ i ];
  14438. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  14439. }
  14440. if ( includeWidth ) {
  14441. attrs.opacity = attrs.width = type;
  14442. }
  14443. return attrs;
  14444. }
  14445. function createTween( value, prop, animation ) {
  14446. var tween,
  14447. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  14448. index = 0,
  14449. length = collection.length;
  14450. for ( ; index < length; index++ ) {
  14451. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  14452. // We're done with this property
  14453. return tween;
  14454. }
  14455. }
  14456. }
  14457. function defaultPrefilter( elem, props, opts ) {
  14458. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  14459. isBox = "width" in props || "height" in props,
  14460. anim = this,
  14461. orig = {},
  14462. style = elem.style,
  14463. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  14464. dataShow = dataPriv.get( elem, "fxshow" );
  14465. // Queue-skipping animations hijack the fx hooks
  14466. if ( !opts.queue ) {
  14467. hooks = jQuery._queueHooks( elem, "fx" );
  14468. if ( hooks.unqueued == null ) {
  14469. hooks.unqueued = 0;
  14470. oldfire = hooks.empty.fire;
  14471. hooks.empty.fire = function() {
  14472. if ( !hooks.unqueued ) {
  14473. oldfire();
  14474. }
  14475. };
  14476. }
  14477. hooks.unqueued++;
  14478. anim.always( function() {
  14479. // Ensure the complete handler is called before this completes
  14480. anim.always( function() {
  14481. hooks.unqueued--;
  14482. if ( !jQuery.queue( elem, "fx" ).length ) {
  14483. hooks.empty.fire();
  14484. }
  14485. } );
  14486. } );
  14487. }
  14488. // Detect show/hide animations
  14489. for ( prop in props ) {
  14490. value = props[ prop ];
  14491. if ( rfxtypes.test( value ) ) {
  14492. delete props[ prop ];
  14493. toggle = toggle || value === "toggle";
  14494. if ( value === ( hidden ? "hide" : "show" ) ) {
  14495. // Pretend to be hidden if this is a "show" and
  14496. // there is still data from a stopped show/hide
  14497. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  14498. hidden = true;
  14499. // Ignore all other no-op show/hide data
  14500. } else {
  14501. continue;
  14502. }
  14503. }
  14504. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  14505. }
  14506. }
  14507. // Bail out if this is a no-op like .hide().hide()
  14508. propTween = !jQuery.isEmptyObject( props );
  14509. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  14510. return;
  14511. }
  14512. // Restrict "overflow" and "display" styles during box animations
  14513. if ( isBox && elem.nodeType === 1 ) {
  14514. // Support: IE <=9 - 11, Edge 12 - 15
  14515. // Record all 3 overflow attributes because IE does not infer the shorthand
  14516. // from identically-valued overflowX and overflowY and Edge just mirrors
  14517. // the overflowX value there.
  14518. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  14519. // Identify a display type, preferring old show/hide data over the CSS cascade
  14520. restoreDisplay = dataShow && dataShow.display;
  14521. if ( restoreDisplay == null ) {
  14522. restoreDisplay = dataPriv.get( elem, "display" );
  14523. }
  14524. display = jQuery.css( elem, "display" );
  14525. if ( display === "none" ) {
  14526. if ( restoreDisplay ) {
  14527. display = restoreDisplay;
  14528. } else {
  14529. // Get nonempty value(s) by temporarily forcing visibility
  14530. showHide( [ elem ], true );
  14531. restoreDisplay = elem.style.display || restoreDisplay;
  14532. display = jQuery.css( elem, "display" );
  14533. showHide( [ elem ] );
  14534. }
  14535. }
  14536. // Animate inline elements as inline-block
  14537. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  14538. if ( jQuery.css( elem, "float" ) === "none" ) {
  14539. // Restore the original display value at the end of pure show/hide animations
  14540. if ( !propTween ) {
  14541. anim.done( function() {
  14542. style.display = restoreDisplay;
  14543. } );
  14544. if ( restoreDisplay == null ) {
  14545. display = style.display;
  14546. restoreDisplay = display === "none" ? "" : display;
  14547. }
  14548. }
  14549. style.display = "inline-block";
  14550. }
  14551. }
  14552. }
  14553. if ( opts.overflow ) {
  14554. style.overflow = "hidden";
  14555. anim.always( function() {
  14556. style.overflow = opts.overflow[ 0 ];
  14557. style.overflowX = opts.overflow[ 1 ];
  14558. style.overflowY = opts.overflow[ 2 ];
  14559. } );
  14560. }
  14561. // Implement show/hide animations
  14562. propTween = false;
  14563. for ( prop in orig ) {
  14564. // General show/hide setup for this element animation
  14565. if ( !propTween ) {
  14566. if ( dataShow ) {
  14567. if ( "hidden" in dataShow ) {
  14568. hidden = dataShow.hidden;
  14569. }
  14570. } else {
  14571. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  14572. }
  14573. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  14574. if ( toggle ) {
  14575. dataShow.hidden = !hidden;
  14576. }
  14577. // Show elements before animating them
  14578. if ( hidden ) {
  14579. showHide( [ elem ], true );
  14580. }
  14581. /* eslint-disable no-loop-func */
  14582. anim.done( function() {
  14583. /* eslint-enable no-loop-func */
  14584. // The final step of a "hide" animation is actually hiding the element
  14585. if ( !hidden ) {
  14586. showHide( [ elem ] );
  14587. }
  14588. dataPriv.remove( elem, "fxshow" );
  14589. for ( prop in orig ) {
  14590. jQuery.style( elem, prop, orig[ prop ] );
  14591. }
  14592. } );
  14593. }
  14594. // Per-property setup
  14595. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  14596. if ( !( prop in dataShow ) ) {
  14597. dataShow[ prop ] = propTween.start;
  14598. if ( hidden ) {
  14599. propTween.end = propTween.start;
  14600. propTween.start = 0;
  14601. }
  14602. }
  14603. }
  14604. }
  14605. function propFilter( props, specialEasing ) {
  14606. var index, name, easing, value, hooks;
  14607. // camelCase, specialEasing and expand cssHook pass
  14608. for ( index in props ) {
  14609. name = camelCase( index );
  14610. easing = specialEasing[ name ];
  14611. value = props[ index ];
  14612. if ( Array.isArray( value ) ) {
  14613. easing = value[ 1 ];
  14614. value = props[ index ] = value[ 0 ];
  14615. }
  14616. if ( index !== name ) {
  14617. props[ name ] = value;
  14618. delete props[ index ];
  14619. }
  14620. hooks = jQuery.cssHooks[ name ];
  14621. if ( hooks && "expand" in hooks ) {
  14622. value = hooks.expand( value );
  14623. delete props[ name ];
  14624. // Not quite $.extend, this won't overwrite existing keys.
  14625. // Reusing 'index' because we have the correct "name"
  14626. for ( index in value ) {
  14627. if ( !( index in props ) ) {
  14628. props[ index ] = value[ index ];
  14629. specialEasing[ index ] = easing;
  14630. }
  14631. }
  14632. } else {
  14633. specialEasing[ name ] = easing;
  14634. }
  14635. }
  14636. }
  14637. function Animation( elem, properties, options ) {
  14638. var result,
  14639. stopped,
  14640. index = 0,
  14641. length = Animation.prefilters.length,
  14642. deferred = jQuery.Deferred().always( function() {
  14643. // Don't match elem in the :animated selector
  14644. delete tick.elem;
  14645. } ),
  14646. tick = function() {
  14647. if ( stopped ) {
  14648. return false;
  14649. }
  14650. var currentTime = fxNow || createFxNow(),
  14651. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  14652. // Support: Android 2.3 only
  14653. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  14654. temp = remaining / animation.duration || 0,
  14655. percent = 1 - temp,
  14656. index = 0,
  14657. length = animation.tweens.length;
  14658. for ( ; index < length; index++ ) {
  14659. animation.tweens[ index ].run( percent );
  14660. }
  14661. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  14662. // If there's more to do, yield
  14663. if ( percent < 1 && length ) {
  14664. return remaining;
  14665. }
  14666. // If this was an empty animation, synthesize a final progress notification
  14667. if ( !length ) {
  14668. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  14669. }
  14670. // Resolve the animation and report its conclusion
  14671. deferred.resolveWith( elem, [ animation ] );
  14672. return false;
  14673. },
  14674. animation = deferred.promise( {
  14675. elem: elem,
  14676. props: jQuery.extend( {}, properties ),
  14677. opts: jQuery.extend( true, {
  14678. specialEasing: {},
  14679. easing: jQuery.easing._default
  14680. }, options ),
  14681. originalProperties: properties,
  14682. originalOptions: options,
  14683. startTime: fxNow || createFxNow(),
  14684. duration: options.duration,
  14685. tweens: [],
  14686. createTween: function( prop, end ) {
  14687. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  14688. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  14689. animation.tweens.push( tween );
  14690. return tween;
  14691. },
  14692. stop: function( gotoEnd ) {
  14693. var index = 0,
  14694. // If we are going to the end, we want to run all the tweens
  14695. // otherwise we skip this part
  14696. length = gotoEnd ? animation.tweens.length : 0;
  14697. if ( stopped ) {
  14698. return this;
  14699. }
  14700. stopped = true;
  14701. for ( ; index < length; index++ ) {
  14702. animation.tweens[ index ].run( 1 );
  14703. }
  14704. // Resolve when we played the last frame; otherwise, reject
  14705. if ( gotoEnd ) {
  14706. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  14707. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  14708. } else {
  14709. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  14710. }
  14711. return this;
  14712. }
  14713. } ),
  14714. props = animation.props;
  14715. propFilter( props, animation.opts.specialEasing );
  14716. for ( ; index < length; index++ ) {
  14717. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  14718. if ( result ) {
  14719. if ( isFunction( result.stop ) ) {
  14720. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  14721. result.stop.bind( result );
  14722. }
  14723. return result;
  14724. }
  14725. }
  14726. jQuery.map( props, createTween, animation );
  14727. if ( isFunction( animation.opts.start ) ) {
  14728. animation.opts.start.call( elem, animation );
  14729. }
  14730. // Attach callbacks from options
  14731. animation
  14732. .progress( animation.opts.progress )
  14733. .done( animation.opts.done, animation.opts.complete )
  14734. .fail( animation.opts.fail )
  14735. .always( animation.opts.always );
  14736. jQuery.fx.timer(
  14737. jQuery.extend( tick, {
  14738. elem: elem,
  14739. anim: animation,
  14740. queue: animation.opts.queue
  14741. } )
  14742. );
  14743. return animation;
  14744. }
  14745. jQuery.Animation = jQuery.extend( Animation, {
  14746. tweeners: {
  14747. "*": [ function( prop, value ) {
  14748. var tween = this.createTween( prop, value );
  14749. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  14750. return tween;
  14751. } ]
  14752. },
  14753. tweener: function( props, callback ) {
  14754. if ( isFunction( props ) ) {
  14755. callback = props;
  14756. props = [ "*" ];
  14757. } else {
  14758. props = props.match( rnothtmlwhite );
  14759. }
  14760. var prop,
  14761. index = 0,
  14762. length = props.length;
  14763. for ( ; index < length; index++ ) {
  14764. prop = props[ index ];
  14765. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  14766. Animation.tweeners[ prop ].unshift( callback );
  14767. }
  14768. },
  14769. prefilters: [ defaultPrefilter ],
  14770. prefilter: function( callback, prepend ) {
  14771. if ( prepend ) {
  14772. Animation.prefilters.unshift( callback );
  14773. } else {
  14774. Animation.prefilters.push( callback );
  14775. }
  14776. }
  14777. } );
  14778. jQuery.speed = function( speed, easing, fn ) {
  14779. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  14780. complete: fn || !fn && easing ||
  14781. isFunction( speed ) && speed,
  14782. duration: speed,
  14783. easing: fn && easing || easing && !isFunction( easing ) && easing
  14784. };
  14785. // Go to the end state if fx are off
  14786. if ( jQuery.fx.off ) {
  14787. opt.duration = 0;
  14788. } else {
  14789. if ( typeof opt.duration !== "number" ) {
  14790. if ( opt.duration in jQuery.fx.speeds ) {
  14791. opt.duration = jQuery.fx.speeds[ opt.duration ];
  14792. } else {
  14793. opt.duration = jQuery.fx.speeds._default;
  14794. }
  14795. }
  14796. }
  14797. // Normalize opt.queue - true/undefined/null -> "fx"
  14798. if ( opt.queue == null || opt.queue === true ) {
  14799. opt.queue = "fx";
  14800. }
  14801. // Queueing
  14802. opt.old = opt.complete;
  14803. opt.complete = function() {
  14804. if ( isFunction( opt.old ) ) {
  14805. opt.old.call( this );
  14806. }
  14807. if ( opt.queue ) {
  14808. jQuery.dequeue( this, opt.queue );
  14809. }
  14810. };
  14811. return opt;
  14812. };
  14813. jQuery.fn.extend( {
  14814. fadeTo: function( speed, to, easing, callback ) {
  14815. // Show any hidden elements after setting opacity to 0
  14816. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  14817. // Animate to the value specified
  14818. .end().animate( { opacity: to }, speed, easing, callback );
  14819. },
  14820. animate: function( prop, speed, easing, callback ) {
  14821. var empty = jQuery.isEmptyObject( prop ),
  14822. optall = jQuery.speed( speed, easing, callback ),
  14823. doAnimation = function() {
  14824. // Operate on a copy of prop so per-property easing won't be lost
  14825. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  14826. // Empty animations, or finishing resolves immediately
  14827. if ( empty || dataPriv.get( this, "finish" ) ) {
  14828. anim.stop( true );
  14829. }
  14830. };
  14831. doAnimation.finish = doAnimation;
  14832. return empty || optall.queue === false ?
  14833. this.each( doAnimation ) :
  14834. this.queue( optall.queue, doAnimation );
  14835. },
  14836. stop: function( type, clearQueue, gotoEnd ) {
  14837. var stopQueue = function( hooks ) {
  14838. var stop = hooks.stop;
  14839. delete hooks.stop;
  14840. stop( gotoEnd );
  14841. };
  14842. if ( typeof type !== "string" ) {
  14843. gotoEnd = clearQueue;
  14844. clearQueue = type;
  14845. type = undefined;
  14846. }
  14847. if ( clearQueue && type !== false ) {
  14848. this.queue( type || "fx", [] );
  14849. }
  14850. return this.each( function() {
  14851. var dequeue = true,
  14852. index = type != null && type + "queueHooks",
  14853. timers = jQuery.timers,
  14854. data = dataPriv.get( this );
  14855. if ( index ) {
  14856. if ( data[ index ] && data[ index ].stop ) {
  14857. stopQueue( data[ index ] );
  14858. }
  14859. } else {
  14860. for ( index in data ) {
  14861. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  14862. stopQueue( data[ index ] );
  14863. }
  14864. }
  14865. }
  14866. for ( index = timers.length; index--; ) {
  14867. if ( timers[ index ].elem === this &&
  14868. ( type == null || timers[ index ].queue === type ) ) {
  14869. timers[ index ].anim.stop( gotoEnd );
  14870. dequeue = false;
  14871. timers.splice( index, 1 );
  14872. }
  14873. }
  14874. // Start the next in the queue if the last step wasn't forced.
  14875. // Timers currently will call their complete callbacks, which
  14876. // will dequeue but only if they were gotoEnd.
  14877. if ( dequeue || !gotoEnd ) {
  14878. jQuery.dequeue( this, type );
  14879. }
  14880. } );
  14881. },
  14882. finish: function( type ) {
  14883. if ( type !== false ) {
  14884. type = type || "fx";
  14885. }
  14886. return this.each( function() {
  14887. var index,
  14888. data = dataPriv.get( this ),
  14889. queue = data[ type + "queue" ],
  14890. hooks = data[ type + "queueHooks" ],
  14891. timers = jQuery.timers,
  14892. length = queue ? queue.length : 0;
  14893. // Enable finishing flag on private data
  14894. data.finish = true;
  14895. // Empty the queue first
  14896. jQuery.queue( this, type, [] );
  14897. if ( hooks && hooks.stop ) {
  14898. hooks.stop.call( this, true );
  14899. }
  14900. // Look for any active animations, and finish them
  14901. for ( index = timers.length; index--; ) {
  14902. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  14903. timers[ index ].anim.stop( true );
  14904. timers.splice( index, 1 );
  14905. }
  14906. }
  14907. // Look for any animations in the old queue and finish them
  14908. for ( index = 0; index < length; index++ ) {
  14909. if ( queue[ index ] && queue[ index ].finish ) {
  14910. queue[ index ].finish.call( this );
  14911. }
  14912. }
  14913. // Turn off finishing flag
  14914. delete data.finish;
  14915. } );
  14916. }
  14917. } );
  14918. jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
  14919. var cssFn = jQuery.fn[ name ];
  14920. jQuery.fn[ name ] = function( speed, easing, callback ) {
  14921. return speed == null || typeof speed === "boolean" ?
  14922. cssFn.apply( this, arguments ) :
  14923. this.animate( genFx( name, true ), speed, easing, callback );
  14924. };
  14925. } );
  14926. // Generate shortcuts for custom animations
  14927. jQuery.each( {
  14928. slideDown: genFx( "show" ),
  14929. slideUp: genFx( "hide" ),
  14930. slideToggle: genFx( "toggle" ),
  14931. fadeIn: { opacity: "show" },
  14932. fadeOut: { opacity: "hide" },
  14933. fadeToggle: { opacity: "toggle" }
  14934. }, function( name, props ) {
  14935. jQuery.fn[ name ] = function( speed, easing, callback ) {
  14936. return this.animate( props, speed, easing, callback );
  14937. };
  14938. } );
  14939. jQuery.timers = [];
  14940. jQuery.fx.tick = function() {
  14941. var timer,
  14942. i = 0,
  14943. timers = jQuery.timers;
  14944. fxNow = Date.now();
  14945. for ( ; i < timers.length; i++ ) {
  14946. timer = timers[ i ];
  14947. // Run the timer and safely remove it when done (allowing for external removal)
  14948. if ( !timer() && timers[ i ] === timer ) {
  14949. timers.splice( i--, 1 );
  14950. }
  14951. }
  14952. if ( !timers.length ) {
  14953. jQuery.fx.stop();
  14954. }
  14955. fxNow = undefined;
  14956. };
  14957. jQuery.fx.timer = function( timer ) {
  14958. jQuery.timers.push( timer );
  14959. jQuery.fx.start();
  14960. };
  14961. jQuery.fx.interval = 13;
  14962. jQuery.fx.start = function() {
  14963. if ( inProgress ) {
  14964. return;
  14965. }
  14966. inProgress = true;
  14967. schedule();
  14968. };
  14969. jQuery.fx.stop = function() {
  14970. inProgress = null;
  14971. };
  14972. jQuery.fx.speeds = {
  14973. slow: 600,
  14974. fast: 200,
  14975. // Default speed
  14976. _default: 400
  14977. };
  14978. // Based off of the plugin by Clint Helfers, with permission.
  14979. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  14980. jQuery.fn.delay = function( time, type ) {
  14981. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  14982. type = type || "fx";
  14983. return this.queue( type, function( next, hooks ) {
  14984. var timeout = window.setTimeout( next, time );
  14985. hooks.stop = function() {
  14986. window.clearTimeout( timeout );
  14987. };
  14988. } );
  14989. };
  14990. ( function() {
  14991. var input = document.createElement( "input" ),
  14992. select = document.createElement( "select" ),
  14993. opt = select.appendChild( document.createElement( "option" ) );
  14994. input.type = "checkbox";
  14995. // Support: Android <=4.3 only
  14996. // Default value for a checkbox should be "on"
  14997. support.checkOn = input.value !== "";
  14998. // Support: IE <=11 only
  14999. // Must access selectedIndex to make default options select
  15000. support.optSelected = opt.selected;
  15001. // Support: IE <=11 only
  15002. // An input loses its value after becoming a radio
  15003. input = document.createElement( "input" );
  15004. input.value = "t";
  15005. input.type = "radio";
  15006. support.radioValue = input.value === "t";
  15007. } )();
  15008. var boolHook,
  15009. attrHandle = jQuery.expr.attrHandle;
  15010. jQuery.fn.extend( {
  15011. attr: function( name, value ) {
  15012. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  15013. },
  15014. removeAttr: function( name ) {
  15015. return this.each( function() {
  15016. jQuery.removeAttr( this, name );
  15017. } );
  15018. }
  15019. } );
  15020. jQuery.extend( {
  15021. attr: function( elem, name, value ) {
  15022. var ret, hooks,
  15023. nType = elem.nodeType;
  15024. // Don't get/set attributes on text, comment and attribute nodes
  15025. if ( nType === 3 || nType === 8 || nType === 2 ) {
  15026. return;
  15027. }
  15028. // Fallback to prop when attributes are not supported
  15029. if ( typeof elem.getAttribute === "undefined" ) {
  15030. return jQuery.prop( elem, name, value );
  15031. }
  15032. // Attribute hooks are determined by the lowercase version
  15033. // Grab necessary hook if one is defined
  15034. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  15035. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  15036. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  15037. }
  15038. if ( value !== undefined ) {
  15039. if ( value === null ) {
  15040. jQuery.removeAttr( elem, name );
  15041. return;
  15042. }
  15043. if ( hooks && "set" in hooks &&
  15044. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  15045. return ret;
  15046. }
  15047. elem.setAttribute( name, value + "" );
  15048. return value;
  15049. }
  15050. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  15051. return ret;
  15052. }
  15053. ret = jQuery.find.attr( elem, name );
  15054. // Non-existent attributes return null, we normalize to undefined
  15055. return ret == null ? undefined : ret;
  15056. },
  15057. attrHooks: {
  15058. type: {
  15059. set: function( elem, value ) {
  15060. if ( !support.radioValue && value === "radio" &&
  15061. nodeName( elem, "input" ) ) {
  15062. var val = elem.value;
  15063. elem.setAttribute( "type", value );
  15064. if ( val ) {
  15065. elem.value = val;
  15066. }
  15067. return value;
  15068. }
  15069. }
  15070. }
  15071. },
  15072. removeAttr: function( elem, value ) {
  15073. var name,
  15074. i = 0,
  15075. // Attribute names can contain non-HTML whitespace characters
  15076. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  15077. attrNames = value && value.match( rnothtmlwhite );
  15078. if ( attrNames && elem.nodeType === 1 ) {
  15079. while ( ( name = attrNames[ i++ ] ) ) {
  15080. elem.removeAttribute( name );
  15081. }
  15082. }
  15083. }
  15084. } );
  15085. // Hooks for boolean attributes
  15086. boolHook = {
  15087. set: function( elem, value, name ) {
  15088. if ( value === false ) {
  15089. // Remove boolean attributes when set to false
  15090. jQuery.removeAttr( elem, name );
  15091. } else {
  15092. elem.setAttribute( name, name );
  15093. }
  15094. return name;
  15095. }
  15096. };
  15097. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  15098. var getter = attrHandle[ name ] || jQuery.find.attr;
  15099. attrHandle[ name ] = function( elem, name, isXML ) {
  15100. var ret, handle,
  15101. lowercaseName = name.toLowerCase();
  15102. if ( !isXML ) {
  15103. // Avoid an infinite loop by temporarily removing this function from the getter
  15104. handle = attrHandle[ lowercaseName ];
  15105. attrHandle[ lowercaseName ] = ret;
  15106. ret = getter( elem, name, isXML ) != null ?
  15107. lowercaseName :
  15108. null;
  15109. attrHandle[ lowercaseName ] = handle;
  15110. }
  15111. return ret;
  15112. };
  15113. } );
  15114. var rfocusable = /^(?:input|select|textarea|button)$/i,
  15115. rclickable = /^(?:a|area)$/i;
  15116. jQuery.fn.extend( {
  15117. prop: function( name, value ) {
  15118. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  15119. },
  15120. removeProp: function( name ) {
  15121. return this.each( function() {
  15122. delete this[ jQuery.propFix[ name ] || name ];
  15123. } );
  15124. }
  15125. } );
  15126. jQuery.extend( {
  15127. prop: function( elem, name, value ) {
  15128. var ret, hooks,
  15129. nType = elem.nodeType;
  15130. // Don't get/set properties on text, comment and attribute nodes
  15131. if ( nType === 3 || nType === 8 || nType === 2 ) {
  15132. return;
  15133. }
  15134. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  15135. // Fix name and attach hooks
  15136. name = jQuery.propFix[ name ] || name;
  15137. hooks = jQuery.propHooks[ name ];
  15138. }
  15139. if ( value !== undefined ) {
  15140. if ( hooks && "set" in hooks &&
  15141. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  15142. return ret;
  15143. }
  15144. return ( elem[ name ] = value );
  15145. }
  15146. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  15147. return ret;
  15148. }
  15149. return elem[ name ];
  15150. },
  15151. propHooks: {
  15152. tabIndex: {
  15153. get: function( elem ) {
  15154. // Support: IE <=9 - 11 only
  15155. // elem.tabIndex doesn't always return the
  15156. // correct value when it hasn't been explicitly set
  15157. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  15158. // Use proper attribute retrieval(#12072)
  15159. var tabindex = jQuery.find.attr( elem, "tabindex" );
  15160. if ( tabindex ) {
  15161. return parseInt( tabindex, 10 );
  15162. }
  15163. if (
  15164. rfocusable.test( elem.nodeName ) ||
  15165. rclickable.test( elem.nodeName ) &&
  15166. elem.href
  15167. ) {
  15168. return 0;
  15169. }
  15170. return -1;
  15171. }
  15172. }
  15173. },
  15174. propFix: {
  15175. "for": "htmlFor",
  15176. "class": "className"
  15177. }
  15178. } );
  15179. // Support: IE <=11 only
  15180. // Accessing the selectedIndex property
  15181. // forces the browser to respect setting selected
  15182. // on the option
  15183. // The getter ensures a default option is selected
  15184. // when in an optgroup
  15185. // eslint rule "no-unused-expressions" is disabled for this code
  15186. // since it considers such accessions noop
  15187. if ( !support.optSelected ) {
  15188. jQuery.propHooks.selected = {
  15189. get: function( elem ) {
  15190. /* eslint no-unused-expressions: "off" */
  15191. var parent = elem.parentNode;
  15192. if ( parent && parent.parentNode ) {
  15193. parent.parentNode.selectedIndex;
  15194. }
  15195. return null;
  15196. },
  15197. set: function( elem ) {
  15198. /* eslint no-unused-expressions: "off" */
  15199. var parent = elem.parentNode;
  15200. if ( parent ) {
  15201. parent.selectedIndex;
  15202. if ( parent.parentNode ) {
  15203. parent.parentNode.selectedIndex;
  15204. }
  15205. }
  15206. }
  15207. };
  15208. }
  15209. jQuery.each( [
  15210. "tabIndex",
  15211. "readOnly",
  15212. "maxLength",
  15213. "cellSpacing",
  15214. "cellPadding",
  15215. "rowSpan",
  15216. "colSpan",
  15217. "useMap",
  15218. "frameBorder",
  15219. "contentEditable"
  15220. ], function() {
  15221. jQuery.propFix[ this.toLowerCase() ] = this;
  15222. } );
  15223. // Strip and collapse whitespace according to HTML spec
  15224. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  15225. function stripAndCollapse( value ) {
  15226. var tokens = value.match( rnothtmlwhite ) || [];
  15227. return tokens.join( " " );
  15228. }
  15229. function getClass( elem ) {
  15230. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  15231. }
  15232. function classesToArray( value ) {
  15233. if ( Array.isArray( value ) ) {
  15234. return value;
  15235. }
  15236. if ( typeof value === "string" ) {
  15237. return value.match( rnothtmlwhite ) || [];
  15238. }
  15239. return [];
  15240. }
  15241. jQuery.fn.extend( {
  15242. addClass: function( value ) {
  15243. var classes, elem, cur, curValue, clazz, j, finalValue,
  15244. i = 0;
  15245. if ( isFunction( value ) ) {
  15246. return this.each( function( j ) {
  15247. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  15248. } );
  15249. }
  15250. classes = classesToArray( value );
  15251. if ( classes.length ) {
  15252. while ( ( elem = this[ i++ ] ) ) {
  15253. curValue = getClass( elem );
  15254. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  15255. if ( cur ) {
  15256. j = 0;
  15257. while ( ( clazz = classes[ j++ ] ) ) {
  15258. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  15259. cur += clazz + " ";
  15260. }
  15261. }
  15262. // Only assign if different to avoid unneeded rendering.
  15263. finalValue = stripAndCollapse( cur );
  15264. if ( curValue !== finalValue ) {
  15265. elem.setAttribute( "class", finalValue );
  15266. }
  15267. }
  15268. }
  15269. }
  15270. return this;
  15271. },
  15272. removeClass: function( value ) {
  15273. var classes, elem, cur, curValue, clazz, j, finalValue,
  15274. i = 0;
  15275. if ( isFunction( value ) ) {
  15276. return this.each( function( j ) {
  15277. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  15278. } );
  15279. }
  15280. if ( !arguments.length ) {
  15281. return this.attr( "class", "" );
  15282. }
  15283. classes = classesToArray( value );
  15284. if ( classes.length ) {
  15285. while ( ( elem = this[ i++ ] ) ) {
  15286. curValue = getClass( elem );
  15287. // This expression is here for better compressibility (see addClass)
  15288. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  15289. if ( cur ) {
  15290. j = 0;
  15291. while ( ( clazz = classes[ j++ ] ) ) {
  15292. // Remove *all* instances
  15293. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  15294. cur = cur.replace( " " + clazz + " ", " " );
  15295. }
  15296. }
  15297. // Only assign if different to avoid unneeded rendering.
  15298. finalValue = stripAndCollapse( cur );
  15299. if ( curValue !== finalValue ) {
  15300. elem.setAttribute( "class", finalValue );
  15301. }
  15302. }
  15303. }
  15304. }
  15305. return this;
  15306. },
  15307. toggleClass: function( value, stateVal ) {
  15308. var type = typeof value,
  15309. isValidValue = type === "string" || Array.isArray( value );
  15310. if ( typeof stateVal === "boolean" && isValidValue ) {
  15311. return stateVal ? this.addClass( value ) : this.removeClass( value );
  15312. }
  15313. if ( isFunction( value ) ) {
  15314. return this.each( function( i ) {
  15315. jQuery( this ).toggleClass(
  15316. value.call( this, i, getClass( this ), stateVal ),
  15317. stateVal
  15318. );
  15319. } );
  15320. }
  15321. return this.each( function() {
  15322. var className, i, self, classNames;
  15323. if ( isValidValue ) {
  15324. // Toggle individual class names
  15325. i = 0;
  15326. self = jQuery( this );
  15327. classNames = classesToArray( value );
  15328. while ( ( className = classNames[ i++ ] ) ) {
  15329. // Check each className given, space separated list
  15330. if ( self.hasClass( className ) ) {
  15331. self.removeClass( className );
  15332. } else {
  15333. self.addClass( className );
  15334. }
  15335. }
  15336. // Toggle whole class name
  15337. } else if ( value === undefined || type === "boolean" ) {
  15338. className = getClass( this );
  15339. if ( className ) {
  15340. // Store className if set
  15341. dataPriv.set( this, "__className__", className );
  15342. }
  15343. // If the element has a class name or if we're passed `false`,
  15344. // then remove the whole classname (if there was one, the above saved it).
  15345. // Otherwise bring back whatever was previously saved (if anything),
  15346. // falling back to the empty string if nothing was stored.
  15347. if ( this.setAttribute ) {
  15348. this.setAttribute( "class",
  15349. className || value === false ?
  15350. "" :
  15351. dataPriv.get( this, "__className__" ) || ""
  15352. );
  15353. }
  15354. }
  15355. } );
  15356. },
  15357. hasClass: function( selector ) {
  15358. var className, elem,
  15359. i = 0;
  15360. className = " " + selector + " ";
  15361. while ( ( elem = this[ i++ ] ) ) {
  15362. if ( elem.nodeType === 1 &&
  15363. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  15364. return true;
  15365. }
  15366. }
  15367. return false;
  15368. }
  15369. } );
  15370. var rreturn = /\r/g;
  15371. jQuery.fn.extend( {
  15372. val: function( value ) {
  15373. var hooks, ret, valueIsFunction,
  15374. elem = this[ 0 ];
  15375. if ( !arguments.length ) {
  15376. if ( elem ) {
  15377. hooks = jQuery.valHooks[ elem.type ] ||
  15378. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  15379. if ( hooks &&
  15380. "get" in hooks &&
  15381. ( ret = hooks.get( elem, "value" ) ) !== undefined
  15382. ) {
  15383. return ret;
  15384. }
  15385. ret = elem.value;
  15386. // Handle most common string cases
  15387. if ( typeof ret === "string" ) {
  15388. return ret.replace( rreturn, "" );
  15389. }
  15390. // Handle cases where value is null/undef or number
  15391. return ret == null ? "" : ret;
  15392. }
  15393. return;
  15394. }
  15395. valueIsFunction = isFunction( value );
  15396. return this.each( function( i ) {
  15397. var val;
  15398. if ( this.nodeType !== 1 ) {
  15399. return;
  15400. }
  15401. if ( valueIsFunction ) {
  15402. val = value.call( this, i, jQuery( this ).val() );
  15403. } else {
  15404. val = value;
  15405. }
  15406. // Treat null/undefined as ""; convert numbers to string
  15407. if ( val == null ) {
  15408. val = "";
  15409. } else if ( typeof val === "number" ) {
  15410. val += "";
  15411. } else if ( Array.isArray( val ) ) {
  15412. val = jQuery.map( val, function( value ) {
  15413. return value == null ? "" : value + "";
  15414. } );
  15415. }
  15416. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  15417. // If set returns undefined, fall back to normal setting
  15418. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  15419. this.value = val;
  15420. }
  15421. } );
  15422. }
  15423. } );
  15424. jQuery.extend( {
  15425. valHooks: {
  15426. option: {
  15427. get: function( elem ) {
  15428. var val = jQuery.find.attr( elem, "value" );
  15429. return val != null ?
  15430. val :
  15431. // Support: IE <=10 - 11 only
  15432. // option.text throws exceptions (#14686, #14858)
  15433. // Strip and collapse whitespace
  15434. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  15435. stripAndCollapse( jQuery.text( elem ) );
  15436. }
  15437. },
  15438. select: {
  15439. get: function( elem ) {
  15440. var value, option, i,
  15441. options = elem.options,
  15442. index = elem.selectedIndex,
  15443. one = elem.type === "select-one",
  15444. values = one ? null : [],
  15445. max = one ? index + 1 : options.length;
  15446. if ( index < 0 ) {
  15447. i = max;
  15448. } else {
  15449. i = one ? index : 0;
  15450. }
  15451. // Loop through all the selected options
  15452. for ( ; i < max; i++ ) {
  15453. option = options[ i ];
  15454. // Support: IE <=9 only
  15455. // IE8-9 doesn't update selected after form reset (#2551)
  15456. if ( ( option.selected || i === index ) &&
  15457. // Don't return options that are disabled or in a disabled optgroup
  15458. !option.disabled &&
  15459. ( !option.parentNode.disabled ||
  15460. !nodeName( option.parentNode, "optgroup" ) ) ) {
  15461. // Get the specific value for the option
  15462. value = jQuery( option ).val();
  15463. // We don't need an array for one selects
  15464. if ( one ) {
  15465. return value;
  15466. }
  15467. // Multi-Selects return an array
  15468. values.push( value );
  15469. }
  15470. }
  15471. return values;
  15472. },
  15473. set: function( elem, value ) {
  15474. var optionSet, option,
  15475. options = elem.options,
  15476. values = jQuery.makeArray( value ),
  15477. i = options.length;
  15478. while ( i-- ) {
  15479. option = options[ i ];
  15480. /* eslint-disable no-cond-assign */
  15481. if ( option.selected =
  15482. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  15483. ) {
  15484. optionSet = true;
  15485. }
  15486. /* eslint-enable no-cond-assign */
  15487. }
  15488. // Force browsers to behave consistently when non-matching value is set
  15489. if ( !optionSet ) {
  15490. elem.selectedIndex = -1;
  15491. }
  15492. return values;
  15493. }
  15494. }
  15495. }
  15496. } );
  15497. // Radios and checkboxes getter/setter
  15498. jQuery.each( [ "radio", "checkbox" ], function() {
  15499. jQuery.valHooks[ this ] = {
  15500. set: function( elem, value ) {
  15501. if ( Array.isArray( value ) ) {
  15502. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  15503. }
  15504. }
  15505. };
  15506. if ( !support.checkOn ) {
  15507. jQuery.valHooks[ this ].get = function( elem ) {
  15508. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  15509. };
  15510. }
  15511. } );
  15512. // Return jQuery for attributes-only inclusion
  15513. support.focusin = "onfocusin" in window;
  15514. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  15515. stopPropagationCallback = function( e ) {
  15516. e.stopPropagation();
  15517. };
  15518. jQuery.extend( jQuery.event, {
  15519. trigger: function( event, data, elem, onlyHandlers ) {
  15520. var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
  15521. eventPath = [ elem || document ],
  15522. type = hasOwn.call( event, "type" ) ? event.type : event,
  15523. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  15524. cur = lastElement = tmp = elem = elem || document;
  15525. // Don't do events on text and comment nodes
  15526. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  15527. return;
  15528. }
  15529. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  15530. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  15531. return;
  15532. }
  15533. if ( type.indexOf( "." ) > -1 ) {
  15534. // Namespaced trigger; create a regexp to match event type in handle()
  15535. namespaces = type.split( "." );
  15536. type = namespaces.shift();
  15537. namespaces.sort();
  15538. }
  15539. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  15540. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  15541. event = event[ jQuery.expando ] ?
  15542. event :
  15543. new jQuery.Event( type, typeof event === "object" && event );
  15544. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  15545. event.isTrigger = onlyHandlers ? 2 : 3;
  15546. event.namespace = namespaces.join( "." );
  15547. event.rnamespace = event.namespace ?
  15548. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  15549. null;
  15550. // Clean up the event in case it is being reused
  15551. event.result = undefined;
  15552. if ( !event.target ) {
  15553. event.target = elem;
  15554. }
  15555. // Clone any incoming data and prepend the event, creating the handler arg list
  15556. data = data == null ?
  15557. [ event ] :
  15558. jQuery.makeArray( data, [ event ] );
  15559. // Allow special events to draw outside the lines
  15560. special = jQuery.event.special[ type ] || {};
  15561. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  15562. return;
  15563. }
  15564. // Determine event propagation path in advance, per W3C events spec (#9951)
  15565. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  15566. if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
  15567. bubbleType = special.delegateType || type;
  15568. if ( !rfocusMorph.test( bubbleType + type ) ) {
  15569. cur = cur.parentNode;
  15570. }
  15571. for ( ; cur; cur = cur.parentNode ) {
  15572. eventPath.push( cur );
  15573. tmp = cur;
  15574. }
  15575. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  15576. if ( tmp === ( elem.ownerDocument || document ) ) {
  15577. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  15578. }
  15579. }
  15580. // Fire handlers on the event path
  15581. i = 0;
  15582. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  15583. lastElement = cur;
  15584. event.type = i > 1 ?
  15585. bubbleType :
  15586. special.bindType || type;
  15587. // jQuery handler
  15588. handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
  15589. dataPriv.get( cur, "handle" );
  15590. if ( handle ) {
  15591. handle.apply( cur, data );
  15592. }
  15593. // Native handler
  15594. handle = ontype && cur[ ontype ];
  15595. if ( handle && handle.apply && acceptData( cur ) ) {
  15596. event.result = handle.apply( cur, data );
  15597. if ( event.result === false ) {
  15598. event.preventDefault();
  15599. }
  15600. }
  15601. }
  15602. event.type = type;
  15603. // If nobody prevented the default action, do it now
  15604. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  15605. if ( ( !special._default ||
  15606. special._default.apply( eventPath.pop(), data ) === false ) &&
  15607. acceptData( elem ) ) {
  15608. // Call a native DOM method on the target with the same name as the event.
  15609. // Don't do default actions on window, that's where global variables be (#6170)
  15610. if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
  15611. // Don't re-trigger an onFOO event when we call its FOO() method
  15612. tmp = elem[ ontype ];
  15613. if ( tmp ) {
  15614. elem[ ontype ] = null;
  15615. }
  15616. // Prevent re-triggering of the same event, since we already bubbled it above
  15617. jQuery.event.triggered = type;
  15618. if ( event.isPropagationStopped() ) {
  15619. lastElement.addEventListener( type, stopPropagationCallback );
  15620. }
  15621. elem[ type ]();
  15622. if ( event.isPropagationStopped() ) {
  15623. lastElement.removeEventListener( type, stopPropagationCallback );
  15624. }
  15625. jQuery.event.triggered = undefined;
  15626. if ( tmp ) {
  15627. elem[ ontype ] = tmp;
  15628. }
  15629. }
  15630. }
  15631. }
  15632. return event.result;
  15633. },
  15634. // Piggyback on a donor event to simulate a different one
  15635. // Used only for `focus(in | out)` events
  15636. simulate: function( type, elem, event ) {
  15637. var e = jQuery.extend(
  15638. new jQuery.Event(),
  15639. event,
  15640. {
  15641. type: type,
  15642. isSimulated: true
  15643. }
  15644. );
  15645. jQuery.event.trigger( e, null, elem );
  15646. }
  15647. } );
  15648. jQuery.fn.extend( {
  15649. trigger: function( type, data ) {
  15650. return this.each( function() {
  15651. jQuery.event.trigger( type, data, this );
  15652. } );
  15653. },
  15654. triggerHandler: function( type, data ) {
  15655. var elem = this[ 0 ];
  15656. if ( elem ) {
  15657. return jQuery.event.trigger( type, data, elem, true );
  15658. }
  15659. }
  15660. } );
  15661. // Support: Firefox <=44
  15662. // Firefox doesn't have focus(in | out) events
  15663. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  15664. //
  15665. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  15666. // focus(in | out) events fire after focus & blur events,
  15667. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  15668. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  15669. if ( !support.focusin ) {
  15670. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  15671. // Attach a single capturing handler on the document while someone wants focusin/focusout
  15672. var handler = function( event ) {
  15673. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  15674. };
  15675. jQuery.event.special[ fix ] = {
  15676. setup: function() {
  15677. var doc = this.ownerDocument || this,
  15678. attaches = dataPriv.access( doc, fix );
  15679. if ( !attaches ) {
  15680. doc.addEventListener( orig, handler, true );
  15681. }
  15682. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  15683. },
  15684. teardown: function() {
  15685. var doc = this.ownerDocument || this,
  15686. attaches = dataPriv.access( doc, fix ) - 1;
  15687. if ( !attaches ) {
  15688. doc.removeEventListener( orig, handler, true );
  15689. dataPriv.remove( doc, fix );
  15690. } else {
  15691. dataPriv.access( doc, fix, attaches );
  15692. }
  15693. }
  15694. };
  15695. } );
  15696. }
  15697. var location = window.location;
  15698. var nonce = Date.now();
  15699. var rquery = ( /\?/ );
  15700. // Cross-browser xml parsing
  15701. jQuery.parseXML = function( data ) {
  15702. var xml;
  15703. if ( !data || typeof data !== "string" ) {
  15704. return null;
  15705. }
  15706. // Support: IE 9 - 11 only
  15707. // IE throws on parseFromString with invalid input.
  15708. try {
  15709. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  15710. } catch ( e ) {
  15711. xml = undefined;
  15712. }
  15713. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  15714. jQuery.error( "Invalid XML: " + data );
  15715. }
  15716. return xml;
  15717. };
  15718. var
  15719. rbracket = /\[\]$/,
  15720. rCRLF = /\r?\n/g,
  15721. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  15722. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  15723. function buildParams( prefix, obj, traditional, add ) {
  15724. var name;
  15725. if ( Array.isArray( obj ) ) {
  15726. // Serialize array item.
  15727. jQuery.each( obj, function( i, v ) {
  15728. if ( traditional || rbracket.test( prefix ) ) {
  15729. // Treat each array item as a scalar.
  15730. add( prefix, v );
  15731. } else {
  15732. // Item is non-scalar (array or object), encode its numeric index.
  15733. buildParams(
  15734. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  15735. v,
  15736. traditional,
  15737. add
  15738. );
  15739. }
  15740. } );
  15741. } else if ( !traditional && toType( obj ) === "object" ) {
  15742. // Serialize object item.
  15743. for ( name in obj ) {
  15744. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  15745. }
  15746. } else {
  15747. // Serialize scalar item.
  15748. add( prefix, obj );
  15749. }
  15750. }
  15751. // Serialize an array of form elements or a set of
  15752. // key/values into a query string
  15753. jQuery.param = function( a, traditional ) {
  15754. var prefix,
  15755. s = [],
  15756. add = function( key, valueOrFunction ) {
  15757. // If value is a function, invoke it and use its return value
  15758. var value = isFunction( valueOrFunction ) ?
  15759. valueOrFunction() :
  15760. valueOrFunction;
  15761. s[ s.length ] = encodeURIComponent( key ) + "=" +
  15762. encodeURIComponent( value == null ? "" : value );
  15763. };
  15764. if ( a == null ) {
  15765. return "";
  15766. }
  15767. // If an array was passed in, assume that it is an array of form elements.
  15768. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  15769. // Serialize the form elements
  15770. jQuery.each( a, function() {
  15771. add( this.name, this.value );
  15772. } );
  15773. } else {
  15774. // If traditional, encode the "old" way (the way 1.3.2 or older
  15775. // did it), otherwise encode params recursively.
  15776. for ( prefix in a ) {
  15777. buildParams( prefix, a[ prefix ], traditional, add );
  15778. }
  15779. }
  15780. // Return the resulting serialization
  15781. return s.join( "&" );
  15782. };
  15783. jQuery.fn.extend( {
  15784. serialize: function() {
  15785. return jQuery.param( this.serializeArray() );
  15786. },
  15787. serializeArray: function() {
  15788. return this.map( function() {
  15789. // Can add propHook for "elements" to filter or add form elements
  15790. var elements = jQuery.prop( this, "elements" );
  15791. return elements ? jQuery.makeArray( elements ) : this;
  15792. } )
  15793. .filter( function() {
  15794. var type = this.type;
  15795. // Use .is( ":disabled" ) so that fieldset[disabled] works
  15796. return this.name && !jQuery( this ).is( ":disabled" ) &&
  15797. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  15798. ( this.checked || !rcheckableType.test( type ) );
  15799. } )
  15800. .map( function( i, elem ) {
  15801. var val = jQuery( this ).val();
  15802. if ( val == null ) {
  15803. return null;
  15804. }
  15805. if ( Array.isArray( val ) ) {
  15806. return jQuery.map( val, function( val ) {
  15807. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  15808. } );
  15809. }
  15810. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  15811. } ).get();
  15812. }
  15813. } );
  15814. var
  15815. r20 = /%20/g,
  15816. rhash = /#.*$/,
  15817. rantiCache = /([?&])_=[^&]*/,
  15818. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  15819. // #7653, #8125, #8152: local protocol detection
  15820. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  15821. rnoContent = /^(?:GET|HEAD)$/,
  15822. rprotocol = /^\/\//,
  15823. /* Prefilters
  15824. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  15825. * 2) These are called:
  15826. * - BEFORE asking for a transport
  15827. * - AFTER param serialization (s.data is a string if s.processData is true)
  15828. * 3) key is the dataType
  15829. * 4) the catchall symbol "*" can be used
  15830. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  15831. */
  15832. prefilters = {},
  15833. /* Transports bindings
  15834. * 1) key is the dataType
  15835. * 2) the catchall symbol "*" can be used
  15836. * 3) selection will start with transport dataType and THEN go to "*" if needed
  15837. */
  15838. transports = {},
  15839. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  15840. allTypes = "*/".concat( "*" ),
  15841. // Anchor tag for parsing the document origin
  15842. originAnchor = document.createElement( "a" );
  15843. originAnchor.href = location.href;
  15844. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  15845. function addToPrefiltersOrTransports( structure ) {
  15846. // dataTypeExpression is optional and defaults to "*"
  15847. return function( dataTypeExpression, func ) {
  15848. if ( typeof dataTypeExpression !== "string" ) {
  15849. func = dataTypeExpression;
  15850. dataTypeExpression = "*";
  15851. }
  15852. var dataType,
  15853. i = 0,
  15854. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  15855. if ( isFunction( func ) ) {
  15856. // For each dataType in the dataTypeExpression
  15857. while ( ( dataType = dataTypes[ i++ ] ) ) {
  15858. // Prepend if requested
  15859. if ( dataType[ 0 ] === "+" ) {
  15860. dataType = dataType.slice( 1 ) || "*";
  15861. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  15862. // Otherwise append
  15863. } else {
  15864. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  15865. }
  15866. }
  15867. }
  15868. };
  15869. }
  15870. // Base inspection function for prefilters and transports
  15871. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  15872. var inspected = {},
  15873. seekingTransport = ( structure === transports );
  15874. function inspect( dataType ) {
  15875. var selected;
  15876. inspected[ dataType ] = true;
  15877. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  15878. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  15879. if ( typeof dataTypeOrTransport === "string" &&
  15880. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  15881. options.dataTypes.unshift( dataTypeOrTransport );
  15882. inspect( dataTypeOrTransport );
  15883. return false;
  15884. } else if ( seekingTransport ) {
  15885. return !( selected = dataTypeOrTransport );
  15886. }
  15887. } );
  15888. return selected;
  15889. }
  15890. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  15891. }
  15892. // A special extend for ajax options
  15893. // that takes "flat" options (not to be deep extended)
  15894. // Fixes #9887
  15895. function ajaxExtend( target, src ) {
  15896. var key, deep,
  15897. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  15898. for ( key in src ) {
  15899. if ( src[ key ] !== undefined ) {
  15900. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  15901. }
  15902. }
  15903. if ( deep ) {
  15904. jQuery.extend( true, target, deep );
  15905. }
  15906. return target;
  15907. }
  15908. /* Handles responses to an ajax request:
  15909. * - finds the right dataType (mediates between content-type and expected dataType)
  15910. * - returns the corresponding response
  15911. */
  15912. function ajaxHandleResponses( s, jqXHR, responses ) {
  15913. var ct, type, finalDataType, firstDataType,
  15914. contents = s.contents,
  15915. dataTypes = s.dataTypes;
  15916. // Remove auto dataType and get content-type in the process
  15917. while ( dataTypes[ 0 ] === "*" ) {
  15918. dataTypes.shift();
  15919. if ( ct === undefined ) {
  15920. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  15921. }
  15922. }
  15923. // Check if we're dealing with a known content-type
  15924. if ( ct ) {
  15925. for ( type in contents ) {
  15926. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  15927. dataTypes.unshift( type );
  15928. break;
  15929. }
  15930. }
  15931. }
  15932. // Check to see if we have a response for the expected dataType
  15933. if ( dataTypes[ 0 ] in responses ) {
  15934. finalDataType = dataTypes[ 0 ];
  15935. } else {
  15936. // Try convertible dataTypes
  15937. for ( type in responses ) {
  15938. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  15939. finalDataType = type;
  15940. break;
  15941. }
  15942. if ( !firstDataType ) {
  15943. firstDataType = type;
  15944. }
  15945. }
  15946. // Or just use first one
  15947. finalDataType = finalDataType || firstDataType;
  15948. }
  15949. // If we found a dataType
  15950. // We add the dataType to the list if needed
  15951. // and return the corresponding response
  15952. if ( finalDataType ) {
  15953. if ( finalDataType !== dataTypes[ 0 ] ) {
  15954. dataTypes.unshift( finalDataType );
  15955. }
  15956. return responses[ finalDataType ];
  15957. }
  15958. }
  15959. /* Chain conversions given the request and the original response
  15960. * Also sets the responseXXX fields on the jqXHR instance
  15961. */
  15962. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  15963. var conv2, current, conv, tmp, prev,
  15964. converters = {},
  15965. // Work with a copy of dataTypes in case we need to modify it for conversion
  15966. dataTypes = s.dataTypes.slice();
  15967. // Create converters map with lowercased keys
  15968. if ( dataTypes[ 1 ] ) {
  15969. for ( conv in s.converters ) {
  15970. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  15971. }
  15972. }
  15973. current = dataTypes.shift();
  15974. // Convert to each sequential dataType
  15975. while ( current ) {
  15976. if ( s.responseFields[ current ] ) {
  15977. jqXHR[ s.responseFields[ current ] ] = response;
  15978. }
  15979. // Apply the dataFilter if provided
  15980. if ( !prev && isSuccess && s.dataFilter ) {
  15981. response = s.dataFilter( response, s.dataType );
  15982. }
  15983. prev = current;
  15984. current = dataTypes.shift();
  15985. if ( current ) {
  15986. // There's only work to do if current dataType is non-auto
  15987. if ( current === "*" ) {
  15988. current = prev;
  15989. // Convert response if prev dataType is non-auto and differs from current
  15990. } else if ( prev !== "*" && prev !== current ) {
  15991. // Seek a direct converter
  15992. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  15993. // If none found, seek a pair
  15994. if ( !conv ) {
  15995. for ( conv2 in converters ) {
  15996. // If conv2 outputs current
  15997. tmp = conv2.split( " " );
  15998. if ( tmp[ 1 ] === current ) {
  15999. // If prev can be converted to accepted input
  16000. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  16001. converters[ "* " + tmp[ 0 ] ];
  16002. if ( conv ) {
  16003. // Condense equivalence converters
  16004. if ( conv === true ) {
  16005. conv = converters[ conv2 ];
  16006. // Otherwise, insert the intermediate dataType
  16007. } else if ( converters[ conv2 ] !== true ) {
  16008. current = tmp[ 0 ];
  16009. dataTypes.unshift( tmp[ 1 ] );
  16010. }
  16011. break;
  16012. }
  16013. }
  16014. }
  16015. }
  16016. // Apply converter (if not an equivalence)
  16017. if ( conv !== true ) {
  16018. // Unless errors are allowed to bubble, catch and return them
  16019. if ( conv && s.throws ) {
  16020. response = conv( response );
  16021. } else {
  16022. try {
  16023. response = conv( response );
  16024. } catch ( e ) {
  16025. return {
  16026. state: "parsererror",
  16027. error: conv ? e : "No conversion from " + prev + " to " + current
  16028. };
  16029. }
  16030. }
  16031. }
  16032. }
  16033. }
  16034. }
  16035. return { state: "success", data: response };
  16036. }
  16037. jQuery.extend( {
  16038. // Counter for holding the number of active queries
  16039. active: 0,
  16040. // Last-Modified header cache for next request
  16041. lastModified: {},
  16042. etag: {},
  16043. ajaxSettings: {
  16044. url: location.href,
  16045. type: "GET",
  16046. isLocal: rlocalProtocol.test( location.protocol ),
  16047. global: true,
  16048. processData: true,
  16049. async: true,
  16050. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  16051. /*
  16052. timeout: 0,
  16053. data: null,
  16054. dataType: null,
  16055. username: null,
  16056. password: null,
  16057. cache: null,
  16058. throws: false,
  16059. traditional: false,
  16060. headers: {},
  16061. */
  16062. accepts: {
  16063. "*": allTypes,
  16064. text: "text/plain",
  16065. html: "text/html",
  16066. xml: "application/xml, text/xml",
  16067. json: "application/json, text/javascript"
  16068. },
  16069. contents: {
  16070. xml: /\bxml\b/,
  16071. html: /\bhtml/,
  16072. json: /\bjson\b/
  16073. },
  16074. responseFields: {
  16075. xml: "responseXML",
  16076. text: "responseText",
  16077. json: "responseJSON"
  16078. },
  16079. // Data converters
  16080. // Keys separate source (or catchall "*") and destination types with a single space
  16081. converters: {
  16082. // Convert anything to text
  16083. "* text": String,
  16084. // Text to html (true = no transformation)
  16085. "text html": true,
  16086. // Evaluate text as a json expression
  16087. "text json": JSON.parse,
  16088. // Parse text as xml
  16089. "text xml": jQuery.parseXML
  16090. },
  16091. // For options that shouldn't be deep extended:
  16092. // you can add your own custom options here if
  16093. // and when you create one that shouldn't be
  16094. // deep extended (see ajaxExtend)
  16095. flatOptions: {
  16096. url: true,
  16097. context: true
  16098. }
  16099. },
  16100. // Creates a full fledged settings object into target
  16101. // with both ajaxSettings and settings fields.
  16102. // If target is omitted, writes into ajaxSettings.
  16103. ajaxSetup: function( target, settings ) {
  16104. return settings ?
  16105. // Building a settings object
  16106. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  16107. // Extending ajaxSettings
  16108. ajaxExtend( jQuery.ajaxSettings, target );
  16109. },
  16110. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  16111. ajaxTransport: addToPrefiltersOrTransports( transports ),
  16112. // Main method
  16113. ajax: function( url, options ) {
  16114. // If url is an object, simulate pre-1.5 signature
  16115. if ( typeof url === "object" ) {
  16116. options = url;
  16117. url = undefined;
  16118. }
  16119. // Force options to be an object
  16120. options = options || {};
  16121. var transport,
  16122. // URL without anti-cache param
  16123. cacheURL,
  16124. // Response headers
  16125. responseHeadersString,
  16126. responseHeaders,
  16127. // timeout handle
  16128. timeoutTimer,
  16129. // Url cleanup var
  16130. urlAnchor,
  16131. // Request state (becomes false upon send and true upon completion)
  16132. completed,
  16133. // To know if global events are to be dispatched
  16134. fireGlobals,
  16135. // Loop variable
  16136. i,
  16137. // uncached part of the url
  16138. uncached,
  16139. // Create the final options object
  16140. s = jQuery.ajaxSetup( {}, options ),
  16141. // Callbacks context
  16142. callbackContext = s.context || s,
  16143. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  16144. globalEventContext = s.context &&
  16145. ( callbackContext.nodeType || callbackContext.jquery ) ?
  16146. jQuery( callbackContext ) :
  16147. jQuery.event,
  16148. // Deferreds
  16149. deferred = jQuery.Deferred(),
  16150. completeDeferred = jQuery.Callbacks( "once memory" ),
  16151. // Status-dependent callbacks
  16152. statusCode = s.statusCode || {},
  16153. // Headers (they are sent all at once)
  16154. requestHeaders = {},
  16155. requestHeadersNames = {},
  16156. // Default abort message
  16157. strAbort = "canceled",
  16158. // Fake xhr
  16159. jqXHR = {
  16160. readyState: 0,
  16161. // Builds headers hashtable if needed
  16162. getResponseHeader: function( key ) {
  16163. var match;
  16164. if ( completed ) {
  16165. if ( !responseHeaders ) {
  16166. responseHeaders = {};
  16167. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  16168. responseHeaders[ match[ 1 ].toLowerCase() + " " ] =
  16169. ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] )
  16170. .concat( match[ 2 ] );
  16171. }
  16172. }
  16173. match = responseHeaders[ key.toLowerCase() + " " ];
  16174. }
  16175. return match == null ? null : match.join( ", " );
  16176. },
  16177. // Raw string
  16178. getAllResponseHeaders: function() {
  16179. return completed ? responseHeadersString : null;
  16180. },
  16181. // Caches the header
  16182. setRequestHeader: function( name, value ) {
  16183. if ( completed == null ) {
  16184. name = requestHeadersNames[ name.toLowerCase() ] =
  16185. requestHeadersNames[ name.toLowerCase() ] || name;
  16186. requestHeaders[ name ] = value;
  16187. }
  16188. return this;
  16189. },
  16190. // Overrides response content-type header
  16191. overrideMimeType: function( type ) {
  16192. if ( completed == null ) {
  16193. s.mimeType = type;
  16194. }
  16195. return this;
  16196. },
  16197. // Status-dependent callbacks
  16198. statusCode: function( map ) {
  16199. var code;
  16200. if ( map ) {
  16201. if ( completed ) {
  16202. // Execute the appropriate callbacks
  16203. jqXHR.always( map[ jqXHR.status ] );
  16204. } else {
  16205. // Lazy-add the new callbacks in a way that preserves old ones
  16206. for ( code in map ) {
  16207. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  16208. }
  16209. }
  16210. }
  16211. return this;
  16212. },
  16213. // Cancel the request
  16214. abort: function( statusText ) {
  16215. var finalText = statusText || strAbort;
  16216. if ( transport ) {
  16217. transport.abort( finalText );
  16218. }
  16219. done( 0, finalText );
  16220. return this;
  16221. }
  16222. };
  16223. // Attach deferreds
  16224. deferred.promise( jqXHR );
  16225. // Add protocol if not provided (prefilters might expect it)
  16226. // Handle falsy url in the settings object (#10093: consistency with old signature)
  16227. // We also use the url parameter if available
  16228. s.url = ( ( url || s.url || location.href ) + "" )
  16229. .replace( rprotocol, location.protocol + "//" );
  16230. // Alias method option to type as per ticket #12004
  16231. s.type = options.method || options.type || s.method || s.type;
  16232. // Extract dataTypes list
  16233. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  16234. // A cross-domain request is in order when the origin doesn't match the current origin.
  16235. if ( s.crossDomain == null ) {
  16236. urlAnchor = document.createElement( "a" );
  16237. // Support: IE <=8 - 11, Edge 12 - 15
  16238. // IE throws exception on accessing the href property if url is malformed,
  16239. // e.g. http://example.com:80x/
  16240. try {
  16241. urlAnchor.href = s.url;
  16242. // Support: IE <=8 - 11 only
  16243. // Anchor's host property isn't correctly set when s.url is relative
  16244. urlAnchor.href = urlAnchor.href;
  16245. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  16246. urlAnchor.protocol + "//" + urlAnchor.host;
  16247. } catch ( e ) {
  16248. // If there is an error parsing the URL, assume it is crossDomain,
  16249. // it can be rejected by the transport if it is invalid
  16250. s.crossDomain = true;
  16251. }
  16252. }
  16253. // Convert data if not already a string
  16254. if ( s.data && s.processData && typeof s.data !== "string" ) {
  16255. s.data = jQuery.param( s.data, s.traditional );
  16256. }
  16257. // Apply prefilters
  16258. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  16259. // If request was aborted inside a prefilter, stop there
  16260. if ( completed ) {
  16261. return jqXHR;
  16262. }
  16263. // We can fire global events as of now if asked to
  16264. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  16265. fireGlobals = jQuery.event && s.global;
  16266. // Watch for a new set of requests
  16267. if ( fireGlobals && jQuery.active++ === 0 ) {
  16268. jQuery.event.trigger( "ajaxStart" );
  16269. }
  16270. // Uppercase the type
  16271. s.type = s.type.toUpperCase();
  16272. // Determine if request has content
  16273. s.hasContent = !rnoContent.test( s.type );
  16274. // Save the URL in case we're toying with the If-Modified-Since
  16275. // and/or If-None-Match header later on
  16276. // Remove hash to simplify url manipulation
  16277. cacheURL = s.url.replace( rhash, "" );
  16278. // More options handling for requests with no content
  16279. if ( !s.hasContent ) {
  16280. // Remember the hash so we can put it back
  16281. uncached = s.url.slice( cacheURL.length );
  16282. // If data is available and should be processed, append data to url
  16283. if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
  16284. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  16285. // #9682: remove data so that it's not used in an eventual retry
  16286. delete s.data;
  16287. }
  16288. // Add or update anti-cache param if needed
  16289. if ( s.cache === false ) {
  16290. cacheURL = cacheURL.replace( rantiCache, "$1" );
  16291. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
  16292. }
  16293. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  16294. s.url = cacheURL + uncached;
  16295. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  16296. } else if ( s.data && s.processData &&
  16297. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  16298. s.data = s.data.replace( r20, "+" );
  16299. }
  16300. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  16301. if ( s.ifModified ) {
  16302. if ( jQuery.lastModified[ cacheURL ] ) {
  16303. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  16304. }
  16305. if ( jQuery.etag[ cacheURL ] ) {
  16306. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  16307. }
  16308. }
  16309. // Set the correct header, if data is being sent
  16310. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  16311. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  16312. }
  16313. // Set the Accepts header for the server, depending on the dataType
  16314. jqXHR.setRequestHeader(
  16315. "Accept",
  16316. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  16317. s.accepts[ s.dataTypes[ 0 ] ] +
  16318. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  16319. s.accepts[ "*" ]
  16320. );
  16321. // Check for headers option
  16322. for ( i in s.headers ) {
  16323. jqXHR.setRequestHeader( i, s.headers[ i ] );
  16324. }
  16325. // Allow custom headers/mimetypes and early abort
  16326. if ( s.beforeSend &&
  16327. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  16328. // Abort if not done already and return
  16329. return jqXHR.abort();
  16330. }
  16331. // Aborting is no longer a cancellation
  16332. strAbort = "abort";
  16333. // Install callbacks on deferreds
  16334. completeDeferred.add( s.complete );
  16335. jqXHR.done( s.success );
  16336. jqXHR.fail( s.error );
  16337. // Get transport
  16338. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  16339. // If no transport, we auto-abort
  16340. if ( !transport ) {
  16341. done( -1, "No Transport" );
  16342. } else {
  16343. jqXHR.readyState = 1;
  16344. // Send global event
  16345. if ( fireGlobals ) {
  16346. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  16347. }
  16348. // If request was aborted inside ajaxSend, stop there
  16349. if ( completed ) {
  16350. return jqXHR;
  16351. }
  16352. // Timeout
  16353. if ( s.async && s.timeout > 0 ) {
  16354. timeoutTimer = window.setTimeout( function() {
  16355. jqXHR.abort( "timeout" );
  16356. }, s.timeout );
  16357. }
  16358. try {
  16359. completed = false;
  16360. transport.send( requestHeaders, done );
  16361. } catch ( e ) {
  16362. // Rethrow post-completion exceptions
  16363. if ( completed ) {
  16364. throw e;
  16365. }
  16366. // Propagate others as results
  16367. done( -1, e );
  16368. }
  16369. }
  16370. // Callback for when everything is done
  16371. function done( status, nativeStatusText, responses, headers ) {
  16372. var isSuccess, success, error, response, modified,
  16373. statusText = nativeStatusText;
  16374. // Ignore repeat invocations
  16375. if ( completed ) {
  16376. return;
  16377. }
  16378. completed = true;
  16379. // Clear timeout if it exists
  16380. if ( timeoutTimer ) {
  16381. window.clearTimeout( timeoutTimer );
  16382. }
  16383. // Dereference transport for early garbage collection
  16384. // (no matter how long the jqXHR object will be used)
  16385. transport = undefined;
  16386. // Cache response headers
  16387. responseHeadersString = headers || "";
  16388. // Set readyState
  16389. jqXHR.readyState = status > 0 ? 4 : 0;
  16390. // Determine if successful
  16391. isSuccess = status >= 200 && status < 300 || status === 304;
  16392. // Get response data
  16393. if ( responses ) {
  16394. response = ajaxHandleResponses( s, jqXHR, responses );
  16395. }
  16396. // Convert no matter what (that way responseXXX fields are always set)
  16397. response = ajaxConvert( s, response, jqXHR, isSuccess );
  16398. // If successful, handle type chaining
  16399. if ( isSuccess ) {
  16400. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  16401. if ( s.ifModified ) {
  16402. modified = jqXHR.getResponseHeader( "Last-Modified" );
  16403. if ( modified ) {
  16404. jQuery.lastModified[ cacheURL ] = modified;
  16405. }
  16406. modified = jqXHR.getResponseHeader( "etag" );
  16407. if ( modified ) {
  16408. jQuery.etag[ cacheURL ] = modified;
  16409. }
  16410. }
  16411. // if no content
  16412. if ( status === 204 || s.type === "HEAD" ) {
  16413. statusText = "nocontent";
  16414. // if not modified
  16415. } else if ( status === 304 ) {
  16416. statusText = "notmodified";
  16417. // If we have data, let's convert it
  16418. } else {
  16419. statusText = response.state;
  16420. success = response.data;
  16421. error = response.error;
  16422. isSuccess = !error;
  16423. }
  16424. } else {
  16425. // Extract error from statusText and normalize for non-aborts
  16426. error = statusText;
  16427. if ( status || !statusText ) {
  16428. statusText = "error";
  16429. if ( status < 0 ) {
  16430. status = 0;
  16431. }
  16432. }
  16433. }
  16434. // Set data for the fake xhr object
  16435. jqXHR.status = status;
  16436. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  16437. // Success/Error
  16438. if ( isSuccess ) {
  16439. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  16440. } else {
  16441. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  16442. }
  16443. // Status-dependent callbacks
  16444. jqXHR.statusCode( statusCode );
  16445. statusCode = undefined;
  16446. if ( fireGlobals ) {
  16447. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  16448. [ jqXHR, s, isSuccess ? success : error ] );
  16449. }
  16450. // Complete
  16451. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  16452. if ( fireGlobals ) {
  16453. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  16454. // Handle the global AJAX counter
  16455. if ( !( --jQuery.active ) ) {
  16456. jQuery.event.trigger( "ajaxStop" );
  16457. }
  16458. }
  16459. }
  16460. return jqXHR;
  16461. },
  16462. getJSON: function( url, data, callback ) {
  16463. return jQuery.get( url, data, callback, "json" );
  16464. },
  16465. getScript: function( url, callback ) {
  16466. return jQuery.get( url, undefined, callback, "script" );
  16467. }
  16468. } );
  16469. jQuery.each( [ "get", "post" ], function( i, method ) {
  16470. jQuery[ method ] = function( url, data, callback, type ) {
  16471. // Shift arguments if data argument was omitted
  16472. if ( isFunction( data ) ) {
  16473. type = type || callback;
  16474. callback = data;
  16475. data = undefined;
  16476. }
  16477. // The url can be an options object (which then must have .url)
  16478. return jQuery.ajax( jQuery.extend( {
  16479. url: url,
  16480. type: method,
  16481. dataType: type,
  16482. data: data,
  16483. success: callback
  16484. }, jQuery.isPlainObject( url ) && url ) );
  16485. };
  16486. } );
  16487. jQuery._evalUrl = function( url, options ) {
  16488. return jQuery.ajax( {
  16489. url: url,
  16490. // Make this explicit, since user can override this through ajaxSetup (#11264)
  16491. type: "GET",
  16492. dataType: "script",
  16493. cache: true,
  16494. async: false,
  16495. global: false,
  16496. // Only evaluate the response if it is successful (gh-4126)
  16497. // dataFilter is not invoked for failure responses, so using it instead
  16498. // of the default converter is kludgy but it works.
  16499. converters: {
  16500. "text script": function() {}
  16501. },
  16502. dataFilter: function( response ) {
  16503. jQuery.globalEval( response, options );
  16504. }
  16505. } );
  16506. };
  16507. jQuery.fn.extend( {
  16508. wrapAll: function( html ) {
  16509. var wrap;
  16510. if ( this[ 0 ] ) {
  16511. if ( isFunction( html ) ) {
  16512. html = html.call( this[ 0 ] );
  16513. }
  16514. // The elements to wrap the target around
  16515. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  16516. if ( this[ 0 ].parentNode ) {
  16517. wrap.insertBefore( this[ 0 ] );
  16518. }
  16519. wrap.map( function() {
  16520. var elem = this;
  16521. while ( elem.firstElementChild ) {
  16522. elem = elem.firstElementChild;
  16523. }
  16524. return elem;
  16525. } ).append( this );
  16526. }
  16527. return this;
  16528. },
  16529. wrapInner: function( html ) {
  16530. if ( isFunction( html ) ) {
  16531. return this.each( function( i ) {
  16532. jQuery( this ).wrapInner( html.call( this, i ) );
  16533. } );
  16534. }
  16535. return this.each( function() {
  16536. var self = jQuery( this ),
  16537. contents = self.contents();
  16538. if ( contents.length ) {
  16539. contents.wrapAll( html );
  16540. } else {
  16541. self.append( html );
  16542. }
  16543. } );
  16544. },
  16545. wrap: function( html ) {
  16546. var htmlIsFunction = isFunction( html );
  16547. return this.each( function( i ) {
  16548. jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
  16549. } );
  16550. },
  16551. unwrap: function( selector ) {
  16552. this.parent( selector ).not( "body" ).each( function() {
  16553. jQuery( this ).replaceWith( this.childNodes );
  16554. } );
  16555. return this;
  16556. }
  16557. } );
  16558. jQuery.expr.pseudos.hidden = function( elem ) {
  16559. return !jQuery.expr.pseudos.visible( elem );
  16560. };
  16561. jQuery.expr.pseudos.visible = function( elem ) {
  16562. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  16563. };
  16564. jQuery.ajaxSettings.xhr = function() {
  16565. try {
  16566. return new window.XMLHttpRequest();
  16567. } catch ( e ) {}
  16568. };
  16569. var xhrSuccessStatus = {
  16570. // File protocol always yields status code 0, assume 200
  16571. 0: 200,
  16572. // Support: IE <=9 only
  16573. // #1450: sometimes IE returns 1223 when it should be 204
  16574. 1223: 204
  16575. },
  16576. xhrSupported = jQuery.ajaxSettings.xhr();
  16577. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  16578. support.ajax = xhrSupported = !!xhrSupported;
  16579. jQuery.ajaxTransport( function( options ) {
  16580. var callback, errorCallback;
  16581. // Cross domain only allowed if supported through XMLHttpRequest
  16582. if ( support.cors || xhrSupported && !options.crossDomain ) {
  16583. return {
  16584. send: function( headers, complete ) {
  16585. var i,
  16586. xhr = options.xhr();
  16587. xhr.open(
  16588. options.type,
  16589. options.url,
  16590. options.async,
  16591. options.username,
  16592. options.password
  16593. );
  16594. // Apply custom fields if provided
  16595. if ( options.xhrFields ) {
  16596. for ( i in options.xhrFields ) {
  16597. xhr[ i ] = options.xhrFields[ i ];
  16598. }
  16599. }
  16600. // Override mime type if needed
  16601. if ( options.mimeType && xhr.overrideMimeType ) {
  16602. xhr.overrideMimeType( options.mimeType );
  16603. }
  16604. // X-Requested-With header
  16605. // For cross-domain requests, seeing as conditions for a preflight are
  16606. // akin to a jigsaw puzzle, we simply never set it to be sure.
  16607. // (it can always be set on a per-request basis or even using ajaxSetup)
  16608. // For same-domain requests, won't change header if already provided.
  16609. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  16610. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  16611. }
  16612. // Set headers
  16613. for ( i in headers ) {
  16614. xhr.setRequestHeader( i, headers[ i ] );
  16615. }
  16616. // Callback
  16617. callback = function( type ) {
  16618. return function() {
  16619. if ( callback ) {
  16620. callback = errorCallback = xhr.onload =
  16621. xhr.onerror = xhr.onabort = xhr.ontimeout =
  16622. xhr.onreadystatechange = null;
  16623. if ( type === "abort" ) {
  16624. xhr.abort();
  16625. } else if ( type === "error" ) {
  16626. // Support: IE <=9 only
  16627. // On a manual native abort, IE9 throws
  16628. // errors on any property access that is not readyState
  16629. if ( typeof xhr.status !== "number" ) {
  16630. complete( 0, "error" );
  16631. } else {
  16632. complete(
  16633. // File: protocol always yields status 0; see #8605, #14207
  16634. xhr.status,
  16635. xhr.statusText
  16636. );
  16637. }
  16638. } else {
  16639. complete(
  16640. xhrSuccessStatus[ xhr.status ] || xhr.status,
  16641. xhr.statusText,
  16642. // Support: IE <=9 only
  16643. // IE9 has no XHR2 but throws on binary (trac-11426)
  16644. // For XHR2 non-text, let the caller handle it (gh-2498)
  16645. ( xhr.responseType || "text" ) !== "text" ||
  16646. typeof xhr.responseText !== "string" ?
  16647. { binary: xhr.response } :
  16648. { text: xhr.responseText },
  16649. xhr.getAllResponseHeaders()
  16650. );
  16651. }
  16652. }
  16653. };
  16654. };
  16655. // Listen to events
  16656. xhr.onload = callback();
  16657. errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
  16658. // Support: IE 9 only
  16659. // Use onreadystatechange to replace onabort
  16660. // to handle uncaught aborts
  16661. if ( xhr.onabort !== undefined ) {
  16662. xhr.onabort = errorCallback;
  16663. } else {
  16664. xhr.onreadystatechange = function() {
  16665. // Check readyState before timeout as it changes
  16666. if ( xhr.readyState === 4 ) {
  16667. // Allow onerror to be called first,
  16668. // but that will not handle a native abort
  16669. // Also, save errorCallback to a variable
  16670. // as xhr.onerror cannot be accessed
  16671. window.setTimeout( function() {
  16672. if ( callback ) {
  16673. errorCallback();
  16674. }
  16675. } );
  16676. }
  16677. };
  16678. }
  16679. // Create the abort callback
  16680. callback = callback( "abort" );
  16681. try {
  16682. // Do send the request (this may raise an exception)
  16683. xhr.send( options.hasContent && options.data || null );
  16684. } catch ( e ) {
  16685. // #14683: Only rethrow if this hasn't been notified as an error yet
  16686. if ( callback ) {
  16687. throw e;
  16688. }
  16689. }
  16690. },
  16691. abort: function() {
  16692. if ( callback ) {
  16693. callback();
  16694. }
  16695. }
  16696. };
  16697. }
  16698. } );
  16699. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  16700. jQuery.ajaxPrefilter( function( s ) {
  16701. if ( s.crossDomain ) {
  16702. s.contents.script = false;
  16703. }
  16704. } );
  16705. // Install script dataType
  16706. jQuery.ajaxSetup( {
  16707. accepts: {
  16708. script: "text/javascript, application/javascript, " +
  16709. "application/ecmascript, application/x-ecmascript"
  16710. },
  16711. contents: {
  16712. script: /\b(?:java|ecma)script\b/
  16713. },
  16714. converters: {
  16715. "text script": function( text ) {
  16716. jQuery.globalEval( text );
  16717. return text;
  16718. }
  16719. }
  16720. } );
  16721. // Handle cache's special case and crossDomain
  16722. jQuery.ajaxPrefilter( "script", function( s ) {
  16723. if ( s.cache === undefined ) {
  16724. s.cache = false;
  16725. }
  16726. if ( s.crossDomain ) {
  16727. s.type = "GET";
  16728. }
  16729. } );
  16730. // Bind script tag hack transport
  16731. jQuery.ajaxTransport( "script", function( s ) {
  16732. // This transport only deals with cross domain or forced-by-attrs requests
  16733. if ( s.crossDomain || s.scriptAttrs ) {
  16734. var script, callback;
  16735. return {
  16736. send: function( _, complete ) {
  16737. script = jQuery( "<script>" )
  16738. .attr( s.scriptAttrs || {} )
  16739. .prop( { charset: s.scriptCharset, src: s.url } )
  16740. .on( "load error", callback = function( evt ) {
  16741. script.remove();
  16742. callback = null;
  16743. if ( evt ) {
  16744. complete( evt.type === "error" ? 404 : 200, evt.type );
  16745. }
  16746. } );
  16747. // Use native DOM manipulation to avoid our domManip AJAX trickery
  16748. document.head.appendChild( script[ 0 ] );
  16749. },
  16750. abort: function() {
  16751. if ( callback ) {
  16752. callback();
  16753. }
  16754. }
  16755. };
  16756. }
  16757. } );
  16758. var oldCallbacks = [],
  16759. rjsonp = /(=)\?(?=&|$)|\?\?/;
  16760. // Default jsonp settings
  16761. jQuery.ajaxSetup( {
  16762. jsonp: "callback",
  16763. jsonpCallback: function() {
  16764. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  16765. this[ callback ] = true;
  16766. return callback;
  16767. }
  16768. } );
  16769. // Detect, normalize options and install callbacks for jsonp requests
  16770. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  16771. var callbackName, overwritten, responseContainer,
  16772. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  16773. "url" :
  16774. typeof s.data === "string" &&
  16775. ( s.contentType || "" )
  16776. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  16777. rjsonp.test( s.data ) && "data"
  16778. );
  16779. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  16780. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  16781. // Get callback name, remembering preexisting value associated with it
  16782. callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
  16783. s.jsonpCallback() :
  16784. s.jsonpCallback;
  16785. // Insert callback into url or form data
  16786. if ( jsonProp ) {
  16787. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  16788. } else if ( s.jsonp !== false ) {
  16789. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  16790. }
  16791. // Use data converter to retrieve json after script execution
  16792. s.converters[ "script json" ] = function() {
  16793. if ( !responseContainer ) {
  16794. jQuery.error( callbackName + " was not called" );
  16795. }
  16796. return responseContainer[ 0 ];
  16797. };
  16798. // Force json dataType
  16799. s.dataTypes[ 0 ] = "json";
  16800. // Install callback
  16801. overwritten = window[ callbackName ];
  16802. window[ callbackName ] = function() {
  16803. responseContainer = arguments;
  16804. };
  16805. // Clean-up function (fires after converters)
  16806. jqXHR.always( function() {
  16807. // If previous value didn't exist - remove it
  16808. if ( overwritten === undefined ) {
  16809. jQuery( window ).removeProp( callbackName );
  16810. // Otherwise restore preexisting value
  16811. } else {
  16812. window[ callbackName ] = overwritten;
  16813. }
  16814. // Save back as free
  16815. if ( s[ callbackName ] ) {
  16816. // Make sure that re-using the options doesn't screw things around
  16817. s.jsonpCallback = originalSettings.jsonpCallback;
  16818. // Save the callback name for future use
  16819. oldCallbacks.push( callbackName );
  16820. }
  16821. // Call if it was a function and we have a response
  16822. if ( responseContainer && isFunction( overwritten ) ) {
  16823. overwritten( responseContainer[ 0 ] );
  16824. }
  16825. responseContainer = overwritten = undefined;
  16826. } );
  16827. // Delegate to script
  16828. return "script";
  16829. }
  16830. } );
  16831. // Support: Safari 8 only
  16832. // In Safari 8 documents created via document.implementation.createHTMLDocument
  16833. // collapse sibling forms: the second one becomes a child of the first one.
  16834. // Because of that, this security measure has to be disabled in Safari 8.
  16835. // https://bugs.webkit.org/show_bug.cgi?id=137337
  16836. support.createHTMLDocument = ( function() {
  16837. var body = document.implementation.createHTMLDocument( "" ).body;
  16838. body.innerHTML = "<form></form><form></form>";
  16839. return body.childNodes.length === 2;
  16840. } )();
  16841. // Argument "data" should be string of html
  16842. // context (optional): If specified, the fragment will be created in this context,
  16843. // defaults to document
  16844. // keepScripts (optional): If true, will include scripts passed in the html string
  16845. jQuery.parseHTML = function( data, context, keepScripts ) {
  16846. if ( typeof data !== "string" ) {
  16847. return [];
  16848. }
  16849. if ( typeof context === "boolean" ) {
  16850. keepScripts = context;
  16851. context = false;
  16852. }
  16853. var base, parsed, scripts;
  16854. if ( !context ) {
  16855. // Stop scripts or inline event handlers from being executed immediately
  16856. // by using document.implementation
  16857. if ( support.createHTMLDocument ) {
  16858. context = document.implementation.createHTMLDocument( "" );
  16859. // Set the base href for the created document
  16860. // so any parsed elements with URLs
  16861. // are based on the document's URL (gh-2965)
  16862. base = context.createElement( "base" );
  16863. base.href = document.location.href;
  16864. context.head.appendChild( base );
  16865. } else {
  16866. context = document;
  16867. }
  16868. }
  16869. parsed = rsingleTag.exec( data );
  16870. scripts = !keepScripts && [];
  16871. // Single tag
  16872. if ( parsed ) {
  16873. return [ context.createElement( parsed[ 1 ] ) ];
  16874. }
  16875. parsed = buildFragment( [ data ], context, scripts );
  16876. if ( scripts && scripts.length ) {
  16877. jQuery( scripts ).remove();
  16878. }
  16879. return jQuery.merge( [], parsed.childNodes );
  16880. };
  16881. /**
  16882. * Load a url into a page
  16883. */
  16884. jQuery.fn.load = function( url, params, callback ) {
  16885. var selector, type, response,
  16886. self = this,
  16887. off = url.indexOf( " " );
  16888. if ( off > -1 ) {
  16889. selector = stripAndCollapse( url.slice( off ) );
  16890. url = url.slice( 0, off );
  16891. }
  16892. // If it's a function
  16893. if ( isFunction( params ) ) {
  16894. // We assume that it's the callback
  16895. callback = params;
  16896. params = undefined;
  16897. // Otherwise, build a param string
  16898. } else if ( params && typeof params === "object" ) {
  16899. type = "POST";
  16900. }
  16901. // If we have elements to modify, make the request
  16902. if ( self.length > 0 ) {
  16903. jQuery.ajax( {
  16904. url: url,
  16905. // If "type" variable is undefined, then "GET" method will be used.
  16906. // Make value of this field explicit since
  16907. // user can override it through ajaxSetup method
  16908. type: type || "GET",
  16909. dataType: "html",
  16910. data: params
  16911. } ).done( function( responseText ) {
  16912. // Save response for use in complete callback
  16913. response = arguments;
  16914. self.html( selector ?
  16915. // If a selector was specified, locate the right elements in a dummy div
  16916. // Exclude scripts to avoid IE 'Permission Denied' errors
  16917. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  16918. // Otherwise use the full result
  16919. responseText );
  16920. // If the request succeeds, this function gets "data", "status", "jqXHR"
  16921. // but they are ignored because response was set above.
  16922. // If it fails, this function gets "jqXHR", "status", "error"
  16923. } ).always( callback && function( jqXHR, status ) {
  16924. self.each( function() {
  16925. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  16926. } );
  16927. } );
  16928. }
  16929. return this;
  16930. };
  16931. // Attach a bunch of functions for handling common AJAX events
  16932. jQuery.each( [
  16933. "ajaxStart",
  16934. "ajaxStop",
  16935. "ajaxComplete",
  16936. "ajaxError",
  16937. "ajaxSuccess",
  16938. "ajaxSend"
  16939. ], function( i, type ) {
  16940. jQuery.fn[ type ] = function( fn ) {
  16941. return this.on( type, fn );
  16942. };
  16943. } );
  16944. jQuery.expr.pseudos.animated = function( elem ) {
  16945. return jQuery.grep( jQuery.timers, function( fn ) {
  16946. return elem === fn.elem;
  16947. } ).length;
  16948. };
  16949. jQuery.offset = {
  16950. setOffset: function( elem, options, i ) {
  16951. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  16952. position = jQuery.css( elem, "position" ),
  16953. curElem = jQuery( elem ),
  16954. props = {};
  16955. // Set position first, in-case top/left are set even on static elem
  16956. if ( position === "static" ) {
  16957. elem.style.position = "relative";
  16958. }
  16959. curOffset = curElem.offset();
  16960. curCSSTop = jQuery.css( elem, "top" );
  16961. curCSSLeft = jQuery.css( elem, "left" );
  16962. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  16963. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  16964. // Need to be able to calculate position if either
  16965. // top or left is auto and position is either absolute or fixed
  16966. if ( calculatePosition ) {
  16967. curPosition = curElem.position();
  16968. curTop = curPosition.top;
  16969. curLeft = curPosition.left;
  16970. } else {
  16971. curTop = parseFloat( curCSSTop ) || 0;
  16972. curLeft = parseFloat( curCSSLeft ) || 0;
  16973. }
  16974. if ( isFunction( options ) ) {
  16975. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  16976. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  16977. }
  16978. if ( options.top != null ) {
  16979. props.top = ( options.top - curOffset.top ) + curTop;
  16980. }
  16981. if ( options.left != null ) {
  16982. props.left = ( options.left - curOffset.left ) + curLeft;
  16983. }
  16984. if ( "using" in options ) {
  16985. options.using.call( elem, props );
  16986. } else {
  16987. curElem.css( props );
  16988. }
  16989. }
  16990. };
  16991. jQuery.fn.extend( {
  16992. // offset() relates an element's border box to the document origin
  16993. offset: function( options ) {
  16994. // Preserve chaining for setter
  16995. if ( arguments.length ) {
  16996. return options === undefined ?
  16997. this :
  16998. this.each( function( i ) {
  16999. jQuery.offset.setOffset( this, options, i );
  17000. } );
  17001. }
  17002. var rect, win,
  17003. elem = this[ 0 ];
  17004. if ( !elem ) {
  17005. return;
  17006. }
  17007. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  17008. // Support: IE <=11 only
  17009. // Running getBoundingClientRect on a
  17010. // disconnected node in IE throws an error
  17011. if ( !elem.getClientRects().length ) {
  17012. return { top: 0, left: 0 };
  17013. }
  17014. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  17015. rect = elem.getBoundingClientRect();
  17016. win = elem.ownerDocument.defaultView;
  17017. return {
  17018. top: rect.top + win.pageYOffset,
  17019. left: rect.left + win.pageXOffset
  17020. };
  17021. },
  17022. // position() relates an element's margin box to its offset parent's padding box
  17023. // This corresponds to the behavior of CSS absolute positioning
  17024. position: function() {
  17025. if ( !this[ 0 ] ) {
  17026. return;
  17027. }
  17028. var offsetParent, offset, doc,
  17029. elem = this[ 0 ],
  17030. parentOffset = { top: 0, left: 0 };
  17031. // position:fixed elements are offset from the viewport, which itself always has zero offset
  17032. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  17033. // Assume position:fixed implies availability of getBoundingClientRect
  17034. offset = elem.getBoundingClientRect();
  17035. } else {
  17036. offset = this.offset();
  17037. // Account for the *real* offset parent, which can be the document or its root element
  17038. // when a statically positioned element is identified
  17039. doc = elem.ownerDocument;
  17040. offsetParent = elem.offsetParent || doc.documentElement;
  17041. while ( offsetParent &&
  17042. ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
  17043. jQuery.css( offsetParent, "position" ) === "static" ) {
  17044. offsetParent = offsetParent.parentNode;
  17045. }
  17046. if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
  17047. // Incorporate borders into its offset, since they are outside its content origin
  17048. parentOffset = jQuery( offsetParent ).offset();
  17049. parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
  17050. parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
  17051. }
  17052. }
  17053. // Subtract parent offsets and element margins
  17054. return {
  17055. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  17056. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  17057. };
  17058. },
  17059. // This method will return documentElement in the following cases:
  17060. // 1) For the element inside the iframe without offsetParent, this method will return
  17061. // documentElement of the parent window
  17062. // 2) For the hidden or detached element
  17063. // 3) For body or html element, i.e. in case of the html node - it will return itself
  17064. //
  17065. // but those exceptions were never presented as a real life use-cases
  17066. // and might be considered as more preferable results.
  17067. //
  17068. // This logic, however, is not guaranteed and can change at any point in the future
  17069. offsetParent: function() {
  17070. return this.map( function() {
  17071. var offsetParent = this.offsetParent;
  17072. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  17073. offsetParent = offsetParent.offsetParent;
  17074. }
  17075. return offsetParent || documentElement;
  17076. } );
  17077. }
  17078. } );
  17079. // Create scrollLeft and scrollTop methods
  17080. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  17081. var top = "pageYOffset" === prop;
  17082. jQuery.fn[ method ] = function( val ) {
  17083. return access( this, function( elem, method, val ) {
  17084. // Coalesce documents and windows
  17085. var win;
  17086. if ( isWindow( elem ) ) {
  17087. win = elem;
  17088. } else if ( elem.nodeType === 9 ) {
  17089. win = elem.defaultView;
  17090. }
  17091. if ( val === undefined ) {
  17092. return win ? win[ prop ] : elem[ method ];
  17093. }
  17094. if ( win ) {
  17095. win.scrollTo(
  17096. !top ? val : win.pageXOffset,
  17097. top ? val : win.pageYOffset
  17098. );
  17099. } else {
  17100. elem[ method ] = val;
  17101. }
  17102. }, method, val, arguments.length );
  17103. };
  17104. } );
  17105. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  17106. // Add the top/left cssHooks using jQuery.fn.position
  17107. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  17108. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  17109. // getComputedStyle returns percent when specified for top/left/bottom/right;
  17110. // rather than make the css module depend on the offset module, just check for it here
  17111. jQuery.each( [ "top", "left" ], function( i, prop ) {
  17112. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  17113. function( elem, computed ) {
  17114. if ( computed ) {
  17115. computed = curCSS( elem, prop );
  17116. // If curCSS returns percentage, fallback to offset
  17117. return rnumnonpx.test( computed ) ?
  17118. jQuery( elem ).position()[ prop ] + "px" :
  17119. computed;
  17120. }
  17121. }
  17122. );
  17123. } );
  17124. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  17125. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  17126. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  17127. function( defaultExtra, funcName ) {
  17128. // Margin is only for outerHeight, outerWidth
  17129. jQuery.fn[ funcName ] = function( margin, value ) {
  17130. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  17131. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  17132. return access( this, function( elem, type, value ) {
  17133. var doc;
  17134. if ( isWindow( elem ) ) {
  17135. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  17136. return funcName.indexOf( "outer" ) === 0 ?
  17137. elem[ "inner" + name ] :
  17138. elem.document.documentElement[ "client" + name ];
  17139. }
  17140. // Get document width or height
  17141. if ( elem.nodeType === 9 ) {
  17142. doc = elem.documentElement;
  17143. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  17144. // whichever is greatest
  17145. return Math.max(
  17146. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  17147. elem.body[ "offset" + name ], doc[ "offset" + name ],
  17148. doc[ "client" + name ]
  17149. );
  17150. }
  17151. return value === undefined ?
  17152. // Get width or height on the element, requesting but not forcing parseFloat
  17153. jQuery.css( elem, type, extra ) :
  17154. // Set width or height on the element
  17155. jQuery.style( elem, type, value, extra );
  17156. }, type, chainable ? margin : undefined, chainable );
  17157. };
  17158. } );
  17159. } );
  17160. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  17161. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  17162. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  17163. function( i, name ) {
  17164. // Handle event binding
  17165. jQuery.fn[ name ] = function( data, fn ) {
  17166. return arguments.length > 0 ?
  17167. this.on( name, null, data, fn ) :
  17168. this.trigger( name );
  17169. };
  17170. } );
  17171. jQuery.fn.extend( {
  17172. hover: function( fnOver, fnOut ) {
  17173. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  17174. }
  17175. } );
  17176. jQuery.fn.extend( {
  17177. bind: function( types, data, fn ) {
  17178. return this.on( types, null, data, fn );
  17179. },
  17180. unbind: function( types, fn ) {
  17181. return this.off( types, null, fn );
  17182. },
  17183. delegate: function( selector, types, data, fn ) {
  17184. return this.on( types, selector, data, fn );
  17185. },
  17186. undelegate: function( selector, types, fn ) {
  17187. // ( namespace ) or ( selector, types [, fn] )
  17188. return arguments.length === 1 ?
  17189. this.off( selector, "**" ) :
  17190. this.off( types, selector || "**", fn );
  17191. }
  17192. } );
  17193. // Bind a function to a context, optionally partially applying any
  17194. // arguments.
  17195. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  17196. // However, it is not slated for removal any time soon
  17197. jQuery.proxy = function( fn, context ) {
  17198. var tmp, args, proxy;
  17199. if ( typeof context === "string" ) {
  17200. tmp = fn[ context ];
  17201. context = fn;
  17202. fn = tmp;
  17203. }
  17204. // Quick check to determine if target is callable, in the spec
  17205. // this throws a TypeError, but we will just return undefined.
  17206. if ( !isFunction( fn ) ) {
  17207. return undefined;
  17208. }
  17209. // Simulated bind
  17210. args = slice.call( arguments, 2 );
  17211. proxy = function() {
  17212. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  17213. };
  17214. // Set the guid of unique handler to the same of original handler, so it can be removed
  17215. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  17216. return proxy;
  17217. };
  17218. jQuery.holdReady = function( hold ) {
  17219. if ( hold ) {
  17220. jQuery.readyWait++;
  17221. } else {
  17222. jQuery.ready( true );
  17223. }
  17224. };
  17225. jQuery.isArray = Array.isArray;
  17226. jQuery.parseJSON = JSON.parse;
  17227. jQuery.nodeName = nodeName;
  17228. jQuery.isFunction = isFunction;
  17229. jQuery.isWindow = isWindow;
  17230. jQuery.camelCase = camelCase;
  17231. jQuery.type = toType;
  17232. jQuery.now = Date.now;
  17233. jQuery.isNumeric = function( obj ) {
  17234. // As of jQuery 3.0, isNumeric is limited to
  17235. // strings and numbers (primitives or objects)
  17236. // that can be coerced to finite numbers (gh-2662)
  17237. var type = jQuery.type( obj );
  17238. return ( type === "number" || type === "string" ) &&
  17239. // parseFloat NaNs numeric-cast false positives ("")
  17240. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  17241. // subtraction forces infinities to NaN
  17242. !isNaN( obj - parseFloat( obj ) );
  17243. };
  17244. // Register as a named AMD module, since jQuery can be concatenated with other
  17245. // files that may use define, but not via a proper concatenation script that
  17246. // understands anonymous AMD modules. A named AMD is safest and most robust
  17247. // way to register. Lowercase jquery is used because AMD module names are
  17248. // derived from file names, and jQuery is normally delivered in a lowercase
  17249. // file name. Do this after creating the global so that if an AMD module wants
  17250. // to call noConflict to hide this version of jQuery, it will work.
  17251. // Note that for maximum portability, libraries that are not jQuery should
  17252. // declare themselves as anonymous modules, and avoid setting a global if an
  17253. // AMD loader is present. jQuery is a special case. For more information, see
  17254. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  17255. if ( true ) {
  17256. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  17257. return jQuery;
  17258. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  17259. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  17260. }
  17261. var
  17262. // Map over jQuery in case of overwrite
  17263. _jQuery = window.jQuery,
  17264. // Map over the $ in case of overwrite
  17265. _$ = window.$;
  17266. jQuery.noConflict = function( deep ) {
  17267. if ( window.$ === jQuery ) {
  17268. window.$ = _$;
  17269. }
  17270. if ( deep && window.jQuery === jQuery ) {
  17271. window.jQuery = _jQuery;
  17272. }
  17273. return jQuery;
  17274. };
  17275. // Expose jQuery and $ identifiers, even in AMD
  17276. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  17277. // and CommonJS for browser emulators (#13566)
  17278. if ( !noGlobal ) {
  17279. window.jQuery = window.$ = jQuery;
  17280. }
  17281. return jQuery;
  17282. } );
  17283. /***/ }),
  17284. /***/ "./node_modules/laravel-echo/dist/echo.js":
  17285. /*!************************************************!*\
  17286. !*** ./node_modules/laravel-echo/dist/echo.js ***!
  17287. \************************************************/
  17288. /*! exports provided: default */
  17289. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  17290. "use strict";
  17291. __webpack_require__.r(__webpack_exports__);
  17292. var classCallCheck = function (instance, Constructor) {
  17293. if (!(instance instanceof Constructor)) {
  17294. throw new TypeError("Cannot call a class as a function");
  17295. }
  17296. };
  17297. var createClass = function () {
  17298. function defineProperties(target, props) {
  17299. for (var i = 0; i < props.length; i++) {
  17300. var descriptor = props[i];
  17301. descriptor.enumerable = descriptor.enumerable || false;
  17302. descriptor.configurable = true;
  17303. if ("value" in descriptor) descriptor.writable = true;
  17304. Object.defineProperty(target, descriptor.key, descriptor);
  17305. }
  17306. }
  17307. return function (Constructor, protoProps, staticProps) {
  17308. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  17309. if (staticProps) defineProperties(Constructor, staticProps);
  17310. return Constructor;
  17311. };
  17312. }();
  17313. var _extends = Object.assign || function (target) {
  17314. for (var i = 1; i < arguments.length; i++) {
  17315. var source = arguments[i];
  17316. for (var key in source) {
  17317. if (Object.prototype.hasOwnProperty.call(source, key)) {
  17318. target[key] = source[key];
  17319. }
  17320. }
  17321. }
  17322. return target;
  17323. };
  17324. var inherits = function (subClass, superClass) {
  17325. if (typeof superClass !== "function" && superClass !== null) {
  17326. throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  17327. }
  17328. subClass.prototype = Object.create(superClass && superClass.prototype, {
  17329. constructor: {
  17330. value: subClass,
  17331. enumerable: false,
  17332. writable: true,
  17333. configurable: true
  17334. }
  17335. });
  17336. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  17337. };
  17338. var possibleConstructorReturn = function (self, call) {
  17339. if (!self) {
  17340. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  17341. }
  17342. return call && (typeof call === "object" || typeof call === "function") ? call : self;
  17343. };
  17344. var Connector = function () {
  17345. /**
  17346. * Create a new class instance.
  17347. */
  17348. function Connector(options) {
  17349. classCallCheck(this, Connector);
  17350. /**
  17351. * Default connector options.
  17352. */
  17353. this._defaultOptions = {
  17354. auth: {
  17355. headers: {}
  17356. },
  17357. authEndpoint: '/broadcasting/auth',
  17358. broadcaster: 'pusher',
  17359. csrfToken: null,
  17360. host: null,
  17361. key: null,
  17362. namespace: 'App.Events'
  17363. };
  17364. this.setOptions(options);
  17365. this.connect();
  17366. }
  17367. /**
  17368. * Merge the custom options with the defaults.
  17369. */
  17370. createClass(Connector, [{
  17371. key: 'setOptions',
  17372. value: function setOptions(options) {
  17373. this.options = _extends(this._defaultOptions, options);
  17374. if (this.csrfToken()) {
  17375. this.options.auth.headers['X-CSRF-TOKEN'] = this.csrfToken();
  17376. }
  17377. return options;
  17378. }
  17379. /**
  17380. * Extract the CSRF token from the page.
  17381. */
  17382. }, {
  17383. key: 'csrfToken',
  17384. value: function csrfToken() {
  17385. var selector = void 0;
  17386. if (typeof window !== 'undefined' && window['Laravel'] && window['Laravel'].csrfToken) {
  17387. return window['Laravel'].csrfToken;
  17388. } else if (this.options.csrfToken) {
  17389. return this.options.csrfToken;
  17390. } else if (typeof document !== 'undefined' && typeof document.querySelector === 'function' && (selector = document.querySelector('meta[name="csrf-token"]'))) {
  17391. return selector.getAttribute('content');
  17392. }
  17393. return null;
  17394. }
  17395. }]);
  17396. return Connector;
  17397. }();
  17398. /**
  17399. * This class represents a basic channel.
  17400. */
  17401. var Channel = function () {
  17402. function Channel() {
  17403. classCallCheck(this, Channel);
  17404. }
  17405. createClass(Channel, [{
  17406. key: 'listenForWhisper',
  17407. /**
  17408. * Listen for a whisper event on the channel instance.
  17409. */
  17410. value: function listenForWhisper(event, callback) {
  17411. return this.listen('.client-' + event, callback);
  17412. }
  17413. /**
  17414. * Listen for an event on the channel instance.
  17415. */
  17416. }, {
  17417. key: 'notification',
  17418. value: function notification(callback) {
  17419. return this.listen('.Illuminate\\Notifications\\Events\\BroadcastNotificationCreated', callback);
  17420. }
  17421. /**
  17422. * Stop listening for a whispser event on the channel instance.
  17423. */
  17424. }, {
  17425. key: 'stopListeningForWhisper',
  17426. value: function stopListeningForWhisper(event) {
  17427. return this.stopListening('.client-' + event);
  17428. }
  17429. }]);
  17430. return Channel;
  17431. }();
  17432. /**
  17433. * Event name formatter
  17434. */
  17435. var EventFormatter = function () {
  17436. /**
  17437. * Create a new class instance.
  17438. */
  17439. function EventFormatter(namespace) {
  17440. classCallCheck(this, EventFormatter);
  17441. this.setNamespace(namespace);
  17442. }
  17443. /**
  17444. * Format the given event name.
  17445. */
  17446. createClass(EventFormatter, [{
  17447. key: 'format',
  17448. value: function format(event) {
  17449. if (event.charAt(0) === '.' || event.charAt(0) === '\\') {
  17450. return event.substr(1);
  17451. } else if (this.namespace) {
  17452. event = this.namespace + '.' + event;
  17453. }
  17454. return event.replace(/\./g, '\\');
  17455. }
  17456. /**
  17457. * Set the event namespace.
  17458. */
  17459. }, {
  17460. key: 'setNamespace',
  17461. value: function setNamespace(value) {
  17462. this.namespace = value;
  17463. }
  17464. }]);
  17465. return EventFormatter;
  17466. }();
  17467. /**
  17468. * This class represents a Pusher channel.
  17469. */
  17470. var PusherChannel = function (_Channel) {
  17471. inherits(PusherChannel, _Channel);
  17472. /**
  17473. * Create a new class instance.
  17474. */
  17475. function PusherChannel(pusher, name, options) {
  17476. classCallCheck(this, PusherChannel);
  17477. var _this = possibleConstructorReturn(this, (PusherChannel.__proto__ || Object.getPrototypeOf(PusherChannel)).call(this));
  17478. _this.name = name;
  17479. _this.pusher = pusher;
  17480. _this.options = options;
  17481. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  17482. _this.subscribe();
  17483. return _this;
  17484. }
  17485. /**
  17486. * Subscribe to a Pusher channel.
  17487. */
  17488. createClass(PusherChannel, [{
  17489. key: 'subscribe',
  17490. value: function subscribe() {
  17491. this.subscription = this.pusher.subscribe(this.name);
  17492. }
  17493. /**
  17494. * Unsubscribe from a Pusher channel.
  17495. */
  17496. }, {
  17497. key: 'unsubscribe',
  17498. value: function unsubscribe() {
  17499. this.pusher.unsubscribe(this.name);
  17500. }
  17501. /**
  17502. * Listen for an event on the channel instance.
  17503. */
  17504. }, {
  17505. key: 'listen',
  17506. value: function listen(event, callback) {
  17507. this.on(this.eventFormatter.format(event), callback);
  17508. return this;
  17509. }
  17510. /**
  17511. * Stop listening for an event on the channel instance.
  17512. */
  17513. }, {
  17514. key: 'stopListening',
  17515. value: function stopListening(event) {
  17516. this.subscription.unbind(this.eventFormatter.format(event));
  17517. return this;
  17518. }
  17519. /**
  17520. * Bind a channel to an event.
  17521. */
  17522. }, {
  17523. key: 'on',
  17524. value: function on(event, callback) {
  17525. this.subscription.bind(event, callback);
  17526. return this;
  17527. }
  17528. }]);
  17529. return PusherChannel;
  17530. }(Channel);
  17531. /**
  17532. * This class represents a Pusher private channel.
  17533. */
  17534. var PusherPrivateChannel = function (_PusherChannel) {
  17535. inherits(PusherPrivateChannel, _PusherChannel);
  17536. function PusherPrivateChannel() {
  17537. classCallCheck(this, PusherPrivateChannel);
  17538. return possibleConstructorReturn(this, (PusherPrivateChannel.__proto__ || Object.getPrototypeOf(PusherPrivateChannel)).apply(this, arguments));
  17539. }
  17540. createClass(PusherPrivateChannel, [{
  17541. key: 'whisper',
  17542. /**
  17543. * Trigger client event on the channel.
  17544. */
  17545. value: function whisper(eventName, data) {
  17546. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  17547. return this;
  17548. }
  17549. }]);
  17550. return PusherPrivateChannel;
  17551. }(PusherChannel);
  17552. /**
  17553. * This class represents a Pusher presence channel.
  17554. */
  17555. var PusherPresenceChannel = function (_PusherChannel) {
  17556. inherits(PusherPresenceChannel, _PusherChannel);
  17557. function PusherPresenceChannel() {
  17558. classCallCheck(this, PusherPresenceChannel);
  17559. return possibleConstructorReturn(this, (PusherPresenceChannel.__proto__ || Object.getPrototypeOf(PusherPresenceChannel)).apply(this, arguments));
  17560. }
  17561. createClass(PusherPresenceChannel, [{
  17562. key: 'here',
  17563. /**
  17564. * Register a callback to be called anytime the member list changes.
  17565. */
  17566. value: function here(callback) {
  17567. this.on('pusher:subscription_succeeded', function (data) {
  17568. callback(Object.keys(data.members).map(function (k) {
  17569. return data.members[k];
  17570. }));
  17571. });
  17572. return this;
  17573. }
  17574. /**
  17575. * Listen for someone joining the channel.
  17576. */
  17577. }, {
  17578. key: 'joining',
  17579. value: function joining(callback) {
  17580. this.on('pusher:member_added', function (member) {
  17581. callback(member.info);
  17582. });
  17583. return this;
  17584. }
  17585. /**
  17586. * Listen for someone leaving the channel.
  17587. */
  17588. }, {
  17589. key: 'leaving',
  17590. value: function leaving(callback) {
  17591. this.on('pusher:member_removed', function (member) {
  17592. callback(member.info);
  17593. });
  17594. return this;
  17595. }
  17596. /**
  17597. * Trigger client event on the channel.
  17598. */
  17599. }, {
  17600. key: 'whisper',
  17601. value: function whisper(eventName, data) {
  17602. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  17603. return this;
  17604. }
  17605. }]);
  17606. return PusherPresenceChannel;
  17607. }(PusherChannel);
  17608. /**
  17609. * This class represents a Socket.io channel.
  17610. */
  17611. var SocketIoChannel = function (_Channel) {
  17612. inherits(SocketIoChannel, _Channel);
  17613. /**
  17614. * Create a new class instance.
  17615. */
  17616. function SocketIoChannel(socket, name, options) {
  17617. classCallCheck(this, SocketIoChannel);
  17618. /**
  17619. * The event callbacks applied to the channel.
  17620. */
  17621. var _this = possibleConstructorReturn(this, (SocketIoChannel.__proto__ || Object.getPrototypeOf(SocketIoChannel)).call(this));
  17622. _this.events = {};
  17623. _this.name = name;
  17624. _this.socket = socket;
  17625. _this.options = options;
  17626. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  17627. _this.subscribe();
  17628. _this.configureReconnector();
  17629. return _this;
  17630. }
  17631. /**
  17632. * Subscribe to a Socket.io channel.
  17633. */
  17634. createClass(SocketIoChannel, [{
  17635. key: 'subscribe',
  17636. value: function subscribe() {
  17637. this.socket.emit('subscribe', {
  17638. channel: this.name,
  17639. auth: this.options.auth || {}
  17640. });
  17641. }
  17642. /**
  17643. * Unsubscribe from channel and ubind event callbacks.
  17644. */
  17645. }, {
  17646. key: 'unsubscribe',
  17647. value: function unsubscribe() {
  17648. this.unbind();
  17649. this.socket.emit('unsubscribe', {
  17650. channel: this.name,
  17651. auth: this.options.auth || {}
  17652. });
  17653. }
  17654. /**
  17655. * Listen for an event on the channel instance.
  17656. */
  17657. }, {
  17658. key: 'listen',
  17659. value: function listen(event, callback) {
  17660. this.on(this.eventFormatter.format(event), callback);
  17661. return this;
  17662. }
  17663. /**
  17664. * Stop listening for an event on the channel instance.
  17665. */
  17666. }, {
  17667. key: 'stopListening',
  17668. value: function stopListening(event) {
  17669. var name = this.eventFormatter.format(event);
  17670. this.socket.removeListener(name);
  17671. delete this.events[name];
  17672. return this;
  17673. }
  17674. /**
  17675. * Bind the channel's socket to an event and store the callback.
  17676. */
  17677. }, {
  17678. key: 'on',
  17679. value: function on(event, callback) {
  17680. var _this2 = this;
  17681. var listener = function listener(channel, data) {
  17682. if (_this2.name == channel) {
  17683. callback(data);
  17684. }
  17685. };
  17686. this.socket.on(event, listener);
  17687. this.bind(event, listener);
  17688. }
  17689. /**
  17690. * Attach a 'reconnect' listener and bind the event.
  17691. */
  17692. }, {
  17693. key: 'configureReconnector',
  17694. value: function configureReconnector() {
  17695. var _this3 = this;
  17696. var listener = function listener() {
  17697. _this3.subscribe();
  17698. };
  17699. this.socket.on('reconnect', listener);
  17700. this.bind('reconnect', listener);
  17701. }
  17702. /**
  17703. * Bind the channel's socket to an event and store the callback.
  17704. */
  17705. }, {
  17706. key: 'bind',
  17707. value: function bind(event, callback) {
  17708. this.events[event] = this.events[event] || [];
  17709. this.events[event].push(callback);
  17710. }
  17711. /**
  17712. * Unbind the channel's socket from all stored event callbacks.
  17713. */
  17714. }, {
  17715. key: 'unbind',
  17716. value: function unbind() {
  17717. var _this4 = this;
  17718. Object.keys(this.events).forEach(function (event) {
  17719. _this4.events[event].forEach(function (callback) {
  17720. _this4.socket.removeListener(event, callback);
  17721. });
  17722. delete _this4.events[event];
  17723. });
  17724. }
  17725. }]);
  17726. return SocketIoChannel;
  17727. }(Channel);
  17728. /**
  17729. * This class represents a Socket.io presence channel.
  17730. */
  17731. var SocketIoPrivateChannel = function (_SocketIoChannel) {
  17732. inherits(SocketIoPrivateChannel, _SocketIoChannel);
  17733. function SocketIoPrivateChannel() {
  17734. classCallCheck(this, SocketIoPrivateChannel);
  17735. return possibleConstructorReturn(this, (SocketIoPrivateChannel.__proto__ || Object.getPrototypeOf(SocketIoPrivateChannel)).apply(this, arguments));
  17736. }
  17737. createClass(SocketIoPrivateChannel, [{
  17738. key: 'whisper',
  17739. /**
  17740. * Trigger client event on the channel.
  17741. */
  17742. value: function whisper(eventName, data) {
  17743. this.socket.emit('client event', {
  17744. channel: this.name,
  17745. event: 'client-' + eventName,
  17746. data: data
  17747. });
  17748. return this;
  17749. }
  17750. }]);
  17751. return SocketIoPrivateChannel;
  17752. }(SocketIoChannel);
  17753. /**
  17754. * This class represents a Socket.io presence channel.
  17755. */
  17756. var SocketIoPresenceChannel = function (_SocketIoPrivateChann) {
  17757. inherits(SocketIoPresenceChannel, _SocketIoPrivateChann);
  17758. function SocketIoPresenceChannel() {
  17759. classCallCheck(this, SocketIoPresenceChannel);
  17760. return possibleConstructorReturn(this, (SocketIoPresenceChannel.__proto__ || Object.getPrototypeOf(SocketIoPresenceChannel)).apply(this, arguments));
  17761. }
  17762. createClass(SocketIoPresenceChannel, [{
  17763. key: 'here',
  17764. /**
  17765. * Register a callback to be called anytime the member list changes.
  17766. */
  17767. value: function here(callback) {
  17768. this.on('presence:subscribed', function (members) {
  17769. callback(members.map(function (m) {
  17770. return m.user_info;
  17771. }));
  17772. });
  17773. return this;
  17774. }
  17775. /**
  17776. * Listen for someone joining the channel.
  17777. */
  17778. }, {
  17779. key: 'joining',
  17780. value: function joining(callback) {
  17781. this.on('presence:joining', function (member) {
  17782. return callback(member.user_info);
  17783. });
  17784. return this;
  17785. }
  17786. /**
  17787. * Listen for someone leaving the channel.
  17788. */
  17789. }, {
  17790. key: 'leaving',
  17791. value: function leaving(callback) {
  17792. this.on('presence:leaving', function (member) {
  17793. return callback(member.user_info);
  17794. });
  17795. return this;
  17796. }
  17797. }]);
  17798. return SocketIoPresenceChannel;
  17799. }(SocketIoPrivateChannel);
  17800. /**
  17801. * This class represents a null channel.
  17802. */
  17803. var NullChannel = function (_Channel) {
  17804. inherits(NullChannel, _Channel);
  17805. function NullChannel() {
  17806. classCallCheck(this, NullChannel);
  17807. return possibleConstructorReturn(this, (NullChannel.__proto__ || Object.getPrototypeOf(NullChannel)).apply(this, arguments));
  17808. }
  17809. createClass(NullChannel, [{
  17810. key: 'subscribe',
  17811. /**
  17812. * Subscribe to a channel.
  17813. */
  17814. value: function subscribe() {}
  17815. //
  17816. /**
  17817. * Unsubscribe from a channel.
  17818. */
  17819. }, {
  17820. key: 'unsubscribe',
  17821. value: function unsubscribe() {}
  17822. //
  17823. /**
  17824. * Listen for an event on the channel instance.
  17825. */
  17826. }, {
  17827. key: 'listen',
  17828. value: function listen(event, callback) {
  17829. return this;
  17830. }
  17831. /**
  17832. * Stop listening for an event on the channel instance.
  17833. */
  17834. }, {
  17835. key: 'stopListening',
  17836. value: function stopListening(event) {
  17837. return this;
  17838. }
  17839. /**
  17840. * Bind a channel to an event.
  17841. */
  17842. }, {
  17843. key: 'on',
  17844. value: function on(event, callback) {
  17845. return this;
  17846. }
  17847. }]);
  17848. return NullChannel;
  17849. }(Channel);
  17850. /**
  17851. * This class represents a null private channel.
  17852. */
  17853. var NullPrivateChannel = function (_NullChannel) {
  17854. inherits(NullPrivateChannel, _NullChannel);
  17855. function NullPrivateChannel() {
  17856. classCallCheck(this, NullPrivateChannel);
  17857. return possibleConstructorReturn(this, (NullPrivateChannel.__proto__ || Object.getPrototypeOf(NullPrivateChannel)).apply(this, arguments));
  17858. }
  17859. createClass(NullPrivateChannel, [{
  17860. key: 'whisper',
  17861. /**
  17862. * Trigger client event on the channel.
  17863. */
  17864. value: function whisper(eventName, data) {
  17865. return this;
  17866. }
  17867. }]);
  17868. return NullPrivateChannel;
  17869. }(NullChannel);
  17870. /**
  17871. * This class represents a null presence channel.
  17872. */
  17873. var NullPresenceChannel = function (_NullChannel) {
  17874. inherits(NullPresenceChannel, _NullChannel);
  17875. function NullPresenceChannel() {
  17876. classCallCheck(this, NullPresenceChannel);
  17877. return possibleConstructorReturn(this, (NullPresenceChannel.__proto__ || Object.getPrototypeOf(NullPresenceChannel)).apply(this, arguments));
  17878. }
  17879. createClass(NullPresenceChannel, [{
  17880. key: 'here',
  17881. /**
  17882. * Register a callback to be called anytime the member list changes.
  17883. */
  17884. value: function here(callback) {
  17885. return this;
  17886. }
  17887. /**
  17888. * Listen for someone joining the channel.
  17889. */
  17890. }, {
  17891. key: 'joining',
  17892. value: function joining(callback) {
  17893. return this;
  17894. }
  17895. /**
  17896. * Listen for someone leaving the channel.
  17897. */
  17898. }, {
  17899. key: 'leaving',
  17900. value: function leaving(callback) {
  17901. return this;
  17902. }
  17903. /**
  17904. * Trigger client event on the channel.
  17905. */
  17906. }, {
  17907. key: 'whisper',
  17908. value: function whisper(eventName, data) {
  17909. return this;
  17910. }
  17911. }]);
  17912. return NullPresenceChannel;
  17913. }(NullChannel);
  17914. /**
  17915. * This class creates a connector to Pusher.
  17916. */
  17917. var PusherConnector = function (_Connector) {
  17918. inherits(PusherConnector, _Connector);
  17919. function PusherConnector() {
  17920. classCallCheck(this, PusherConnector);
  17921. /**
  17922. * All of the subscribed channel names.
  17923. */
  17924. var _this = possibleConstructorReturn(this, (PusherConnector.__proto__ || Object.getPrototypeOf(PusherConnector)).apply(this, arguments));
  17925. _this.channels = {};
  17926. return _this;
  17927. }
  17928. /**
  17929. * Create a fresh Pusher connection.
  17930. */
  17931. createClass(PusherConnector, [{
  17932. key: 'connect',
  17933. value: function connect() {
  17934. if (typeof this.options.client !== 'undefined') {
  17935. this.pusher = this.options.client;
  17936. } else {
  17937. this.pusher = new Pusher(this.options.key, this.options);
  17938. }
  17939. }
  17940. /**
  17941. * Listen for an event on a channel instance.
  17942. */
  17943. }, {
  17944. key: 'listen',
  17945. value: function listen(name, event, callback) {
  17946. return this.channel(name).listen(event, callback);
  17947. }
  17948. /**
  17949. * Get a channel instance by name.
  17950. */
  17951. }, {
  17952. key: 'channel',
  17953. value: function channel(name) {
  17954. if (!this.channels[name]) {
  17955. this.channels[name] = new PusherChannel(this.pusher, name, this.options);
  17956. }
  17957. return this.channels[name];
  17958. }
  17959. /**
  17960. * Get a private channel instance by name.
  17961. */
  17962. }, {
  17963. key: 'privateChannel',
  17964. value: function privateChannel(name) {
  17965. if (!this.channels['private-' + name]) {
  17966. this.channels['private-' + name] = new PusherPrivateChannel(this.pusher, 'private-' + name, this.options);
  17967. }
  17968. return this.channels['private-' + name];
  17969. }
  17970. /**
  17971. * Get a presence channel instance by name.
  17972. */
  17973. }, {
  17974. key: 'presenceChannel',
  17975. value: function presenceChannel(name) {
  17976. if (!this.channels['presence-' + name]) {
  17977. this.channels['presence-' + name] = new PusherPresenceChannel(this.pusher, 'presence-' + name, this.options);
  17978. }
  17979. return this.channels['presence-' + name];
  17980. }
  17981. /**
  17982. * Leave the given channel, as well as its private and presence variants.
  17983. */
  17984. }, {
  17985. key: 'leave',
  17986. value: function leave(name) {
  17987. var _this2 = this;
  17988. var channels = [name, 'private-' + name, 'presence-' + name];
  17989. channels.forEach(function (name, index) {
  17990. _this2.leaveChannel(name);
  17991. });
  17992. }
  17993. /**
  17994. * Leave the given channel.
  17995. */
  17996. }, {
  17997. key: 'leaveChannel',
  17998. value: function leaveChannel(name) {
  17999. if (this.channels[name]) {
  18000. this.channels[name].unsubscribe();
  18001. delete this.channels[name];
  18002. }
  18003. }
  18004. /**
  18005. * Get the socket ID for the connection.
  18006. */
  18007. }, {
  18008. key: 'socketId',
  18009. value: function socketId() {
  18010. return this.pusher.connection.socket_id;
  18011. }
  18012. /**
  18013. * Disconnect Pusher connection.
  18014. */
  18015. }, {
  18016. key: 'disconnect',
  18017. value: function disconnect() {
  18018. this.pusher.disconnect();
  18019. }
  18020. }]);
  18021. return PusherConnector;
  18022. }(Connector);
  18023. /**
  18024. * This class creates a connnector to a Socket.io server.
  18025. */
  18026. var SocketIoConnector = function (_Connector) {
  18027. inherits(SocketIoConnector, _Connector);
  18028. function SocketIoConnector() {
  18029. classCallCheck(this, SocketIoConnector);
  18030. /**
  18031. * All of the subscribed channel names.
  18032. */
  18033. var _this = possibleConstructorReturn(this, (SocketIoConnector.__proto__ || Object.getPrototypeOf(SocketIoConnector)).apply(this, arguments));
  18034. _this.channels = {};
  18035. return _this;
  18036. }
  18037. /**
  18038. * Create a fresh Socket.io connection.
  18039. */
  18040. createClass(SocketIoConnector, [{
  18041. key: 'connect',
  18042. value: function connect() {
  18043. var io = this.getSocketIO();
  18044. this.socket = io(this.options.host, this.options);
  18045. return this.socket;
  18046. }
  18047. /**
  18048. * Get socket.io module from global scope or options.
  18049. */
  18050. }, {
  18051. key: 'getSocketIO',
  18052. value: function getSocketIO() {
  18053. if (typeof this.options.client !== 'undefined') {
  18054. return this.options.client;
  18055. }
  18056. if (typeof io !== 'undefined') {
  18057. return io;
  18058. }
  18059. throw new Error('Socket.io client not found. Should be globally available or passed via options.client');
  18060. }
  18061. /**
  18062. * Listen for an event on a channel instance.
  18063. */
  18064. }, {
  18065. key: 'listen',
  18066. value: function listen(name, event, callback) {
  18067. return this.channel(name).listen(event, callback);
  18068. }
  18069. /**
  18070. * Get a channel instance by name.
  18071. */
  18072. }, {
  18073. key: 'channel',
  18074. value: function channel(name) {
  18075. if (!this.channels[name]) {
  18076. this.channels[name] = new SocketIoChannel(this.socket, name, this.options);
  18077. }
  18078. return this.channels[name];
  18079. }
  18080. /**
  18081. * Get a private channel instance by name.
  18082. */
  18083. }, {
  18084. key: 'privateChannel',
  18085. value: function privateChannel(name) {
  18086. if (!this.channels['private-' + name]) {
  18087. this.channels['private-' + name] = new SocketIoPrivateChannel(this.socket, 'private-' + name, this.options);
  18088. }
  18089. return this.channels['private-' + name];
  18090. }
  18091. /**
  18092. * Get a presence channel instance by name.
  18093. */
  18094. }, {
  18095. key: 'presenceChannel',
  18096. value: function presenceChannel(name) {
  18097. if (!this.channels['presence-' + name]) {
  18098. this.channels['presence-' + name] = new SocketIoPresenceChannel(this.socket, 'presence-' + name, this.options);
  18099. }
  18100. return this.channels['presence-' + name];
  18101. }
  18102. /**
  18103. * Leave the given channel, as well as its private and presence variants.
  18104. */
  18105. }, {
  18106. key: 'leave',
  18107. value: function leave(name) {
  18108. var _this2 = this;
  18109. var channels = [name, 'private-' + name, 'presence-' + name];
  18110. channels.forEach(function (name) {
  18111. _this2.leaveChannel(name);
  18112. });
  18113. }
  18114. /**
  18115. * Leave the given channel.
  18116. */
  18117. }, {
  18118. key: 'leaveChannel',
  18119. value: function leaveChannel(name) {
  18120. if (this.channels[name]) {
  18121. this.channels[name].unsubscribe();
  18122. delete this.channels[name];
  18123. }
  18124. }
  18125. /**
  18126. * Get the socket ID for the connection.
  18127. */
  18128. }, {
  18129. key: 'socketId',
  18130. value: function socketId() {
  18131. return this.socket.id;
  18132. }
  18133. /**
  18134. * Disconnect Socketio connection.
  18135. */
  18136. }, {
  18137. key: 'disconnect',
  18138. value: function disconnect() {
  18139. this.socket.disconnect();
  18140. }
  18141. }]);
  18142. return SocketIoConnector;
  18143. }(Connector);
  18144. /**
  18145. * This class creates a null connector.
  18146. */
  18147. var NullConnector = function (_Connector) {
  18148. inherits(NullConnector, _Connector);
  18149. function NullConnector() {
  18150. classCallCheck(this, NullConnector);
  18151. /**
  18152. * All of the subscribed channel names.
  18153. */
  18154. var _this = possibleConstructorReturn(this, (NullConnector.__proto__ || Object.getPrototypeOf(NullConnector)).apply(this, arguments));
  18155. _this.channels = {};
  18156. return _this;
  18157. }
  18158. /**
  18159. * Create a fresh connection.
  18160. */
  18161. createClass(NullConnector, [{
  18162. key: 'connect',
  18163. value: function connect() {}
  18164. //
  18165. /**
  18166. * Listen for an event on a channel instance.
  18167. */
  18168. }, {
  18169. key: 'listen',
  18170. value: function listen(name, event, callback) {
  18171. return new NullChannel();
  18172. }
  18173. /**
  18174. * Get a channel instance by name.
  18175. */
  18176. }, {
  18177. key: 'channel',
  18178. value: function channel(name) {
  18179. return new NullChannel();
  18180. }
  18181. /**
  18182. * Get a private channel instance by name.
  18183. */
  18184. }, {
  18185. key: 'privateChannel',
  18186. value: function privateChannel(name) {
  18187. return new NullPrivateChannel();
  18188. }
  18189. /**
  18190. * Get a presence channel instance by name.
  18191. */
  18192. }, {
  18193. key: 'presenceChannel',
  18194. value: function presenceChannel(name) {
  18195. return new NullPresenceChannel();
  18196. }
  18197. /**
  18198. * Leave the given channel, as well as its private and presence variants.
  18199. */
  18200. }, {
  18201. key: 'leave',
  18202. value: function leave(name) {}
  18203. //
  18204. /**
  18205. * Leave the given channel.
  18206. */
  18207. }, {
  18208. key: 'leaveChannel',
  18209. value: function leaveChannel(name) {}
  18210. //
  18211. /**
  18212. * Get the socket ID for the connection.
  18213. */
  18214. }, {
  18215. key: 'socketId',
  18216. value: function socketId() {
  18217. return 'fake-socket-id';
  18218. }
  18219. /**
  18220. * Disconnect the connection.
  18221. */
  18222. }, {
  18223. key: 'disconnect',
  18224. value: function disconnect() {
  18225. //
  18226. }
  18227. }]);
  18228. return NullConnector;
  18229. }(Connector);
  18230. /**
  18231. * This class is the primary API for interacting with broadcasting.
  18232. */
  18233. var Echo = function () {
  18234. /**
  18235. * Create a new class instance.
  18236. */
  18237. function Echo(options) {
  18238. classCallCheck(this, Echo);
  18239. this.options = options;
  18240. this.connect();
  18241. if (!this.options.withoutInterceptors) {
  18242. this.registerInterceptors();
  18243. }
  18244. }
  18245. /**
  18246. * Get a channel instance by name.
  18247. */
  18248. createClass(Echo, [{
  18249. key: 'channel',
  18250. value: function channel(_channel) {
  18251. return this.connector.channel(_channel);
  18252. }
  18253. /**
  18254. * Create a new connection.
  18255. */
  18256. }, {
  18257. key: 'connect',
  18258. value: function connect() {
  18259. if (this.options.broadcaster == 'pusher') {
  18260. this.connector = new PusherConnector(this.options);
  18261. } else if (this.options.broadcaster == 'socket.io') {
  18262. this.connector = new SocketIoConnector(this.options);
  18263. } else if (this.options.broadcaster == 'null') {
  18264. this.connector = new NullConnector(this.options);
  18265. } else if (typeof this.options.broadcaster == 'function') {
  18266. this.connector = new this.options.broadcaster(this.options);
  18267. }
  18268. }
  18269. /**
  18270. * Disconnect from the Echo server.
  18271. */
  18272. }, {
  18273. key: 'disconnect',
  18274. value: function disconnect() {
  18275. this.connector.disconnect();
  18276. }
  18277. /**
  18278. * Get a presence channel instance by name.
  18279. */
  18280. }, {
  18281. key: 'join',
  18282. value: function join(channel) {
  18283. return this.connector.presenceChannel(channel);
  18284. }
  18285. /**
  18286. * Leave the given channel, as well as its private and presence variants.
  18287. */
  18288. }, {
  18289. key: 'leave',
  18290. value: function leave(channel) {
  18291. this.connector.leave(channel);
  18292. }
  18293. /**
  18294. * Leave the given channel.
  18295. */
  18296. }, {
  18297. key: 'leaveChannel',
  18298. value: function leaveChannel(channel) {
  18299. this.connector.leaveChannel(channel);
  18300. }
  18301. /**
  18302. * Listen for an event on a channel instance.
  18303. */
  18304. }, {
  18305. key: 'listen',
  18306. value: function listen(channel, event, callback) {
  18307. return this.connector.listen(channel, event, callback);
  18308. }
  18309. /**
  18310. * Get a private channel instance by name.
  18311. */
  18312. }, {
  18313. key: 'private',
  18314. value: function _private(channel) {
  18315. return this.connector.privateChannel(channel);
  18316. }
  18317. /**
  18318. * Get the Socket ID for the connection.
  18319. */
  18320. }, {
  18321. key: 'socketId',
  18322. value: function socketId() {
  18323. return this.connector.socketId();
  18324. }
  18325. /**
  18326. * Register 3rd party request interceptiors. These are used to automatically
  18327. * send a connections socket id to a Laravel app with a X-Socket-Id header.
  18328. */
  18329. }, {
  18330. key: 'registerInterceptors',
  18331. value: function registerInterceptors() {
  18332. if (typeof Vue === 'function' && Vue.http) {
  18333. this.registerVueRequestInterceptor();
  18334. }
  18335. if (typeof axios === 'function') {
  18336. this.registerAxiosRequestInterceptor();
  18337. }
  18338. if (typeof jQuery === 'function') {
  18339. this.registerjQueryAjaxSetup();
  18340. }
  18341. }
  18342. /**
  18343. * Register a Vue HTTP interceptor to add the X-Socket-ID header.
  18344. */
  18345. }, {
  18346. key: 'registerVueRequestInterceptor',
  18347. value: function registerVueRequestInterceptor() {
  18348. var _this = this;
  18349. Vue.http.interceptors.push(function (request, next) {
  18350. if (_this.socketId()) {
  18351. request.headers.set('X-Socket-ID', _this.socketId());
  18352. }
  18353. next();
  18354. });
  18355. }
  18356. /**
  18357. * Register an Axios HTTP interceptor to add the X-Socket-ID header.
  18358. */
  18359. }, {
  18360. key: 'registerAxiosRequestInterceptor',
  18361. value: function registerAxiosRequestInterceptor() {
  18362. var _this2 = this;
  18363. axios.interceptors.request.use(function (config) {
  18364. if (_this2.socketId()) {
  18365. config.headers['X-Socket-Id'] = _this2.socketId();
  18366. }
  18367. return config;
  18368. });
  18369. }
  18370. /**
  18371. * Register jQuery AjaxPrefilter to add the X-Socket-ID header.
  18372. */
  18373. }, {
  18374. key: 'registerjQueryAjaxSetup',
  18375. value: function registerjQueryAjaxSetup() {
  18376. var _this3 = this;
  18377. if (typeof jQuery.ajax != 'undefined') {
  18378. jQuery.ajaxPrefilter(function (options, originalOptions, xhr) {
  18379. if (_this3.socketId()) {
  18380. xhr.setRequestHeader('X-Socket-Id', _this3.socketId());
  18381. }
  18382. });
  18383. }
  18384. }
  18385. }]);
  18386. return Echo;
  18387. }();
  18388. /* harmony default export */ __webpack_exports__["default"] = (Echo);
  18389. /***/ }),
  18390. /***/ "./node_modules/lodash/lodash.js":
  18391. /*!***************************************!*\
  18392. !*** ./node_modules/lodash/lodash.js ***!
  18393. \***************************************/
  18394. /*! no static exports found */
  18395. /***/ (function(module, exports, __webpack_require__) {
  18396. /* WEBPACK VAR INJECTION */(function(global, module) {var __WEBPACK_AMD_DEFINE_RESULT__;/**
  18397. * @license
  18398. * Lodash <https://lodash.com/>
  18399. * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
  18400. * Released under MIT license <https://lodash.com/license>
  18401. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  18402. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  18403. */
  18404. ;(function() {
  18405. /** Used as a safe reference for `undefined` in pre-ES5 environments. */
  18406. var undefined;
  18407. /** Used as the semantic version number. */
  18408. var VERSION = '4.17.15';
  18409. /** Used as the size to enable large array optimizations. */
  18410. var LARGE_ARRAY_SIZE = 200;
  18411. /** Error message constants. */
  18412. var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
  18413. FUNC_ERROR_TEXT = 'Expected a function';
  18414. /** Used to stand-in for `undefined` hash values. */
  18415. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  18416. /** Used as the maximum memoize cache size. */
  18417. var MAX_MEMOIZE_SIZE = 500;
  18418. /** Used as the internal argument placeholder. */
  18419. var PLACEHOLDER = '__lodash_placeholder__';
  18420. /** Used to compose bitmasks for cloning. */
  18421. var CLONE_DEEP_FLAG = 1,
  18422. CLONE_FLAT_FLAG = 2,
  18423. CLONE_SYMBOLS_FLAG = 4;
  18424. /** Used to compose bitmasks for value comparisons. */
  18425. var COMPARE_PARTIAL_FLAG = 1,
  18426. COMPARE_UNORDERED_FLAG = 2;
  18427. /** Used to compose bitmasks for function metadata. */
  18428. var WRAP_BIND_FLAG = 1,
  18429. WRAP_BIND_KEY_FLAG = 2,
  18430. WRAP_CURRY_BOUND_FLAG = 4,
  18431. WRAP_CURRY_FLAG = 8,
  18432. WRAP_CURRY_RIGHT_FLAG = 16,
  18433. WRAP_PARTIAL_FLAG = 32,
  18434. WRAP_PARTIAL_RIGHT_FLAG = 64,
  18435. WRAP_ARY_FLAG = 128,
  18436. WRAP_REARG_FLAG = 256,
  18437. WRAP_FLIP_FLAG = 512;
  18438. /** Used as default options for `_.truncate`. */
  18439. var DEFAULT_TRUNC_LENGTH = 30,
  18440. DEFAULT_TRUNC_OMISSION = '...';
  18441. /** Used to detect hot functions by number of calls within a span of milliseconds. */
  18442. var HOT_COUNT = 800,
  18443. HOT_SPAN = 16;
  18444. /** Used to indicate the type of lazy iteratees. */
  18445. var LAZY_FILTER_FLAG = 1,
  18446. LAZY_MAP_FLAG = 2,
  18447. LAZY_WHILE_FLAG = 3;
  18448. /** Used as references for various `Number` constants. */
  18449. var INFINITY = 1 / 0,
  18450. MAX_SAFE_INTEGER = 9007199254740991,
  18451. MAX_INTEGER = 1.7976931348623157e+308,
  18452. NAN = 0 / 0;
  18453. /** Used as references for the maximum length and index of an array. */
  18454. var MAX_ARRAY_LENGTH = 4294967295,
  18455. MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
  18456. HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
  18457. /** Used to associate wrap methods with their bit flags. */
  18458. var wrapFlags = [
  18459. ['ary', WRAP_ARY_FLAG],
  18460. ['bind', WRAP_BIND_FLAG],
  18461. ['bindKey', WRAP_BIND_KEY_FLAG],
  18462. ['curry', WRAP_CURRY_FLAG],
  18463. ['curryRight', WRAP_CURRY_RIGHT_FLAG],
  18464. ['flip', WRAP_FLIP_FLAG],
  18465. ['partial', WRAP_PARTIAL_FLAG],
  18466. ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
  18467. ['rearg', WRAP_REARG_FLAG]
  18468. ];
  18469. /** `Object#toString` result references. */
  18470. var argsTag = '[object Arguments]',
  18471. arrayTag = '[object Array]',
  18472. asyncTag = '[object AsyncFunction]',
  18473. boolTag = '[object Boolean]',
  18474. dateTag = '[object Date]',
  18475. domExcTag = '[object DOMException]',
  18476. errorTag = '[object Error]',
  18477. funcTag = '[object Function]',
  18478. genTag = '[object GeneratorFunction]',
  18479. mapTag = '[object Map]',
  18480. numberTag = '[object Number]',
  18481. nullTag = '[object Null]',
  18482. objectTag = '[object Object]',
  18483. promiseTag = '[object Promise]',
  18484. proxyTag = '[object Proxy]',
  18485. regexpTag = '[object RegExp]',
  18486. setTag = '[object Set]',
  18487. stringTag = '[object String]',
  18488. symbolTag = '[object Symbol]',
  18489. undefinedTag = '[object Undefined]',
  18490. weakMapTag = '[object WeakMap]',
  18491. weakSetTag = '[object WeakSet]';
  18492. var arrayBufferTag = '[object ArrayBuffer]',
  18493. dataViewTag = '[object DataView]',
  18494. float32Tag = '[object Float32Array]',
  18495. float64Tag = '[object Float64Array]',
  18496. int8Tag = '[object Int8Array]',
  18497. int16Tag = '[object Int16Array]',
  18498. int32Tag = '[object Int32Array]',
  18499. uint8Tag = '[object Uint8Array]',
  18500. uint8ClampedTag = '[object Uint8ClampedArray]',
  18501. uint16Tag = '[object Uint16Array]',
  18502. uint32Tag = '[object Uint32Array]';
  18503. /** Used to match empty string literals in compiled template source. */
  18504. var reEmptyStringLeading = /\b__p \+= '';/g,
  18505. reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
  18506. reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  18507. /** Used to match HTML entities and HTML characters. */
  18508. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
  18509. reUnescapedHtml = /[&<>"']/g,
  18510. reHasEscapedHtml = RegExp(reEscapedHtml.source),
  18511. reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  18512. /** Used to match template delimiters. */
  18513. var reEscape = /<%-([\s\S]+?)%>/g,
  18514. reEvaluate = /<%([\s\S]+?)%>/g,
  18515. reInterpolate = /<%=([\s\S]+?)%>/g;
  18516. /** Used to match property names within property paths. */
  18517. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  18518. reIsPlainProp = /^\w*$/,
  18519. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  18520. /**
  18521. * Used to match `RegExp`
  18522. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  18523. */
  18524. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
  18525. reHasRegExpChar = RegExp(reRegExpChar.source);
  18526. /** Used to match leading and trailing whitespace. */
  18527. var reTrim = /^\s+|\s+$/g,
  18528. reTrimStart = /^\s+/,
  18529. reTrimEnd = /\s+$/;
  18530. /** Used to match wrap detail comments. */
  18531. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
  18532. reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
  18533. reSplitDetails = /,? & /;
  18534. /** Used to match words composed of alphanumeric characters. */
  18535. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  18536. /** Used to match backslashes in property paths. */
  18537. var reEscapeChar = /\\(\\)?/g;
  18538. /**
  18539. * Used to match
  18540. * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
  18541. */
  18542. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  18543. /** Used to match `RegExp` flags from their coerced string values. */
  18544. var reFlags = /\w*$/;
  18545. /** Used to detect bad signed hexadecimal string values. */
  18546. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  18547. /** Used to detect binary string values. */
  18548. var reIsBinary = /^0b[01]+$/i;
  18549. /** Used to detect host constructors (Safari). */
  18550. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  18551. /** Used to detect octal string values. */
  18552. var reIsOctal = /^0o[0-7]+$/i;
  18553. /** Used to detect unsigned integer values. */
  18554. var reIsUint = /^(?:0|[1-9]\d*)$/;
  18555. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  18556. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  18557. /** Used to ensure capturing order of template delimiters. */
  18558. var reNoMatch = /($^)/;
  18559. /** Used to match unescaped characters in compiled string literals. */
  18560. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  18561. /** Used to compose unicode character classes. */
  18562. var rsAstralRange = '\\ud800-\\udfff',
  18563. rsComboMarksRange = '\\u0300-\\u036f',
  18564. reComboHalfMarksRange = '\\ufe20-\\ufe2f',
  18565. rsComboSymbolsRange = '\\u20d0-\\u20ff',
  18566. rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
  18567. rsDingbatRange = '\\u2700-\\u27bf',
  18568. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  18569. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  18570. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  18571. rsPunctuationRange = '\\u2000-\\u206f',
  18572. 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',
  18573. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  18574. rsVarRange = '\\ufe0e\\ufe0f',
  18575. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  18576. /** Used to compose unicode capture groups. */
  18577. var rsApos = "['\u2019]",
  18578. rsAstral = '[' + rsAstralRange + ']',
  18579. rsBreak = '[' + rsBreakRange + ']',
  18580. rsCombo = '[' + rsComboRange + ']',
  18581. rsDigits = '\\d+',
  18582. rsDingbat = '[' + rsDingbatRange + ']',
  18583. rsLower = '[' + rsLowerRange + ']',
  18584. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  18585. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  18586. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  18587. rsNonAstral = '[^' + rsAstralRange + ']',
  18588. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  18589. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  18590. rsUpper = '[' + rsUpperRange + ']',
  18591. rsZWJ = '\\u200d';
  18592. /** Used to compose unicode regexes. */
  18593. var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
  18594. rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
  18595. rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  18596. rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  18597. reOptMod = rsModifier + '?',
  18598. rsOptVar = '[' + rsVarRange + ']?',
  18599. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  18600. rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
  18601. rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
  18602. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  18603. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  18604. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  18605. /** Used to match apostrophes. */
  18606. var reApos = RegExp(rsApos, 'g');
  18607. /**
  18608. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  18609. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  18610. */
  18611. var reComboMark = RegExp(rsCombo, 'g');
  18612. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  18613. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  18614. /** Used to match complex or compound words. */
  18615. var reUnicodeWord = RegExp([
  18616. rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  18617. rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
  18618. rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
  18619. rsUpper + '+' + rsOptContrUpper,
  18620. rsOrdUpper,
  18621. rsOrdLower,
  18622. rsDigits,
  18623. rsEmoji
  18624. ].join('|'), 'g');
  18625. /** 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/). */
  18626. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
  18627. /** Used to detect strings that need a more robust regexp to match words. */
  18628. 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 ]/;
  18629. /** Used to assign default `context` object properties. */
  18630. var contextProps = [
  18631. 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
  18632. 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
  18633. 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
  18634. 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
  18635. '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
  18636. ];
  18637. /** Used to make template sourceURLs easier to identify. */
  18638. var templateCounter = -1;
  18639. /** Used to identify `toStringTag` values of typed arrays. */
  18640. var typedArrayTags = {};
  18641. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  18642. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  18643. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  18644. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  18645. typedArrayTags[uint32Tag] = true;
  18646. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  18647. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  18648. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  18649. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  18650. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  18651. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  18652. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  18653. typedArrayTags[weakMapTag] = false;
  18654. /** Used to identify `toStringTag` values supported by `_.clone`. */
  18655. var cloneableTags = {};
  18656. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  18657. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  18658. cloneableTags[boolTag] = cloneableTags[dateTag] =
  18659. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  18660. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  18661. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  18662. cloneableTags[numberTag] = cloneableTags[objectTag] =
  18663. cloneableTags[regexpTag] = cloneableTags[setTag] =
  18664. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  18665. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  18666. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  18667. cloneableTags[errorTag] = cloneableTags[funcTag] =
  18668. cloneableTags[weakMapTag] = false;
  18669. /** Used to map Latin Unicode letters to basic Latin letters. */
  18670. var deburredLetters = {
  18671. // Latin-1 Supplement block.
  18672. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  18673. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  18674. '\xc7': 'C', '\xe7': 'c',
  18675. '\xd0': 'D', '\xf0': 'd',
  18676. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  18677. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  18678. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  18679. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  18680. '\xd1': 'N', '\xf1': 'n',
  18681. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  18682. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  18683. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  18684. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  18685. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  18686. '\xc6': 'Ae', '\xe6': 'ae',
  18687. '\xde': 'Th', '\xfe': 'th',
  18688. '\xdf': 'ss',
  18689. // Latin Extended-A block.
  18690. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  18691. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  18692. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  18693. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  18694. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  18695. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  18696. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  18697. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  18698. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  18699. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  18700. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  18701. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  18702. '\u0134': 'J', '\u0135': 'j',
  18703. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  18704. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  18705. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  18706. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  18707. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  18708. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  18709. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  18710. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  18711. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  18712. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  18713. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  18714. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  18715. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  18716. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  18717. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  18718. '\u0174': 'W', '\u0175': 'w',
  18719. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  18720. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  18721. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  18722. '\u0132': 'IJ', '\u0133': 'ij',
  18723. '\u0152': 'Oe', '\u0153': 'oe',
  18724. '\u0149': "'n", '\u017f': 's'
  18725. };
  18726. /** Used to map characters to HTML entities. */
  18727. var htmlEscapes = {
  18728. '&': '&amp;',
  18729. '<': '&lt;',
  18730. '>': '&gt;',
  18731. '"': '&quot;',
  18732. "'": '&#39;'
  18733. };
  18734. /** Used to map HTML entities to characters. */
  18735. var htmlUnescapes = {
  18736. '&amp;': '&',
  18737. '&lt;': '<',
  18738. '&gt;': '>',
  18739. '&quot;': '"',
  18740. '&#39;': "'"
  18741. };
  18742. /** Used to escape characters for inclusion in compiled string literals. */
  18743. var stringEscapes = {
  18744. '\\': '\\',
  18745. "'": "'",
  18746. '\n': 'n',
  18747. '\r': 'r',
  18748. '\u2028': 'u2028',
  18749. '\u2029': 'u2029'
  18750. };
  18751. /** Built-in method references without a dependency on `root`. */
  18752. var freeParseFloat = parseFloat,
  18753. freeParseInt = parseInt;
  18754. /** Detect free variable `global` from Node.js. */
  18755. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  18756. /** Detect free variable `self`. */
  18757. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  18758. /** Used as a reference to the global object. */
  18759. var root = freeGlobal || freeSelf || Function('return this')();
  18760. /** Detect free variable `exports`. */
  18761. var freeExports = true && exports && !exports.nodeType && exports;
  18762. /** Detect free variable `module`. */
  18763. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  18764. /** Detect the popular CommonJS extension `module.exports`. */
  18765. var moduleExports = freeModule && freeModule.exports === freeExports;
  18766. /** Detect free variable `process` from Node.js. */
  18767. var freeProcess = moduleExports && freeGlobal.process;
  18768. /** Used to access faster Node.js helpers. */
  18769. var nodeUtil = (function() {
  18770. try {
  18771. // Use `util.types` for Node.js 10+.
  18772. var types = freeModule && freeModule.require && freeModule.require('util').types;
  18773. if (types) {
  18774. return types;
  18775. }
  18776. // Legacy `process.binding('util')` for Node.js < 10.
  18777. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  18778. } catch (e) {}
  18779. }());
  18780. /* Node.js helper references. */
  18781. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
  18782. nodeIsDate = nodeUtil && nodeUtil.isDate,
  18783. nodeIsMap = nodeUtil && nodeUtil.isMap,
  18784. nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
  18785. nodeIsSet = nodeUtil && nodeUtil.isSet,
  18786. nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  18787. /*--------------------------------------------------------------------------*/
  18788. /**
  18789. * A faster alternative to `Function#apply`, this function invokes `func`
  18790. * with the `this` binding of `thisArg` and the arguments of `args`.
  18791. *
  18792. * @private
  18793. * @param {Function} func The function to invoke.
  18794. * @param {*} thisArg The `this` binding of `func`.
  18795. * @param {Array} args The arguments to invoke `func` with.
  18796. * @returns {*} Returns the result of `func`.
  18797. */
  18798. function apply(func, thisArg, args) {
  18799. switch (args.length) {
  18800. case 0: return func.call(thisArg);
  18801. case 1: return func.call(thisArg, args[0]);
  18802. case 2: return func.call(thisArg, args[0], args[1]);
  18803. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  18804. }
  18805. return func.apply(thisArg, args);
  18806. }
  18807. /**
  18808. * A specialized version of `baseAggregator` for arrays.
  18809. *
  18810. * @private
  18811. * @param {Array} [array] The array to iterate over.
  18812. * @param {Function} setter The function to set `accumulator` values.
  18813. * @param {Function} iteratee The iteratee to transform keys.
  18814. * @param {Object} accumulator The initial aggregated object.
  18815. * @returns {Function} Returns `accumulator`.
  18816. */
  18817. function arrayAggregator(array, setter, iteratee, accumulator) {
  18818. var index = -1,
  18819. length = array == null ? 0 : array.length;
  18820. while (++index < length) {
  18821. var value = array[index];
  18822. setter(accumulator, value, iteratee(value), array);
  18823. }
  18824. return accumulator;
  18825. }
  18826. /**
  18827. * A specialized version of `_.forEach` for arrays without support for
  18828. * iteratee shorthands.
  18829. *
  18830. * @private
  18831. * @param {Array} [array] The array to iterate over.
  18832. * @param {Function} iteratee The function invoked per iteration.
  18833. * @returns {Array} Returns `array`.
  18834. */
  18835. function arrayEach(array, iteratee) {
  18836. var index = -1,
  18837. length = array == null ? 0 : array.length;
  18838. while (++index < length) {
  18839. if (iteratee(array[index], index, array) === false) {
  18840. break;
  18841. }
  18842. }
  18843. return array;
  18844. }
  18845. /**
  18846. * A specialized version of `_.forEachRight` for arrays without support for
  18847. * iteratee shorthands.
  18848. *
  18849. * @private
  18850. * @param {Array} [array] The array to iterate over.
  18851. * @param {Function} iteratee The function invoked per iteration.
  18852. * @returns {Array} Returns `array`.
  18853. */
  18854. function arrayEachRight(array, iteratee) {
  18855. var length = array == null ? 0 : array.length;
  18856. while (length--) {
  18857. if (iteratee(array[length], length, array) === false) {
  18858. break;
  18859. }
  18860. }
  18861. return array;
  18862. }
  18863. /**
  18864. * A specialized version of `_.every` for arrays without support for
  18865. * iteratee shorthands.
  18866. *
  18867. * @private
  18868. * @param {Array} [array] The array to iterate over.
  18869. * @param {Function} predicate The function invoked per iteration.
  18870. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  18871. * else `false`.
  18872. */
  18873. function arrayEvery(array, predicate) {
  18874. var index = -1,
  18875. length = array == null ? 0 : array.length;
  18876. while (++index < length) {
  18877. if (!predicate(array[index], index, array)) {
  18878. return false;
  18879. }
  18880. }
  18881. return true;
  18882. }
  18883. /**
  18884. * A specialized version of `_.filter` for arrays without support for
  18885. * iteratee shorthands.
  18886. *
  18887. * @private
  18888. * @param {Array} [array] The array to iterate over.
  18889. * @param {Function} predicate The function invoked per iteration.
  18890. * @returns {Array} Returns the new filtered array.
  18891. */
  18892. function arrayFilter(array, predicate) {
  18893. var index = -1,
  18894. length = array == null ? 0 : array.length,
  18895. resIndex = 0,
  18896. result = [];
  18897. while (++index < length) {
  18898. var value = array[index];
  18899. if (predicate(value, index, array)) {
  18900. result[resIndex++] = value;
  18901. }
  18902. }
  18903. return result;
  18904. }
  18905. /**
  18906. * A specialized version of `_.includes` for arrays without support for
  18907. * specifying an index to search from.
  18908. *
  18909. * @private
  18910. * @param {Array} [array] The array to inspect.
  18911. * @param {*} target The value to search for.
  18912. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  18913. */
  18914. function arrayIncludes(array, value) {
  18915. var length = array == null ? 0 : array.length;
  18916. return !!length && baseIndexOf(array, value, 0) > -1;
  18917. }
  18918. /**
  18919. * This function is like `arrayIncludes` except that it accepts a comparator.
  18920. *
  18921. * @private
  18922. * @param {Array} [array] The array to inspect.
  18923. * @param {*} target The value to search for.
  18924. * @param {Function} comparator The comparator invoked per element.
  18925. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  18926. */
  18927. function arrayIncludesWith(array, value, comparator) {
  18928. var index = -1,
  18929. length = array == null ? 0 : array.length;
  18930. while (++index < length) {
  18931. if (comparator(value, array[index])) {
  18932. return true;
  18933. }
  18934. }
  18935. return false;
  18936. }
  18937. /**
  18938. * A specialized version of `_.map` for arrays without support for iteratee
  18939. * shorthands.
  18940. *
  18941. * @private
  18942. * @param {Array} [array] The array to iterate over.
  18943. * @param {Function} iteratee The function invoked per iteration.
  18944. * @returns {Array} Returns the new mapped array.
  18945. */
  18946. function arrayMap(array, iteratee) {
  18947. var index = -1,
  18948. length = array == null ? 0 : array.length,
  18949. result = Array(length);
  18950. while (++index < length) {
  18951. result[index] = iteratee(array[index], index, array);
  18952. }
  18953. return result;
  18954. }
  18955. /**
  18956. * Appends the elements of `values` to `array`.
  18957. *
  18958. * @private
  18959. * @param {Array} array The array to modify.
  18960. * @param {Array} values The values to append.
  18961. * @returns {Array} Returns `array`.
  18962. */
  18963. function arrayPush(array, values) {
  18964. var index = -1,
  18965. length = values.length,
  18966. offset = array.length;
  18967. while (++index < length) {
  18968. array[offset + index] = values[index];
  18969. }
  18970. return array;
  18971. }
  18972. /**
  18973. * A specialized version of `_.reduce` for arrays without support for
  18974. * iteratee shorthands.
  18975. *
  18976. * @private
  18977. * @param {Array} [array] The array to iterate over.
  18978. * @param {Function} iteratee The function invoked per iteration.
  18979. * @param {*} [accumulator] The initial value.
  18980. * @param {boolean} [initAccum] Specify using the first element of `array` as
  18981. * the initial value.
  18982. * @returns {*} Returns the accumulated value.
  18983. */
  18984. function arrayReduce(array, iteratee, accumulator, initAccum) {
  18985. var index = -1,
  18986. length = array == null ? 0 : array.length;
  18987. if (initAccum && length) {
  18988. accumulator = array[++index];
  18989. }
  18990. while (++index < length) {
  18991. accumulator = iteratee(accumulator, array[index], index, array);
  18992. }
  18993. return accumulator;
  18994. }
  18995. /**
  18996. * A specialized version of `_.reduceRight` for arrays without support for
  18997. * iteratee shorthands.
  18998. *
  18999. * @private
  19000. * @param {Array} [array] The array to iterate over.
  19001. * @param {Function} iteratee The function invoked per iteration.
  19002. * @param {*} [accumulator] The initial value.
  19003. * @param {boolean} [initAccum] Specify using the last element of `array` as
  19004. * the initial value.
  19005. * @returns {*} Returns the accumulated value.
  19006. */
  19007. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  19008. var length = array == null ? 0 : array.length;
  19009. if (initAccum && length) {
  19010. accumulator = array[--length];
  19011. }
  19012. while (length--) {
  19013. accumulator = iteratee(accumulator, array[length], length, array);
  19014. }
  19015. return accumulator;
  19016. }
  19017. /**
  19018. * A specialized version of `_.some` for arrays without support for iteratee
  19019. * shorthands.
  19020. *
  19021. * @private
  19022. * @param {Array} [array] The array to iterate over.
  19023. * @param {Function} predicate The function invoked per iteration.
  19024. * @returns {boolean} Returns `true` if any element passes the predicate check,
  19025. * else `false`.
  19026. */
  19027. function arraySome(array, predicate) {
  19028. var index = -1,
  19029. length = array == null ? 0 : array.length;
  19030. while (++index < length) {
  19031. if (predicate(array[index], index, array)) {
  19032. return true;
  19033. }
  19034. }
  19035. return false;
  19036. }
  19037. /**
  19038. * Gets the size of an ASCII `string`.
  19039. *
  19040. * @private
  19041. * @param {string} string The string inspect.
  19042. * @returns {number} Returns the string size.
  19043. */
  19044. var asciiSize = baseProperty('length');
  19045. /**
  19046. * Converts an ASCII `string` to an array.
  19047. *
  19048. * @private
  19049. * @param {string} string The string to convert.
  19050. * @returns {Array} Returns the converted array.
  19051. */
  19052. function asciiToArray(string) {
  19053. return string.split('');
  19054. }
  19055. /**
  19056. * Splits an ASCII `string` into an array of its words.
  19057. *
  19058. * @private
  19059. * @param {string} The string to inspect.
  19060. * @returns {Array} Returns the words of `string`.
  19061. */
  19062. function asciiWords(string) {
  19063. return string.match(reAsciiWord) || [];
  19064. }
  19065. /**
  19066. * The base implementation of methods like `_.findKey` and `_.findLastKey`,
  19067. * without support for iteratee shorthands, which iterates over `collection`
  19068. * using `eachFunc`.
  19069. *
  19070. * @private
  19071. * @param {Array|Object} collection The collection to inspect.
  19072. * @param {Function} predicate The function invoked per iteration.
  19073. * @param {Function} eachFunc The function to iterate over `collection`.
  19074. * @returns {*} Returns the found element or its key, else `undefined`.
  19075. */
  19076. function baseFindKey(collection, predicate, eachFunc) {
  19077. var result;
  19078. eachFunc(collection, function(value, key, collection) {
  19079. if (predicate(value, key, collection)) {
  19080. result = key;
  19081. return false;
  19082. }
  19083. });
  19084. return result;
  19085. }
  19086. /**
  19087. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  19088. * support for iteratee shorthands.
  19089. *
  19090. * @private
  19091. * @param {Array} array The array to inspect.
  19092. * @param {Function} predicate The function invoked per iteration.
  19093. * @param {number} fromIndex The index to search from.
  19094. * @param {boolean} [fromRight] Specify iterating from right to left.
  19095. * @returns {number} Returns the index of the matched value, else `-1`.
  19096. */
  19097. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  19098. var length = array.length,
  19099. index = fromIndex + (fromRight ? 1 : -1);
  19100. while ((fromRight ? index-- : ++index < length)) {
  19101. if (predicate(array[index], index, array)) {
  19102. return index;
  19103. }
  19104. }
  19105. return -1;
  19106. }
  19107. /**
  19108. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  19109. *
  19110. * @private
  19111. * @param {Array} array The array to inspect.
  19112. * @param {*} value The value to search for.
  19113. * @param {number} fromIndex The index to search from.
  19114. * @returns {number} Returns the index of the matched value, else `-1`.
  19115. */
  19116. function baseIndexOf(array, value, fromIndex) {
  19117. return value === value
  19118. ? strictIndexOf(array, value, fromIndex)
  19119. : baseFindIndex(array, baseIsNaN, fromIndex);
  19120. }
  19121. /**
  19122. * This function is like `baseIndexOf` except that it accepts a comparator.
  19123. *
  19124. * @private
  19125. * @param {Array} array The array to inspect.
  19126. * @param {*} value The value to search for.
  19127. * @param {number} fromIndex The index to search from.
  19128. * @param {Function} comparator The comparator invoked per element.
  19129. * @returns {number} Returns the index of the matched value, else `-1`.
  19130. */
  19131. function baseIndexOfWith(array, value, fromIndex, comparator) {
  19132. var index = fromIndex - 1,
  19133. length = array.length;
  19134. while (++index < length) {
  19135. if (comparator(array[index], value)) {
  19136. return index;
  19137. }
  19138. }
  19139. return -1;
  19140. }
  19141. /**
  19142. * The base implementation of `_.isNaN` without support for number objects.
  19143. *
  19144. * @private
  19145. * @param {*} value The value to check.
  19146. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  19147. */
  19148. function baseIsNaN(value) {
  19149. return value !== value;
  19150. }
  19151. /**
  19152. * The base implementation of `_.mean` and `_.meanBy` without support for
  19153. * iteratee shorthands.
  19154. *
  19155. * @private
  19156. * @param {Array} array The array to iterate over.
  19157. * @param {Function} iteratee The function invoked per iteration.
  19158. * @returns {number} Returns the mean.
  19159. */
  19160. function baseMean(array, iteratee) {
  19161. var length = array == null ? 0 : array.length;
  19162. return length ? (baseSum(array, iteratee) / length) : NAN;
  19163. }
  19164. /**
  19165. * The base implementation of `_.property` without support for deep paths.
  19166. *
  19167. * @private
  19168. * @param {string} key The key of the property to get.
  19169. * @returns {Function} Returns the new accessor function.
  19170. */
  19171. function baseProperty(key) {
  19172. return function(object) {
  19173. return object == null ? undefined : object[key];
  19174. };
  19175. }
  19176. /**
  19177. * The base implementation of `_.propertyOf` without support for deep paths.
  19178. *
  19179. * @private
  19180. * @param {Object} object The object to query.
  19181. * @returns {Function} Returns the new accessor function.
  19182. */
  19183. function basePropertyOf(object) {
  19184. return function(key) {
  19185. return object == null ? undefined : object[key];
  19186. };
  19187. }
  19188. /**
  19189. * The base implementation of `_.reduce` and `_.reduceRight`, without support
  19190. * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
  19191. *
  19192. * @private
  19193. * @param {Array|Object} collection The collection to iterate over.
  19194. * @param {Function} iteratee The function invoked per iteration.
  19195. * @param {*} accumulator The initial value.
  19196. * @param {boolean} initAccum Specify using the first or last element of
  19197. * `collection` as the initial value.
  19198. * @param {Function} eachFunc The function to iterate over `collection`.
  19199. * @returns {*} Returns the accumulated value.
  19200. */
  19201. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  19202. eachFunc(collection, function(value, index, collection) {
  19203. accumulator = initAccum
  19204. ? (initAccum = false, value)
  19205. : iteratee(accumulator, value, index, collection);
  19206. });
  19207. return accumulator;
  19208. }
  19209. /**
  19210. * The base implementation of `_.sortBy` which uses `comparer` to define the
  19211. * sort order of `array` and replaces criteria objects with their corresponding
  19212. * values.
  19213. *
  19214. * @private
  19215. * @param {Array} array The array to sort.
  19216. * @param {Function} comparer The function to define sort order.
  19217. * @returns {Array} Returns `array`.
  19218. */
  19219. function baseSortBy(array, comparer) {
  19220. var length = array.length;
  19221. array.sort(comparer);
  19222. while (length--) {
  19223. array[length] = array[length].value;
  19224. }
  19225. return array;
  19226. }
  19227. /**
  19228. * The base implementation of `_.sum` and `_.sumBy` without support for
  19229. * iteratee shorthands.
  19230. *
  19231. * @private
  19232. * @param {Array} array The array to iterate over.
  19233. * @param {Function} iteratee The function invoked per iteration.
  19234. * @returns {number} Returns the sum.
  19235. */
  19236. function baseSum(array, iteratee) {
  19237. var result,
  19238. index = -1,
  19239. length = array.length;
  19240. while (++index < length) {
  19241. var current = iteratee(array[index]);
  19242. if (current !== undefined) {
  19243. result = result === undefined ? current : (result + current);
  19244. }
  19245. }
  19246. return result;
  19247. }
  19248. /**
  19249. * The base implementation of `_.times` without support for iteratee shorthands
  19250. * or max array length checks.
  19251. *
  19252. * @private
  19253. * @param {number} n The number of times to invoke `iteratee`.
  19254. * @param {Function} iteratee The function invoked per iteration.
  19255. * @returns {Array} Returns the array of results.
  19256. */
  19257. function baseTimes(n, iteratee) {
  19258. var index = -1,
  19259. result = Array(n);
  19260. while (++index < n) {
  19261. result[index] = iteratee(index);
  19262. }
  19263. return result;
  19264. }
  19265. /**
  19266. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  19267. * of key-value pairs for `object` corresponding to the property names of `props`.
  19268. *
  19269. * @private
  19270. * @param {Object} object The object to query.
  19271. * @param {Array} props The property names to get values for.
  19272. * @returns {Object} Returns the key-value pairs.
  19273. */
  19274. function baseToPairs(object, props) {
  19275. return arrayMap(props, function(key) {
  19276. return [key, object[key]];
  19277. });
  19278. }
  19279. /**
  19280. * The base implementation of `_.unary` without support for storing metadata.
  19281. *
  19282. * @private
  19283. * @param {Function} func The function to cap arguments for.
  19284. * @returns {Function} Returns the new capped function.
  19285. */
  19286. function baseUnary(func) {
  19287. return function(value) {
  19288. return func(value);
  19289. };
  19290. }
  19291. /**
  19292. * The base implementation of `_.values` and `_.valuesIn` which creates an
  19293. * array of `object` property values corresponding to the property names
  19294. * of `props`.
  19295. *
  19296. * @private
  19297. * @param {Object} object The object to query.
  19298. * @param {Array} props The property names to get values for.
  19299. * @returns {Object} Returns the array of property values.
  19300. */
  19301. function baseValues(object, props) {
  19302. return arrayMap(props, function(key) {
  19303. return object[key];
  19304. });
  19305. }
  19306. /**
  19307. * Checks if a `cache` value for `key` exists.
  19308. *
  19309. * @private
  19310. * @param {Object} cache The cache to query.
  19311. * @param {string} key The key of the entry to check.
  19312. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  19313. */
  19314. function cacheHas(cache, key) {
  19315. return cache.has(key);
  19316. }
  19317. /**
  19318. * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
  19319. * that is not found in the character symbols.
  19320. *
  19321. * @private
  19322. * @param {Array} strSymbols The string symbols to inspect.
  19323. * @param {Array} chrSymbols The character symbols to find.
  19324. * @returns {number} Returns the index of the first unmatched string symbol.
  19325. */
  19326. function charsStartIndex(strSymbols, chrSymbols) {
  19327. var index = -1,
  19328. length = strSymbols.length;
  19329. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  19330. return index;
  19331. }
  19332. /**
  19333. * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
  19334. * that is not found in the character symbols.
  19335. *
  19336. * @private
  19337. * @param {Array} strSymbols The string symbols to inspect.
  19338. * @param {Array} chrSymbols The character symbols to find.
  19339. * @returns {number} Returns the index of the last unmatched string symbol.
  19340. */
  19341. function charsEndIndex(strSymbols, chrSymbols) {
  19342. var index = strSymbols.length;
  19343. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  19344. return index;
  19345. }
  19346. /**
  19347. * Gets the number of `placeholder` occurrences in `array`.
  19348. *
  19349. * @private
  19350. * @param {Array} array The array to inspect.
  19351. * @param {*} placeholder The placeholder to search for.
  19352. * @returns {number} Returns the placeholder count.
  19353. */
  19354. function countHolders(array, placeholder) {
  19355. var length = array.length,
  19356. result = 0;
  19357. while (length--) {
  19358. if (array[length] === placeholder) {
  19359. ++result;
  19360. }
  19361. }
  19362. return result;
  19363. }
  19364. /**
  19365. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  19366. * letters to basic Latin letters.
  19367. *
  19368. * @private
  19369. * @param {string} letter The matched letter to deburr.
  19370. * @returns {string} Returns the deburred letter.
  19371. */
  19372. var deburrLetter = basePropertyOf(deburredLetters);
  19373. /**
  19374. * Used by `_.escape` to convert characters to HTML entities.
  19375. *
  19376. * @private
  19377. * @param {string} chr The matched character to escape.
  19378. * @returns {string} Returns the escaped character.
  19379. */
  19380. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  19381. /**
  19382. * Used by `_.template` to escape characters for inclusion in compiled string literals.
  19383. *
  19384. * @private
  19385. * @param {string} chr The matched character to escape.
  19386. * @returns {string} Returns the escaped character.
  19387. */
  19388. function escapeStringChar(chr) {
  19389. return '\\' + stringEscapes[chr];
  19390. }
  19391. /**
  19392. * Gets the value at `key` of `object`.
  19393. *
  19394. * @private
  19395. * @param {Object} [object] The object to query.
  19396. * @param {string} key The key of the property to get.
  19397. * @returns {*} Returns the property value.
  19398. */
  19399. function getValue(object, key) {
  19400. return object == null ? undefined : object[key];
  19401. }
  19402. /**
  19403. * Checks if `string` contains Unicode symbols.
  19404. *
  19405. * @private
  19406. * @param {string} string The string to inspect.
  19407. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  19408. */
  19409. function hasUnicode(string) {
  19410. return reHasUnicode.test(string);
  19411. }
  19412. /**
  19413. * Checks if `string` contains a word composed of Unicode symbols.
  19414. *
  19415. * @private
  19416. * @param {string} string The string to inspect.
  19417. * @returns {boolean} Returns `true` if a word is found, else `false`.
  19418. */
  19419. function hasUnicodeWord(string) {
  19420. return reHasUnicodeWord.test(string);
  19421. }
  19422. /**
  19423. * Converts `iterator` to an array.
  19424. *
  19425. * @private
  19426. * @param {Object} iterator The iterator to convert.
  19427. * @returns {Array} Returns the converted array.
  19428. */
  19429. function iteratorToArray(iterator) {
  19430. var data,
  19431. result = [];
  19432. while (!(data = iterator.next()).done) {
  19433. result.push(data.value);
  19434. }
  19435. return result;
  19436. }
  19437. /**
  19438. * Converts `map` to its key-value pairs.
  19439. *
  19440. * @private
  19441. * @param {Object} map The map to convert.
  19442. * @returns {Array} Returns the key-value pairs.
  19443. */
  19444. function mapToArray(map) {
  19445. var index = -1,
  19446. result = Array(map.size);
  19447. map.forEach(function(value, key) {
  19448. result[++index] = [key, value];
  19449. });
  19450. return result;
  19451. }
  19452. /**
  19453. * Creates a unary function that invokes `func` with its argument transformed.
  19454. *
  19455. * @private
  19456. * @param {Function} func The function to wrap.
  19457. * @param {Function} transform The argument transform.
  19458. * @returns {Function} Returns the new function.
  19459. */
  19460. function overArg(func, transform) {
  19461. return function(arg) {
  19462. return func(transform(arg));
  19463. };
  19464. }
  19465. /**
  19466. * Replaces all `placeholder` elements in `array` with an internal placeholder
  19467. * and returns an array of their indexes.
  19468. *
  19469. * @private
  19470. * @param {Array} array The array to modify.
  19471. * @param {*} placeholder The placeholder to replace.
  19472. * @returns {Array} Returns the new array of placeholder indexes.
  19473. */
  19474. function replaceHolders(array, placeholder) {
  19475. var index = -1,
  19476. length = array.length,
  19477. resIndex = 0,
  19478. result = [];
  19479. while (++index < length) {
  19480. var value = array[index];
  19481. if (value === placeholder || value === PLACEHOLDER) {
  19482. array[index] = PLACEHOLDER;
  19483. result[resIndex++] = index;
  19484. }
  19485. }
  19486. return result;
  19487. }
  19488. /**
  19489. * Converts `set` to an array of its values.
  19490. *
  19491. * @private
  19492. * @param {Object} set The set to convert.
  19493. * @returns {Array} Returns the values.
  19494. */
  19495. function setToArray(set) {
  19496. var index = -1,
  19497. result = Array(set.size);
  19498. set.forEach(function(value) {
  19499. result[++index] = value;
  19500. });
  19501. return result;
  19502. }
  19503. /**
  19504. * Converts `set` to its value-value pairs.
  19505. *
  19506. * @private
  19507. * @param {Object} set The set to convert.
  19508. * @returns {Array} Returns the value-value pairs.
  19509. */
  19510. function setToPairs(set) {
  19511. var index = -1,
  19512. result = Array(set.size);
  19513. set.forEach(function(value) {
  19514. result[++index] = [value, value];
  19515. });
  19516. return result;
  19517. }
  19518. /**
  19519. * A specialized version of `_.indexOf` which performs strict equality
  19520. * comparisons of values, i.e. `===`.
  19521. *
  19522. * @private
  19523. * @param {Array} array The array to inspect.
  19524. * @param {*} value The value to search for.
  19525. * @param {number} fromIndex The index to search from.
  19526. * @returns {number} Returns the index of the matched value, else `-1`.
  19527. */
  19528. function strictIndexOf(array, value, fromIndex) {
  19529. var index = fromIndex - 1,
  19530. length = array.length;
  19531. while (++index < length) {
  19532. if (array[index] === value) {
  19533. return index;
  19534. }
  19535. }
  19536. return -1;
  19537. }
  19538. /**
  19539. * A specialized version of `_.lastIndexOf` which performs strict equality
  19540. * comparisons of values, i.e. `===`.
  19541. *
  19542. * @private
  19543. * @param {Array} array The array to inspect.
  19544. * @param {*} value The value to search for.
  19545. * @param {number} fromIndex The index to search from.
  19546. * @returns {number} Returns the index of the matched value, else `-1`.
  19547. */
  19548. function strictLastIndexOf(array, value, fromIndex) {
  19549. var index = fromIndex + 1;
  19550. while (index--) {
  19551. if (array[index] === value) {
  19552. return index;
  19553. }
  19554. }
  19555. return index;
  19556. }
  19557. /**
  19558. * Gets the number of symbols in `string`.
  19559. *
  19560. * @private
  19561. * @param {string} string The string to inspect.
  19562. * @returns {number} Returns the string size.
  19563. */
  19564. function stringSize(string) {
  19565. return hasUnicode(string)
  19566. ? unicodeSize(string)
  19567. : asciiSize(string);
  19568. }
  19569. /**
  19570. * Converts `string` to an array.
  19571. *
  19572. * @private
  19573. * @param {string} string The string to convert.
  19574. * @returns {Array} Returns the converted array.
  19575. */
  19576. function stringToArray(string) {
  19577. return hasUnicode(string)
  19578. ? unicodeToArray(string)
  19579. : asciiToArray(string);
  19580. }
  19581. /**
  19582. * Used by `_.unescape` to convert HTML entities to characters.
  19583. *
  19584. * @private
  19585. * @param {string} chr The matched character to unescape.
  19586. * @returns {string} Returns the unescaped character.
  19587. */
  19588. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  19589. /**
  19590. * Gets the size of a Unicode `string`.
  19591. *
  19592. * @private
  19593. * @param {string} string The string inspect.
  19594. * @returns {number} Returns the string size.
  19595. */
  19596. function unicodeSize(string) {
  19597. var result = reUnicode.lastIndex = 0;
  19598. while (reUnicode.test(string)) {
  19599. ++result;
  19600. }
  19601. return result;
  19602. }
  19603. /**
  19604. * Converts a Unicode `string` to an array.
  19605. *
  19606. * @private
  19607. * @param {string} string The string to convert.
  19608. * @returns {Array} Returns the converted array.
  19609. */
  19610. function unicodeToArray(string) {
  19611. return string.match(reUnicode) || [];
  19612. }
  19613. /**
  19614. * Splits a Unicode `string` into an array of its words.
  19615. *
  19616. * @private
  19617. * @param {string} The string to inspect.
  19618. * @returns {Array} Returns the words of `string`.
  19619. */
  19620. function unicodeWords(string) {
  19621. return string.match(reUnicodeWord) || [];
  19622. }
  19623. /*--------------------------------------------------------------------------*/
  19624. /**
  19625. * Create a new pristine `lodash` function using the `context` object.
  19626. *
  19627. * @static
  19628. * @memberOf _
  19629. * @since 1.1.0
  19630. * @category Util
  19631. * @param {Object} [context=root] The context object.
  19632. * @returns {Function} Returns a new `lodash` function.
  19633. * @example
  19634. *
  19635. * _.mixin({ 'foo': _.constant('foo') });
  19636. *
  19637. * var lodash = _.runInContext();
  19638. * lodash.mixin({ 'bar': lodash.constant('bar') });
  19639. *
  19640. * _.isFunction(_.foo);
  19641. * // => true
  19642. * _.isFunction(_.bar);
  19643. * // => false
  19644. *
  19645. * lodash.isFunction(lodash.foo);
  19646. * // => false
  19647. * lodash.isFunction(lodash.bar);
  19648. * // => true
  19649. *
  19650. * // Create a suped-up `defer` in Node.js.
  19651. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
  19652. */
  19653. var runInContext = (function runInContext(context) {
  19654. context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
  19655. /** Built-in constructor references. */
  19656. var Array = context.Array,
  19657. Date = context.Date,
  19658. Error = context.Error,
  19659. Function = context.Function,
  19660. Math = context.Math,
  19661. Object = context.Object,
  19662. RegExp = context.RegExp,
  19663. String = context.String,
  19664. TypeError = context.TypeError;
  19665. /** Used for built-in method references. */
  19666. var arrayProto = Array.prototype,
  19667. funcProto = Function.prototype,
  19668. objectProto = Object.prototype;
  19669. /** Used to detect overreaching core-js shims. */
  19670. var coreJsData = context['__core-js_shared__'];
  19671. /** Used to resolve the decompiled source of functions. */
  19672. var funcToString = funcProto.toString;
  19673. /** Used to check objects for own properties. */
  19674. var hasOwnProperty = objectProto.hasOwnProperty;
  19675. /** Used to generate unique IDs. */
  19676. var idCounter = 0;
  19677. /** Used to detect methods masquerading as native. */
  19678. var maskSrcKey = (function() {
  19679. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  19680. return uid ? ('Symbol(src)_1.' + uid) : '';
  19681. }());
  19682. /**
  19683. * Used to resolve the
  19684. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  19685. * of values.
  19686. */
  19687. var nativeObjectToString = objectProto.toString;
  19688. /** Used to infer the `Object` constructor. */
  19689. var objectCtorString = funcToString.call(Object);
  19690. /** Used to restore the original `_` reference in `_.noConflict`. */
  19691. var oldDash = root._;
  19692. /** Used to detect if a method is native. */
  19693. var reIsNative = RegExp('^' +
  19694. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  19695. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  19696. );
  19697. /** Built-in value references. */
  19698. var Buffer = moduleExports ? context.Buffer : undefined,
  19699. Symbol = context.Symbol,
  19700. Uint8Array = context.Uint8Array,
  19701. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
  19702. getPrototype = overArg(Object.getPrototypeOf, Object),
  19703. objectCreate = Object.create,
  19704. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  19705. splice = arrayProto.splice,
  19706. spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
  19707. symIterator = Symbol ? Symbol.iterator : undefined,
  19708. symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  19709. var defineProperty = (function() {
  19710. try {
  19711. var func = getNative(Object, 'defineProperty');
  19712. func({}, '', {});
  19713. return func;
  19714. } catch (e) {}
  19715. }());
  19716. /** Mocked built-ins. */
  19717. var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
  19718. ctxNow = Date && Date.now !== root.Date.now && Date.now,
  19719. ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
  19720. /* Built-in method references for those with the same name as other `lodash` methods. */
  19721. var nativeCeil = Math.ceil,
  19722. nativeFloor = Math.floor,
  19723. nativeGetSymbols = Object.getOwnPropertySymbols,
  19724. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  19725. nativeIsFinite = context.isFinite,
  19726. nativeJoin = arrayProto.join,
  19727. nativeKeys = overArg(Object.keys, Object),
  19728. nativeMax = Math.max,
  19729. nativeMin = Math.min,
  19730. nativeNow = Date.now,
  19731. nativeParseInt = context.parseInt,
  19732. nativeRandom = Math.random,
  19733. nativeReverse = arrayProto.reverse;
  19734. /* Built-in method references that are verified to be native. */
  19735. var DataView = getNative(context, 'DataView'),
  19736. Map = getNative(context, 'Map'),
  19737. Promise = getNative(context, 'Promise'),
  19738. Set = getNative(context, 'Set'),
  19739. WeakMap = getNative(context, 'WeakMap'),
  19740. nativeCreate = getNative(Object, 'create');
  19741. /** Used to store function metadata. */
  19742. var metaMap = WeakMap && new WeakMap;
  19743. /** Used to lookup unminified function names. */
  19744. var realNames = {};
  19745. /** Used to detect maps, sets, and weakmaps. */
  19746. var dataViewCtorString = toSource(DataView),
  19747. mapCtorString = toSource(Map),
  19748. promiseCtorString = toSource(Promise),
  19749. setCtorString = toSource(Set),
  19750. weakMapCtorString = toSource(WeakMap);
  19751. /** Used to convert symbols to primitives and strings. */
  19752. var symbolProto = Symbol ? Symbol.prototype : undefined,
  19753. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  19754. symbolToString = symbolProto ? symbolProto.toString : undefined;
  19755. /*------------------------------------------------------------------------*/
  19756. /**
  19757. * Creates a `lodash` object which wraps `value` to enable implicit method
  19758. * chain sequences. Methods that operate on and return arrays, collections,
  19759. * and functions can be chained together. Methods that retrieve a single value
  19760. * or may return a primitive value will automatically end the chain sequence
  19761. * and return the unwrapped value. Otherwise, the value must be unwrapped
  19762. * with `_#value`.
  19763. *
  19764. * Explicit chain sequences, which must be unwrapped with `_#value`, may be
  19765. * enabled using `_.chain`.
  19766. *
  19767. * The execution of chained methods is lazy, that is, it's deferred until
  19768. * `_#value` is implicitly or explicitly called.
  19769. *
  19770. * Lazy evaluation allows several methods to support shortcut fusion.
  19771. * Shortcut fusion is an optimization to merge iteratee calls; this avoids
  19772. * the creation of intermediate arrays and can greatly reduce the number of
  19773. * iteratee executions. Sections of a chain sequence qualify for shortcut
  19774. * fusion if the section is applied to an array and iteratees accept only
  19775. * one argument. The heuristic for whether a section qualifies for shortcut
  19776. * fusion is subject to change.
  19777. *
  19778. * Chaining is supported in custom builds as long as the `_#value` method is
  19779. * directly or indirectly included in the build.
  19780. *
  19781. * In addition to lodash methods, wrappers have `Array` and `String` methods.
  19782. *
  19783. * The wrapper `Array` methods are:
  19784. * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
  19785. *
  19786. * The wrapper `String` methods are:
  19787. * `replace` and `split`
  19788. *
  19789. * The wrapper methods that support shortcut fusion are:
  19790. * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
  19791. * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
  19792. * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
  19793. *
  19794. * The chainable wrapper methods are:
  19795. * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
  19796. * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
  19797. * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
  19798. * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
  19799. * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
  19800. * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
  19801. * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
  19802. * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
  19803. * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
  19804. * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
  19805. * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
  19806. * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
  19807. * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
  19808. * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
  19809. * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
  19810. * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
  19811. * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
  19812. * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
  19813. * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
  19814. * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
  19815. * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
  19816. * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
  19817. * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
  19818. * `zipObject`, `zipObjectDeep`, and `zipWith`
  19819. *
  19820. * The wrapper methods that are **not** chainable by default are:
  19821. * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
  19822. * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
  19823. * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
  19824. * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
  19825. * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
  19826. * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
  19827. * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
  19828. * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
  19829. * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
  19830. * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
  19831. * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
  19832. * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
  19833. * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
  19834. * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
  19835. * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
  19836. * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
  19837. * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
  19838. * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
  19839. * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
  19840. * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
  19841. * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
  19842. * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
  19843. * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
  19844. * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
  19845. * `upperFirst`, `value`, and `words`
  19846. *
  19847. * @name _
  19848. * @constructor
  19849. * @category Seq
  19850. * @param {*} value The value to wrap in a `lodash` instance.
  19851. * @returns {Object} Returns the new `lodash` wrapper instance.
  19852. * @example
  19853. *
  19854. * function square(n) {
  19855. * return n * n;
  19856. * }
  19857. *
  19858. * var wrapped = _([1, 2, 3]);
  19859. *
  19860. * // Returns an unwrapped value.
  19861. * wrapped.reduce(_.add);
  19862. * // => 6
  19863. *
  19864. * // Returns a wrapped value.
  19865. * var squares = wrapped.map(square);
  19866. *
  19867. * _.isArray(squares);
  19868. * // => false
  19869. *
  19870. * _.isArray(squares.value());
  19871. * // => true
  19872. */
  19873. function lodash(value) {
  19874. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  19875. if (value instanceof LodashWrapper) {
  19876. return value;
  19877. }
  19878. if (hasOwnProperty.call(value, '__wrapped__')) {
  19879. return wrapperClone(value);
  19880. }
  19881. }
  19882. return new LodashWrapper(value);
  19883. }
  19884. /**
  19885. * The base implementation of `_.create` without support for assigning
  19886. * properties to the created object.
  19887. *
  19888. * @private
  19889. * @param {Object} proto The object to inherit from.
  19890. * @returns {Object} Returns the new object.
  19891. */
  19892. var baseCreate = (function() {
  19893. function object() {}
  19894. return function(proto) {
  19895. if (!isObject(proto)) {
  19896. return {};
  19897. }
  19898. if (objectCreate) {
  19899. return objectCreate(proto);
  19900. }
  19901. object.prototype = proto;
  19902. var result = new object;
  19903. object.prototype = undefined;
  19904. return result;
  19905. };
  19906. }());
  19907. /**
  19908. * The function whose prototype chain sequence wrappers inherit from.
  19909. *
  19910. * @private
  19911. */
  19912. function baseLodash() {
  19913. // No operation performed.
  19914. }
  19915. /**
  19916. * The base constructor for creating `lodash` wrapper objects.
  19917. *
  19918. * @private
  19919. * @param {*} value The value to wrap.
  19920. * @param {boolean} [chainAll] Enable explicit method chain sequences.
  19921. */
  19922. function LodashWrapper(value, chainAll) {
  19923. this.__wrapped__ = value;
  19924. this.__actions__ = [];
  19925. this.__chain__ = !!chainAll;
  19926. this.__index__ = 0;
  19927. this.__values__ = undefined;
  19928. }
  19929. /**
  19930. * By default, the template delimiters used by lodash are like those in
  19931. * embedded Ruby (ERB) as well as ES2015 template strings. Change the
  19932. * following template settings to use alternative delimiters.
  19933. *
  19934. * @static
  19935. * @memberOf _
  19936. * @type {Object}
  19937. */
  19938. lodash.templateSettings = {
  19939. /**
  19940. * Used to detect `data` property values to be HTML-escaped.
  19941. *
  19942. * @memberOf _.templateSettings
  19943. * @type {RegExp}
  19944. */
  19945. 'escape': reEscape,
  19946. /**
  19947. * Used to detect code to be evaluated.
  19948. *
  19949. * @memberOf _.templateSettings
  19950. * @type {RegExp}
  19951. */
  19952. 'evaluate': reEvaluate,
  19953. /**
  19954. * Used to detect `data` property values to inject.
  19955. *
  19956. * @memberOf _.templateSettings
  19957. * @type {RegExp}
  19958. */
  19959. 'interpolate': reInterpolate,
  19960. /**
  19961. * Used to reference the data object in the template text.
  19962. *
  19963. * @memberOf _.templateSettings
  19964. * @type {string}
  19965. */
  19966. 'variable': '',
  19967. /**
  19968. * Used to import variables into the compiled template.
  19969. *
  19970. * @memberOf _.templateSettings
  19971. * @type {Object}
  19972. */
  19973. 'imports': {
  19974. /**
  19975. * A reference to the `lodash` function.
  19976. *
  19977. * @memberOf _.templateSettings.imports
  19978. * @type {Function}
  19979. */
  19980. '_': lodash
  19981. }
  19982. };
  19983. // Ensure wrappers are instances of `baseLodash`.
  19984. lodash.prototype = baseLodash.prototype;
  19985. lodash.prototype.constructor = lodash;
  19986. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  19987. LodashWrapper.prototype.constructor = LodashWrapper;
  19988. /*------------------------------------------------------------------------*/
  19989. /**
  19990. * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
  19991. *
  19992. * @private
  19993. * @constructor
  19994. * @param {*} value The value to wrap.
  19995. */
  19996. function LazyWrapper(value) {
  19997. this.__wrapped__ = value;
  19998. this.__actions__ = [];
  19999. this.__dir__ = 1;
  20000. this.__filtered__ = false;
  20001. this.__iteratees__ = [];
  20002. this.__takeCount__ = MAX_ARRAY_LENGTH;
  20003. this.__views__ = [];
  20004. }
  20005. /**
  20006. * Creates a clone of the lazy wrapper object.
  20007. *
  20008. * @private
  20009. * @name clone
  20010. * @memberOf LazyWrapper
  20011. * @returns {Object} Returns the cloned `LazyWrapper` object.
  20012. */
  20013. function lazyClone() {
  20014. var result = new LazyWrapper(this.__wrapped__);
  20015. result.__actions__ = copyArray(this.__actions__);
  20016. result.__dir__ = this.__dir__;
  20017. result.__filtered__ = this.__filtered__;
  20018. result.__iteratees__ = copyArray(this.__iteratees__);
  20019. result.__takeCount__ = this.__takeCount__;
  20020. result.__views__ = copyArray(this.__views__);
  20021. return result;
  20022. }
  20023. /**
  20024. * Reverses the direction of lazy iteration.
  20025. *
  20026. * @private
  20027. * @name reverse
  20028. * @memberOf LazyWrapper
  20029. * @returns {Object} Returns the new reversed `LazyWrapper` object.
  20030. */
  20031. function lazyReverse() {
  20032. if (this.__filtered__) {
  20033. var result = new LazyWrapper(this);
  20034. result.__dir__ = -1;
  20035. result.__filtered__ = true;
  20036. } else {
  20037. result = this.clone();
  20038. result.__dir__ *= -1;
  20039. }
  20040. return result;
  20041. }
  20042. /**
  20043. * Extracts the unwrapped value from its lazy wrapper.
  20044. *
  20045. * @private
  20046. * @name value
  20047. * @memberOf LazyWrapper
  20048. * @returns {*} Returns the unwrapped value.
  20049. */
  20050. function lazyValue() {
  20051. var array = this.__wrapped__.value(),
  20052. dir = this.__dir__,
  20053. isArr = isArray(array),
  20054. isRight = dir < 0,
  20055. arrLength = isArr ? array.length : 0,
  20056. view = getView(0, arrLength, this.__views__),
  20057. start = view.start,
  20058. end = view.end,
  20059. length = end - start,
  20060. index = isRight ? end : (start - 1),
  20061. iteratees = this.__iteratees__,
  20062. iterLength = iteratees.length,
  20063. resIndex = 0,
  20064. takeCount = nativeMin(length, this.__takeCount__);
  20065. if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
  20066. return baseWrapperValue(array, this.__actions__);
  20067. }
  20068. var result = [];
  20069. outer:
  20070. while (length-- && resIndex < takeCount) {
  20071. index += dir;
  20072. var iterIndex = -1,
  20073. value = array[index];
  20074. while (++iterIndex < iterLength) {
  20075. var data = iteratees[iterIndex],
  20076. iteratee = data.iteratee,
  20077. type = data.type,
  20078. computed = iteratee(value);
  20079. if (type == LAZY_MAP_FLAG) {
  20080. value = computed;
  20081. } else if (!computed) {
  20082. if (type == LAZY_FILTER_FLAG) {
  20083. continue outer;
  20084. } else {
  20085. break outer;
  20086. }
  20087. }
  20088. }
  20089. result[resIndex++] = value;
  20090. }
  20091. return result;
  20092. }
  20093. // Ensure `LazyWrapper` is an instance of `baseLodash`.
  20094. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  20095. LazyWrapper.prototype.constructor = LazyWrapper;
  20096. /*------------------------------------------------------------------------*/
  20097. /**
  20098. * Creates a hash object.
  20099. *
  20100. * @private
  20101. * @constructor
  20102. * @param {Array} [entries] The key-value pairs to cache.
  20103. */
  20104. function Hash(entries) {
  20105. var index = -1,
  20106. length = entries == null ? 0 : entries.length;
  20107. this.clear();
  20108. while (++index < length) {
  20109. var entry = entries[index];
  20110. this.set(entry[0], entry[1]);
  20111. }
  20112. }
  20113. /**
  20114. * Removes all key-value entries from the hash.
  20115. *
  20116. * @private
  20117. * @name clear
  20118. * @memberOf Hash
  20119. */
  20120. function hashClear() {
  20121. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  20122. this.size = 0;
  20123. }
  20124. /**
  20125. * Removes `key` and its value from the hash.
  20126. *
  20127. * @private
  20128. * @name delete
  20129. * @memberOf Hash
  20130. * @param {Object} hash The hash to modify.
  20131. * @param {string} key The key of the value to remove.
  20132. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20133. */
  20134. function hashDelete(key) {
  20135. var result = this.has(key) && delete this.__data__[key];
  20136. this.size -= result ? 1 : 0;
  20137. return result;
  20138. }
  20139. /**
  20140. * Gets the hash value for `key`.
  20141. *
  20142. * @private
  20143. * @name get
  20144. * @memberOf Hash
  20145. * @param {string} key The key of the value to get.
  20146. * @returns {*} Returns the entry value.
  20147. */
  20148. function hashGet(key) {
  20149. var data = this.__data__;
  20150. if (nativeCreate) {
  20151. var result = data[key];
  20152. return result === HASH_UNDEFINED ? undefined : result;
  20153. }
  20154. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  20155. }
  20156. /**
  20157. * Checks if a hash value for `key` exists.
  20158. *
  20159. * @private
  20160. * @name has
  20161. * @memberOf Hash
  20162. * @param {string} key The key of the entry to check.
  20163. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20164. */
  20165. function hashHas(key) {
  20166. var data = this.__data__;
  20167. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  20168. }
  20169. /**
  20170. * Sets the hash `key` to `value`.
  20171. *
  20172. * @private
  20173. * @name set
  20174. * @memberOf Hash
  20175. * @param {string} key The key of the value to set.
  20176. * @param {*} value The value to set.
  20177. * @returns {Object} Returns the hash instance.
  20178. */
  20179. function hashSet(key, value) {
  20180. var data = this.__data__;
  20181. this.size += this.has(key) ? 0 : 1;
  20182. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  20183. return this;
  20184. }
  20185. // Add methods to `Hash`.
  20186. Hash.prototype.clear = hashClear;
  20187. Hash.prototype['delete'] = hashDelete;
  20188. Hash.prototype.get = hashGet;
  20189. Hash.prototype.has = hashHas;
  20190. Hash.prototype.set = hashSet;
  20191. /*------------------------------------------------------------------------*/
  20192. /**
  20193. * Creates an list cache object.
  20194. *
  20195. * @private
  20196. * @constructor
  20197. * @param {Array} [entries] The key-value pairs to cache.
  20198. */
  20199. function ListCache(entries) {
  20200. var index = -1,
  20201. length = entries == null ? 0 : entries.length;
  20202. this.clear();
  20203. while (++index < length) {
  20204. var entry = entries[index];
  20205. this.set(entry[0], entry[1]);
  20206. }
  20207. }
  20208. /**
  20209. * Removes all key-value entries from the list cache.
  20210. *
  20211. * @private
  20212. * @name clear
  20213. * @memberOf ListCache
  20214. */
  20215. function listCacheClear() {
  20216. this.__data__ = [];
  20217. this.size = 0;
  20218. }
  20219. /**
  20220. * Removes `key` and its value from the list cache.
  20221. *
  20222. * @private
  20223. * @name delete
  20224. * @memberOf ListCache
  20225. * @param {string} key The key of the value to remove.
  20226. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20227. */
  20228. function listCacheDelete(key) {
  20229. var data = this.__data__,
  20230. index = assocIndexOf(data, key);
  20231. if (index < 0) {
  20232. return false;
  20233. }
  20234. var lastIndex = data.length - 1;
  20235. if (index == lastIndex) {
  20236. data.pop();
  20237. } else {
  20238. splice.call(data, index, 1);
  20239. }
  20240. --this.size;
  20241. return true;
  20242. }
  20243. /**
  20244. * Gets the list cache value for `key`.
  20245. *
  20246. * @private
  20247. * @name get
  20248. * @memberOf ListCache
  20249. * @param {string} key The key of the value to get.
  20250. * @returns {*} Returns the entry value.
  20251. */
  20252. function listCacheGet(key) {
  20253. var data = this.__data__,
  20254. index = assocIndexOf(data, key);
  20255. return index < 0 ? undefined : data[index][1];
  20256. }
  20257. /**
  20258. * Checks if a list cache value for `key` exists.
  20259. *
  20260. * @private
  20261. * @name has
  20262. * @memberOf ListCache
  20263. * @param {string} key The key of the entry to check.
  20264. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20265. */
  20266. function listCacheHas(key) {
  20267. return assocIndexOf(this.__data__, key) > -1;
  20268. }
  20269. /**
  20270. * Sets the list cache `key` to `value`.
  20271. *
  20272. * @private
  20273. * @name set
  20274. * @memberOf ListCache
  20275. * @param {string} key The key of the value to set.
  20276. * @param {*} value The value to set.
  20277. * @returns {Object} Returns the list cache instance.
  20278. */
  20279. function listCacheSet(key, value) {
  20280. var data = this.__data__,
  20281. index = assocIndexOf(data, key);
  20282. if (index < 0) {
  20283. ++this.size;
  20284. data.push([key, value]);
  20285. } else {
  20286. data[index][1] = value;
  20287. }
  20288. return this;
  20289. }
  20290. // Add methods to `ListCache`.
  20291. ListCache.prototype.clear = listCacheClear;
  20292. ListCache.prototype['delete'] = listCacheDelete;
  20293. ListCache.prototype.get = listCacheGet;
  20294. ListCache.prototype.has = listCacheHas;
  20295. ListCache.prototype.set = listCacheSet;
  20296. /*------------------------------------------------------------------------*/
  20297. /**
  20298. * Creates a map cache object to store key-value pairs.
  20299. *
  20300. * @private
  20301. * @constructor
  20302. * @param {Array} [entries] The key-value pairs to cache.
  20303. */
  20304. function MapCache(entries) {
  20305. var index = -1,
  20306. length = entries == null ? 0 : entries.length;
  20307. this.clear();
  20308. while (++index < length) {
  20309. var entry = entries[index];
  20310. this.set(entry[0], entry[1]);
  20311. }
  20312. }
  20313. /**
  20314. * Removes all key-value entries from the map.
  20315. *
  20316. * @private
  20317. * @name clear
  20318. * @memberOf MapCache
  20319. */
  20320. function mapCacheClear() {
  20321. this.size = 0;
  20322. this.__data__ = {
  20323. 'hash': new Hash,
  20324. 'map': new (Map || ListCache),
  20325. 'string': new Hash
  20326. };
  20327. }
  20328. /**
  20329. * Removes `key` and its value from the map.
  20330. *
  20331. * @private
  20332. * @name delete
  20333. * @memberOf MapCache
  20334. * @param {string} key The key of the value to remove.
  20335. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20336. */
  20337. function mapCacheDelete(key) {
  20338. var result = getMapData(this, key)['delete'](key);
  20339. this.size -= result ? 1 : 0;
  20340. return result;
  20341. }
  20342. /**
  20343. * Gets the map value for `key`.
  20344. *
  20345. * @private
  20346. * @name get
  20347. * @memberOf MapCache
  20348. * @param {string} key The key of the value to get.
  20349. * @returns {*} Returns the entry value.
  20350. */
  20351. function mapCacheGet(key) {
  20352. return getMapData(this, key).get(key);
  20353. }
  20354. /**
  20355. * Checks if a map value for `key` exists.
  20356. *
  20357. * @private
  20358. * @name has
  20359. * @memberOf MapCache
  20360. * @param {string} key The key of the entry to check.
  20361. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20362. */
  20363. function mapCacheHas(key) {
  20364. return getMapData(this, key).has(key);
  20365. }
  20366. /**
  20367. * Sets the map `key` to `value`.
  20368. *
  20369. * @private
  20370. * @name set
  20371. * @memberOf MapCache
  20372. * @param {string} key The key of the value to set.
  20373. * @param {*} value The value to set.
  20374. * @returns {Object} Returns the map cache instance.
  20375. */
  20376. function mapCacheSet(key, value) {
  20377. var data = getMapData(this, key),
  20378. size = data.size;
  20379. data.set(key, value);
  20380. this.size += data.size == size ? 0 : 1;
  20381. return this;
  20382. }
  20383. // Add methods to `MapCache`.
  20384. MapCache.prototype.clear = mapCacheClear;
  20385. MapCache.prototype['delete'] = mapCacheDelete;
  20386. MapCache.prototype.get = mapCacheGet;
  20387. MapCache.prototype.has = mapCacheHas;
  20388. MapCache.prototype.set = mapCacheSet;
  20389. /*------------------------------------------------------------------------*/
  20390. /**
  20391. *
  20392. * Creates an array cache object to store unique values.
  20393. *
  20394. * @private
  20395. * @constructor
  20396. * @param {Array} [values] The values to cache.
  20397. */
  20398. function SetCache(values) {
  20399. var index = -1,
  20400. length = values == null ? 0 : values.length;
  20401. this.__data__ = new MapCache;
  20402. while (++index < length) {
  20403. this.add(values[index]);
  20404. }
  20405. }
  20406. /**
  20407. * Adds `value` to the array cache.
  20408. *
  20409. * @private
  20410. * @name add
  20411. * @memberOf SetCache
  20412. * @alias push
  20413. * @param {*} value The value to cache.
  20414. * @returns {Object} Returns the cache instance.
  20415. */
  20416. function setCacheAdd(value) {
  20417. this.__data__.set(value, HASH_UNDEFINED);
  20418. return this;
  20419. }
  20420. /**
  20421. * Checks if `value` is in the array cache.
  20422. *
  20423. * @private
  20424. * @name has
  20425. * @memberOf SetCache
  20426. * @param {*} value The value to search for.
  20427. * @returns {number} Returns `true` if `value` is found, else `false`.
  20428. */
  20429. function setCacheHas(value) {
  20430. return this.__data__.has(value);
  20431. }
  20432. // Add methods to `SetCache`.
  20433. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  20434. SetCache.prototype.has = setCacheHas;
  20435. /*------------------------------------------------------------------------*/
  20436. /**
  20437. * Creates a stack cache object to store key-value pairs.
  20438. *
  20439. * @private
  20440. * @constructor
  20441. * @param {Array} [entries] The key-value pairs to cache.
  20442. */
  20443. function Stack(entries) {
  20444. var data = this.__data__ = new ListCache(entries);
  20445. this.size = data.size;
  20446. }
  20447. /**
  20448. * Removes all key-value entries from the stack.
  20449. *
  20450. * @private
  20451. * @name clear
  20452. * @memberOf Stack
  20453. */
  20454. function stackClear() {
  20455. this.__data__ = new ListCache;
  20456. this.size = 0;
  20457. }
  20458. /**
  20459. * Removes `key` and its value from the stack.
  20460. *
  20461. * @private
  20462. * @name delete
  20463. * @memberOf Stack
  20464. * @param {string} key The key of the value to remove.
  20465. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20466. */
  20467. function stackDelete(key) {
  20468. var data = this.__data__,
  20469. result = data['delete'](key);
  20470. this.size = data.size;
  20471. return result;
  20472. }
  20473. /**
  20474. * Gets the stack value for `key`.
  20475. *
  20476. * @private
  20477. * @name get
  20478. * @memberOf Stack
  20479. * @param {string} key The key of the value to get.
  20480. * @returns {*} Returns the entry value.
  20481. */
  20482. function stackGet(key) {
  20483. return this.__data__.get(key);
  20484. }
  20485. /**
  20486. * Checks if a stack value for `key` exists.
  20487. *
  20488. * @private
  20489. * @name has
  20490. * @memberOf Stack
  20491. * @param {string} key The key of the entry to check.
  20492. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20493. */
  20494. function stackHas(key) {
  20495. return this.__data__.has(key);
  20496. }
  20497. /**
  20498. * Sets the stack `key` to `value`.
  20499. *
  20500. * @private
  20501. * @name set
  20502. * @memberOf Stack
  20503. * @param {string} key The key of the value to set.
  20504. * @param {*} value The value to set.
  20505. * @returns {Object} Returns the stack cache instance.
  20506. */
  20507. function stackSet(key, value) {
  20508. var data = this.__data__;
  20509. if (data instanceof ListCache) {
  20510. var pairs = data.__data__;
  20511. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  20512. pairs.push([key, value]);
  20513. this.size = ++data.size;
  20514. return this;
  20515. }
  20516. data = this.__data__ = new MapCache(pairs);
  20517. }
  20518. data.set(key, value);
  20519. this.size = data.size;
  20520. return this;
  20521. }
  20522. // Add methods to `Stack`.
  20523. Stack.prototype.clear = stackClear;
  20524. Stack.prototype['delete'] = stackDelete;
  20525. Stack.prototype.get = stackGet;
  20526. Stack.prototype.has = stackHas;
  20527. Stack.prototype.set = stackSet;
  20528. /*------------------------------------------------------------------------*/
  20529. /**
  20530. * Creates an array of the enumerable property names of the array-like `value`.
  20531. *
  20532. * @private
  20533. * @param {*} value The value to query.
  20534. * @param {boolean} inherited Specify returning inherited property names.
  20535. * @returns {Array} Returns the array of property names.
  20536. */
  20537. function arrayLikeKeys(value, inherited) {
  20538. var isArr = isArray(value),
  20539. isArg = !isArr && isArguments(value),
  20540. isBuff = !isArr && !isArg && isBuffer(value),
  20541. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  20542. skipIndexes = isArr || isArg || isBuff || isType,
  20543. result = skipIndexes ? baseTimes(value.length, String) : [],
  20544. length = result.length;
  20545. for (var key in value) {
  20546. if ((inherited || hasOwnProperty.call(value, key)) &&
  20547. !(skipIndexes && (
  20548. // Safari 9 has enumerable `arguments.length` in strict mode.
  20549. key == 'length' ||
  20550. // Node.js 0.10 has enumerable non-index properties on buffers.
  20551. (isBuff && (key == 'offset' || key == 'parent')) ||
  20552. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  20553. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  20554. // Skip index properties.
  20555. isIndex(key, length)
  20556. ))) {
  20557. result.push(key);
  20558. }
  20559. }
  20560. return result;
  20561. }
  20562. /**
  20563. * A specialized version of `_.sample` for arrays.
  20564. *
  20565. * @private
  20566. * @param {Array} array The array to sample.
  20567. * @returns {*} Returns the random element.
  20568. */
  20569. function arraySample(array) {
  20570. var length = array.length;
  20571. return length ? array[baseRandom(0, length - 1)] : undefined;
  20572. }
  20573. /**
  20574. * A specialized version of `_.sampleSize` for arrays.
  20575. *
  20576. * @private
  20577. * @param {Array} array The array to sample.
  20578. * @param {number} n The number of elements to sample.
  20579. * @returns {Array} Returns the random elements.
  20580. */
  20581. function arraySampleSize(array, n) {
  20582. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  20583. }
  20584. /**
  20585. * A specialized version of `_.shuffle` for arrays.
  20586. *
  20587. * @private
  20588. * @param {Array} array The array to shuffle.
  20589. * @returns {Array} Returns the new shuffled array.
  20590. */
  20591. function arrayShuffle(array) {
  20592. return shuffleSelf(copyArray(array));
  20593. }
  20594. /**
  20595. * This function is like `assignValue` except that it doesn't assign
  20596. * `undefined` values.
  20597. *
  20598. * @private
  20599. * @param {Object} object The object to modify.
  20600. * @param {string} key The key of the property to assign.
  20601. * @param {*} value The value to assign.
  20602. */
  20603. function assignMergeValue(object, key, value) {
  20604. if ((value !== undefined && !eq(object[key], value)) ||
  20605. (value === undefined && !(key in object))) {
  20606. baseAssignValue(object, key, value);
  20607. }
  20608. }
  20609. /**
  20610. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  20611. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  20612. * for equality comparisons.
  20613. *
  20614. * @private
  20615. * @param {Object} object The object to modify.
  20616. * @param {string} key The key of the property to assign.
  20617. * @param {*} value The value to assign.
  20618. */
  20619. function assignValue(object, key, value) {
  20620. var objValue = object[key];
  20621. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  20622. (value === undefined && !(key in object))) {
  20623. baseAssignValue(object, key, value);
  20624. }
  20625. }
  20626. /**
  20627. * Gets the index at which the `key` is found in `array` of key-value pairs.
  20628. *
  20629. * @private
  20630. * @param {Array} array The array to inspect.
  20631. * @param {*} key The key to search for.
  20632. * @returns {number} Returns the index of the matched value, else `-1`.
  20633. */
  20634. function assocIndexOf(array, key) {
  20635. var length = array.length;
  20636. while (length--) {
  20637. if (eq(array[length][0], key)) {
  20638. return length;
  20639. }
  20640. }
  20641. return -1;
  20642. }
  20643. /**
  20644. * Aggregates elements of `collection` on `accumulator` with keys transformed
  20645. * by `iteratee` and values set by `setter`.
  20646. *
  20647. * @private
  20648. * @param {Array|Object} collection The collection to iterate over.
  20649. * @param {Function} setter The function to set `accumulator` values.
  20650. * @param {Function} iteratee The iteratee to transform keys.
  20651. * @param {Object} accumulator The initial aggregated object.
  20652. * @returns {Function} Returns `accumulator`.
  20653. */
  20654. function baseAggregator(collection, setter, iteratee, accumulator) {
  20655. baseEach(collection, function(value, key, collection) {
  20656. setter(accumulator, value, iteratee(value), collection);
  20657. });
  20658. return accumulator;
  20659. }
  20660. /**
  20661. * The base implementation of `_.assign` without support for multiple sources
  20662. * or `customizer` functions.
  20663. *
  20664. * @private
  20665. * @param {Object} object The destination object.
  20666. * @param {Object} source The source object.
  20667. * @returns {Object} Returns `object`.
  20668. */
  20669. function baseAssign(object, source) {
  20670. return object && copyObject(source, keys(source), object);
  20671. }
  20672. /**
  20673. * The base implementation of `_.assignIn` without support for multiple sources
  20674. * or `customizer` functions.
  20675. *
  20676. * @private
  20677. * @param {Object} object The destination object.
  20678. * @param {Object} source The source object.
  20679. * @returns {Object} Returns `object`.
  20680. */
  20681. function baseAssignIn(object, source) {
  20682. return object && copyObject(source, keysIn(source), object);
  20683. }
  20684. /**
  20685. * The base implementation of `assignValue` and `assignMergeValue` without
  20686. * value checks.
  20687. *
  20688. * @private
  20689. * @param {Object} object The object to modify.
  20690. * @param {string} key The key of the property to assign.
  20691. * @param {*} value The value to assign.
  20692. */
  20693. function baseAssignValue(object, key, value) {
  20694. if (key == '__proto__' && defineProperty) {
  20695. defineProperty(object, key, {
  20696. 'configurable': true,
  20697. 'enumerable': true,
  20698. 'value': value,
  20699. 'writable': true
  20700. });
  20701. } else {
  20702. object[key] = value;
  20703. }
  20704. }
  20705. /**
  20706. * The base implementation of `_.at` without support for individual paths.
  20707. *
  20708. * @private
  20709. * @param {Object} object The object to iterate over.
  20710. * @param {string[]} paths The property paths to pick.
  20711. * @returns {Array} Returns the picked elements.
  20712. */
  20713. function baseAt(object, paths) {
  20714. var index = -1,
  20715. length = paths.length,
  20716. result = Array(length),
  20717. skip = object == null;
  20718. while (++index < length) {
  20719. result[index] = skip ? undefined : get(object, paths[index]);
  20720. }
  20721. return result;
  20722. }
  20723. /**
  20724. * The base implementation of `_.clamp` which doesn't coerce arguments.
  20725. *
  20726. * @private
  20727. * @param {number} number The number to clamp.
  20728. * @param {number} [lower] The lower bound.
  20729. * @param {number} upper The upper bound.
  20730. * @returns {number} Returns the clamped number.
  20731. */
  20732. function baseClamp(number, lower, upper) {
  20733. if (number === number) {
  20734. if (upper !== undefined) {
  20735. number = number <= upper ? number : upper;
  20736. }
  20737. if (lower !== undefined) {
  20738. number = number >= lower ? number : lower;
  20739. }
  20740. }
  20741. return number;
  20742. }
  20743. /**
  20744. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  20745. * traversed objects.
  20746. *
  20747. * @private
  20748. * @param {*} value The value to clone.
  20749. * @param {boolean} bitmask The bitmask flags.
  20750. * 1 - Deep clone
  20751. * 2 - Flatten inherited properties
  20752. * 4 - Clone symbols
  20753. * @param {Function} [customizer] The function to customize cloning.
  20754. * @param {string} [key] The key of `value`.
  20755. * @param {Object} [object] The parent object of `value`.
  20756. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  20757. * @returns {*} Returns the cloned value.
  20758. */
  20759. function baseClone(value, bitmask, customizer, key, object, stack) {
  20760. var result,
  20761. isDeep = bitmask & CLONE_DEEP_FLAG,
  20762. isFlat = bitmask & CLONE_FLAT_FLAG,
  20763. isFull = bitmask & CLONE_SYMBOLS_FLAG;
  20764. if (customizer) {
  20765. result = object ? customizer(value, key, object, stack) : customizer(value);
  20766. }
  20767. if (result !== undefined) {
  20768. return result;
  20769. }
  20770. if (!isObject(value)) {
  20771. return value;
  20772. }
  20773. var isArr = isArray(value);
  20774. if (isArr) {
  20775. result = initCloneArray(value);
  20776. if (!isDeep) {
  20777. return copyArray(value, result);
  20778. }
  20779. } else {
  20780. var tag = getTag(value),
  20781. isFunc = tag == funcTag || tag == genTag;
  20782. if (isBuffer(value)) {
  20783. return cloneBuffer(value, isDeep);
  20784. }
  20785. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  20786. result = (isFlat || isFunc) ? {} : initCloneObject(value);
  20787. if (!isDeep) {
  20788. return isFlat
  20789. ? copySymbolsIn(value, baseAssignIn(result, value))
  20790. : copySymbols(value, baseAssign(result, value));
  20791. }
  20792. } else {
  20793. if (!cloneableTags[tag]) {
  20794. return object ? value : {};
  20795. }
  20796. result = initCloneByTag(value, tag, isDeep);
  20797. }
  20798. }
  20799. // Check for circular references and return its corresponding clone.
  20800. stack || (stack = new Stack);
  20801. var stacked = stack.get(value);
  20802. if (stacked) {
  20803. return stacked;
  20804. }
  20805. stack.set(value, result);
  20806. if (isSet(value)) {
  20807. value.forEach(function(subValue) {
  20808. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  20809. });
  20810. } else if (isMap(value)) {
  20811. value.forEach(function(subValue, key) {
  20812. result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
  20813. });
  20814. }
  20815. var keysFunc = isFull
  20816. ? (isFlat ? getAllKeysIn : getAllKeys)
  20817. : (isFlat ? keysIn : keys);
  20818. var props = isArr ? undefined : keysFunc(value);
  20819. arrayEach(props || value, function(subValue, key) {
  20820. if (props) {
  20821. key = subValue;
  20822. subValue = value[key];
  20823. }
  20824. // Recursively populate clone (susceptible to call stack limits).
  20825. assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  20826. });
  20827. return result;
  20828. }
  20829. /**
  20830. * The base implementation of `_.conforms` which doesn't clone `source`.
  20831. *
  20832. * @private
  20833. * @param {Object} source The object of property predicates to conform to.
  20834. * @returns {Function} Returns the new spec function.
  20835. */
  20836. function baseConforms(source) {
  20837. var props = keys(source);
  20838. return function(object) {
  20839. return baseConformsTo(object, source, props);
  20840. };
  20841. }
  20842. /**
  20843. * The base implementation of `_.conformsTo` which accepts `props` to check.
  20844. *
  20845. * @private
  20846. * @param {Object} object The object to inspect.
  20847. * @param {Object} source The object of property predicates to conform to.
  20848. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  20849. */
  20850. function baseConformsTo(object, source, props) {
  20851. var length = props.length;
  20852. if (object == null) {
  20853. return !length;
  20854. }
  20855. object = Object(object);
  20856. while (length--) {
  20857. var key = props[length],
  20858. predicate = source[key],
  20859. value = object[key];
  20860. if ((value === undefined && !(key in object)) || !predicate(value)) {
  20861. return false;
  20862. }
  20863. }
  20864. return true;
  20865. }
  20866. /**
  20867. * The base implementation of `_.delay` and `_.defer` which accepts `args`
  20868. * to provide to `func`.
  20869. *
  20870. * @private
  20871. * @param {Function} func The function to delay.
  20872. * @param {number} wait The number of milliseconds to delay invocation.
  20873. * @param {Array} args The arguments to provide to `func`.
  20874. * @returns {number|Object} Returns the timer id or timeout object.
  20875. */
  20876. function baseDelay(func, wait, args) {
  20877. if (typeof func != 'function') {
  20878. throw new TypeError(FUNC_ERROR_TEXT);
  20879. }
  20880. return setTimeout(function() { func.apply(undefined, args); }, wait);
  20881. }
  20882. /**
  20883. * The base implementation of methods like `_.difference` without support
  20884. * for excluding multiple arrays or iteratee shorthands.
  20885. *
  20886. * @private
  20887. * @param {Array} array The array to inspect.
  20888. * @param {Array} values The values to exclude.
  20889. * @param {Function} [iteratee] The iteratee invoked per element.
  20890. * @param {Function} [comparator] The comparator invoked per element.
  20891. * @returns {Array} Returns the new array of filtered values.
  20892. */
  20893. function baseDifference(array, values, iteratee, comparator) {
  20894. var index = -1,
  20895. includes = arrayIncludes,
  20896. isCommon = true,
  20897. length = array.length,
  20898. result = [],
  20899. valuesLength = values.length;
  20900. if (!length) {
  20901. return result;
  20902. }
  20903. if (iteratee) {
  20904. values = arrayMap(values, baseUnary(iteratee));
  20905. }
  20906. if (comparator) {
  20907. includes = arrayIncludesWith;
  20908. isCommon = false;
  20909. }
  20910. else if (values.length >= LARGE_ARRAY_SIZE) {
  20911. includes = cacheHas;
  20912. isCommon = false;
  20913. values = new SetCache(values);
  20914. }
  20915. outer:
  20916. while (++index < length) {
  20917. var value = array[index],
  20918. computed = iteratee == null ? value : iteratee(value);
  20919. value = (comparator || value !== 0) ? value : 0;
  20920. if (isCommon && computed === computed) {
  20921. var valuesIndex = valuesLength;
  20922. while (valuesIndex--) {
  20923. if (values[valuesIndex] === computed) {
  20924. continue outer;
  20925. }
  20926. }
  20927. result.push(value);
  20928. }
  20929. else if (!includes(values, computed, comparator)) {
  20930. result.push(value);
  20931. }
  20932. }
  20933. return result;
  20934. }
  20935. /**
  20936. * The base implementation of `_.forEach` without support for iteratee shorthands.
  20937. *
  20938. * @private
  20939. * @param {Array|Object} collection The collection to iterate over.
  20940. * @param {Function} iteratee The function invoked per iteration.
  20941. * @returns {Array|Object} Returns `collection`.
  20942. */
  20943. var baseEach = createBaseEach(baseForOwn);
  20944. /**
  20945. * The base implementation of `_.forEachRight` without support for iteratee shorthands.
  20946. *
  20947. * @private
  20948. * @param {Array|Object} collection The collection to iterate over.
  20949. * @param {Function} iteratee The function invoked per iteration.
  20950. * @returns {Array|Object} Returns `collection`.
  20951. */
  20952. var baseEachRight = createBaseEach(baseForOwnRight, true);
  20953. /**
  20954. * The base implementation of `_.every` without support for iteratee shorthands.
  20955. *
  20956. * @private
  20957. * @param {Array|Object} collection The collection to iterate over.
  20958. * @param {Function} predicate The function invoked per iteration.
  20959. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  20960. * else `false`
  20961. */
  20962. function baseEvery(collection, predicate) {
  20963. var result = true;
  20964. baseEach(collection, function(value, index, collection) {
  20965. result = !!predicate(value, index, collection);
  20966. return result;
  20967. });
  20968. return result;
  20969. }
  20970. /**
  20971. * The base implementation of methods like `_.max` and `_.min` which accepts a
  20972. * `comparator` to determine the extremum value.
  20973. *
  20974. * @private
  20975. * @param {Array} array The array to iterate over.
  20976. * @param {Function} iteratee The iteratee invoked per iteration.
  20977. * @param {Function} comparator The comparator used to compare values.
  20978. * @returns {*} Returns the extremum value.
  20979. */
  20980. function baseExtremum(array, iteratee, comparator) {
  20981. var index = -1,
  20982. length = array.length;
  20983. while (++index < length) {
  20984. var value = array[index],
  20985. current = iteratee(value);
  20986. if (current != null && (computed === undefined
  20987. ? (current === current && !isSymbol(current))
  20988. : comparator(current, computed)
  20989. )) {
  20990. var computed = current,
  20991. result = value;
  20992. }
  20993. }
  20994. return result;
  20995. }
  20996. /**
  20997. * The base implementation of `_.fill` without an iteratee call guard.
  20998. *
  20999. * @private
  21000. * @param {Array} array The array to fill.
  21001. * @param {*} value The value to fill `array` with.
  21002. * @param {number} [start=0] The start position.
  21003. * @param {number} [end=array.length] The end position.
  21004. * @returns {Array} Returns `array`.
  21005. */
  21006. function baseFill(array, value, start, end) {
  21007. var length = array.length;
  21008. start = toInteger(start);
  21009. if (start < 0) {
  21010. start = -start > length ? 0 : (length + start);
  21011. }
  21012. end = (end === undefined || end > length) ? length : toInteger(end);
  21013. if (end < 0) {
  21014. end += length;
  21015. }
  21016. end = start > end ? 0 : toLength(end);
  21017. while (start < end) {
  21018. array[start++] = value;
  21019. }
  21020. return array;
  21021. }
  21022. /**
  21023. * The base implementation of `_.filter` without support for iteratee shorthands.
  21024. *
  21025. * @private
  21026. * @param {Array|Object} collection The collection to iterate over.
  21027. * @param {Function} predicate The function invoked per iteration.
  21028. * @returns {Array} Returns the new filtered array.
  21029. */
  21030. function baseFilter(collection, predicate) {
  21031. var result = [];
  21032. baseEach(collection, function(value, index, collection) {
  21033. if (predicate(value, index, collection)) {
  21034. result.push(value);
  21035. }
  21036. });
  21037. return result;
  21038. }
  21039. /**
  21040. * The base implementation of `_.flatten` with support for restricting flattening.
  21041. *
  21042. * @private
  21043. * @param {Array} array The array to flatten.
  21044. * @param {number} depth The maximum recursion depth.
  21045. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  21046. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  21047. * @param {Array} [result=[]] The initial result value.
  21048. * @returns {Array} Returns the new flattened array.
  21049. */
  21050. function baseFlatten(array, depth, predicate, isStrict, result) {
  21051. var index = -1,
  21052. length = array.length;
  21053. predicate || (predicate = isFlattenable);
  21054. result || (result = []);
  21055. while (++index < length) {
  21056. var value = array[index];
  21057. if (depth > 0 && predicate(value)) {
  21058. if (depth > 1) {
  21059. // Recursively flatten arrays (susceptible to call stack limits).
  21060. baseFlatten(value, depth - 1, predicate, isStrict, result);
  21061. } else {
  21062. arrayPush(result, value);
  21063. }
  21064. } else if (!isStrict) {
  21065. result[result.length] = value;
  21066. }
  21067. }
  21068. return result;
  21069. }
  21070. /**
  21071. * The base implementation of `baseForOwn` which iterates over `object`
  21072. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  21073. * Iteratee functions may exit iteration early by explicitly returning `false`.
  21074. *
  21075. * @private
  21076. * @param {Object} object The object to iterate over.
  21077. * @param {Function} iteratee The function invoked per iteration.
  21078. * @param {Function} keysFunc The function to get the keys of `object`.
  21079. * @returns {Object} Returns `object`.
  21080. */
  21081. var baseFor = createBaseFor();
  21082. /**
  21083. * This function is like `baseFor` except that it iterates over properties
  21084. * in the opposite order.
  21085. *
  21086. * @private
  21087. * @param {Object} object The object to iterate over.
  21088. * @param {Function} iteratee The function invoked per iteration.
  21089. * @param {Function} keysFunc The function to get the keys of `object`.
  21090. * @returns {Object} Returns `object`.
  21091. */
  21092. var baseForRight = createBaseFor(true);
  21093. /**
  21094. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  21095. *
  21096. * @private
  21097. * @param {Object} object The object to iterate over.
  21098. * @param {Function} iteratee The function invoked per iteration.
  21099. * @returns {Object} Returns `object`.
  21100. */
  21101. function baseForOwn(object, iteratee) {
  21102. return object && baseFor(object, iteratee, keys);
  21103. }
  21104. /**
  21105. * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
  21106. *
  21107. * @private
  21108. * @param {Object} object The object to iterate over.
  21109. * @param {Function} iteratee The function invoked per iteration.
  21110. * @returns {Object} Returns `object`.
  21111. */
  21112. function baseForOwnRight(object, iteratee) {
  21113. return object && baseForRight(object, iteratee, keys);
  21114. }
  21115. /**
  21116. * The base implementation of `_.functions` which creates an array of
  21117. * `object` function property names filtered from `props`.
  21118. *
  21119. * @private
  21120. * @param {Object} object The object to inspect.
  21121. * @param {Array} props The property names to filter.
  21122. * @returns {Array} Returns the function names.
  21123. */
  21124. function baseFunctions(object, props) {
  21125. return arrayFilter(props, function(key) {
  21126. return isFunction(object[key]);
  21127. });
  21128. }
  21129. /**
  21130. * The base implementation of `_.get` without support for default values.
  21131. *
  21132. * @private
  21133. * @param {Object} object The object to query.
  21134. * @param {Array|string} path The path of the property to get.
  21135. * @returns {*} Returns the resolved value.
  21136. */
  21137. function baseGet(object, path) {
  21138. path = castPath(path, object);
  21139. var index = 0,
  21140. length = path.length;
  21141. while (object != null && index < length) {
  21142. object = object[toKey(path[index++])];
  21143. }
  21144. return (index && index == length) ? object : undefined;
  21145. }
  21146. /**
  21147. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  21148. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  21149. * symbols of `object`.
  21150. *
  21151. * @private
  21152. * @param {Object} object The object to query.
  21153. * @param {Function} keysFunc The function to get the keys of `object`.
  21154. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  21155. * @returns {Array} Returns the array of property names and symbols.
  21156. */
  21157. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  21158. var result = keysFunc(object);
  21159. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  21160. }
  21161. /**
  21162. * The base implementation of `getTag` without fallbacks for buggy environments.
  21163. *
  21164. * @private
  21165. * @param {*} value The value to query.
  21166. * @returns {string} Returns the `toStringTag`.
  21167. */
  21168. function baseGetTag(value) {
  21169. if (value == null) {
  21170. return value === undefined ? undefinedTag : nullTag;
  21171. }
  21172. return (symToStringTag && symToStringTag in Object(value))
  21173. ? getRawTag(value)
  21174. : objectToString(value);
  21175. }
  21176. /**
  21177. * The base implementation of `_.gt` which doesn't coerce arguments.
  21178. *
  21179. * @private
  21180. * @param {*} value The value to compare.
  21181. * @param {*} other The other value to compare.
  21182. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  21183. * else `false`.
  21184. */
  21185. function baseGt(value, other) {
  21186. return value > other;
  21187. }
  21188. /**
  21189. * The base implementation of `_.has` without support for deep paths.
  21190. *
  21191. * @private
  21192. * @param {Object} [object] The object to query.
  21193. * @param {Array|string} key The key to check.
  21194. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  21195. */
  21196. function baseHas(object, key) {
  21197. return object != null && hasOwnProperty.call(object, key);
  21198. }
  21199. /**
  21200. * The base implementation of `_.hasIn` without support for deep paths.
  21201. *
  21202. * @private
  21203. * @param {Object} [object] The object to query.
  21204. * @param {Array|string} key The key to check.
  21205. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  21206. */
  21207. function baseHasIn(object, key) {
  21208. return object != null && key in Object(object);
  21209. }
  21210. /**
  21211. * The base implementation of `_.inRange` which doesn't coerce arguments.
  21212. *
  21213. * @private
  21214. * @param {number} number The number to check.
  21215. * @param {number} start The start of the range.
  21216. * @param {number} end The end of the range.
  21217. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  21218. */
  21219. function baseInRange(number, start, end) {
  21220. return number >= nativeMin(start, end) && number < nativeMax(start, end);
  21221. }
  21222. /**
  21223. * The base implementation of methods like `_.intersection`, without support
  21224. * for iteratee shorthands, that accepts an array of arrays to inspect.
  21225. *
  21226. * @private
  21227. * @param {Array} arrays The arrays to inspect.
  21228. * @param {Function} [iteratee] The iteratee invoked per element.
  21229. * @param {Function} [comparator] The comparator invoked per element.
  21230. * @returns {Array} Returns the new array of shared values.
  21231. */
  21232. function baseIntersection(arrays, iteratee, comparator) {
  21233. var includes = comparator ? arrayIncludesWith : arrayIncludes,
  21234. length = arrays[0].length,
  21235. othLength = arrays.length,
  21236. othIndex = othLength,
  21237. caches = Array(othLength),
  21238. maxLength = Infinity,
  21239. result = [];
  21240. while (othIndex--) {
  21241. var array = arrays[othIndex];
  21242. if (othIndex && iteratee) {
  21243. array = arrayMap(array, baseUnary(iteratee));
  21244. }
  21245. maxLength = nativeMin(array.length, maxLength);
  21246. caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
  21247. ? new SetCache(othIndex && array)
  21248. : undefined;
  21249. }
  21250. array = arrays[0];
  21251. var index = -1,
  21252. seen = caches[0];
  21253. outer:
  21254. while (++index < length && result.length < maxLength) {
  21255. var value = array[index],
  21256. computed = iteratee ? iteratee(value) : value;
  21257. value = (comparator || value !== 0) ? value : 0;
  21258. if (!(seen
  21259. ? cacheHas(seen, computed)
  21260. : includes(result, computed, comparator)
  21261. )) {
  21262. othIndex = othLength;
  21263. while (--othIndex) {
  21264. var cache = caches[othIndex];
  21265. if (!(cache
  21266. ? cacheHas(cache, computed)
  21267. : includes(arrays[othIndex], computed, comparator))
  21268. ) {
  21269. continue outer;
  21270. }
  21271. }
  21272. if (seen) {
  21273. seen.push(computed);
  21274. }
  21275. result.push(value);
  21276. }
  21277. }
  21278. return result;
  21279. }
  21280. /**
  21281. * The base implementation of `_.invert` and `_.invertBy` which inverts
  21282. * `object` with values transformed by `iteratee` and set by `setter`.
  21283. *
  21284. * @private
  21285. * @param {Object} object The object to iterate over.
  21286. * @param {Function} setter The function to set `accumulator` values.
  21287. * @param {Function} iteratee The iteratee to transform values.
  21288. * @param {Object} accumulator The initial inverted object.
  21289. * @returns {Function} Returns `accumulator`.
  21290. */
  21291. function baseInverter(object, setter, iteratee, accumulator) {
  21292. baseForOwn(object, function(value, key, object) {
  21293. setter(accumulator, iteratee(value), key, object);
  21294. });
  21295. return accumulator;
  21296. }
  21297. /**
  21298. * The base implementation of `_.invoke` without support for individual
  21299. * method arguments.
  21300. *
  21301. * @private
  21302. * @param {Object} object The object to query.
  21303. * @param {Array|string} path The path of the method to invoke.
  21304. * @param {Array} args The arguments to invoke the method with.
  21305. * @returns {*} Returns the result of the invoked method.
  21306. */
  21307. function baseInvoke(object, path, args) {
  21308. path = castPath(path, object);
  21309. object = parent(object, path);
  21310. var func = object == null ? object : object[toKey(last(path))];
  21311. return func == null ? undefined : apply(func, object, args);
  21312. }
  21313. /**
  21314. * The base implementation of `_.isArguments`.
  21315. *
  21316. * @private
  21317. * @param {*} value The value to check.
  21318. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  21319. */
  21320. function baseIsArguments(value) {
  21321. return isObjectLike(value) && baseGetTag(value) == argsTag;
  21322. }
  21323. /**
  21324. * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
  21325. *
  21326. * @private
  21327. * @param {*} value The value to check.
  21328. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  21329. */
  21330. function baseIsArrayBuffer(value) {
  21331. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  21332. }
  21333. /**
  21334. * The base implementation of `_.isDate` without Node.js optimizations.
  21335. *
  21336. * @private
  21337. * @param {*} value The value to check.
  21338. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  21339. */
  21340. function baseIsDate(value) {
  21341. return isObjectLike(value) && baseGetTag(value) == dateTag;
  21342. }
  21343. /**
  21344. * The base implementation of `_.isEqual` which supports partial comparisons
  21345. * and tracks traversed objects.
  21346. *
  21347. * @private
  21348. * @param {*} value The value to compare.
  21349. * @param {*} other The other value to compare.
  21350. * @param {boolean} bitmask The bitmask flags.
  21351. * 1 - Unordered comparison
  21352. * 2 - Partial comparison
  21353. * @param {Function} [customizer] The function to customize comparisons.
  21354. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  21355. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  21356. */
  21357. function baseIsEqual(value, other, bitmask, customizer, stack) {
  21358. if (value === other) {
  21359. return true;
  21360. }
  21361. if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
  21362. return value !== value && other !== other;
  21363. }
  21364. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  21365. }
  21366. /**
  21367. * A specialized version of `baseIsEqual` for arrays and objects which performs
  21368. * deep comparisons and tracks traversed objects enabling objects with circular
  21369. * references to be compared.
  21370. *
  21371. * @private
  21372. * @param {Object} object The object to compare.
  21373. * @param {Object} other The other object to compare.
  21374. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  21375. * @param {Function} customizer The function to customize comparisons.
  21376. * @param {Function} equalFunc The function to determine equivalents of values.
  21377. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  21378. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  21379. */
  21380. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  21381. var objIsArr = isArray(object),
  21382. othIsArr = isArray(other),
  21383. objTag = objIsArr ? arrayTag : getTag(object),
  21384. othTag = othIsArr ? arrayTag : getTag(other);
  21385. objTag = objTag == argsTag ? objectTag : objTag;
  21386. othTag = othTag == argsTag ? objectTag : othTag;
  21387. var objIsObj = objTag == objectTag,
  21388. othIsObj = othTag == objectTag,
  21389. isSameTag = objTag == othTag;
  21390. if (isSameTag && isBuffer(object)) {
  21391. if (!isBuffer(other)) {
  21392. return false;
  21393. }
  21394. objIsArr = true;
  21395. objIsObj = false;
  21396. }
  21397. if (isSameTag && !objIsObj) {
  21398. stack || (stack = new Stack);
  21399. return (objIsArr || isTypedArray(object))
  21400. ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
  21401. : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  21402. }
  21403. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  21404. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  21405. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  21406. if (objIsWrapped || othIsWrapped) {
  21407. var objUnwrapped = objIsWrapped ? object.value() : object,
  21408. othUnwrapped = othIsWrapped ? other.value() : other;
  21409. stack || (stack = new Stack);
  21410. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  21411. }
  21412. }
  21413. if (!isSameTag) {
  21414. return false;
  21415. }
  21416. stack || (stack = new Stack);
  21417. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  21418. }
  21419. /**
  21420. * The base implementation of `_.isMap` without Node.js optimizations.
  21421. *
  21422. * @private
  21423. * @param {*} value The value to check.
  21424. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  21425. */
  21426. function baseIsMap(value) {
  21427. return isObjectLike(value) && getTag(value) == mapTag;
  21428. }
  21429. /**
  21430. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  21431. *
  21432. * @private
  21433. * @param {Object} object The object to inspect.
  21434. * @param {Object} source The object of property values to match.
  21435. * @param {Array} matchData The property names, values, and compare flags to match.
  21436. * @param {Function} [customizer] The function to customize comparisons.
  21437. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  21438. */
  21439. function baseIsMatch(object, source, matchData, customizer) {
  21440. var index = matchData.length,
  21441. length = index,
  21442. noCustomizer = !customizer;
  21443. if (object == null) {
  21444. return !length;
  21445. }
  21446. object = Object(object);
  21447. while (index--) {
  21448. var data = matchData[index];
  21449. if ((noCustomizer && data[2])
  21450. ? data[1] !== object[data[0]]
  21451. : !(data[0] in object)
  21452. ) {
  21453. return false;
  21454. }
  21455. }
  21456. while (++index < length) {
  21457. data = matchData[index];
  21458. var key = data[0],
  21459. objValue = object[key],
  21460. srcValue = data[1];
  21461. if (noCustomizer && data[2]) {
  21462. if (objValue === undefined && !(key in object)) {
  21463. return false;
  21464. }
  21465. } else {
  21466. var stack = new Stack;
  21467. if (customizer) {
  21468. var result = customizer(objValue, srcValue, key, object, source, stack);
  21469. }
  21470. if (!(result === undefined
  21471. ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
  21472. : result
  21473. )) {
  21474. return false;
  21475. }
  21476. }
  21477. }
  21478. return true;
  21479. }
  21480. /**
  21481. * The base implementation of `_.isNative` without bad shim checks.
  21482. *
  21483. * @private
  21484. * @param {*} value The value to check.
  21485. * @returns {boolean} Returns `true` if `value` is a native function,
  21486. * else `false`.
  21487. */
  21488. function baseIsNative(value) {
  21489. if (!isObject(value) || isMasked(value)) {
  21490. return false;
  21491. }
  21492. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  21493. return pattern.test(toSource(value));
  21494. }
  21495. /**
  21496. * The base implementation of `_.isRegExp` without Node.js optimizations.
  21497. *
  21498. * @private
  21499. * @param {*} value The value to check.
  21500. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  21501. */
  21502. function baseIsRegExp(value) {
  21503. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  21504. }
  21505. /**
  21506. * The base implementation of `_.isSet` without Node.js optimizations.
  21507. *
  21508. * @private
  21509. * @param {*} value The value to check.
  21510. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  21511. */
  21512. function baseIsSet(value) {
  21513. return isObjectLike(value) && getTag(value) == setTag;
  21514. }
  21515. /**
  21516. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  21517. *
  21518. * @private
  21519. * @param {*} value The value to check.
  21520. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  21521. */
  21522. function baseIsTypedArray(value) {
  21523. return isObjectLike(value) &&
  21524. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  21525. }
  21526. /**
  21527. * The base implementation of `_.iteratee`.
  21528. *
  21529. * @private
  21530. * @param {*} [value=_.identity] The value to convert to an iteratee.
  21531. * @returns {Function} Returns the iteratee.
  21532. */
  21533. function baseIteratee(value) {
  21534. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  21535. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  21536. if (typeof value == 'function') {
  21537. return value;
  21538. }
  21539. if (value == null) {
  21540. return identity;
  21541. }
  21542. if (typeof value == 'object') {
  21543. return isArray(value)
  21544. ? baseMatchesProperty(value[0], value[1])
  21545. : baseMatches(value);
  21546. }
  21547. return property(value);
  21548. }
  21549. /**
  21550. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  21551. *
  21552. * @private
  21553. * @param {Object} object The object to query.
  21554. * @returns {Array} Returns the array of property names.
  21555. */
  21556. function baseKeys(object) {
  21557. if (!isPrototype(object)) {
  21558. return nativeKeys(object);
  21559. }
  21560. var result = [];
  21561. for (var key in Object(object)) {
  21562. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  21563. result.push(key);
  21564. }
  21565. }
  21566. return result;
  21567. }
  21568. /**
  21569. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  21570. *
  21571. * @private
  21572. * @param {Object} object The object to query.
  21573. * @returns {Array} Returns the array of property names.
  21574. */
  21575. function baseKeysIn(object) {
  21576. if (!isObject(object)) {
  21577. return nativeKeysIn(object);
  21578. }
  21579. var isProto = isPrototype(object),
  21580. result = [];
  21581. for (var key in object) {
  21582. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  21583. result.push(key);
  21584. }
  21585. }
  21586. return result;
  21587. }
  21588. /**
  21589. * The base implementation of `_.lt` which doesn't coerce arguments.
  21590. *
  21591. * @private
  21592. * @param {*} value The value to compare.
  21593. * @param {*} other The other value to compare.
  21594. * @returns {boolean} Returns `true` if `value` is less than `other`,
  21595. * else `false`.
  21596. */
  21597. function baseLt(value, other) {
  21598. return value < other;
  21599. }
  21600. /**
  21601. * The base implementation of `_.map` without support for iteratee shorthands.
  21602. *
  21603. * @private
  21604. * @param {Array|Object} collection The collection to iterate over.
  21605. * @param {Function} iteratee The function invoked per iteration.
  21606. * @returns {Array} Returns the new mapped array.
  21607. */
  21608. function baseMap(collection, iteratee) {
  21609. var index = -1,
  21610. result = isArrayLike(collection) ? Array(collection.length) : [];
  21611. baseEach(collection, function(value, key, collection) {
  21612. result[++index] = iteratee(value, key, collection);
  21613. });
  21614. return result;
  21615. }
  21616. /**
  21617. * The base implementation of `_.matches` which doesn't clone `source`.
  21618. *
  21619. * @private
  21620. * @param {Object} source The object of property values to match.
  21621. * @returns {Function} Returns the new spec function.
  21622. */
  21623. function baseMatches(source) {
  21624. var matchData = getMatchData(source);
  21625. if (matchData.length == 1 && matchData[0][2]) {
  21626. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  21627. }
  21628. return function(object) {
  21629. return object === source || baseIsMatch(object, source, matchData);
  21630. };
  21631. }
  21632. /**
  21633. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  21634. *
  21635. * @private
  21636. * @param {string} path The path of the property to get.
  21637. * @param {*} srcValue The value to match.
  21638. * @returns {Function} Returns the new spec function.
  21639. */
  21640. function baseMatchesProperty(path, srcValue) {
  21641. if (isKey(path) && isStrictComparable(srcValue)) {
  21642. return matchesStrictComparable(toKey(path), srcValue);
  21643. }
  21644. return function(object) {
  21645. var objValue = get(object, path);
  21646. return (objValue === undefined && objValue === srcValue)
  21647. ? hasIn(object, path)
  21648. : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  21649. };
  21650. }
  21651. /**
  21652. * The base implementation of `_.merge` without support for multiple sources.
  21653. *
  21654. * @private
  21655. * @param {Object} object The destination object.
  21656. * @param {Object} source The source object.
  21657. * @param {number} srcIndex The index of `source`.
  21658. * @param {Function} [customizer] The function to customize merged values.
  21659. * @param {Object} [stack] Tracks traversed source values and their merged
  21660. * counterparts.
  21661. */
  21662. function baseMerge(object, source, srcIndex, customizer, stack) {
  21663. if (object === source) {
  21664. return;
  21665. }
  21666. baseFor(source, function(srcValue, key) {
  21667. stack || (stack = new Stack);
  21668. if (isObject(srcValue)) {
  21669. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  21670. }
  21671. else {
  21672. var newValue = customizer
  21673. ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
  21674. : undefined;
  21675. if (newValue === undefined) {
  21676. newValue = srcValue;
  21677. }
  21678. assignMergeValue(object, key, newValue);
  21679. }
  21680. }, keysIn);
  21681. }
  21682. /**
  21683. * A specialized version of `baseMerge` for arrays and objects which performs
  21684. * deep merges and tracks traversed objects enabling objects with circular
  21685. * references to be merged.
  21686. *
  21687. * @private
  21688. * @param {Object} object The destination object.
  21689. * @param {Object} source The source object.
  21690. * @param {string} key The key of the value to merge.
  21691. * @param {number} srcIndex The index of `source`.
  21692. * @param {Function} mergeFunc The function to merge values.
  21693. * @param {Function} [customizer] The function to customize assigned values.
  21694. * @param {Object} [stack] Tracks traversed source values and their merged
  21695. * counterparts.
  21696. */
  21697. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  21698. var objValue = safeGet(object, key),
  21699. srcValue = safeGet(source, key),
  21700. stacked = stack.get(srcValue);
  21701. if (stacked) {
  21702. assignMergeValue(object, key, stacked);
  21703. return;
  21704. }
  21705. var newValue = customizer
  21706. ? customizer(objValue, srcValue, (key + ''), object, source, stack)
  21707. : undefined;
  21708. var isCommon = newValue === undefined;
  21709. if (isCommon) {
  21710. var isArr = isArray(srcValue),
  21711. isBuff = !isArr && isBuffer(srcValue),
  21712. isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  21713. newValue = srcValue;
  21714. if (isArr || isBuff || isTyped) {
  21715. if (isArray(objValue)) {
  21716. newValue = objValue;
  21717. }
  21718. else if (isArrayLikeObject(objValue)) {
  21719. newValue = copyArray(objValue);
  21720. }
  21721. else if (isBuff) {
  21722. isCommon = false;
  21723. newValue = cloneBuffer(srcValue, true);
  21724. }
  21725. else if (isTyped) {
  21726. isCommon = false;
  21727. newValue = cloneTypedArray(srcValue, true);
  21728. }
  21729. else {
  21730. newValue = [];
  21731. }
  21732. }
  21733. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  21734. newValue = objValue;
  21735. if (isArguments(objValue)) {
  21736. newValue = toPlainObject(objValue);
  21737. }
  21738. else if (!isObject(objValue) || isFunction(objValue)) {
  21739. newValue = initCloneObject(srcValue);
  21740. }
  21741. }
  21742. else {
  21743. isCommon = false;
  21744. }
  21745. }
  21746. if (isCommon) {
  21747. // Recursively merge objects and arrays (susceptible to call stack limits).
  21748. stack.set(srcValue, newValue);
  21749. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  21750. stack['delete'](srcValue);
  21751. }
  21752. assignMergeValue(object, key, newValue);
  21753. }
  21754. /**
  21755. * The base implementation of `_.nth` which doesn't coerce arguments.
  21756. *
  21757. * @private
  21758. * @param {Array} array The array to query.
  21759. * @param {number} n The index of the element to return.
  21760. * @returns {*} Returns the nth element of `array`.
  21761. */
  21762. function baseNth(array, n) {
  21763. var length = array.length;
  21764. if (!length) {
  21765. return;
  21766. }
  21767. n += n < 0 ? length : 0;
  21768. return isIndex(n, length) ? array[n] : undefined;
  21769. }
  21770. /**
  21771. * The base implementation of `_.orderBy` without param guards.
  21772. *
  21773. * @private
  21774. * @param {Array|Object} collection The collection to iterate over.
  21775. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
  21776. * @param {string[]} orders The sort orders of `iteratees`.
  21777. * @returns {Array} Returns the new sorted array.
  21778. */
  21779. function baseOrderBy(collection, iteratees, orders) {
  21780. var index = -1;
  21781. iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee()));
  21782. var result = baseMap(collection, function(value, key, collection) {
  21783. var criteria = arrayMap(iteratees, function(iteratee) {
  21784. return iteratee(value);
  21785. });
  21786. return { 'criteria': criteria, 'index': ++index, 'value': value };
  21787. });
  21788. return baseSortBy(result, function(object, other) {
  21789. return compareMultiple(object, other, orders);
  21790. });
  21791. }
  21792. /**
  21793. * The base implementation of `_.pick` without support for individual
  21794. * property identifiers.
  21795. *
  21796. * @private
  21797. * @param {Object} object The source object.
  21798. * @param {string[]} paths The property paths to pick.
  21799. * @returns {Object} Returns the new object.
  21800. */
  21801. function basePick(object, paths) {
  21802. return basePickBy(object, paths, function(value, path) {
  21803. return hasIn(object, path);
  21804. });
  21805. }
  21806. /**
  21807. * The base implementation of `_.pickBy` without support for iteratee shorthands.
  21808. *
  21809. * @private
  21810. * @param {Object} object The source object.
  21811. * @param {string[]} paths The property paths to pick.
  21812. * @param {Function} predicate The function invoked per property.
  21813. * @returns {Object} Returns the new object.
  21814. */
  21815. function basePickBy(object, paths, predicate) {
  21816. var index = -1,
  21817. length = paths.length,
  21818. result = {};
  21819. while (++index < length) {
  21820. var path = paths[index],
  21821. value = baseGet(object, path);
  21822. if (predicate(value, path)) {
  21823. baseSet(result, castPath(path, object), value);
  21824. }
  21825. }
  21826. return result;
  21827. }
  21828. /**
  21829. * A specialized version of `baseProperty` which supports deep paths.
  21830. *
  21831. * @private
  21832. * @param {Array|string} path The path of the property to get.
  21833. * @returns {Function} Returns the new accessor function.
  21834. */
  21835. function basePropertyDeep(path) {
  21836. return function(object) {
  21837. return baseGet(object, path);
  21838. };
  21839. }
  21840. /**
  21841. * The base implementation of `_.pullAllBy` without support for iteratee
  21842. * shorthands.
  21843. *
  21844. * @private
  21845. * @param {Array} array The array to modify.
  21846. * @param {Array} values The values to remove.
  21847. * @param {Function} [iteratee] The iteratee invoked per element.
  21848. * @param {Function} [comparator] The comparator invoked per element.
  21849. * @returns {Array} Returns `array`.
  21850. */
  21851. function basePullAll(array, values, iteratee, comparator) {
  21852. var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
  21853. index = -1,
  21854. length = values.length,
  21855. seen = array;
  21856. if (array === values) {
  21857. values = copyArray(values);
  21858. }
  21859. if (iteratee) {
  21860. seen = arrayMap(array, baseUnary(iteratee));
  21861. }
  21862. while (++index < length) {
  21863. var fromIndex = 0,
  21864. value = values[index],
  21865. computed = iteratee ? iteratee(value) : value;
  21866. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  21867. if (seen !== array) {
  21868. splice.call(seen, fromIndex, 1);
  21869. }
  21870. splice.call(array, fromIndex, 1);
  21871. }
  21872. }
  21873. return array;
  21874. }
  21875. /**
  21876. * The base implementation of `_.pullAt` without support for individual
  21877. * indexes or capturing the removed elements.
  21878. *
  21879. * @private
  21880. * @param {Array} array The array to modify.
  21881. * @param {number[]} indexes The indexes of elements to remove.
  21882. * @returns {Array} Returns `array`.
  21883. */
  21884. function basePullAt(array, indexes) {
  21885. var length = array ? indexes.length : 0,
  21886. lastIndex = length - 1;
  21887. while (length--) {
  21888. var index = indexes[length];
  21889. if (length == lastIndex || index !== previous) {
  21890. var previous = index;
  21891. if (isIndex(index)) {
  21892. splice.call(array, index, 1);
  21893. } else {
  21894. baseUnset(array, index);
  21895. }
  21896. }
  21897. }
  21898. return array;
  21899. }
  21900. /**
  21901. * The base implementation of `_.random` without support for returning
  21902. * floating-point numbers.
  21903. *
  21904. * @private
  21905. * @param {number} lower The lower bound.
  21906. * @param {number} upper The upper bound.
  21907. * @returns {number} Returns the random number.
  21908. */
  21909. function baseRandom(lower, upper) {
  21910. return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
  21911. }
  21912. /**
  21913. * The base implementation of `_.range` and `_.rangeRight` which doesn't
  21914. * coerce arguments.
  21915. *
  21916. * @private
  21917. * @param {number} start The start of the range.
  21918. * @param {number} end The end of the range.
  21919. * @param {number} step The value to increment or decrement by.
  21920. * @param {boolean} [fromRight] Specify iterating from right to left.
  21921. * @returns {Array} Returns the range of numbers.
  21922. */
  21923. function baseRange(start, end, step, fromRight) {
  21924. var index = -1,
  21925. length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
  21926. result = Array(length);
  21927. while (length--) {
  21928. result[fromRight ? length : ++index] = start;
  21929. start += step;
  21930. }
  21931. return result;
  21932. }
  21933. /**
  21934. * The base implementation of `_.repeat` which doesn't coerce arguments.
  21935. *
  21936. * @private
  21937. * @param {string} string The string to repeat.
  21938. * @param {number} n The number of times to repeat the string.
  21939. * @returns {string} Returns the repeated string.
  21940. */
  21941. function baseRepeat(string, n) {
  21942. var result = '';
  21943. if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
  21944. return result;
  21945. }
  21946. // Leverage the exponentiation by squaring algorithm for a faster repeat.
  21947. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
  21948. do {
  21949. if (n % 2) {
  21950. result += string;
  21951. }
  21952. n = nativeFloor(n / 2);
  21953. if (n) {
  21954. string += string;
  21955. }
  21956. } while (n);
  21957. return result;
  21958. }
  21959. /**
  21960. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  21961. *
  21962. * @private
  21963. * @param {Function} func The function to apply a rest parameter to.
  21964. * @param {number} [start=func.length-1] The start position of the rest parameter.
  21965. * @returns {Function} Returns the new function.
  21966. */
  21967. function baseRest(func, start) {
  21968. return setToString(overRest(func, start, identity), func + '');
  21969. }
  21970. /**
  21971. * The base implementation of `_.sample`.
  21972. *
  21973. * @private
  21974. * @param {Array|Object} collection The collection to sample.
  21975. * @returns {*} Returns the random element.
  21976. */
  21977. function baseSample(collection) {
  21978. return arraySample(values(collection));
  21979. }
  21980. /**
  21981. * The base implementation of `_.sampleSize` without param guards.
  21982. *
  21983. * @private
  21984. * @param {Array|Object} collection The collection to sample.
  21985. * @param {number} n The number of elements to sample.
  21986. * @returns {Array} Returns the random elements.
  21987. */
  21988. function baseSampleSize(collection, n) {
  21989. var array = values(collection);
  21990. return shuffleSelf(array, baseClamp(n, 0, array.length));
  21991. }
  21992. /**
  21993. * The base implementation of `_.set`.
  21994. *
  21995. * @private
  21996. * @param {Object} object The object to modify.
  21997. * @param {Array|string} path The path of the property to set.
  21998. * @param {*} value The value to set.
  21999. * @param {Function} [customizer] The function to customize path creation.
  22000. * @returns {Object} Returns `object`.
  22001. */
  22002. function baseSet(object, path, value, customizer) {
  22003. if (!isObject(object)) {
  22004. return object;
  22005. }
  22006. path = castPath(path, object);
  22007. var index = -1,
  22008. length = path.length,
  22009. lastIndex = length - 1,
  22010. nested = object;
  22011. while (nested != null && ++index < length) {
  22012. var key = toKey(path[index]),
  22013. newValue = value;
  22014. if (index != lastIndex) {
  22015. var objValue = nested[key];
  22016. newValue = customizer ? customizer(objValue, key, nested) : undefined;
  22017. if (newValue === undefined) {
  22018. newValue = isObject(objValue)
  22019. ? objValue
  22020. : (isIndex(path[index + 1]) ? [] : {});
  22021. }
  22022. }
  22023. assignValue(nested, key, newValue);
  22024. nested = nested[key];
  22025. }
  22026. return object;
  22027. }
  22028. /**
  22029. * The base implementation of `setData` without support for hot loop shorting.
  22030. *
  22031. * @private
  22032. * @param {Function} func The function to associate metadata with.
  22033. * @param {*} data The metadata.
  22034. * @returns {Function} Returns `func`.
  22035. */
  22036. var baseSetData = !metaMap ? identity : function(func, data) {
  22037. metaMap.set(func, data);
  22038. return func;
  22039. };
  22040. /**
  22041. * The base implementation of `setToString` without support for hot loop shorting.
  22042. *
  22043. * @private
  22044. * @param {Function} func The function to modify.
  22045. * @param {Function} string The `toString` result.
  22046. * @returns {Function} Returns `func`.
  22047. */
  22048. var baseSetToString = !defineProperty ? identity : function(func, string) {
  22049. return defineProperty(func, 'toString', {
  22050. 'configurable': true,
  22051. 'enumerable': false,
  22052. 'value': constant(string),
  22053. 'writable': true
  22054. });
  22055. };
  22056. /**
  22057. * The base implementation of `_.shuffle`.
  22058. *
  22059. * @private
  22060. * @param {Array|Object} collection The collection to shuffle.
  22061. * @returns {Array} Returns the new shuffled array.
  22062. */
  22063. function baseShuffle(collection) {
  22064. return shuffleSelf(values(collection));
  22065. }
  22066. /**
  22067. * The base implementation of `_.slice` without an iteratee call guard.
  22068. *
  22069. * @private
  22070. * @param {Array} array The array to slice.
  22071. * @param {number} [start=0] The start position.
  22072. * @param {number} [end=array.length] The end position.
  22073. * @returns {Array} Returns the slice of `array`.
  22074. */
  22075. function baseSlice(array, start, end) {
  22076. var index = -1,
  22077. length = array.length;
  22078. if (start < 0) {
  22079. start = -start > length ? 0 : (length + start);
  22080. }
  22081. end = end > length ? length : end;
  22082. if (end < 0) {
  22083. end += length;
  22084. }
  22085. length = start > end ? 0 : ((end - start) >>> 0);
  22086. start >>>= 0;
  22087. var result = Array(length);
  22088. while (++index < length) {
  22089. result[index] = array[index + start];
  22090. }
  22091. return result;
  22092. }
  22093. /**
  22094. * The base implementation of `_.some` without support for iteratee shorthands.
  22095. *
  22096. * @private
  22097. * @param {Array|Object} collection The collection to iterate over.
  22098. * @param {Function} predicate The function invoked per iteration.
  22099. * @returns {boolean} Returns `true` if any element passes the predicate check,
  22100. * else `false`.
  22101. */
  22102. function baseSome(collection, predicate) {
  22103. var result;
  22104. baseEach(collection, function(value, index, collection) {
  22105. result = predicate(value, index, collection);
  22106. return !result;
  22107. });
  22108. return !!result;
  22109. }
  22110. /**
  22111. * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
  22112. * performs a binary search of `array` to determine the index at which `value`
  22113. * should be inserted into `array` in order to maintain its sort order.
  22114. *
  22115. * @private
  22116. * @param {Array} array The sorted array to inspect.
  22117. * @param {*} value The value to evaluate.
  22118. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  22119. * @returns {number} Returns the index at which `value` should be inserted
  22120. * into `array`.
  22121. */
  22122. function baseSortedIndex(array, value, retHighest) {
  22123. var low = 0,
  22124. high = array == null ? low : array.length;
  22125. if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  22126. while (low < high) {
  22127. var mid = (low + high) >>> 1,
  22128. computed = array[mid];
  22129. if (computed !== null && !isSymbol(computed) &&
  22130. (retHighest ? (computed <= value) : (computed < value))) {
  22131. low = mid + 1;
  22132. } else {
  22133. high = mid;
  22134. }
  22135. }
  22136. return high;
  22137. }
  22138. return baseSortedIndexBy(array, value, identity, retHighest);
  22139. }
  22140. /**
  22141. * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
  22142. * which invokes `iteratee` for `value` and each element of `array` to compute
  22143. * their sort ranking. The iteratee is invoked with one argument; (value).
  22144. *
  22145. * @private
  22146. * @param {Array} array The sorted array to inspect.
  22147. * @param {*} value The value to evaluate.
  22148. * @param {Function} iteratee The iteratee invoked per element.
  22149. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  22150. * @returns {number} Returns the index at which `value` should be inserted
  22151. * into `array`.
  22152. */
  22153. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  22154. value = iteratee(value);
  22155. var low = 0,
  22156. high = array == null ? 0 : array.length,
  22157. valIsNaN = value !== value,
  22158. valIsNull = value === null,
  22159. valIsSymbol = isSymbol(value),
  22160. valIsUndefined = value === undefined;
  22161. while (low < high) {
  22162. var mid = nativeFloor((low + high) / 2),
  22163. computed = iteratee(array[mid]),
  22164. othIsDefined = computed !== undefined,
  22165. othIsNull = computed === null,
  22166. othIsReflexive = computed === computed,
  22167. othIsSymbol = isSymbol(computed);
  22168. if (valIsNaN) {
  22169. var setLow = retHighest || othIsReflexive;
  22170. } else if (valIsUndefined) {
  22171. setLow = othIsReflexive && (retHighest || othIsDefined);
  22172. } else if (valIsNull) {
  22173. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  22174. } else if (valIsSymbol) {
  22175. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  22176. } else if (othIsNull || othIsSymbol) {
  22177. setLow = false;
  22178. } else {
  22179. setLow = retHighest ? (computed <= value) : (computed < value);
  22180. }
  22181. if (setLow) {
  22182. low = mid + 1;
  22183. } else {
  22184. high = mid;
  22185. }
  22186. }
  22187. return nativeMin(high, MAX_ARRAY_INDEX);
  22188. }
  22189. /**
  22190. * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
  22191. * support for iteratee shorthands.
  22192. *
  22193. * @private
  22194. * @param {Array} array The array to inspect.
  22195. * @param {Function} [iteratee] The iteratee invoked per element.
  22196. * @returns {Array} Returns the new duplicate free array.
  22197. */
  22198. function baseSortedUniq(array, iteratee) {
  22199. var index = -1,
  22200. length = array.length,
  22201. resIndex = 0,
  22202. result = [];
  22203. while (++index < length) {
  22204. var value = array[index],
  22205. computed = iteratee ? iteratee(value) : value;
  22206. if (!index || !eq(computed, seen)) {
  22207. var seen = computed;
  22208. result[resIndex++] = value === 0 ? 0 : value;
  22209. }
  22210. }
  22211. return result;
  22212. }
  22213. /**
  22214. * The base implementation of `_.toNumber` which doesn't ensure correct
  22215. * conversions of binary, hexadecimal, or octal string values.
  22216. *
  22217. * @private
  22218. * @param {*} value The value to process.
  22219. * @returns {number} Returns the number.
  22220. */
  22221. function baseToNumber(value) {
  22222. if (typeof value == 'number') {
  22223. return value;
  22224. }
  22225. if (isSymbol(value)) {
  22226. return NAN;
  22227. }
  22228. return +value;
  22229. }
  22230. /**
  22231. * The base implementation of `_.toString` which doesn't convert nullish
  22232. * values to empty strings.
  22233. *
  22234. * @private
  22235. * @param {*} value The value to process.
  22236. * @returns {string} Returns the string.
  22237. */
  22238. function baseToString(value) {
  22239. // Exit early for strings to avoid a performance hit in some environments.
  22240. if (typeof value == 'string') {
  22241. return value;
  22242. }
  22243. if (isArray(value)) {
  22244. // Recursively convert values (susceptible to call stack limits).
  22245. return arrayMap(value, baseToString) + '';
  22246. }
  22247. if (isSymbol(value)) {
  22248. return symbolToString ? symbolToString.call(value) : '';
  22249. }
  22250. var result = (value + '');
  22251. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  22252. }
  22253. /**
  22254. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  22255. *
  22256. * @private
  22257. * @param {Array} array The array to inspect.
  22258. * @param {Function} [iteratee] The iteratee invoked per element.
  22259. * @param {Function} [comparator] The comparator invoked per element.
  22260. * @returns {Array} Returns the new duplicate free array.
  22261. */
  22262. function baseUniq(array, iteratee, comparator) {
  22263. var index = -1,
  22264. includes = arrayIncludes,
  22265. length = array.length,
  22266. isCommon = true,
  22267. result = [],
  22268. seen = result;
  22269. if (comparator) {
  22270. isCommon = false;
  22271. includes = arrayIncludesWith;
  22272. }
  22273. else if (length >= LARGE_ARRAY_SIZE) {
  22274. var set = iteratee ? null : createSet(array);
  22275. if (set) {
  22276. return setToArray(set);
  22277. }
  22278. isCommon = false;
  22279. includes = cacheHas;
  22280. seen = new SetCache;
  22281. }
  22282. else {
  22283. seen = iteratee ? [] : result;
  22284. }
  22285. outer:
  22286. while (++index < length) {
  22287. var value = array[index],
  22288. computed = iteratee ? iteratee(value) : value;
  22289. value = (comparator || value !== 0) ? value : 0;
  22290. if (isCommon && computed === computed) {
  22291. var seenIndex = seen.length;
  22292. while (seenIndex--) {
  22293. if (seen[seenIndex] === computed) {
  22294. continue outer;
  22295. }
  22296. }
  22297. if (iteratee) {
  22298. seen.push(computed);
  22299. }
  22300. result.push(value);
  22301. }
  22302. else if (!includes(seen, computed, comparator)) {
  22303. if (seen !== result) {
  22304. seen.push(computed);
  22305. }
  22306. result.push(value);
  22307. }
  22308. }
  22309. return result;
  22310. }
  22311. /**
  22312. * The base implementation of `_.unset`.
  22313. *
  22314. * @private
  22315. * @param {Object} object The object to modify.
  22316. * @param {Array|string} path The property path to unset.
  22317. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  22318. */
  22319. function baseUnset(object, path) {
  22320. path = castPath(path, object);
  22321. object = parent(object, path);
  22322. return object == null || delete object[toKey(last(path))];
  22323. }
  22324. /**
  22325. * The base implementation of `_.update`.
  22326. *
  22327. * @private
  22328. * @param {Object} object The object to modify.
  22329. * @param {Array|string} path The path of the property to update.
  22330. * @param {Function} updater The function to produce the updated value.
  22331. * @param {Function} [customizer] The function to customize path creation.
  22332. * @returns {Object} Returns `object`.
  22333. */
  22334. function baseUpdate(object, path, updater, customizer) {
  22335. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  22336. }
  22337. /**
  22338. * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
  22339. * without support for iteratee shorthands.
  22340. *
  22341. * @private
  22342. * @param {Array} array The array to query.
  22343. * @param {Function} predicate The function invoked per iteration.
  22344. * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
  22345. * @param {boolean} [fromRight] Specify iterating from right to left.
  22346. * @returns {Array} Returns the slice of `array`.
  22347. */
  22348. function baseWhile(array, predicate, isDrop, fromRight) {
  22349. var length = array.length,
  22350. index = fromRight ? length : -1;
  22351. while ((fromRight ? index-- : ++index < length) &&
  22352. predicate(array[index], index, array)) {}
  22353. return isDrop
  22354. ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
  22355. : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
  22356. }
  22357. /**
  22358. * The base implementation of `wrapperValue` which returns the result of
  22359. * performing a sequence of actions on the unwrapped `value`, where each
  22360. * successive action is supplied the return value of the previous.
  22361. *
  22362. * @private
  22363. * @param {*} value The unwrapped value.
  22364. * @param {Array} actions Actions to perform to resolve the unwrapped value.
  22365. * @returns {*} Returns the resolved value.
  22366. */
  22367. function baseWrapperValue(value, actions) {
  22368. var result = value;
  22369. if (result instanceof LazyWrapper) {
  22370. result = result.value();
  22371. }
  22372. return arrayReduce(actions, function(result, action) {
  22373. return action.func.apply(action.thisArg, arrayPush([result], action.args));
  22374. }, result);
  22375. }
  22376. /**
  22377. * The base implementation of methods like `_.xor`, without support for
  22378. * iteratee shorthands, that accepts an array of arrays to inspect.
  22379. *
  22380. * @private
  22381. * @param {Array} arrays The arrays to inspect.
  22382. * @param {Function} [iteratee] The iteratee invoked per element.
  22383. * @param {Function} [comparator] The comparator invoked per element.
  22384. * @returns {Array} Returns the new array of values.
  22385. */
  22386. function baseXor(arrays, iteratee, comparator) {
  22387. var length = arrays.length;
  22388. if (length < 2) {
  22389. return length ? baseUniq(arrays[0]) : [];
  22390. }
  22391. var index = -1,
  22392. result = Array(length);
  22393. while (++index < length) {
  22394. var array = arrays[index],
  22395. othIndex = -1;
  22396. while (++othIndex < length) {
  22397. if (othIndex != index) {
  22398. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  22399. }
  22400. }
  22401. }
  22402. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  22403. }
  22404. /**
  22405. * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
  22406. *
  22407. * @private
  22408. * @param {Array} props The property identifiers.
  22409. * @param {Array} values The property values.
  22410. * @param {Function} assignFunc The function to assign values.
  22411. * @returns {Object} Returns the new object.
  22412. */
  22413. function baseZipObject(props, values, assignFunc) {
  22414. var index = -1,
  22415. length = props.length,
  22416. valsLength = values.length,
  22417. result = {};
  22418. while (++index < length) {
  22419. var value = index < valsLength ? values[index] : undefined;
  22420. assignFunc(result, props[index], value);
  22421. }
  22422. return result;
  22423. }
  22424. /**
  22425. * Casts `value` to an empty array if it's not an array like object.
  22426. *
  22427. * @private
  22428. * @param {*} value The value to inspect.
  22429. * @returns {Array|Object} Returns the cast array-like object.
  22430. */
  22431. function castArrayLikeObject(value) {
  22432. return isArrayLikeObject(value) ? value : [];
  22433. }
  22434. /**
  22435. * Casts `value` to `identity` if it's not a function.
  22436. *
  22437. * @private
  22438. * @param {*} value The value to inspect.
  22439. * @returns {Function} Returns cast function.
  22440. */
  22441. function castFunction(value) {
  22442. return typeof value == 'function' ? value : identity;
  22443. }
  22444. /**
  22445. * Casts `value` to a path array if it's not one.
  22446. *
  22447. * @private
  22448. * @param {*} value The value to inspect.
  22449. * @param {Object} [object] The object to query keys on.
  22450. * @returns {Array} Returns the cast property path array.
  22451. */
  22452. function castPath(value, object) {
  22453. if (isArray(value)) {
  22454. return value;
  22455. }
  22456. return isKey(value, object) ? [value] : stringToPath(toString(value));
  22457. }
  22458. /**
  22459. * A `baseRest` alias which can be replaced with `identity` by module
  22460. * replacement plugins.
  22461. *
  22462. * @private
  22463. * @type {Function}
  22464. * @param {Function} func The function to apply a rest parameter to.
  22465. * @returns {Function} Returns the new function.
  22466. */
  22467. var castRest = baseRest;
  22468. /**
  22469. * Casts `array` to a slice if it's needed.
  22470. *
  22471. * @private
  22472. * @param {Array} array The array to inspect.
  22473. * @param {number} start The start position.
  22474. * @param {number} [end=array.length] The end position.
  22475. * @returns {Array} Returns the cast slice.
  22476. */
  22477. function castSlice(array, start, end) {
  22478. var length = array.length;
  22479. end = end === undefined ? length : end;
  22480. return (!start && end >= length) ? array : baseSlice(array, start, end);
  22481. }
  22482. /**
  22483. * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
  22484. *
  22485. * @private
  22486. * @param {number|Object} id The timer id or timeout object of the timer to clear.
  22487. */
  22488. var clearTimeout = ctxClearTimeout || function(id) {
  22489. return root.clearTimeout(id);
  22490. };
  22491. /**
  22492. * Creates a clone of `buffer`.
  22493. *
  22494. * @private
  22495. * @param {Buffer} buffer The buffer to clone.
  22496. * @param {boolean} [isDeep] Specify a deep clone.
  22497. * @returns {Buffer} Returns the cloned buffer.
  22498. */
  22499. function cloneBuffer(buffer, isDeep) {
  22500. if (isDeep) {
  22501. return buffer.slice();
  22502. }
  22503. var length = buffer.length,
  22504. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  22505. buffer.copy(result);
  22506. return result;
  22507. }
  22508. /**
  22509. * Creates a clone of `arrayBuffer`.
  22510. *
  22511. * @private
  22512. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  22513. * @returns {ArrayBuffer} Returns the cloned array buffer.
  22514. */
  22515. function cloneArrayBuffer(arrayBuffer) {
  22516. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  22517. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  22518. return result;
  22519. }
  22520. /**
  22521. * Creates a clone of `dataView`.
  22522. *
  22523. * @private
  22524. * @param {Object} dataView The data view to clone.
  22525. * @param {boolean} [isDeep] Specify a deep clone.
  22526. * @returns {Object} Returns the cloned data view.
  22527. */
  22528. function cloneDataView(dataView, isDeep) {
  22529. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  22530. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  22531. }
  22532. /**
  22533. * Creates a clone of `regexp`.
  22534. *
  22535. * @private
  22536. * @param {Object} regexp The regexp to clone.
  22537. * @returns {Object} Returns the cloned regexp.
  22538. */
  22539. function cloneRegExp(regexp) {
  22540. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  22541. result.lastIndex = regexp.lastIndex;
  22542. return result;
  22543. }
  22544. /**
  22545. * Creates a clone of the `symbol` object.
  22546. *
  22547. * @private
  22548. * @param {Object} symbol The symbol object to clone.
  22549. * @returns {Object} Returns the cloned symbol object.
  22550. */
  22551. function cloneSymbol(symbol) {
  22552. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  22553. }
  22554. /**
  22555. * Creates a clone of `typedArray`.
  22556. *
  22557. * @private
  22558. * @param {Object} typedArray The typed array to clone.
  22559. * @param {boolean} [isDeep] Specify a deep clone.
  22560. * @returns {Object} Returns the cloned typed array.
  22561. */
  22562. function cloneTypedArray(typedArray, isDeep) {
  22563. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  22564. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  22565. }
  22566. /**
  22567. * Compares values to sort them in ascending order.
  22568. *
  22569. * @private
  22570. * @param {*} value The value to compare.
  22571. * @param {*} other The other value to compare.
  22572. * @returns {number} Returns the sort order indicator for `value`.
  22573. */
  22574. function compareAscending(value, other) {
  22575. if (value !== other) {
  22576. var valIsDefined = value !== undefined,
  22577. valIsNull = value === null,
  22578. valIsReflexive = value === value,
  22579. valIsSymbol = isSymbol(value);
  22580. var othIsDefined = other !== undefined,
  22581. othIsNull = other === null,
  22582. othIsReflexive = other === other,
  22583. othIsSymbol = isSymbol(other);
  22584. if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
  22585. (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
  22586. (valIsNull && othIsDefined && othIsReflexive) ||
  22587. (!valIsDefined && othIsReflexive) ||
  22588. !valIsReflexive) {
  22589. return 1;
  22590. }
  22591. if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
  22592. (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
  22593. (othIsNull && valIsDefined && valIsReflexive) ||
  22594. (!othIsDefined && valIsReflexive) ||
  22595. !othIsReflexive) {
  22596. return -1;
  22597. }
  22598. }
  22599. return 0;
  22600. }
  22601. /**
  22602. * Used by `_.orderBy` to compare multiple properties of a value to another
  22603. * and stable sort them.
  22604. *
  22605. * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
  22606. * specify an order of "desc" for descending or "asc" for ascending sort order
  22607. * of corresponding values.
  22608. *
  22609. * @private
  22610. * @param {Object} object The object to compare.
  22611. * @param {Object} other The other object to compare.
  22612. * @param {boolean[]|string[]} orders The order to sort by for each property.
  22613. * @returns {number} Returns the sort order indicator for `object`.
  22614. */
  22615. function compareMultiple(object, other, orders) {
  22616. var index = -1,
  22617. objCriteria = object.criteria,
  22618. othCriteria = other.criteria,
  22619. length = objCriteria.length,
  22620. ordersLength = orders.length;
  22621. while (++index < length) {
  22622. var result = compareAscending(objCriteria[index], othCriteria[index]);
  22623. if (result) {
  22624. if (index >= ordersLength) {
  22625. return result;
  22626. }
  22627. var order = orders[index];
  22628. return result * (order == 'desc' ? -1 : 1);
  22629. }
  22630. }
  22631. // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
  22632. // that causes it, under certain circumstances, to provide the same value for
  22633. // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
  22634. // for more details.
  22635. //
  22636. // This also ensures a stable sort in V8 and other engines.
  22637. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
  22638. return object.index - other.index;
  22639. }
  22640. /**
  22641. * Creates an array that is the composition of partially applied arguments,
  22642. * placeholders, and provided arguments into a single array of arguments.
  22643. *
  22644. * @private
  22645. * @param {Array} args The provided arguments.
  22646. * @param {Array} partials The arguments to prepend to those provided.
  22647. * @param {Array} holders The `partials` placeholder indexes.
  22648. * @params {boolean} [isCurried] Specify composing for a curried function.
  22649. * @returns {Array} Returns the new array of composed arguments.
  22650. */
  22651. function composeArgs(args, partials, holders, isCurried) {
  22652. var argsIndex = -1,
  22653. argsLength = args.length,
  22654. holdersLength = holders.length,
  22655. leftIndex = -1,
  22656. leftLength = partials.length,
  22657. rangeLength = nativeMax(argsLength - holdersLength, 0),
  22658. result = Array(leftLength + rangeLength),
  22659. isUncurried = !isCurried;
  22660. while (++leftIndex < leftLength) {
  22661. result[leftIndex] = partials[leftIndex];
  22662. }
  22663. while (++argsIndex < holdersLength) {
  22664. if (isUncurried || argsIndex < argsLength) {
  22665. result[holders[argsIndex]] = args[argsIndex];
  22666. }
  22667. }
  22668. while (rangeLength--) {
  22669. result[leftIndex++] = args[argsIndex++];
  22670. }
  22671. return result;
  22672. }
  22673. /**
  22674. * This function is like `composeArgs` except that the arguments composition
  22675. * is tailored for `_.partialRight`.
  22676. *
  22677. * @private
  22678. * @param {Array} args The provided arguments.
  22679. * @param {Array} partials The arguments to append to those provided.
  22680. * @param {Array} holders The `partials` placeholder indexes.
  22681. * @params {boolean} [isCurried] Specify composing for a curried function.
  22682. * @returns {Array} Returns the new array of composed arguments.
  22683. */
  22684. function composeArgsRight(args, partials, holders, isCurried) {
  22685. var argsIndex = -1,
  22686. argsLength = args.length,
  22687. holdersIndex = -1,
  22688. holdersLength = holders.length,
  22689. rightIndex = -1,
  22690. rightLength = partials.length,
  22691. rangeLength = nativeMax(argsLength - holdersLength, 0),
  22692. result = Array(rangeLength + rightLength),
  22693. isUncurried = !isCurried;
  22694. while (++argsIndex < rangeLength) {
  22695. result[argsIndex] = args[argsIndex];
  22696. }
  22697. var offset = argsIndex;
  22698. while (++rightIndex < rightLength) {
  22699. result[offset + rightIndex] = partials[rightIndex];
  22700. }
  22701. while (++holdersIndex < holdersLength) {
  22702. if (isUncurried || argsIndex < argsLength) {
  22703. result[offset + holders[holdersIndex]] = args[argsIndex++];
  22704. }
  22705. }
  22706. return result;
  22707. }
  22708. /**
  22709. * Copies the values of `source` to `array`.
  22710. *
  22711. * @private
  22712. * @param {Array} source The array to copy values from.
  22713. * @param {Array} [array=[]] The array to copy values to.
  22714. * @returns {Array} Returns `array`.
  22715. */
  22716. function copyArray(source, array) {
  22717. var index = -1,
  22718. length = source.length;
  22719. array || (array = Array(length));
  22720. while (++index < length) {
  22721. array[index] = source[index];
  22722. }
  22723. return array;
  22724. }
  22725. /**
  22726. * Copies properties of `source` to `object`.
  22727. *
  22728. * @private
  22729. * @param {Object} source The object to copy properties from.
  22730. * @param {Array} props The property identifiers to copy.
  22731. * @param {Object} [object={}] The object to copy properties to.
  22732. * @param {Function} [customizer] The function to customize copied values.
  22733. * @returns {Object} Returns `object`.
  22734. */
  22735. function copyObject(source, props, object, customizer) {
  22736. var isNew = !object;
  22737. object || (object = {});
  22738. var index = -1,
  22739. length = props.length;
  22740. while (++index < length) {
  22741. var key = props[index];
  22742. var newValue = customizer
  22743. ? customizer(object[key], source[key], key, object, source)
  22744. : undefined;
  22745. if (newValue === undefined) {
  22746. newValue = source[key];
  22747. }
  22748. if (isNew) {
  22749. baseAssignValue(object, key, newValue);
  22750. } else {
  22751. assignValue(object, key, newValue);
  22752. }
  22753. }
  22754. return object;
  22755. }
  22756. /**
  22757. * Copies own symbols of `source` to `object`.
  22758. *
  22759. * @private
  22760. * @param {Object} source The object to copy symbols from.
  22761. * @param {Object} [object={}] The object to copy symbols to.
  22762. * @returns {Object} Returns `object`.
  22763. */
  22764. function copySymbols(source, object) {
  22765. return copyObject(source, getSymbols(source), object);
  22766. }
  22767. /**
  22768. * Copies own and inherited symbols of `source` to `object`.
  22769. *
  22770. * @private
  22771. * @param {Object} source The object to copy symbols from.
  22772. * @param {Object} [object={}] The object to copy symbols to.
  22773. * @returns {Object} Returns `object`.
  22774. */
  22775. function copySymbolsIn(source, object) {
  22776. return copyObject(source, getSymbolsIn(source), object);
  22777. }
  22778. /**
  22779. * Creates a function like `_.groupBy`.
  22780. *
  22781. * @private
  22782. * @param {Function} setter The function to set accumulator values.
  22783. * @param {Function} [initializer] The accumulator object initializer.
  22784. * @returns {Function} Returns the new aggregator function.
  22785. */
  22786. function createAggregator(setter, initializer) {
  22787. return function(collection, iteratee) {
  22788. var func = isArray(collection) ? arrayAggregator : baseAggregator,
  22789. accumulator = initializer ? initializer() : {};
  22790. return func(collection, setter, getIteratee(iteratee, 2), accumulator);
  22791. };
  22792. }
  22793. /**
  22794. * Creates a function like `_.assign`.
  22795. *
  22796. * @private
  22797. * @param {Function} assigner The function to assign values.
  22798. * @returns {Function} Returns the new assigner function.
  22799. */
  22800. function createAssigner(assigner) {
  22801. return baseRest(function(object, sources) {
  22802. var index = -1,
  22803. length = sources.length,
  22804. customizer = length > 1 ? sources[length - 1] : undefined,
  22805. guard = length > 2 ? sources[2] : undefined;
  22806. customizer = (assigner.length > 3 && typeof customizer == 'function')
  22807. ? (length--, customizer)
  22808. : undefined;
  22809. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  22810. customizer = length < 3 ? undefined : customizer;
  22811. length = 1;
  22812. }
  22813. object = Object(object);
  22814. while (++index < length) {
  22815. var source = sources[index];
  22816. if (source) {
  22817. assigner(object, source, index, customizer);
  22818. }
  22819. }
  22820. return object;
  22821. });
  22822. }
  22823. /**
  22824. * Creates a `baseEach` or `baseEachRight` function.
  22825. *
  22826. * @private
  22827. * @param {Function} eachFunc The function to iterate over a collection.
  22828. * @param {boolean} [fromRight] Specify iterating from right to left.
  22829. * @returns {Function} Returns the new base function.
  22830. */
  22831. function createBaseEach(eachFunc, fromRight) {
  22832. return function(collection, iteratee) {
  22833. if (collection == null) {
  22834. return collection;
  22835. }
  22836. if (!isArrayLike(collection)) {
  22837. return eachFunc(collection, iteratee);
  22838. }
  22839. var length = collection.length,
  22840. index = fromRight ? length : -1,
  22841. iterable = Object(collection);
  22842. while ((fromRight ? index-- : ++index < length)) {
  22843. if (iteratee(iterable[index], index, iterable) === false) {
  22844. break;
  22845. }
  22846. }
  22847. return collection;
  22848. };
  22849. }
  22850. /**
  22851. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  22852. *
  22853. * @private
  22854. * @param {boolean} [fromRight] Specify iterating from right to left.
  22855. * @returns {Function} Returns the new base function.
  22856. */
  22857. function createBaseFor(fromRight) {
  22858. return function(object, iteratee, keysFunc) {
  22859. var index = -1,
  22860. iterable = Object(object),
  22861. props = keysFunc(object),
  22862. length = props.length;
  22863. while (length--) {
  22864. var key = props[fromRight ? length : ++index];
  22865. if (iteratee(iterable[key], key, iterable) === false) {
  22866. break;
  22867. }
  22868. }
  22869. return object;
  22870. };
  22871. }
  22872. /**
  22873. * Creates a function that wraps `func` to invoke it with the optional `this`
  22874. * binding of `thisArg`.
  22875. *
  22876. * @private
  22877. * @param {Function} func The function to wrap.
  22878. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22879. * @param {*} [thisArg] The `this` binding of `func`.
  22880. * @returns {Function} Returns the new wrapped function.
  22881. */
  22882. function createBind(func, bitmask, thisArg) {
  22883. var isBind = bitmask & WRAP_BIND_FLAG,
  22884. Ctor = createCtor(func);
  22885. function wrapper() {
  22886. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  22887. return fn.apply(isBind ? thisArg : this, arguments);
  22888. }
  22889. return wrapper;
  22890. }
  22891. /**
  22892. * Creates a function like `_.lowerFirst`.
  22893. *
  22894. * @private
  22895. * @param {string} methodName The name of the `String` case method to use.
  22896. * @returns {Function} Returns the new case function.
  22897. */
  22898. function createCaseFirst(methodName) {
  22899. return function(string) {
  22900. string = toString(string);
  22901. var strSymbols = hasUnicode(string)
  22902. ? stringToArray(string)
  22903. : undefined;
  22904. var chr = strSymbols
  22905. ? strSymbols[0]
  22906. : string.charAt(0);
  22907. var trailing = strSymbols
  22908. ? castSlice(strSymbols, 1).join('')
  22909. : string.slice(1);
  22910. return chr[methodName]() + trailing;
  22911. };
  22912. }
  22913. /**
  22914. * Creates a function like `_.camelCase`.
  22915. *
  22916. * @private
  22917. * @param {Function} callback The function to combine each word.
  22918. * @returns {Function} Returns the new compounder function.
  22919. */
  22920. function createCompounder(callback) {
  22921. return function(string) {
  22922. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  22923. };
  22924. }
  22925. /**
  22926. * Creates a function that produces an instance of `Ctor` regardless of
  22927. * whether it was invoked as part of a `new` expression or by `call` or `apply`.
  22928. *
  22929. * @private
  22930. * @param {Function} Ctor The constructor to wrap.
  22931. * @returns {Function} Returns the new wrapped function.
  22932. */
  22933. function createCtor(Ctor) {
  22934. return function() {
  22935. // Use a `switch` statement to work with class constructors. See
  22936. // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
  22937. // for more details.
  22938. var args = arguments;
  22939. switch (args.length) {
  22940. case 0: return new Ctor;
  22941. case 1: return new Ctor(args[0]);
  22942. case 2: return new Ctor(args[0], args[1]);
  22943. case 3: return new Ctor(args[0], args[1], args[2]);
  22944. case 4: return new Ctor(args[0], args[1], args[2], args[3]);
  22945. case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  22946. case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  22947. case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  22948. }
  22949. var thisBinding = baseCreate(Ctor.prototype),
  22950. result = Ctor.apply(thisBinding, args);
  22951. // Mimic the constructor's `return` behavior.
  22952. // See https://es5.github.io/#x13.2.2 for more details.
  22953. return isObject(result) ? result : thisBinding;
  22954. };
  22955. }
  22956. /**
  22957. * Creates a function that wraps `func` to enable currying.
  22958. *
  22959. * @private
  22960. * @param {Function} func The function to wrap.
  22961. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22962. * @param {number} arity The arity of `func`.
  22963. * @returns {Function} Returns the new wrapped function.
  22964. */
  22965. function createCurry(func, bitmask, arity) {
  22966. var Ctor = createCtor(func);
  22967. function wrapper() {
  22968. var length = arguments.length,
  22969. args = Array(length),
  22970. index = length,
  22971. placeholder = getHolder(wrapper);
  22972. while (index--) {
  22973. args[index] = arguments[index];
  22974. }
  22975. var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
  22976. ? []
  22977. : replaceHolders(args, placeholder);
  22978. length -= holders.length;
  22979. if (length < arity) {
  22980. return createRecurry(
  22981. func, bitmask, createHybrid, wrapper.placeholder, undefined,
  22982. args, holders, undefined, undefined, arity - length);
  22983. }
  22984. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  22985. return apply(fn, this, args);
  22986. }
  22987. return wrapper;
  22988. }
  22989. /**
  22990. * Creates a `_.find` or `_.findLast` function.
  22991. *
  22992. * @private
  22993. * @param {Function} findIndexFunc The function to find the collection index.
  22994. * @returns {Function} Returns the new find function.
  22995. */
  22996. function createFind(findIndexFunc) {
  22997. return function(collection, predicate, fromIndex) {
  22998. var iterable = Object(collection);
  22999. if (!isArrayLike(collection)) {
  23000. var iteratee = getIteratee(predicate, 3);
  23001. collection = keys(collection);
  23002. predicate = function(key) { return iteratee(iterable[key], key, iterable); };
  23003. }
  23004. var index = findIndexFunc(collection, predicate, fromIndex);
  23005. return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
  23006. };
  23007. }
  23008. /**
  23009. * Creates a `_.flow` or `_.flowRight` function.
  23010. *
  23011. * @private
  23012. * @param {boolean} [fromRight] Specify iterating from right to left.
  23013. * @returns {Function} Returns the new flow function.
  23014. */
  23015. function createFlow(fromRight) {
  23016. return flatRest(function(funcs) {
  23017. var length = funcs.length,
  23018. index = length,
  23019. prereq = LodashWrapper.prototype.thru;
  23020. if (fromRight) {
  23021. funcs.reverse();
  23022. }
  23023. while (index--) {
  23024. var func = funcs[index];
  23025. if (typeof func != 'function') {
  23026. throw new TypeError(FUNC_ERROR_TEXT);
  23027. }
  23028. if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
  23029. var wrapper = new LodashWrapper([], true);
  23030. }
  23031. }
  23032. index = wrapper ? index : length;
  23033. while (++index < length) {
  23034. func = funcs[index];
  23035. var funcName = getFuncName(func),
  23036. data = funcName == 'wrapper' ? getData(func) : undefined;
  23037. if (data && isLaziable(data[0]) &&
  23038. data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
  23039. !data[4].length && data[9] == 1
  23040. ) {
  23041. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  23042. } else {
  23043. wrapper = (func.length == 1 && isLaziable(func))
  23044. ? wrapper[funcName]()
  23045. : wrapper.thru(func);
  23046. }
  23047. }
  23048. return function() {
  23049. var args = arguments,
  23050. value = args[0];
  23051. if (wrapper && args.length == 1 && isArray(value)) {
  23052. return wrapper.plant(value).value();
  23053. }
  23054. var index = 0,
  23055. result = length ? funcs[index].apply(this, args) : value;
  23056. while (++index < length) {
  23057. result = funcs[index].call(this, result);
  23058. }
  23059. return result;
  23060. };
  23061. });
  23062. }
  23063. /**
  23064. * Creates a function that wraps `func` to invoke it with optional `this`
  23065. * binding of `thisArg`, partial application, and currying.
  23066. *
  23067. * @private
  23068. * @param {Function|string} func The function or method name to wrap.
  23069. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23070. * @param {*} [thisArg] The `this` binding of `func`.
  23071. * @param {Array} [partials] The arguments to prepend to those provided to
  23072. * the new function.
  23073. * @param {Array} [holders] The `partials` placeholder indexes.
  23074. * @param {Array} [partialsRight] The arguments to append to those provided
  23075. * to the new function.
  23076. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
  23077. * @param {Array} [argPos] The argument positions of the new function.
  23078. * @param {number} [ary] The arity cap of `func`.
  23079. * @param {number} [arity] The arity of `func`.
  23080. * @returns {Function} Returns the new wrapped function.
  23081. */
  23082. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  23083. var isAry = bitmask & WRAP_ARY_FLAG,
  23084. isBind = bitmask & WRAP_BIND_FLAG,
  23085. isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
  23086. isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
  23087. isFlip = bitmask & WRAP_FLIP_FLAG,
  23088. Ctor = isBindKey ? undefined : createCtor(func);
  23089. function wrapper() {
  23090. var length = arguments.length,
  23091. args = Array(length),
  23092. index = length;
  23093. while (index--) {
  23094. args[index] = arguments[index];
  23095. }
  23096. if (isCurried) {
  23097. var placeholder = getHolder(wrapper),
  23098. holdersCount = countHolders(args, placeholder);
  23099. }
  23100. if (partials) {
  23101. args = composeArgs(args, partials, holders, isCurried);
  23102. }
  23103. if (partialsRight) {
  23104. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  23105. }
  23106. length -= holdersCount;
  23107. if (isCurried && length < arity) {
  23108. var newHolders = replaceHolders(args, placeholder);
  23109. return createRecurry(
  23110. func, bitmask, createHybrid, wrapper.placeholder, thisArg,
  23111. args, newHolders, argPos, ary, arity - length
  23112. );
  23113. }
  23114. var thisBinding = isBind ? thisArg : this,
  23115. fn = isBindKey ? thisBinding[func] : func;
  23116. length = args.length;
  23117. if (argPos) {
  23118. args = reorder(args, argPos);
  23119. } else if (isFlip && length > 1) {
  23120. args.reverse();
  23121. }
  23122. if (isAry && ary < length) {
  23123. args.length = ary;
  23124. }
  23125. if (this && this !== root && this instanceof wrapper) {
  23126. fn = Ctor || createCtor(fn);
  23127. }
  23128. return fn.apply(thisBinding, args);
  23129. }
  23130. return wrapper;
  23131. }
  23132. /**
  23133. * Creates a function like `_.invertBy`.
  23134. *
  23135. * @private
  23136. * @param {Function} setter The function to set accumulator values.
  23137. * @param {Function} toIteratee The function to resolve iteratees.
  23138. * @returns {Function} Returns the new inverter function.
  23139. */
  23140. function createInverter(setter, toIteratee) {
  23141. return function(object, iteratee) {
  23142. return baseInverter(object, setter, toIteratee(iteratee), {});
  23143. };
  23144. }
  23145. /**
  23146. * Creates a function that performs a mathematical operation on two values.
  23147. *
  23148. * @private
  23149. * @param {Function} operator The function to perform the operation.
  23150. * @param {number} [defaultValue] The value used for `undefined` arguments.
  23151. * @returns {Function} Returns the new mathematical operation function.
  23152. */
  23153. function createMathOperation(operator, defaultValue) {
  23154. return function(value, other) {
  23155. var result;
  23156. if (value === undefined && other === undefined) {
  23157. return defaultValue;
  23158. }
  23159. if (value !== undefined) {
  23160. result = value;
  23161. }
  23162. if (other !== undefined) {
  23163. if (result === undefined) {
  23164. return other;
  23165. }
  23166. if (typeof value == 'string' || typeof other == 'string') {
  23167. value = baseToString(value);
  23168. other = baseToString(other);
  23169. } else {
  23170. value = baseToNumber(value);
  23171. other = baseToNumber(other);
  23172. }
  23173. result = operator(value, other);
  23174. }
  23175. return result;
  23176. };
  23177. }
  23178. /**
  23179. * Creates a function like `_.over`.
  23180. *
  23181. * @private
  23182. * @param {Function} arrayFunc The function to iterate over iteratees.
  23183. * @returns {Function} Returns the new over function.
  23184. */
  23185. function createOver(arrayFunc) {
  23186. return flatRest(function(iteratees) {
  23187. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  23188. return baseRest(function(args) {
  23189. var thisArg = this;
  23190. return arrayFunc(iteratees, function(iteratee) {
  23191. return apply(iteratee, thisArg, args);
  23192. });
  23193. });
  23194. });
  23195. }
  23196. /**
  23197. * Creates the padding for `string` based on `length`. The `chars` string
  23198. * is truncated if the number of characters exceeds `length`.
  23199. *
  23200. * @private
  23201. * @param {number} length The padding length.
  23202. * @param {string} [chars=' '] The string used as padding.
  23203. * @returns {string} Returns the padding for `string`.
  23204. */
  23205. function createPadding(length, chars) {
  23206. chars = chars === undefined ? ' ' : baseToString(chars);
  23207. var charsLength = chars.length;
  23208. if (charsLength < 2) {
  23209. return charsLength ? baseRepeat(chars, length) : chars;
  23210. }
  23211. var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
  23212. return hasUnicode(chars)
  23213. ? castSlice(stringToArray(result), 0, length).join('')
  23214. : result.slice(0, length);
  23215. }
  23216. /**
  23217. * Creates a function that wraps `func` to invoke it with the `this` binding
  23218. * of `thisArg` and `partials` prepended to the arguments it receives.
  23219. *
  23220. * @private
  23221. * @param {Function} func The function to wrap.
  23222. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23223. * @param {*} thisArg The `this` binding of `func`.
  23224. * @param {Array} partials The arguments to prepend to those provided to
  23225. * the new function.
  23226. * @returns {Function} Returns the new wrapped function.
  23227. */
  23228. function createPartial(func, bitmask, thisArg, partials) {
  23229. var isBind = bitmask & WRAP_BIND_FLAG,
  23230. Ctor = createCtor(func);
  23231. function wrapper() {
  23232. var argsIndex = -1,
  23233. argsLength = arguments.length,
  23234. leftIndex = -1,
  23235. leftLength = partials.length,
  23236. args = Array(leftLength + argsLength),
  23237. fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  23238. while (++leftIndex < leftLength) {
  23239. args[leftIndex] = partials[leftIndex];
  23240. }
  23241. while (argsLength--) {
  23242. args[leftIndex++] = arguments[++argsIndex];
  23243. }
  23244. return apply(fn, isBind ? thisArg : this, args);
  23245. }
  23246. return wrapper;
  23247. }
  23248. /**
  23249. * Creates a `_.range` or `_.rangeRight` function.
  23250. *
  23251. * @private
  23252. * @param {boolean} [fromRight] Specify iterating from right to left.
  23253. * @returns {Function} Returns the new range function.
  23254. */
  23255. function createRange(fromRight) {
  23256. return function(start, end, step) {
  23257. if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
  23258. end = step = undefined;
  23259. }
  23260. // Ensure the sign of `-0` is preserved.
  23261. start = toFinite(start);
  23262. if (end === undefined) {
  23263. end = start;
  23264. start = 0;
  23265. } else {
  23266. end = toFinite(end);
  23267. }
  23268. step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
  23269. return baseRange(start, end, step, fromRight);
  23270. };
  23271. }
  23272. /**
  23273. * Creates a function that performs a relational operation on two values.
  23274. *
  23275. * @private
  23276. * @param {Function} operator The function to perform the operation.
  23277. * @returns {Function} Returns the new relational operation function.
  23278. */
  23279. function createRelationalOperation(operator) {
  23280. return function(value, other) {
  23281. if (!(typeof value == 'string' && typeof other == 'string')) {
  23282. value = toNumber(value);
  23283. other = toNumber(other);
  23284. }
  23285. return operator(value, other);
  23286. };
  23287. }
  23288. /**
  23289. * Creates a function that wraps `func` to continue currying.
  23290. *
  23291. * @private
  23292. * @param {Function} func The function to wrap.
  23293. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23294. * @param {Function} wrapFunc The function to create the `func` wrapper.
  23295. * @param {*} placeholder The placeholder value.
  23296. * @param {*} [thisArg] The `this` binding of `func`.
  23297. * @param {Array} [partials] The arguments to prepend to those provided to
  23298. * the new function.
  23299. * @param {Array} [holders] The `partials` placeholder indexes.
  23300. * @param {Array} [argPos] The argument positions of the new function.
  23301. * @param {number} [ary] The arity cap of `func`.
  23302. * @param {number} [arity] The arity of `func`.
  23303. * @returns {Function} Returns the new wrapped function.
  23304. */
  23305. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  23306. var isCurry = bitmask & WRAP_CURRY_FLAG,
  23307. newHolders = isCurry ? holders : undefined,
  23308. newHoldersRight = isCurry ? undefined : holders,
  23309. newPartials = isCurry ? partials : undefined,
  23310. newPartialsRight = isCurry ? undefined : partials;
  23311. bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
  23312. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
  23313. if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
  23314. bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
  23315. }
  23316. var newData = [
  23317. func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
  23318. newHoldersRight, argPos, ary, arity
  23319. ];
  23320. var result = wrapFunc.apply(undefined, newData);
  23321. if (isLaziable(func)) {
  23322. setData(result, newData);
  23323. }
  23324. result.placeholder = placeholder;
  23325. return setWrapToString(result, func, bitmask);
  23326. }
  23327. /**
  23328. * Creates a function like `_.round`.
  23329. *
  23330. * @private
  23331. * @param {string} methodName The name of the `Math` method to use when rounding.
  23332. * @returns {Function} Returns the new round function.
  23333. */
  23334. function createRound(methodName) {
  23335. var func = Math[methodName];
  23336. return function(number, precision) {
  23337. number = toNumber(number);
  23338. precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
  23339. if (precision && nativeIsFinite(number)) {
  23340. // Shift with exponential notation to avoid floating-point issues.
  23341. // See [MDN](https://mdn.io/round#Examples) for more details.
  23342. var pair = (toString(number) + 'e').split('e'),
  23343. value = func(pair[0] + 'e' + (+pair[1] + precision));
  23344. pair = (toString(value) + 'e').split('e');
  23345. return +(pair[0] + 'e' + (+pair[1] - precision));
  23346. }
  23347. return func(number);
  23348. };
  23349. }
  23350. /**
  23351. * Creates a set object of `values`.
  23352. *
  23353. * @private
  23354. * @param {Array} values The values to add to the set.
  23355. * @returns {Object} Returns the new set.
  23356. */
  23357. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  23358. return new Set(values);
  23359. };
  23360. /**
  23361. * Creates a `_.toPairs` or `_.toPairsIn` function.
  23362. *
  23363. * @private
  23364. * @param {Function} keysFunc The function to get the keys of a given object.
  23365. * @returns {Function} Returns the new pairs function.
  23366. */
  23367. function createToPairs(keysFunc) {
  23368. return function(object) {
  23369. var tag = getTag(object);
  23370. if (tag == mapTag) {
  23371. return mapToArray(object);
  23372. }
  23373. if (tag == setTag) {
  23374. return setToPairs(object);
  23375. }
  23376. return baseToPairs(object, keysFunc(object));
  23377. };
  23378. }
  23379. /**
  23380. * Creates a function that either curries or invokes `func` with optional
  23381. * `this` binding and partially applied arguments.
  23382. *
  23383. * @private
  23384. * @param {Function|string} func The function or method name to wrap.
  23385. * @param {number} bitmask The bitmask flags.
  23386. * 1 - `_.bind`
  23387. * 2 - `_.bindKey`
  23388. * 4 - `_.curry` or `_.curryRight` of a bound function
  23389. * 8 - `_.curry`
  23390. * 16 - `_.curryRight`
  23391. * 32 - `_.partial`
  23392. * 64 - `_.partialRight`
  23393. * 128 - `_.rearg`
  23394. * 256 - `_.ary`
  23395. * 512 - `_.flip`
  23396. * @param {*} [thisArg] The `this` binding of `func`.
  23397. * @param {Array} [partials] The arguments to be partially applied.
  23398. * @param {Array} [holders] The `partials` placeholder indexes.
  23399. * @param {Array} [argPos] The argument positions of the new function.
  23400. * @param {number} [ary] The arity cap of `func`.
  23401. * @param {number} [arity] The arity of `func`.
  23402. * @returns {Function} Returns the new wrapped function.
  23403. */
  23404. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  23405. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
  23406. if (!isBindKey && typeof func != 'function') {
  23407. throw new TypeError(FUNC_ERROR_TEXT);
  23408. }
  23409. var length = partials ? partials.length : 0;
  23410. if (!length) {
  23411. bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
  23412. partials = holders = undefined;
  23413. }
  23414. ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
  23415. arity = arity === undefined ? arity : toInteger(arity);
  23416. length -= holders ? holders.length : 0;
  23417. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
  23418. var partialsRight = partials,
  23419. holdersRight = holders;
  23420. partials = holders = undefined;
  23421. }
  23422. var data = isBindKey ? undefined : getData(func);
  23423. var newData = [
  23424. func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
  23425. argPos, ary, arity
  23426. ];
  23427. if (data) {
  23428. mergeData(newData, data);
  23429. }
  23430. func = newData[0];
  23431. bitmask = newData[1];
  23432. thisArg = newData[2];
  23433. partials = newData[3];
  23434. holders = newData[4];
  23435. arity = newData[9] = newData[9] === undefined
  23436. ? (isBindKey ? 0 : func.length)
  23437. : nativeMax(newData[9] - length, 0);
  23438. if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
  23439. bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
  23440. }
  23441. if (!bitmask || bitmask == WRAP_BIND_FLAG) {
  23442. var result = createBind(func, bitmask, thisArg);
  23443. } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
  23444. result = createCurry(func, bitmask, arity);
  23445. } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
  23446. result = createPartial(func, bitmask, thisArg, partials);
  23447. } else {
  23448. result = createHybrid.apply(undefined, newData);
  23449. }
  23450. var setter = data ? baseSetData : setData;
  23451. return setWrapToString(setter(result, newData), func, bitmask);
  23452. }
  23453. /**
  23454. * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
  23455. * of source objects to the destination object for all destination properties
  23456. * that resolve to `undefined`.
  23457. *
  23458. * @private
  23459. * @param {*} objValue The destination value.
  23460. * @param {*} srcValue The source value.
  23461. * @param {string} key The key of the property to assign.
  23462. * @param {Object} object The parent object of `objValue`.
  23463. * @returns {*} Returns the value to assign.
  23464. */
  23465. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  23466. if (objValue === undefined ||
  23467. (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  23468. return srcValue;
  23469. }
  23470. return objValue;
  23471. }
  23472. /**
  23473. * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
  23474. * objects into destination objects that are passed thru.
  23475. *
  23476. * @private
  23477. * @param {*} objValue The destination value.
  23478. * @param {*} srcValue The source value.
  23479. * @param {string} key The key of the property to merge.
  23480. * @param {Object} object The parent object of `objValue`.
  23481. * @param {Object} source The parent object of `srcValue`.
  23482. * @param {Object} [stack] Tracks traversed source values and their merged
  23483. * counterparts.
  23484. * @returns {*} Returns the value to assign.
  23485. */
  23486. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  23487. if (isObject(objValue) && isObject(srcValue)) {
  23488. // Recursively merge objects and arrays (susceptible to call stack limits).
  23489. stack.set(srcValue, objValue);
  23490. baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
  23491. stack['delete'](srcValue);
  23492. }
  23493. return objValue;
  23494. }
  23495. /**
  23496. * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
  23497. * objects.
  23498. *
  23499. * @private
  23500. * @param {*} value The value to inspect.
  23501. * @param {string} key The key of the property to inspect.
  23502. * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
  23503. */
  23504. function customOmitClone(value) {
  23505. return isPlainObject(value) ? undefined : value;
  23506. }
  23507. /**
  23508. * A specialized version of `baseIsEqualDeep` for arrays with support for
  23509. * partial deep comparisons.
  23510. *
  23511. * @private
  23512. * @param {Array} array The array to compare.
  23513. * @param {Array} other The other array to compare.
  23514. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23515. * @param {Function} customizer The function to customize comparisons.
  23516. * @param {Function} equalFunc The function to determine equivalents of values.
  23517. * @param {Object} stack Tracks traversed `array` and `other` objects.
  23518. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  23519. */
  23520. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  23521. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  23522. arrLength = array.length,
  23523. othLength = other.length;
  23524. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  23525. return false;
  23526. }
  23527. // Assume cyclic values are equal.
  23528. var stacked = stack.get(array);
  23529. if (stacked && stack.get(other)) {
  23530. return stacked == other;
  23531. }
  23532. var index = -1,
  23533. result = true,
  23534. seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
  23535. stack.set(array, other);
  23536. stack.set(other, array);
  23537. // Ignore non-index properties.
  23538. while (++index < arrLength) {
  23539. var arrValue = array[index],
  23540. othValue = other[index];
  23541. if (customizer) {
  23542. var compared = isPartial
  23543. ? customizer(othValue, arrValue, index, other, array, stack)
  23544. : customizer(arrValue, othValue, index, array, other, stack);
  23545. }
  23546. if (compared !== undefined) {
  23547. if (compared) {
  23548. continue;
  23549. }
  23550. result = false;
  23551. break;
  23552. }
  23553. // Recursively compare arrays (susceptible to call stack limits).
  23554. if (seen) {
  23555. if (!arraySome(other, function(othValue, othIndex) {
  23556. if (!cacheHas(seen, othIndex) &&
  23557. (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  23558. return seen.push(othIndex);
  23559. }
  23560. })) {
  23561. result = false;
  23562. break;
  23563. }
  23564. } else if (!(
  23565. arrValue === othValue ||
  23566. equalFunc(arrValue, othValue, bitmask, customizer, stack)
  23567. )) {
  23568. result = false;
  23569. break;
  23570. }
  23571. }
  23572. stack['delete'](array);
  23573. stack['delete'](other);
  23574. return result;
  23575. }
  23576. /**
  23577. * A specialized version of `baseIsEqualDeep` for comparing objects of
  23578. * the same `toStringTag`.
  23579. *
  23580. * **Note:** This function only supports comparing values with tags of
  23581. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  23582. *
  23583. * @private
  23584. * @param {Object} object The object to compare.
  23585. * @param {Object} other The other object to compare.
  23586. * @param {string} tag The `toStringTag` of the objects to compare.
  23587. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23588. * @param {Function} customizer The function to customize comparisons.
  23589. * @param {Function} equalFunc The function to determine equivalents of values.
  23590. * @param {Object} stack Tracks traversed `object` and `other` objects.
  23591. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  23592. */
  23593. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  23594. switch (tag) {
  23595. case dataViewTag:
  23596. if ((object.byteLength != other.byteLength) ||
  23597. (object.byteOffset != other.byteOffset)) {
  23598. return false;
  23599. }
  23600. object = object.buffer;
  23601. other = other.buffer;
  23602. case arrayBufferTag:
  23603. if ((object.byteLength != other.byteLength) ||
  23604. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  23605. return false;
  23606. }
  23607. return true;
  23608. case boolTag:
  23609. case dateTag:
  23610. case numberTag:
  23611. // Coerce booleans to `1` or `0` and dates to milliseconds.
  23612. // Invalid dates are coerced to `NaN`.
  23613. return eq(+object, +other);
  23614. case errorTag:
  23615. return object.name == other.name && object.message == other.message;
  23616. case regexpTag:
  23617. case stringTag:
  23618. // Coerce regexes to strings and treat strings, primitives and objects,
  23619. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  23620. // for more details.
  23621. return object == (other + '');
  23622. case mapTag:
  23623. var convert = mapToArray;
  23624. case setTag:
  23625. var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
  23626. convert || (convert = setToArray);
  23627. if (object.size != other.size && !isPartial) {
  23628. return false;
  23629. }
  23630. // Assume cyclic values are equal.
  23631. var stacked = stack.get(object);
  23632. if (stacked) {
  23633. return stacked == other;
  23634. }
  23635. bitmask |= COMPARE_UNORDERED_FLAG;
  23636. // Recursively compare objects (susceptible to call stack limits).
  23637. stack.set(object, other);
  23638. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  23639. stack['delete'](object);
  23640. return result;
  23641. case symbolTag:
  23642. if (symbolValueOf) {
  23643. return symbolValueOf.call(object) == symbolValueOf.call(other);
  23644. }
  23645. }
  23646. return false;
  23647. }
  23648. /**
  23649. * A specialized version of `baseIsEqualDeep` for objects with support for
  23650. * partial deep comparisons.
  23651. *
  23652. * @private
  23653. * @param {Object} object The object to compare.
  23654. * @param {Object} other The other object to compare.
  23655. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23656. * @param {Function} customizer The function to customize comparisons.
  23657. * @param {Function} equalFunc The function to determine equivalents of values.
  23658. * @param {Object} stack Tracks traversed `object` and `other` objects.
  23659. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  23660. */
  23661. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  23662. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  23663. objProps = getAllKeys(object),
  23664. objLength = objProps.length,
  23665. othProps = getAllKeys(other),
  23666. othLength = othProps.length;
  23667. if (objLength != othLength && !isPartial) {
  23668. return false;
  23669. }
  23670. var index = objLength;
  23671. while (index--) {
  23672. var key = objProps[index];
  23673. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  23674. return false;
  23675. }
  23676. }
  23677. // Assume cyclic values are equal.
  23678. var stacked = stack.get(object);
  23679. if (stacked && stack.get(other)) {
  23680. return stacked == other;
  23681. }
  23682. var result = true;
  23683. stack.set(object, other);
  23684. stack.set(other, object);
  23685. var skipCtor = isPartial;
  23686. while (++index < objLength) {
  23687. key = objProps[index];
  23688. var objValue = object[key],
  23689. othValue = other[key];
  23690. if (customizer) {
  23691. var compared = isPartial
  23692. ? customizer(othValue, objValue, key, other, object, stack)
  23693. : customizer(objValue, othValue, key, object, other, stack);
  23694. }
  23695. // Recursively compare objects (susceptible to call stack limits).
  23696. if (!(compared === undefined
  23697. ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
  23698. : compared
  23699. )) {
  23700. result = false;
  23701. break;
  23702. }
  23703. skipCtor || (skipCtor = key == 'constructor');
  23704. }
  23705. if (result && !skipCtor) {
  23706. var objCtor = object.constructor,
  23707. othCtor = other.constructor;
  23708. // Non `Object` object instances with different constructors are not equal.
  23709. if (objCtor != othCtor &&
  23710. ('constructor' in object && 'constructor' in other) &&
  23711. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  23712. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  23713. result = false;
  23714. }
  23715. }
  23716. stack['delete'](object);
  23717. stack['delete'](other);
  23718. return result;
  23719. }
  23720. /**
  23721. * A specialized version of `baseRest` which flattens the rest array.
  23722. *
  23723. * @private
  23724. * @param {Function} func The function to apply a rest parameter to.
  23725. * @returns {Function} Returns the new function.
  23726. */
  23727. function flatRest(func) {
  23728. return setToString(overRest(func, undefined, flatten), func + '');
  23729. }
  23730. /**
  23731. * Creates an array of own enumerable property names and symbols of `object`.
  23732. *
  23733. * @private
  23734. * @param {Object} object The object to query.
  23735. * @returns {Array} Returns the array of property names and symbols.
  23736. */
  23737. function getAllKeys(object) {
  23738. return baseGetAllKeys(object, keys, getSymbols);
  23739. }
  23740. /**
  23741. * Creates an array of own and inherited enumerable property names and
  23742. * symbols of `object`.
  23743. *
  23744. * @private
  23745. * @param {Object} object The object to query.
  23746. * @returns {Array} Returns the array of property names and symbols.
  23747. */
  23748. function getAllKeysIn(object) {
  23749. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  23750. }
  23751. /**
  23752. * Gets metadata for `func`.
  23753. *
  23754. * @private
  23755. * @param {Function} func The function to query.
  23756. * @returns {*} Returns the metadata for `func`.
  23757. */
  23758. var getData = !metaMap ? noop : function(func) {
  23759. return metaMap.get(func);
  23760. };
  23761. /**
  23762. * Gets the name of `func`.
  23763. *
  23764. * @private
  23765. * @param {Function} func The function to query.
  23766. * @returns {string} Returns the function name.
  23767. */
  23768. function getFuncName(func) {
  23769. var result = (func.name + ''),
  23770. array = realNames[result],
  23771. length = hasOwnProperty.call(realNames, result) ? array.length : 0;
  23772. while (length--) {
  23773. var data = array[length],
  23774. otherFunc = data.func;
  23775. if (otherFunc == null || otherFunc == func) {
  23776. return data.name;
  23777. }
  23778. }
  23779. return result;
  23780. }
  23781. /**
  23782. * Gets the argument placeholder value for `func`.
  23783. *
  23784. * @private
  23785. * @param {Function} func The function to inspect.
  23786. * @returns {*} Returns the placeholder value.
  23787. */
  23788. function getHolder(func) {
  23789. var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
  23790. return object.placeholder;
  23791. }
  23792. /**
  23793. * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
  23794. * this function returns the custom method, otherwise it returns `baseIteratee`.
  23795. * If arguments are provided, the chosen function is invoked with them and
  23796. * its result is returned.
  23797. *
  23798. * @private
  23799. * @param {*} [value] The value to convert to an iteratee.
  23800. * @param {number} [arity] The arity of the created iteratee.
  23801. * @returns {Function} Returns the chosen function or its result.
  23802. */
  23803. function getIteratee() {
  23804. var result = lodash.iteratee || iteratee;
  23805. result = result === iteratee ? baseIteratee : result;
  23806. return arguments.length ? result(arguments[0], arguments[1]) : result;
  23807. }
  23808. /**
  23809. * Gets the data for `map`.
  23810. *
  23811. * @private
  23812. * @param {Object} map The map to query.
  23813. * @param {string} key The reference key.
  23814. * @returns {*} Returns the map data.
  23815. */
  23816. function getMapData(map, key) {
  23817. var data = map.__data__;
  23818. return isKeyable(key)
  23819. ? data[typeof key == 'string' ? 'string' : 'hash']
  23820. : data.map;
  23821. }
  23822. /**
  23823. * Gets the property names, values, and compare flags of `object`.
  23824. *
  23825. * @private
  23826. * @param {Object} object The object to query.
  23827. * @returns {Array} Returns the match data of `object`.
  23828. */
  23829. function getMatchData(object) {
  23830. var result = keys(object),
  23831. length = result.length;
  23832. while (length--) {
  23833. var key = result[length],
  23834. value = object[key];
  23835. result[length] = [key, value, isStrictComparable(value)];
  23836. }
  23837. return result;
  23838. }
  23839. /**
  23840. * Gets the native function at `key` of `object`.
  23841. *
  23842. * @private
  23843. * @param {Object} object The object to query.
  23844. * @param {string} key The key of the method to get.
  23845. * @returns {*} Returns the function if it's native, else `undefined`.
  23846. */
  23847. function getNative(object, key) {
  23848. var value = getValue(object, key);
  23849. return baseIsNative(value) ? value : undefined;
  23850. }
  23851. /**
  23852. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  23853. *
  23854. * @private
  23855. * @param {*} value The value to query.
  23856. * @returns {string} Returns the raw `toStringTag`.
  23857. */
  23858. function getRawTag(value) {
  23859. var isOwn = hasOwnProperty.call(value, symToStringTag),
  23860. tag = value[symToStringTag];
  23861. try {
  23862. value[symToStringTag] = undefined;
  23863. var unmasked = true;
  23864. } catch (e) {}
  23865. var result = nativeObjectToString.call(value);
  23866. if (unmasked) {
  23867. if (isOwn) {
  23868. value[symToStringTag] = tag;
  23869. } else {
  23870. delete value[symToStringTag];
  23871. }
  23872. }
  23873. return result;
  23874. }
  23875. /**
  23876. * Creates an array of the own enumerable symbols of `object`.
  23877. *
  23878. * @private
  23879. * @param {Object} object The object to query.
  23880. * @returns {Array} Returns the array of symbols.
  23881. */
  23882. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  23883. if (object == null) {
  23884. return [];
  23885. }
  23886. object = Object(object);
  23887. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  23888. return propertyIsEnumerable.call(object, symbol);
  23889. });
  23890. };
  23891. /**
  23892. * Creates an array of the own and inherited enumerable symbols of `object`.
  23893. *
  23894. * @private
  23895. * @param {Object} object The object to query.
  23896. * @returns {Array} Returns the array of symbols.
  23897. */
  23898. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  23899. var result = [];
  23900. while (object) {
  23901. arrayPush(result, getSymbols(object));
  23902. object = getPrototype(object);
  23903. }
  23904. return result;
  23905. };
  23906. /**
  23907. * Gets the `toStringTag` of `value`.
  23908. *
  23909. * @private
  23910. * @param {*} value The value to query.
  23911. * @returns {string} Returns the `toStringTag`.
  23912. */
  23913. var getTag = baseGetTag;
  23914. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  23915. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  23916. (Map && getTag(new Map) != mapTag) ||
  23917. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  23918. (Set && getTag(new Set) != setTag) ||
  23919. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  23920. getTag = function(value) {
  23921. var result = baseGetTag(value),
  23922. Ctor = result == objectTag ? value.constructor : undefined,
  23923. ctorString = Ctor ? toSource(Ctor) : '';
  23924. if (ctorString) {
  23925. switch (ctorString) {
  23926. case dataViewCtorString: return dataViewTag;
  23927. case mapCtorString: return mapTag;
  23928. case promiseCtorString: return promiseTag;
  23929. case setCtorString: return setTag;
  23930. case weakMapCtorString: return weakMapTag;
  23931. }
  23932. }
  23933. return result;
  23934. };
  23935. }
  23936. /**
  23937. * Gets the view, applying any `transforms` to the `start` and `end` positions.
  23938. *
  23939. * @private
  23940. * @param {number} start The start of the view.
  23941. * @param {number} end The end of the view.
  23942. * @param {Array} transforms The transformations to apply to the view.
  23943. * @returns {Object} Returns an object containing the `start` and `end`
  23944. * positions of the view.
  23945. */
  23946. function getView(start, end, transforms) {
  23947. var index = -1,
  23948. length = transforms.length;
  23949. while (++index < length) {
  23950. var data = transforms[index],
  23951. size = data.size;
  23952. switch (data.type) {
  23953. case 'drop': start += size; break;
  23954. case 'dropRight': end -= size; break;
  23955. case 'take': end = nativeMin(end, start + size); break;
  23956. case 'takeRight': start = nativeMax(start, end - size); break;
  23957. }
  23958. }
  23959. return { 'start': start, 'end': end };
  23960. }
  23961. /**
  23962. * Extracts wrapper details from the `source` body comment.
  23963. *
  23964. * @private
  23965. * @param {string} source The source to inspect.
  23966. * @returns {Array} Returns the wrapper details.
  23967. */
  23968. function getWrapDetails(source) {
  23969. var match = source.match(reWrapDetails);
  23970. return match ? match[1].split(reSplitDetails) : [];
  23971. }
  23972. /**
  23973. * Checks if `path` exists on `object`.
  23974. *
  23975. * @private
  23976. * @param {Object} object The object to query.
  23977. * @param {Array|string} path The path to check.
  23978. * @param {Function} hasFunc The function to check properties.
  23979. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  23980. */
  23981. function hasPath(object, path, hasFunc) {
  23982. path = castPath(path, object);
  23983. var index = -1,
  23984. length = path.length,
  23985. result = false;
  23986. while (++index < length) {
  23987. var key = toKey(path[index]);
  23988. if (!(result = object != null && hasFunc(object, key))) {
  23989. break;
  23990. }
  23991. object = object[key];
  23992. }
  23993. if (result || ++index != length) {
  23994. return result;
  23995. }
  23996. length = object == null ? 0 : object.length;
  23997. return !!length && isLength(length) && isIndex(key, length) &&
  23998. (isArray(object) || isArguments(object));
  23999. }
  24000. /**
  24001. * Initializes an array clone.
  24002. *
  24003. * @private
  24004. * @param {Array} array The array to clone.
  24005. * @returns {Array} Returns the initialized clone.
  24006. */
  24007. function initCloneArray(array) {
  24008. var length = array.length,
  24009. result = new array.constructor(length);
  24010. // Add properties assigned by `RegExp#exec`.
  24011. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  24012. result.index = array.index;
  24013. result.input = array.input;
  24014. }
  24015. return result;
  24016. }
  24017. /**
  24018. * Initializes an object clone.
  24019. *
  24020. * @private
  24021. * @param {Object} object The object to clone.
  24022. * @returns {Object} Returns the initialized clone.
  24023. */
  24024. function initCloneObject(object) {
  24025. return (typeof object.constructor == 'function' && !isPrototype(object))
  24026. ? baseCreate(getPrototype(object))
  24027. : {};
  24028. }
  24029. /**
  24030. * Initializes an object clone based on its `toStringTag`.
  24031. *
  24032. * **Note:** This function only supports cloning values with tags of
  24033. * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
  24034. *
  24035. * @private
  24036. * @param {Object} object The object to clone.
  24037. * @param {string} tag The `toStringTag` of the object to clone.
  24038. * @param {boolean} [isDeep] Specify a deep clone.
  24039. * @returns {Object} Returns the initialized clone.
  24040. */
  24041. function initCloneByTag(object, tag, isDeep) {
  24042. var Ctor = object.constructor;
  24043. switch (tag) {
  24044. case arrayBufferTag:
  24045. return cloneArrayBuffer(object);
  24046. case boolTag:
  24047. case dateTag:
  24048. return new Ctor(+object);
  24049. case dataViewTag:
  24050. return cloneDataView(object, isDeep);
  24051. case float32Tag: case float64Tag:
  24052. case int8Tag: case int16Tag: case int32Tag:
  24053. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  24054. return cloneTypedArray(object, isDeep);
  24055. case mapTag:
  24056. return new Ctor;
  24057. case numberTag:
  24058. case stringTag:
  24059. return new Ctor(object);
  24060. case regexpTag:
  24061. return cloneRegExp(object);
  24062. case setTag:
  24063. return new Ctor;
  24064. case symbolTag:
  24065. return cloneSymbol(object);
  24066. }
  24067. }
  24068. /**
  24069. * Inserts wrapper `details` in a comment at the top of the `source` body.
  24070. *
  24071. * @private
  24072. * @param {string} source The source to modify.
  24073. * @returns {Array} details The details to insert.
  24074. * @returns {string} Returns the modified source.
  24075. */
  24076. function insertWrapDetails(source, details) {
  24077. var length = details.length;
  24078. if (!length) {
  24079. return source;
  24080. }
  24081. var lastIndex = length - 1;
  24082. details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
  24083. details = details.join(length > 2 ? ', ' : ' ');
  24084. return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
  24085. }
  24086. /**
  24087. * Checks if `value` is a flattenable `arguments` object or array.
  24088. *
  24089. * @private
  24090. * @param {*} value The value to check.
  24091. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  24092. */
  24093. function isFlattenable(value) {
  24094. return isArray(value) || isArguments(value) ||
  24095. !!(spreadableSymbol && value && value[spreadableSymbol]);
  24096. }
  24097. /**
  24098. * Checks if `value` is a valid array-like index.
  24099. *
  24100. * @private
  24101. * @param {*} value The value to check.
  24102. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  24103. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  24104. */
  24105. function isIndex(value, length) {
  24106. var type = typeof value;
  24107. length = length == null ? MAX_SAFE_INTEGER : length;
  24108. return !!length &&
  24109. (type == 'number' ||
  24110. (type != 'symbol' && reIsUint.test(value))) &&
  24111. (value > -1 && value % 1 == 0 && value < length);
  24112. }
  24113. /**
  24114. * Checks if the given arguments are from an iteratee call.
  24115. *
  24116. * @private
  24117. * @param {*} value The potential iteratee value argument.
  24118. * @param {*} index The potential iteratee index or key argument.
  24119. * @param {*} object The potential iteratee object argument.
  24120. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  24121. * else `false`.
  24122. */
  24123. function isIterateeCall(value, index, object) {
  24124. if (!isObject(object)) {
  24125. return false;
  24126. }
  24127. var type = typeof index;
  24128. if (type == 'number'
  24129. ? (isArrayLike(object) && isIndex(index, object.length))
  24130. : (type == 'string' && index in object)
  24131. ) {
  24132. return eq(object[index], value);
  24133. }
  24134. return false;
  24135. }
  24136. /**
  24137. * Checks if `value` is a property name and not a property path.
  24138. *
  24139. * @private
  24140. * @param {*} value The value to check.
  24141. * @param {Object} [object] The object to query keys on.
  24142. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  24143. */
  24144. function isKey(value, object) {
  24145. if (isArray(value)) {
  24146. return false;
  24147. }
  24148. var type = typeof value;
  24149. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  24150. value == null || isSymbol(value)) {
  24151. return true;
  24152. }
  24153. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  24154. (object != null && value in Object(object));
  24155. }
  24156. /**
  24157. * Checks if `value` is suitable for use as unique object key.
  24158. *
  24159. * @private
  24160. * @param {*} value The value to check.
  24161. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  24162. */
  24163. function isKeyable(value) {
  24164. var type = typeof value;
  24165. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  24166. ? (value !== '__proto__')
  24167. : (value === null);
  24168. }
  24169. /**
  24170. * Checks if `func` has a lazy counterpart.
  24171. *
  24172. * @private
  24173. * @param {Function} func The function to check.
  24174. * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
  24175. * else `false`.
  24176. */
  24177. function isLaziable(func) {
  24178. var funcName = getFuncName(func),
  24179. other = lodash[funcName];
  24180. if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
  24181. return false;
  24182. }
  24183. if (func === other) {
  24184. return true;
  24185. }
  24186. var data = getData(other);
  24187. return !!data && func === data[0];
  24188. }
  24189. /**
  24190. * Checks if `func` has its source masked.
  24191. *
  24192. * @private
  24193. * @param {Function} func The function to check.
  24194. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  24195. */
  24196. function isMasked(func) {
  24197. return !!maskSrcKey && (maskSrcKey in func);
  24198. }
  24199. /**
  24200. * Checks if `func` is capable of being masked.
  24201. *
  24202. * @private
  24203. * @param {*} value The value to check.
  24204. * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
  24205. */
  24206. var isMaskable = coreJsData ? isFunction : stubFalse;
  24207. /**
  24208. * Checks if `value` is likely a prototype object.
  24209. *
  24210. * @private
  24211. * @param {*} value The value to check.
  24212. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  24213. */
  24214. function isPrototype(value) {
  24215. var Ctor = value && value.constructor,
  24216. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  24217. return value === proto;
  24218. }
  24219. /**
  24220. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  24221. *
  24222. * @private
  24223. * @param {*} value The value to check.
  24224. * @returns {boolean} Returns `true` if `value` if suitable for strict
  24225. * equality comparisons, else `false`.
  24226. */
  24227. function isStrictComparable(value) {
  24228. return value === value && !isObject(value);
  24229. }
  24230. /**
  24231. * A specialized version of `matchesProperty` for source values suitable
  24232. * for strict equality comparisons, i.e. `===`.
  24233. *
  24234. * @private
  24235. * @param {string} key The key of the property to get.
  24236. * @param {*} srcValue The value to match.
  24237. * @returns {Function} Returns the new spec function.
  24238. */
  24239. function matchesStrictComparable(key, srcValue) {
  24240. return function(object) {
  24241. if (object == null) {
  24242. return false;
  24243. }
  24244. return object[key] === srcValue &&
  24245. (srcValue !== undefined || (key in Object(object)));
  24246. };
  24247. }
  24248. /**
  24249. * A specialized version of `_.memoize` which clears the memoized function's
  24250. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  24251. *
  24252. * @private
  24253. * @param {Function} func The function to have its output memoized.
  24254. * @returns {Function} Returns the new memoized function.
  24255. */
  24256. function memoizeCapped(func) {
  24257. var result = memoize(func, function(key) {
  24258. if (cache.size === MAX_MEMOIZE_SIZE) {
  24259. cache.clear();
  24260. }
  24261. return key;
  24262. });
  24263. var cache = result.cache;
  24264. return result;
  24265. }
  24266. /**
  24267. * Merges the function metadata of `source` into `data`.
  24268. *
  24269. * Merging metadata reduces the number of wrappers used to invoke a function.
  24270. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
  24271. * may be applied regardless of execution order. Methods like `_.ary` and
  24272. * `_.rearg` modify function arguments, making the order in which they are
  24273. * executed important, preventing the merging of metadata. However, we make
  24274. * an exception for a safe combined case where curried functions have `_.ary`
  24275. * and or `_.rearg` applied.
  24276. *
  24277. * @private
  24278. * @param {Array} data The destination metadata.
  24279. * @param {Array} source The source metadata.
  24280. * @returns {Array} Returns `data`.
  24281. */
  24282. function mergeData(data, source) {
  24283. var bitmask = data[1],
  24284. srcBitmask = source[1],
  24285. newBitmask = bitmask | srcBitmask,
  24286. isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
  24287. var isCombo =
  24288. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
  24289. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
  24290. ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
  24291. // Exit early if metadata can't be merged.
  24292. if (!(isCommon || isCombo)) {
  24293. return data;
  24294. }
  24295. // Use source `thisArg` if available.
  24296. if (srcBitmask & WRAP_BIND_FLAG) {
  24297. data[2] = source[2];
  24298. // Set when currying a bound function.
  24299. newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
  24300. }
  24301. // Compose partial arguments.
  24302. var value = source[3];
  24303. if (value) {
  24304. var partials = data[3];
  24305. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  24306. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  24307. }
  24308. // Compose partial right arguments.
  24309. value = source[5];
  24310. if (value) {
  24311. partials = data[5];
  24312. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  24313. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  24314. }
  24315. // Use source `argPos` if available.
  24316. value = source[7];
  24317. if (value) {
  24318. data[7] = value;
  24319. }
  24320. // Use source `ary` if it's smaller.
  24321. if (srcBitmask & WRAP_ARY_FLAG) {
  24322. data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
  24323. }
  24324. // Use source `arity` if one is not provided.
  24325. if (data[9] == null) {
  24326. data[9] = source[9];
  24327. }
  24328. // Use source `func` and merge bitmasks.
  24329. data[0] = source[0];
  24330. data[1] = newBitmask;
  24331. return data;
  24332. }
  24333. /**
  24334. * This function is like
  24335. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  24336. * except that it includes inherited enumerable properties.
  24337. *
  24338. * @private
  24339. * @param {Object} object The object to query.
  24340. * @returns {Array} Returns the array of property names.
  24341. */
  24342. function nativeKeysIn(object) {
  24343. var result = [];
  24344. if (object != null) {
  24345. for (var key in Object(object)) {
  24346. result.push(key);
  24347. }
  24348. }
  24349. return result;
  24350. }
  24351. /**
  24352. * Converts `value` to a string using `Object.prototype.toString`.
  24353. *
  24354. * @private
  24355. * @param {*} value The value to convert.
  24356. * @returns {string} Returns the converted string.
  24357. */
  24358. function objectToString(value) {
  24359. return nativeObjectToString.call(value);
  24360. }
  24361. /**
  24362. * A specialized version of `baseRest` which transforms the rest array.
  24363. *
  24364. * @private
  24365. * @param {Function} func The function to apply a rest parameter to.
  24366. * @param {number} [start=func.length-1] The start position of the rest parameter.
  24367. * @param {Function} transform The rest array transform.
  24368. * @returns {Function} Returns the new function.
  24369. */
  24370. function overRest(func, start, transform) {
  24371. start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
  24372. return function() {
  24373. var args = arguments,
  24374. index = -1,
  24375. length = nativeMax(args.length - start, 0),
  24376. array = Array(length);
  24377. while (++index < length) {
  24378. array[index] = args[start + index];
  24379. }
  24380. index = -1;
  24381. var otherArgs = Array(start + 1);
  24382. while (++index < start) {
  24383. otherArgs[index] = args[index];
  24384. }
  24385. otherArgs[start] = transform(array);
  24386. return apply(func, this, otherArgs);
  24387. };
  24388. }
  24389. /**
  24390. * Gets the parent value at `path` of `object`.
  24391. *
  24392. * @private
  24393. * @param {Object} object The object to query.
  24394. * @param {Array} path The path to get the parent value of.
  24395. * @returns {*} Returns the parent value.
  24396. */
  24397. function parent(object, path) {
  24398. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  24399. }
  24400. /**
  24401. * Reorder `array` according to the specified indexes where the element at
  24402. * the first index is assigned as the first element, the element at
  24403. * the second index is assigned as the second element, and so on.
  24404. *
  24405. * @private
  24406. * @param {Array} array The array to reorder.
  24407. * @param {Array} indexes The arranged array indexes.
  24408. * @returns {Array} Returns `array`.
  24409. */
  24410. function reorder(array, indexes) {
  24411. var arrLength = array.length,
  24412. length = nativeMin(indexes.length, arrLength),
  24413. oldArray = copyArray(array);
  24414. while (length--) {
  24415. var index = indexes[length];
  24416. array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
  24417. }
  24418. return array;
  24419. }
  24420. /**
  24421. * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
  24422. *
  24423. * @private
  24424. * @param {Object} object The object to query.
  24425. * @param {string} key The key of the property to get.
  24426. * @returns {*} Returns the property value.
  24427. */
  24428. function safeGet(object, key) {
  24429. if (key === 'constructor' && typeof object[key] === 'function') {
  24430. return;
  24431. }
  24432. if (key == '__proto__') {
  24433. return;
  24434. }
  24435. return object[key];
  24436. }
  24437. /**
  24438. * Sets metadata for `func`.
  24439. *
  24440. * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
  24441. * period of time, it will trip its breaker and transition to an identity
  24442. * function to avoid garbage collection pauses in V8. See
  24443. * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
  24444. * for more details.
  24445. *
  24446. * @private
  24447. * @param {Function} func The function to associate metadata with.
  24448. * @param {*} data The metadata.
  24449. * @returns {Function} Returns `func`.
  24450. */
  24451. var setData = shortOut(baseSetData);
  24452. /**
  24453. * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
  24454. *
  24455. * @private
  24456. * @param {Function} func The function to delay.
  24457. * @param {number} wait The number of milliseconds to delay invocation.
  24458. * @returns {number|Object} Returns the timer id or timeout object.
  24459. */
  24460. var setTimeout = ctxSetTimeout || function(func, wait) {
  24461. return root.setTimeout(func, wait);
  24462. };
  24463. /**
  24464. * Sets the `toString` method of `func` to return `string`.
  24465. *
  24466. * @private
  24467. * @param {Function} func The function to modify.
  24468. * @param {Function} string The `toString` result.
  24469. * @returns {Function} Returns `func`.
  24470. */
  24471. var setToString = shortOut(baseSetToString);
  24472. /**
  24473. * Sets the `toString` method of `wrapper` to mimic the source of `reference`
  24474. * with wrapper details in a comment at the top of the source body.
  24475. *
  24476. * @private
  24477. * @param {Function} wrapper The function to modify.
  24478. * @param {Function} reference The reference function.
  24479. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  24480. * @returns {Function} Returns `wrapper`.
  24481. */
  24482. function setWrapToString(wrapper, reference, bitmask) {
  24483. var source = (reference + '');
  24484. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  24485. }
  24486. /**
  24487. * Creates a function that'll short out and invoke `identity` instead
  24488. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  24489. * milliseconds.
  24490. *
  24491. * @private
  24492. * @param {Function} func The function to restrict.
  24493. * @returns {Function} Returns the new shortable function.
  24494. */
  24495. function shortOut(func) {
  24496. var count = 0,
  24497. lastCalled = 0;
  24498. return function() {
  24499. var stamp = nativeNow(),
  24500. remaining = HOT_SPAN - (stamp - lastCalled);
  24501. lastCalled = stamp;
  24502. if (remaining > 0) {
  24503. if (++count >= HOT_COUNT) {
  24504. return arguments[0];
  24505. }
  24506. } else {
  24507. count = 0;
  24508. }
  24509. return func.apply(undefined, arguments);
  24510. };
  24511. }
  24512. /**
  24513. * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
  24514. *
  24515. * @private
  24516. * @param {Array} array The array to shuffle.
  24517. * @param {number} [size=array.length] The size of `array`.
  24518. * @returns {Array} Returns `array`.
  24519. */
  24520. function shuffleSelf(array, size) {
  24521. var index = -1,
  24522. length = array.length,
  24523. lastIndex = length - 1;
  24524. size = size === undefined ? length : size;
  24525. while (++index < size) {
  24526. var rand = baseRandom(index, lastIndex),
  24527. value = array[rand];
  24528. array[rand] = array[index];
  24529. array[index] = value;
  24530. }
  24531. array.length = size;
  24532. return array;
  24533. }
  24534. /**
  24535. * Converts `string` to a property path array.
  24536. *
  24537. * @private
  24538. * @param {string} string The string to convert.
  24539. * @returns {Array} Returns the property path array.
  24540. */
  24541. var stringToPath = memoizeCapped(function(string) {
  24542. var result = [];
  24543. if (string.charCodeAt(0) === 46 /* . */) {
  24544. result.push('');
  24545. }
  24546. string.replace(rePropName, function(match, number, quote, subString) {
  24547. result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
  24548. });
  24549. return result;
  24550. });
  24551. /**
  24552. * Converts `value` to a string key if it's not a string or symbol.
  24553. *
  24554. * @private
  24555. * @param {*} value The value to inspect.
  24556. * @returns {string|symbol} Returns the key.
  24557. */
  24558. function toKey(value) {
  24559. if (typeof value == 'string' || isSymbol(value)) {
  24560. return value;
  24561. }
  24562. var result = (value + '');
  24563. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  24564. }
  24565. /**
  24566. * Converts `func` to its source code.
  24567. *
  24568. * @private
  24569. * @param {Function} func The function to convert.
  24570. * @returns {string} Returns the source code.
  24571. */
  24572. function toSource(func) {
  24573. if (func != null) {
  24574. try {
  24575. return funcToString.call(func);
  24576. } catch (e) {}
  24577. try {
  24578. return (func + '');
  24579. } catch (e) {}
  24580. }
  24581. return '';
  24582. }
  24583. /**
  24584. * Updates wrapper `details` based on `bitmask` flags.
  24585. *
  24586. * @private
  24587. * @returns {Array} details The details to modify.
  24588. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  24589. * @returns {Array} Returns `details`.
  24590. */
  24591. function updateWrapDetails(details, bitmask) {
  24592. arrayEach(wrapFlags, function(pair) {
  24593. var value = '_.' + pair[0];
  24594. if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
  24595. details.push(value);
  24596. }
  24597. });
  24598. return details.sort();
  24599. }
  24600. /**
  24601. * Creates a clone of `wrapper`.
  24602. *
  24603. * @private
  24604. * @param {Object} wrapper The wrapper to clone.
  24605. * @returns {Object} Returns the cloned wrapper.
  24606. */
  24607. function wrapperClone(wrapper) {
  24608. if (wrapper instanceof LazyWrapper) {
  24609. return wrapper.clone();
  24610. }
  24611. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  24612. result.__actions__ = copyArray(wrapper.__actions__);
  24613. result.__index__ = wrapper.__index__;
  24614. result.__values__ = wrapper.__values__;
  24615. return result;
  24616. }
  24617. /*------------------------------------------------------------------------*/
  24618. /**
  24619. * Creates an array of elements split into groups the length of `size`.
  24620. * If `array` can't be split evenly, the final chunk will be the remaining
  24621. * elements.
  24622. *
  24623. * @static
  24624. * @memberOf _
  24625. * @since 3.0.0
  24626. * @category Array
  24627. * @param {Array} array The array to process.
  24628. * @param {number} [size=1] The length of each chunk
  24629. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24630. * @returns {Array} Returns the new array of chunks.
  24631. * @example
  24632. *
  24633. * _.chunk(['a', 'b', 'c', 'd'], 2);
  24634. * // => [['a', 'b'], ['c', 'd']]
  24635. *
  24636. * _.chunk(['a', 'b', 'c', 'd'], 3);
  24637. * // => [['a', 'b', 'c'], ['d']]
  24638. */
  24639. function chunk(array, size, guard) {
  24640. if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
  24641. size = 1;
  24642. } else {
  24643. size = nativeMax(toInteger(size), 0);
  24644. }
  24645. var length = array == null ? 0 : array.length;
  24646. if (!length || size < 1) {
  24647. return [];
  24648. }
  24649. var index = 0,
  24650. resIndex = 0,
  24651. result = Array(nativeCeil(length / size));
  24652. while (index < length) {
  24653. result[resIndex++] = baseSlice(array, index, (index += size));
  24654. }
  24655. return result;
  24656. }
  24657. /**
  24658. * Creates an array with all falsey values removed. The values `false`, `null`,
  24659. * `0`, `""`, `undefined`, and `NaN` are falsey.
  24660. *
  24661. * @static
  24662. * @memberOf _
  24663. * @since 0.1.0
  24664. * @category Array
  24665. * @param {Array} array The array to compact.
  24666. * @returns {Array} Returns the new array of filtered values.
  24667. * @example
  24668. *
  24669. * _.compact([0, 1, false, 2, '', 3]);
  24670. * // => [1, 2, 3]
  24671. */
  24672. function compact(array) {
  24673. var index = -1,
  24674. length = array == null ? 0 : array.length,
  24675. resIndex = 0,
  24676. result = [];
  24677. while (++index < length) {
  24678. var value = array[index];
  24679. if (value) {
  24680. result[resIndex++] = value;
  24681. }
  24682. }
  24683. return result;
  24684. }
  24685. /**
  24686. * Creates a new array concatenating `array` with any additional arrays
  24687. * and/or values.
  24688. *
  24689. * @static
  24690. * @memberOf _
  24691. * @since 4.0.0
  24692. * @category Array
  24693. * @param {Array} array The array to concatenate.
  24694. * @param {...*} [values] The values to concatenate.
  24695. * @returns {Array} Returns the new concatenated array.
  24696. * @example
  24697. *
  24698. * var array = [1];
  24699. * var other = _.concat(array, 2, [3], [[4]]);
  24700. *
  24701. * console.log(other);
  24702. * // => [1, 2, 3, [4]]
  24703. *
  24704. * console.log(array);
  24705. * // => [1]
  24706. */
  24707. function concat() {
  24708. var length = arguments.length;
  24709. if (!length) {
  24710. return [];
  24711. }
  24712. var args = Array(length - 1),
  24713. array = arguments[0],
  24714. index = length;
  24715. while (index--) {
  24716. args[index - 1] = arguments[index];
  24717. }
  24718. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  24719. }
  24720. /**
  24721. * Creates an array of `array` values not included in the other given arrays
  24722. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  24723. * for equality comparisons. The order and references of result values are
  24724. * determined by the first array.
  24725. *
  24726. * **Note:** Unlike `_.pullAll`, this method returns a new array.
  24727. *
  24728. * @static
  24729. * @memberOf _
  24730. * @since 0.1.0
  24731. * @category Array
  24732. * @param {Array} array The array to inspect.
  24733. * @param {...Array} [values] The values to exclude.
  24734. * @returns {Array} Returns the new array of filtered values.
  24735. * @see _.without, _.xor
  24736. * @example
  24737. *
  24738. * _.difference([2, 1], [2, 3]);
  24739. * // => [1]
  24740. */
  24741. var difference = baseRest(function(array, values) {
  24742. return isArrayLikeObject(array)
  24743. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
  24744. : [];
  24745. });
  24746. /**
  24747. * This method is like `_.difference` except that it accepts `iteratee` which
  24748. * is invoked for each element of `array` and `values` to generate the criterion
  24749. * by which they're compared. The order and references of result values are
  24750. * determined by the first array. The iteratee is invoked with one argument:
  24751. * (value).
  24752. *
  24753. * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
  24754. *
  24755. * @static
  24756. * @memberOf _
  24757. * @since 4.0.0
  24758. * @category Array
  24759. * @param {Array} array The array to inspect.
  24760. * @param {...Array} [values] The values to exclude.
  24761. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  24762. * @returns {Array} Returns the new array of filtered values.
  24763. * @example
  24764. *
  24765. * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  24766. * // => [1.2]
  24767. *
  24768. * // The `_.property` iteratee shorthand.
  24769. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
  24770. * // => [{ 'x': 2 }]
  24771. */
  24772. var differenceBy = baseRest(function(array, values) {
  24773. var iteratee = last(values);
  24774. if (isArrayLikeObject(iteratee)) {
  24775. iteratee = undefined;
  24776. }
  24777. return isArrayLikeObject(array)
  24778. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
  24779. : [];
  24780. });
  24781. /**
  24782. * This method is like `_.difference` except that it accepts `comparator`
  24783. * which is invoked to compare elements of `array` to `values`. The order and
  24784. * references of result values are determined by the first array. The comparator
  24785. * is invoked with two arguments: (arrVal, othVal).
  24786. *
  24787. * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
  24788. *
  24789. * @static
  24790. * @memberOf _
  24791. * @since 4.0.0
  24792. * @category Array
  24793. * @param {Array} array The array to inspect.
  24794. * @param {...Array} [values] The values to exclude.
  24795. * @param {Function} [comparator] The comparator invoked per element.
  24796. * @returns {Array} Returns the new array of filtered values.
  24797. * @example
  24798. *
  24799. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  24800. *
  24801. * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
  24802. * // => [{ 'x': 2, 'y': 1 }]
  24803. */
  24804. var differenceWith = baseRest(function(array, values) {
  24805. var comparator = last(values);
  24806. if (isArrayLikeObject(comparator)) {
  24807. comparator = undefined;
  24808. }
  24809. return isArrayLikeObject(array)
  24810. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
  24811. : [];
  24812. });
  24813. /**
  24814. * Creates a slice of `array` with `n` elements dropped from the beginning.
  24815. *
  24816. * @static
  24817. * @memberOf _
  24818. * @since 0.5.0
  24819. * @category Array
  24820. * @param {Array} array The array to query.
  24821. * @param {number} [n=1] The number of elements to drop.
  24822. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24823. * @returns {Array} Returns the slice of `array`.
  24824. * @example
  24825. *
  24826. * _.drop([1, 2, 3]);
  24827. * // => [2, 3]
  24828. *
  24829. * _.drop([1, 2, 3], 2);
  24830. * // => [3]
  24831. *
  24832. * _.drop([1, 2, 3], 5);
  24833. * // => []
  24834. *
  24835. * _.drop([1, 2, 3], 0);
  24836. * // => [1, 2, 3]
  24837. */
  24838. function drop(array, n, guard) {
  24839. var length = array == null ? 0 : array.length;
  24840. if (!length) {
  24841. return [];
  24842. }
  24843. n = (guard || n === undefined) ? 1 : toInteger(n);
  24844. return baseSlice(array, n < 0 ? 0 : n, length);
  24845. }
  24846. /**
  24847. * Creates a slice of `array` with `n` elements dropped from the end.
  24848. *
  24849. * @static
  24850. * @memberOf _
  24851. * @since 3.0.0
  24852. * @category Array
  24853. * @param {Array} array The array to query.
  24854. * @param {number} [n=1] The number of elements to drop.
  24855. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24856. * @returns {Array} Returns the slice of `array`.
  24857. * @example
  24858. *
  24859. * _.dropRight([1, 2, 3]);
  24860. * // => [1, 2]
  24861. *
  24862. * _.dropRight([1, 2, 3], 2);
  24863. * // => [1]
  24864. *
  24865. * _.dropRight([1, 2, 3], 5);
  24866. * // => []
  24867. *
  24868. * _.dropRight([1, 2, 3], 0);
  24869. * // => [1, 2, 3]
  24870. */
  24871. function dropRight(array, n, guard) {
  24872. var length = array == null ? 0 : array.length;
  24873. if (!length) {
  24874. return [];
  24875. }
  24876. n = (guard || n === undefined) ? 1 : toInteger(n);
  24877. n = length - n;
  24878. return baseSlice(array, 0, n < 0 ? 0 : n);
  24879. }
  24880. /**
  24881. * Creates a slice of `array` excluding elements dropped from the end.
  24882. * Elements are dropped until `predicate` returns falsey. The predicate is
  24883. * invoked with three arguments: (value, index, array).
  24884. *
  24885. * @static
  24886. * @memberOf _
  24887. * @since 3.0.0
  24888. * @category Array
  24889. * @param {Array} array The array to query.
  24890. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24891. * @returns {Array} Returns the slice of `array`.
  24892. * @example
  24893. *
  24894. * var users = [
  24895. * { 'user': 'barney', 'active': true },
  24896. * { 'user': 'fred', 'active': false },
  24897. * { 'user': 'pebbles', 'active': false }
  24898. * ];
  24899. *
  24900. * _.dropRightWhile(users, function(o) { return !o.active; });
  24901. * // => objects for ['barney']
  24902. *
  24903. * // The `_.matches` iteratee shorthand.
  24904. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
  24905. * // => objects for ['barney', 'fred']
  24906. *
  24907. * // The `_.matchesProperty` iteratee shorthand.
  24908. * _.dropRightWhile(users, ['active', false]);
  24909. * // => objects for ['barney']
  24910. *
  24911. * // The `_.property` iteratee shorthand.
  24912. * _.dropRightWhile(users, 'active');
  24913. * // => objects for ['barney', 'fred', 'pebbles']
  24914. */
  24915. function dropRightWhile(array, predicate) {
  24916. return (array && array.length)
  24917. ? baseWhile(array, getIteratee(predicate, 3), true, true)
  24918. : [];
  24919. }
  24920. /**
  24921. * Creates a slice of `array` excluding elements dropped from the beginning.
  24922. * Elements are dropped until `predicate` returns falsey. The predicate is
  24923. * invoked with three arguments: (value, index, array).
  24924. *
  24925. * @static
  24926. * @memberOf _
  24927. * @since 3.0.0
  24928. * @category Array
  24929. * @param {Array} array The array to query.
  24930. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24931. * @returns {Array} Returns the slice of `array`.
  24932. * @example
  24933. *
  24934. * var users = [
  24935. * { 'user': 'barney', 'active': false },
  24936. * { 'user': 'fred', 'active': false },
  24937. * { 'user': 'pebbles', 'active': true }
  24938. * ];
  24939. *
  24940. * _.dropWhile(users, function(o) { return !o.active; });
  24941. * // => objects for ['pebbles']
  24942. *
  24943. * // The `_.matches` iteratee shorthand.
  24944. * _.dropWhile(users, { 'user': 'barney', 'active': false });
  24945. * // => objects for ['fred', 'pebbles']
  24946. *
  24947. * // The `_.matchesProperty` iteratee shorthand.
  24948. * _.dropWhile(users, ['active', false]);
  24949. * // => objects for ['pebbles']
  24950. *
  24951. * // The `_.property` iteratee shorthand.
  24952. * _.dropWhile(users, 'active');
  24953. * // => objects for ['barney', 'fred', 'pebbles']
  24954. */
  24955. function dropWhile(array, predicate) {
  24956. return (array && array.length)
  24957. ? baseWhile(array, getIteratee(predicate, 3), true)
  24958. : [];
  24959. }
  24960. /**
  24961. * Fills elements of `array` with `value` from `start` up to, but not
  24962. * including, `end`.
  24963. *
  24964. * **Note:** This method mutates `array`.
  24965. *
  24966. * @static
  24967. * @memberOf _
  24968. * @since 3.2.0
  24969. * @category Array
  24970. * @param {Array} array The array to fill.
  24971. * @param {*} value The value to fill `array` with.
  24972. * @param {number} [start=0] The start position.
  24973. * @param {number} [end=array.length] The end position.
  24974. * @returns {Array} Returns `array`.
  24975. * @example
  24976. *
  24977. * var array = [1, 2, 3];
  24978. *
  24979. * _.fill(array, 'a');
  24980. * console.log(array);
  24981. * // => ['a', 'a', 'a']
  24982. *
  24983. * _.fill(Array(3), 2);
  24984. * // => [2, 2, 2]
  24985. *
  24986. * _.fill([4, 6, 8, 10], '*', 1, 3);
  24987. * // => [4, '*', '*', 10]
  24988. */
  24989. function fill(array, value, start, end) {
  24990. var length = array == null ? 0 : array.length;
  24991. if (!length) {
  24992. return [];
  24993. }
  24994. if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
  24995. start = 0;
  24996. end = length;
  24997. }
  24998. return baseFill(array, value, start, end);
  24999. }
  25000. /**
  25001. * This method is like `_.find` except that it returns the index of the first
  25002. * element `predicate` returns truthy for instead of the element itself.
  25003. *
  25004. * @static
  25005. * @memberOf _
  25006. * @since 1.1.0
  25007. * @category Array
  25008. * @param {Array} array The array to inspect.
  25009. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25010. * @param {number} [fromIndex=0] The index to search from.
  25011. * @returns {number} Returns the index of the found element, else `-1`.
  25012. * @example
  25013. *
  25014. * var users = [
  25015. * { 'user': 'barney', 'active': false },
  25016. * { 'user': 'fred', 'active': false },
  25017. * { 'user': 'pebbles', 'active': true }
  25018. * ];
  25019. *
  25020. * _.findIndex(users, function(o) { return o.user == 'barney'; });
  25021. * // => 0
  25022. *
  25023. * // The `_.matches` iteratee shorthand.
  25024. * _.findIndex(users, { 'user': 'fred', 'active': false });
  25025. * // => 1
  25026. *
  25027. * // The `_.matchesProperty` iteratee shorthand.
  25028. * _.findIndex(users, ['active', false]);
  25029. * // => 0
  25030. *
  25031. * // The `_.property` iteratee shorthand.
  25032. * _.findIndex(users, 'active');
  25033. * // => 2
  25034. */
  25035. function findIndex(array, predicate, fromIndex) {
  25036. var length = array == null ? 0 : array.length;
  25037. if (!length) {
  25038. return -1;
  25039. }
  25040. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  25041. if (index < 0) {
  25042. index = nativeMax(length + index, 0);
  25043. }
  25044. return baseFindIndex(array, getIteratee(predicate, 3), index);
  25045. }
  25046. /**
  25047. * This method is like `_.findIndex` except that it iterates over elements
  25048. * of `collection` from right to left.
  25049. *
  25050. * @static
  25051. * @memberOf _
  25052. * @since 2.0.0
  25053. * @category Array
  25054. * @param {Array} array The array to inspect.
  25055. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25056. * @param {number} [fromIndex=array.length-1] The index to search from.
  25057. * @returns {number} Returns the index of the found element, else `-1`.
  25058. * @example
  25059. *
  25060. * var users = [
  25061. * { 'user': 'barney', 'active': true },
  25062. * { 'user': 'fred', 'active': false },
  25063. * { 'user': 'pebbles', 'active': false }
  25064. * ];
  25065. *
  25066. * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
  25067. * // => 2
  25068. *
  25069. * // The `_.matches` iteratee shorthand.
  25070. * _.findLastIndex(users, { 'user': 'barney', 'active': true });
  25071. * // => 0
  25072. *
  25073. * // The `_.matchesProperty` iteratee shorthand.
  25074. * _.findLastIndex(users, ['active', false]);
  25075. * // => 2
  25076. *
  25077. * // The `_.property` iteratee shorthand.
  25078. * _.findLastIndex(users, 'active');
  25079. * // => 0
  25080. */
  25081. function findLastIndex(array, predicate, fromIndex) {
  25082. var length = array == null ? 0 : array.length;
  25083. if (!length) {
  25084. return -1;
  25085. }
  25086. var index = length - 1;
  25087. if (fromIndex !== undefined) {
  25088. index = toInteger(fromIndex);
  25089. index = fromIndex < 0
  25090. ? nativeMax(length + index, 0)
  25091. : nativeMin(index, length - 1);
  25092. }
  25093. return baseFindIndex(array, getIteratee(predicate, 3), index, true);
  25094. }
  25095. /**
  25096. * Flattens `array` a single level deep.
  25097. *
  25098. * @static
  25099. * @memberOf _
  25100. * @since 0.1.0
  25101. * @category Array
  25102. * @param {Array} array The array to flatten.
  25103. * @returns {Array} Returns the new flattened array.
  25104. * @example
  25105. *
  25106. * _.flatten([1, [2, [3, [4]], 5]]);
  25107. * // => [1, 2, [3, [4]], 5]
  25108. */
  25109. function flatten(array) {
  25110. var length = array == null ? 0 : array.length;
  25111. return length ? baseFlatten(array, 1) : [];
  25112. }
  25113. /**
  25114. * Recursively flattens `array`.
  25115. *
  25116. * @static
  25117. * @memberOf _
  25118. * @since 3.0.0
  25119. * @category Array
  25120. * @param {Array} array The array to flatten.
  25121. * @returns {Array} Returns the new flattened array.
  25122. * @example
  25123. *
  25124. * _.flattenDeep([1, [2, [3, [4]], 5]]);
  25125. * // => [1, 2, 3, 4, 5]
  25126. */
  25127. function flattenDeep(array) {
  25128. var length = array == null ? 0 : array.length;
  25129. return length ? baseFlatten(array, INFINITY) : [];
  25130. }
  25131. /**
  25132. * Recursively flatten `array` up to `depth` times.
  25133. *
  25134. * @static
  25135. * @memberOf _
  25136. * @since 4.4.0
  25137. * @category Array
  25138. * @param {Array} array The array to flatten.
  25139. * @param {number} [depth=1] The maximum recursion depth.
  25140. * @returns {Array} Returns the new flattened array.
  25141. * @example
  25142. *
  25143. * var array = [1, [2, [3, [4]], 5]];
  25144. *
  25145. * _.flattenDepth(array, 1);
  25146. * // => [1, 2, [3, [4]], 5]
  25147. *
  25148. * _.flattenDepth(array, 2);
  25149. * // => [1, 2, 3, [4], 5]
  25150. */
  25151. function flattenDepth(array, depth) {
  25152. var length = array == null ? 0 : array.length;
  25153. if (!length) {
  25154. return [];
  25155. }
  25156. depth = depth === undefined ? 1 : toInteger(depth);
  25157. return baseFlatten(array, depth);
  25158. }
  25159. /**
  25160. * The inverse of `_.toPairs`; this method returns an object composed
  25161. * from key-value `pairs`.
  25162. *
  25163. * @static
  25164. * @memberOf _
  25165. * @since 4.0.0
  25166. * @category Array
  25167. * @param {Array} pairs The key-value pairs.
  25168. * @returns {Object} Returns the new object.
  25169. * @example
  25170. *
  25171. * _.fromPairs([['a', 1], ['b', 2]]);
  25172. * // => { 'a': 1, 'b': 2 }
  25173. */
  25174. function fromPairs(pairs) {
  25175. var index = -1,
  25176. length = pairs == null ? 0 : pairs.length,
  25177. result = {};
  25178. while (++index < length) {
  25179. var pair = pairs[index];
  25180. result[pair[0]] = pair[1];
  25181. }
  25182. return result;
  25183. }
  25184. /**
  25185. * Gets the first element of `array`.
  25186. *
  25187. * @static
  25188. * @memberOf _
  25189. * @since 0.1.0
  25190. * @alias first
  25191. * @category Array
  25192. * @param {Array} array The array to query.
  25193. * @returns {*} Returns the first element of `array`.
  25194. * @example
  25195. *
  25196. * _.head([1, 2, 3]);
  25197. * // => 1
  25198. *
  25199. * _.head([]);
  25200. * // => undefined
  25201. */
  25202. function head(array) {
  25203. return (array && array.length) ? array[0] : undefined;
  25204. }
  25205. /**
  25206. * Gets the index at which the first occurrence of `value` is found in `array`
  25207. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25208. * for equality comparisons. If `fromIndex` is negative, it's used as the
  25209. * offset from the end of `array`.
  25210. *
  25211. * @static
  25212. * @memberOf _
  25213. * @since 0.1.0
  25214. * @category Array
  25215. * @param {Array} array The array to inspect.
  25216. * @param {*} value The value to search for.
  25217. * @param {number} [fromIndex=0] The index to search from.
  25218. * @returns {number} Returns the index of the matched value, else `-1`.
  25219. * @example
  25220. *
  25221. * _.indexOf([1, 2, 1, 2], 2);
  25222. * // => 1
  25223. *
  25224. * // Search from the `fromIndex`.
  25225. * _.indexOf([1, 2, 1, 2], 2, 2);
  25226. * // => 3
  25227. */
  25228. function indexOf(array, value, fromIndex) {
  25229. var length = array == null ? 0 : array.length;
  25230. if (!length) {
  25231. return -1;
  25232. }
  25233. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  25234. if (index < 0) {
  25235. index = nativeMax(length + index, 0);
  25236. }
  25237. return baseIndexOf(array, value, index);
  25238. }
  25239. /**
  25240. * Gets all but the last element of `array`.
  25241. *
  25242. * @static
  25243. * @memberOf _
  25244. * @since 0.1.0
  25245. * @category Array
  25246. * @param {Array} array The array to query.
  25247. * @returns {Array} Returns the slice of `array`.
  25248. * @example
  25249. *
  25250. * _.initial([1, 2, 3]);
  25251. * // => [1, 2]
  25252. */
  25253. function initial(array) {
  25254. var length = array == null ? 0 : array.length;
  25255. return length ? baseSlice(array, 0, -1) : [];
  25256. }
  25257. /**
  25258. * Creates an array of unique values that are included in all given arrays
  25259. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25260. * for equality comparisons. The order and references of result values are
  25261. * determined by the first array.
  25262. *
  25263. * @static
  25264. * @memberOf _
  25265. * @since 0.1.0
  25266. * @category Array
  25267. * @param {...Array} [arrays] The arrays to inspect.
  25268. * @returns {Array} Returns the new array of intersecting values.
  25269. * @example
  25270. *
  25271. * _.intersection([2, 1], [2, 3]);
  25272. * // => [2]
  25273. */
  25274. var intersection = baseRest(function(arrays) {
  25275. var mapped = arrayMap(arrays, castArrayLikeObject);
  25276. return (mapped.length && mapped[0] === arrays[0])
  25277. ? baseIntersection(mapped)
  25278. : [];
  25279. });
  25280. /**
  25281. * This method is like `_.intersection` except that it accepts `iteratee`
  25282. * which is invoked for each element of each `arrays` to generate the criterion
  25283. * by which they're compared. The order and references of result values are
  25284. * determined by the first array. The iteratee is invoked with one argument:
  25285. * (value).
  25286. *
  25287. * @static
  25288. * @memberOf _
  25289. * @since 4.0.0
  25290. * @category Array
  25291. * @param {...Array} [arrays] The arrays to inspect.
  25292. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25293. * @returns {Array} Returns the new array of intersecting values.
  25294. * @example
  25295. *
  25296. * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  25297. * // => [2.1]
  25298. *
  25299. * // The `_.property` iteratee shorthand.
  25300. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  25301. * // => [{ 'x': 1 }]
  25302. */
  25303. var intersectionBy = baseRest(function(arrays) {
  25304. var iteratee = last(arrays),
  25305. mapped = arrayMap(arrays, castArrayLikeObject);
  25306. if (iteratee === last(mapped)) {
  25307. iteratee = undefined;
  25308. } else {
  25309. mapped.pop();
  25310. }
  25311. return (mapped.length && mapped[0] === arrays[0])
  25312. ? baseIntersection(mapped, getIteratee(iteratee, 2))
  25313. : [];
  25314. });
  25315. /**
  25316. * This method is like `_.intersection` except that it accepts `comparator`
  25317. * which is invoked to compare elements of `arrays`. The order and references
  25318. * of result values are determined by the first array. The comparator is
  25319. * invoked with two arguments: (arrVal, othVal).
  25320. *
  25321. * @static
  25322. * @memberOf _
  25323. * @since 4.0.0
  25324. * @category Array
  25325. * @param {...Array} [arrays] The arrays to inspect.
  25326. * @param {Function} [comparator] The comparator invoked per element.
  25327. * @returns {Array} Returns the new array of intersecting values.
  25328. * @example
  25329. *
  25330. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  25331. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  25332. *
  25333. * _.intersectionWith(objects, others, _.isEqual);
  25334. * // => [{ 'x': 1, 'y': 2 }]
  25335. */
  25336. var intersectionWith = baseRest(function(arrays) {
  25337. var comparator = last(arrays),
  25338. mapped = arrayMap(arrays, castArrayLikeObject);
  25339. comparator = typeof comparator == 'function' ? comparator : undefined;
  25340. if (comparator) {
  25341. mapped.pop();
  25342. }
  25343. return (mapped.length && mapped[0] === arrays[0])
  25344. ? baseIntersection(mapped, undefined, comparator)
  25345. : [];
  25346. });
  25347. /**
  25348. * Converts all elements in `array` into a string separated by `separator`.
  25349. *
  25350. * @static
  25351. * @memberOf _
  25352. * @since 4.0.0
  25353. * @category Array
  25354. * @param {Array} array The array to convert.
  25355. * @param {string} [separator=','] The element separator.
  25356. * @returns {string} Returns the joined string.
  25357. * @example
  25358. *
  25359. * _.join(['a', 'b', 'c'], '~');
  25360. * // => 'a~b~c'
  25361. */
  25362. function join(array, separator) {
  25363. return array == null ? '' : nativeJoin.call(array, separator);
  25364. }
  25365. /**
  25366. * Gets the last element of `array`.
  25367. *
  25368. * @static
  25369. * @memberOf _
  25370. * @since 0.1.0
  25371. * @category Array
  25372. * @param {Array} array The array to query.
  25373. * @returns {*} Returns the last element of `array`.
  25374. * @example
  25375. *
  25376. * _.last([1, 2, 3]);
  25377. * // => 3
  25378. */
  25379. function last(array) {
  25380. var length = array == null ? 0 : array.length;
  25381. return length ? array[length - 1] : undefined;
  25382. }
  25383. /**
  25384. * This method is like `_.indexOf` except that it iterates over elements of
  25385. * `array` from right to left.
  25386. *
  25387. * @static
  25388. * @memberOf _
  25389. * @since 0.1.0
  25390. * @category Array
  25391. * @param {Array} array The array to inspect.
  25392. * @param {*} value The value to search for.
  25393. * @param {number} [fromIndex=array.length-1] The index to search from.
  25394. * @returns {number} Returns the index of the matched value, else `-1`.
  25395. * @example
  25396. *
  25397. * _.lastIndexOf([1, 2, 1, 2], 2);
  25398. * // => 3
  25399. *
  25400. * // Search from the `fromIndex`.
  25401. * _.lastIndexOf([1, 2, 1, 2], 2, 2);
  25402. * // => 1
  25403. */
  25404. function lastIndexOf(array, value, fromIndex) {
  25405. var length = array == null ? 0 : array.length;
  25406. if (!length) {
  25407. return -1;
  25408. }
  25409. var index = length;
  25410. if (fromIndex !== undefined) {
  25411. index = toInteger(fromIndex);
  25412. index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
  25413. }
  25414. return value === value
  25415. ? strictLastIndexOf(array, value, index)
  25416. : baseFindIndex(array, baseIsNaN, index, true);
  25417. }
  25418. /**
  25419. * Gets the element at index `n` of `array`. If `n` is negative, the nth
  25420. * element from the end is returned.
  25421. *
  25422. * @static
  25423. * @memberOf _
  25424. * @since 4.11.0
  25425. * @category Array
  25426. * @param {Array} array The array to query.
  25427. * @param {number} [n=0] The index of the element to return.
  25428. * @returns {*} Returns the nth element of `array`.
  25429. * @example
  25430. *
  25431. * var array = ['a', 'b', 'c', 'd'];
  25432. *
  25433. * _.nth(array, 1);
  25434. * // => 'b'
  25435. *
  25436. * _.nth(array, -2);
  25437. * // => 'c';
  25438. */
  25439. function nth(array, n) {
  25440. return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
  25441. }
  25442. /**
  25443. * Removes all given values from `array` using
  25444. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25445. * for equality comparisons.
  25446. *
  25447. * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
  25448. * to remove elements from an array by predicate.
  25449. *
  25450. * @static
  25451. * @memberOf _
  25452. * @since 2.0.0
  25453. * @category Array
  25454. * @param {Array} array The array to modify.
  25455. * @param {...*} [values] The values to remove.
  25456. * @returns {Array} Returns `array`.
  25457. * @example
  25458. *
  25459. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  25460. *
  25461. * _.pull(array, 'a', 'c');
  25462. * console.log(array);
  25463. * // => ['b', 'b']
  25464. */
  25465. var pull = baseRest(pullAll);
  25466. /**
  25467. * This method is like `_.pull` except that it accepts an array of values to remove.
  25468. *
  25469. * **Note:** Unlike `_.difference`, this method mutates `array`.
  25470. *
  25471. * @static
  25472. * @memberOf _
  25473. * @since 4.0.0
  25474. * @category Array
  25475. * @param {Array} array The array to modify.
  25476. * @param {Array} values The values to remove.
  25477. * @returns {Array} Returns `array`.
  25478. * @example
  25479. *
  25480. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  25481. *
  25482. * _.pullAll(array, ['a', 'c']);
  25483. * console.log(array);
  25484. * // => ['b', 'b']
  25485. */
  25486. function pullAll(array, values) {
  25487. return (array && array.length && values && values.length)
  25488. ? basePullAll(array, values)
  25489. : array;
  25490. }
  25491. /**
  25492. * This method is like `_.pullAll` except that it accepts `iteratee` which is
  25493. * invoked for each element of `array` and `values` to generate the criterion
  25494. * by which they're compared. The iteratee is invoked with one argument: (value).
  25495. *
  25496. * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
  25497. *
  25498. * @static
  25499. * @memberOf _
  25500. * @since 4.0.0
  25501. * @category Array
  25502. * @param {Array} array The array to modify.
  25503. * @param {Array} values The values to remove.
  25504. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25505. * @returns {Array} Returns `array`.
  25506. * @example
  25507. *
  25508. * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
  25509. *
  25510. * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
  25511. * console.log(array);
  25512. * // => [{ 'x': 2 }]
  25513. */
  25514. function pullAllBy(array, values, iteratee) {
  25515. return (array && array.length && values && values.length)
  25516. ? basePullAll(array, values, getIteratee(iteratee, 2))
  25517. : array;
  25518. }
  25519. /**
  25520. * This method is like `_.pullAll` except that it accepts `comparator` which
  25521. * is invoked to compare elements of `array` to `values`. The comparator is
  25522. * invoked with two arguments: (arrVal, othVal).
  25523. *
  25524. * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
  25525. *
  25526. * @static
  25527. * @memberOf _
  25528. * @since 4.6.0
  25529. * @category Array
  25530. * @param {Array} array The array to modify.
  25531. * @param {Array} values The values to remove.
  25532. * @param {Function} [comparator] The comparator invoked per element.
  25533. * @returns {Array} Returns `array`.
  25534. * @example
  25535. *
  25536. * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
  25537. *
  25538. * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
  25539. * console.log(array);
  25540. * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
  25541. */
  25542. function pullAllWith(array, values, comparator) {
  25543. return (array && array.length && values && values.length)
  25544. ? basePullAll(array, values, undefined, comparator)
  25545. : array;
  25546. }
  25547. /**
  25548. * Removes elements from `array` corresponding to `indexes` and returns an
  25549. * array of removed elements.
  25550. *
  25551. * **Note:** Unlike `_.at`, this method mutates `array`.
  25552. *
  25553. * @static
  25554. * @memberOf _
  25555. * @since 3.0.0
  25556. * @category Array
  25557. * @param {Array} array The array to modify.
  25558. * @param {...(number|number[])} [indexes] The indexes of elements to remove.
  25559. * @returns {Array} Returns the new array of removed elements.
  25560. * @example
  25561. *
  25562. * var array = ['a', 'b', 'c', 'd'];
  25563. * var pulled = _.pullAt(array, [1, 3]);
  25564. *
  25565. * console.log(array);
  25566. * // => ['a', 'c']
  25567. *
  25568. * console.log(pulled);
  25569. * // => ['b', 'd']
  25570. */
  25571. var pullAt = flatRest(function(array, indexes) {
  25572. var length = array == null ? 0 : array.length,
  25573. result = baseAt(array, indexes);
  25574. basePullAt(array, arrayMap(indexes, function(index) {
  25575. return isIndex(index, length) ? +index : index;
  25576. }).sort(compareAscending));
  25577. return result;
  25578. });
  25579. /**
  25580. * Removes all elements from `array` that `predicate` returns truthy for
  25581. * and returns an array of the removed elements. The predicate is invoked
  25582. * with three arguments: (value, index, array).
  25583. *
  25584. * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
  25585. * to pull elements from an array by value.
  25586. *
  25587. * @static
  25588. * @memberOf _
  25589. * @since 2.0.0
  25590. * @category Array
  25591. * @param {Array} array The array to modify.
  25592. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25593. * @returns {Array} Returns the new array of removed elements.
  25594. * @example
  25595. *
  25596. * var array = [1, 2, 3, 4];
  25597. * var evens = _.remove(array, function(n) {
  25598. * return n % 2 == 0;
  25599. * });
  25600. *
  25601. * console.log(array);
  25602. * // => [1, 3]
  25603. *
  25604. * console.log(evens);
  25605. * // => [2, 4]
  25606. */
  25607. function remove(array, predicate) {
  25608. var result = [];
  25609. if (!(array && array.length)) {
  25610. return result;
  25611. }
  25612. var index = -1,
  25613. indexes = [],
  25614. length = array.length;
  25615. predicate = getIteratee(predicate, 3);
  25616. while (++index < length) {
  25617. var value = array[index];
  25618. if (predicate(value, index, array)) {
  25619. result.push(value);
  25620. indexes.push(index);
  25621. }
  25622. }
  25623. basePullAt(array, indexes);
  25624. return result;
  25625. }
  25626. /**
  25627. * Reverses `array` so that the first element becomes the last, the second
  25628. * element becomes the second to last, and so on.
  25629. *
  25630. * **Note:** This method mutates `array` and is based on
  25631. * [`Array#reverse`](https://mdn.io/Array/reverse).
  25632. *
  25633. * @static
  25634. * @memberOf _
  25635. * @since 4.0.0
  25636. * @category Array
  25637. * @param {Array} array The array to modify.
  25638. * @returns {Array} Returns `array`.
  25639. * @example
  25640. *
  25641. * var array = [1, 2, 3];
  25642. *
  25643. * _.reverse(array);
  25644. * // => [3, 2, 1]
  25645. *
  25646. * console.log(array);
  25647. * // => [3, 2, 1]
  25648. */
  25649. function reverse(array) {
  25650. return array == null ? array : nativeReverse.call(array);
  25651. }
  25652. /**
  25653. * Creates a slice of `array` from `start` up to, but not including, `end`.
  25654. *
  25655. * **Note:** This method is used instead of
  25656. * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
  25657. * returned.
  25658. *
  25659. * @static
  25660. * @memberOf _
  25661. * @since 3.0.0
  25662. * @category Array
  25663. * @param {Array} array The array to slice.
  25664. * @param {number} [start=0] The start position.
  25665. * @param {number} [end=array.length] The end position.
  25666. * @returns {Array} Returns the slice of `array`.
  25667. */
  25668. function slice(array, start, end) {
  25669. var length = array == null ? 0 : array.length;
  25670. if (!length) {
  25671. return [];
  25672. }
  25673. if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
  25674. start = 0;
  25675. end = length;
  25676. }
  25677. else {
  25678. start = start == null ? 0 : toInteger(start);
  25679. end = end === undefined ? length : toInteger(end);
  25680. }
  25681. return baseSlice(array, start, end);
  25682. }
  25683. /**
  25684. * Uses a binary search to determine the lowest index at which `value`
  25685. * should be inserted into `array` in order to maintain its sort order.
  25686. *
  25687. * @static
  25688. * @memberOf _
  25689. * @since 0.1.0
  25690. * @category Array
  25691. * @param {Array} array The sorted array to inspect.
  25692. * @param {*} value The value to evaluate.
  25693. * @returns {number} Returns the index at which `value` should be inserted
  25694. * into `array`.
  25695. * @example
  25696. *
  25697. * _.sortedIndex([30, 50], 40);
  25698. * // => 1
  25699. */
  25700. function sortedIndex(array, value) {
  25701. return baseSortedIndex(array, value);
  25702. }
  25703. /**
  25704. * This method is like `_.sortedIndex` except that it accepts `iteratee`
  25705. * which is invoked for `value` and each element of `array` to compute their
  25706. * sort ranking. The iteratee is invoked with one argument: (value).
  25707. *
  25708. * @static
  25709. * @memberOf _
  25710. * @since 4.0.0
  25711. * @category Array
  25712. * @param {Array} array The sorted array to inspect.
  25713. * @param {*} value The value to evaluate.
  25714. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25715. * @returns {number} Returns the index at which `value` should be inserted
  25716. * into `array`.
  25717. * @example
  25718. *
  25719. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  25720. *
  25721. * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  25722. * // => 0
  25723. *
  25724. * // The `_.property` iteratee shorthand.
  25725. * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
  25726. * // => 0
  25727. */
  25728. function sortedIndexBy(array, value, iteratee) {
  25729. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
  25730. }
  25731. /**
  25732. * This method is like `_.indexOf` except that it performs a binary
  25733. * search on a sorted `array`.
  25734. *
  25735. * @static
  25736. * @memberOf _
  25737. * @since 4.0.0
  25738. * @category Array
  25739. * @param {Array} array The array to inspect.
  25740. * @param {*} value The value to search for.
  25741. * @returns {number} Returns the index of the matched value, else `-1`.
  25742. * @example
  25743. *
  25744. * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
  25745. * // => 1
  25746. */
  25747. function sortedIndexOf(array, value) {
  25748. var length = array == null ? 0 : array.length;
  25749. if (length) {
  25750. var index = baseSortedIndex(array, value);
  25751. if (index < length && eq(array[index], value)) {
  25752. return index;
  25753. }
  25754. }
  25755. return -1;
  25756. }
  25757. /**
  25758. * This method is like `_.sortedIndex` except that it returns the highest
  25759. * index at which `value` should be inserted into `array` in order to
  25760. * maintain its sort order.
  25761. *
  25762. * @static
  25763. * @memberOf _
  25764. * @since 3.0.0
  25765. * @category Array
  25766. * @param {Array} array The sorted array to inspect.
  25767. * @param {*} value The value to evaluate.
  25768. * @returns {number} Returns the index at which `value` should be inserted
  25769. * into `array`.
  25770. * @example
  25771. *
  25772. * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
  25773. * // => 4
  25774. */
  25775. function sortedLastIndex(array, value) {
  25776. return baseSortedIndex(array, value, true);
  25777. }
  25778. /**
  25779. * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
  25780. * which is invoked for `value` and each element of `array` to compute their
  25781. * sort ranking. The iteratee is invoked with one argument: (value).
  25782. *
  25783. * @static
  25784. * @memberOf _
  25785. * @since 4.0.0
  25786. * @category Array
  25787. * @param {Array} array The sorted array to inspect.
  25788. * @param {*} value The value to evaluate.
  25789. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25790. * @returns {number} Returns the index at which `value` should be inserted
  25791. * into `array`.
  25792. * @example
  25793. *
  25794. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  25795. *
  25796. * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  25797. * // => 1
  25798. *
  25799. * // The `_.property` iteratee shorthand.
  25800. * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
  25801. * // => 1
  25802. */
  25803. function sortedLastIndexBy(array, value, iteratee) {
  25804. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
  25805. }
  25806. /**
  25807. * This method is like `_.lastIndexOf` except that it performs a binary
  25808. * search on a sorted `array`.
  25809. *
  25810. * @static
  25811. * @memberOf _
  25812. * @since 4.0.0
  25813. * @category Array
  25814. * @param {Array} array The array to inspect.
  25815. * @param {*} value The value to search for.
  25816. * @returns {number} Returns the index of the matched value, else `-1`.
  25817. * @example
  25818. *
  25819. * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
  25820. * // => 3
  25821. */
  25822. function sortedLastIndexOf(array, value) {
  25823. var length = array == null ? 0 : array.length;
  25824. if (length) {
  25825. var index = baseSortedIndex(array, value, true) - 1;
  25826. if (eq(array[index], value)) {
  25827. return index;
  25828. }
  25829. }
  25830. return -1;
  25831. }
  25832. /**
  25833. * This method is like `_.uniq` except that it's designed and optimized
  25834. * for sorted arrays.
  25835. *
  25836. * @static
  25837. * @memberOf _
  25838. * @since 4.0.0
  25839. * @category Array
  25840. * @param {Array} array The array to inspect.
  25841. * @returns {Array} Returns the new duplicate free array.
  25842. * @example
  25843. *
  25844. * _.sortedUniq([1, 1, 2]);
  25845. * // => [1, 2]
  25846. */
  25847. function sortedUniq(array) {
  25848. return (array && array.length)
  25849. ? baseSortedUniq(array)
  25850. : [];
  25851. }
  25852. /**
  25853. * This method is like `_.uniqBy` except that it's designed and optimized
  25854. * for sorted arrays.
  25855. *
  25856. * @static
  25857. * @memberOf _
  25858. * @since 4.0.0
  25859. * @category Array
  25860. * @param {Array} array The array to inspect.
  25861. * @param {Function} [iteratee] The iteratee invoked per element.
  25862. * @returns {Array} Returns the new duplicate free array.
  25863. * @example
  25864. *
  25865. * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
  25866. * // => [1.1, 2.3]
  25867. */
  25868. function sortedUniqBy(array, iteratee) {
  25869. return (array && array.length)
  25870. ? baseSortedUniq(array, getIteratee(iteratee, 2))
  25871. : [];
  25872. }
  25873. /**
  25874. * Gets all but the first element of `array`.
  25875. *
  25876. * @static
  25877. * @memberOf _
  25878. * @since 4.0.0
  25879. * @category Array
  25880. * @param {Array} array The array to query.
  25881. * @returns {Array} Returns the slice of `array`.
  25882. * @example
  25883. *
  25884. * _.tail([1, 2, 3]);
  25885. * // => [2, 3]
  25886. */
  25887. function tail(array) {
  25888. var length = array == null ? 0 : array.length;
  25889. return length ? baseSlice(array, 1, length) : [];
  25890. }
  25891. /**
  25892. * Creates a slice of `array` with `n` elements taken from the beginning.
  25893. *
  25894. * @static
  25895. * @memberOf _
  25896. * @since 0.1.0
  25897. * @category Array
  25898. * @param {Array} array The array to query.
  25899. * @param {number} [n=1] The number of elements to take.
  25900. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25901. * @returns {Array} Returns the slice of `array`.
  25902. * @example
  25903. *
  25904. * _.take([1, 2, 3]);
  25905. * // => [1]
  25906. *
  25907. * _.take([1, 2, 3], 2);
  25908. * // => [1, 2]
  25909. *
  25910. * _.take([1, 2, 3], 5);
  25911. * // => [1, 2, 3]
  25912. *
  25913. * _.take([1, 2, 3], 0);
  25914. * // => []
  25915. */
  25916. function take(array, n, guard) {
  25917. if (!(array && array.length)) {
  25918. return [];
  25919. }
  25920. n = (guard || n === undefined) ? 1 : toInteger(n);
  25921. return baseSlice(array, 0, n < 0 ? 0 : n);
  25922. }
  25923. /**
  25924. * Creates a slice of `array` with `n` elements taken from the end.
  25925. *
  25926. * @static
  25927. * @memberOf _
  25928. * @since 3.0.0
  25929. * @category Array
  25930. * @param {Array} array The array to query.
  25931. * @param {number} [n=1] The number of elements to take.
  25932. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25933. * @returns {Array} Returns the slice of `array`.
  25934. * @example
  25935. *
  25936. * _.takeRight([1, 2, 3]);
  25937. * // => [3]
  25938. *
  25939. * _.takeRight([1, 2, 3], 2);
  25940. * // => [2, 3]
  25941. *
  25942. * _.takeRight([1, 2, 3], 5);
  25943. * // => [1, 2, 3]
  25944. *
  25945. * _.takeRight([1, 2, 3], 0);
  25946. * // => []
  25947. */
  25948. function takeRight(array, n, guard) {
  25949. var length = array == null ? 0 : array.length;
  25950. if (!length) {
  25951. return [];
  25952. }
  25953. n = (guard || n === undefined) ? 1 : toInteger(n);
  25954. n = length - n;
  25955. return baseSlice(array, n < 0 ? 0 : n, length);
  25956. }
  25957. /**
  25958. * Creates a slice of `array` with elements taken from the end. Elements are
  25959. * taken until `predicate` returns falsey. The predicate is invoked with
  25960. * three arguments: (value, index, array).
  25961. *
  25962. * @static
  25963. * @memberOf _
  25964. * @since 3.0.0
  25965. * @category Array
  25966. * @param {Array} array The array to query.
  25967. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25968. * @returns {Array} Returns the slice of `array`.
  25969. * @example
  25970. *
  25971. * var users = [
  25972. * { 'user': 'barney', 'active': true },
  25973. * { 'user': 'fred', 'active': false },
  25974. * { 'user': 'pebbles', 'active': false }
  25975. * ];
  25976. *
  25977. * _.takeRightWhile(users, function(o) { return !o.active; });
  25978. * // => objects for ['fred', 'pebbles']
  25979. *
  25980. * // The `_.matches` iteratee shorthand.
  25981. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
  25982. * // => objects for ['pebbles']
  25983. *
  25984. * // The `_.matchesProperty` iteratee shorthand.
  25985. * _.takeRightWhile(users, ['active', false]);
  25986. * // => objects for ['fred', 'pebbles']
  25987. *
  25988. * // The `_.property` iteratee shorthand.
  25989. * _.takeRightWhile(users, 'active');
  25990. * // => []
  25991. */
  25992. function takeRightWhile(array, predicate) {
  25993. return (array && array.length)
  25994. ? baseWhile(array, getIteratee(predicate, 3), false, true)
  25995. : [];
  25996. }
  25997. /**
  25998. * Creates a slice of `array` with elements taken from the beginning. Elements
  25999. * are taken until `predicate` returns falsey. The predicate is invoked with
  26000. * three arguments: (value, index, array).
  26001. *
  26002. * @static
  26003. * @memberOf _
  26004. * @since 3.0.0
  26005. * @category Array
  26006. * @param {Array} array The array to query.
  26007. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26008. * @returns {Array} Returns the slice of `array`.
  26009. * @example
  26010. *
  26011. * var users = [
  26012. * { 'user': 'barney', 'active': false },
  26013. * { 'user': 'fred', 'active': false },
  26014. * { 'user': 'pebbles', 'active': true }
  26015. * ];
  26016. *
  26017. * _.takeWhile(users, function(o) { return !o.active; });
  26018. * // => objects for ['barney', 'fred']
  26019. *
  26020. * // The `_.matches` iteratee shorthand.
  26021. * _.takeWhile(users, { 'user': 'barney', 'active': false });
  26022. * // => objects for ['barney']
  26023. *
  26024. * // The `_.matchesProperty` iteratee shorthand.
  26025. * _.takeWhile(users, ['active', false]);
  26026. * // => objects for ['barney', 'fred']
  26027. *
  26028. * // The `_.property` iteratee shorthand.
  26029. * _.takeWhile(users, 'active');
  26030. * // => []
  26031. */
  26032. function takeWhile(array, predicate) {
  26033. return (array && array.length)
  26034. ? baseWhile(array, getIteratee(predicate, 3))
  26035. : [];
  26036. }
  26037. /**
  26038. * Creates an array of unique values, in order, from all given arrays using
  26039. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26040. * for equality comparisons.
  26041. *
  26042. * @static
  26043. * @memberOf _
  26044. * @since 0.1.0
  26045. * @category Array
  26046. * @param {...Array} [arrays] The arrays to inspect.
  26047. * @returns {Array} Returns the new array of combined values.
  26048. * @example
  26049. *
  26050. * _.union([2], [1, 2]);
  26051. * // => [2, 1]
  26052. */
  26053. var union = baseRest(function(arrays) {
  26054. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  26055. });
  26056. /**
  26057. * This method is like `_.union` except that it accepts `iteratee` which is
  26058. * invoked for each element of each `arrays` to generate the criterion by
  26059. * which uniqueness is computed. Result values are chosen from the first
  26060. * array in which the value occurs. The iteratee is invoked with one argument:
  26061. * (value).
  26062. *
  26063. * @static
  26064. * @memberOf _
  26065. * @since 4.0.0
  26066. * @category Array
  26067. * @param {...Array} [arrays] The arrays to inspect.
  26068. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26069. * @returns {Array} Returns the new array of combined values.
  26070. * @example
  26071. *
  26072. * _.unionBy([2.1], [1.2, 2.3], Math.floor);
  26073. * // => [2.1, 1.2]
  26074. *
  26075. * // The `_.property` iteratee shorthand.
  26076. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  26077. * // => [{ 'x': 1 }, { 'x': 2 }]
  26078. */
  26079. var unionBy = baseRest(function(arrays) {
  26080. var iteratee = last(arrays);
  26081. if (isArrayLikeObject(iteratee)) {
  26082. iteratee = undefined;
  26083. }
  26084. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
  26085. });
  26086. /**
  26087. * This method is like `_.union` except that it accepts `comparator` which
  26088. * is invoked to compare elements of `arrays`. Result values are chosen from
  26089. * the first array in which the value occurs. The comparator is invoked
  26090. * with two arguments: (arrVal, othVal).
  26091. *
  26092. * @static
  26093. * @memberOf _
  26094. * @since 4.0.0
  26095. * @category Array
  26096. * @param {...Array} [arrays] The arrays to inspect.
  26097. * @param {Function} [comparator] The comparator invoked per element.
  26098. * @returns {Array} Returns the new array of combined values.
  26099. * @example
  26100. *
  26101. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  26102. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26103. *
  26104. * _.unionWith(objects, others, _.isEqual);
  26105. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  26106. */
  26107. var unionWith = baseRest(function(arrays) {
  26108. var comparator = last(arrays);
  26109. comparator = typeof comparator == 'function' ? comparator : undefined;
  26110. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
  26111. });
  26112. /**
  26113. * Creates a duplicate-free version of an array, using
  26114. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26115. * for equality comparisons, in which only the first occurrence of each element
  26116. * is kept. The order of result values is determined by the order they occur
  26117. * in the array.
  26118. *
  26119. * @static
  26120. * @memberOf _
  26121. * @since 0.1.0
  26122. * @category Array
  26123. * @param {Array} array The array to inspect.
  26124. * @returns {Array} Returns the new duplicate free array.
  26125. * @example
  26126. *
  26127. * _.uniq([2, 1, 2]);
  26128. * // => [2, 1]
  26129. */
  26130. function uniq(array) {
  26131. return (array && array.length) ? baseUniq(array) : [];
  26132. }
  26133. /**
  26134. * This method is like `_.uniq` except that it accepts `iteratee` which is
  26135. * invoked for each element in `array` to generate the criterion by which
  26136. * uniqueness is computed. The order of result values is determined by the
  26137. * order they occur in the array. The iteratee is invoked with one argument:
  26138. * (value).
  26139. *
  26140. * @static
  26141. * @memberOf _
  26142. * @since 4.0.0
  26143. * @category Array
  26144. * @param {Array} array The array to inspect.
  26145. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26146. * @returns {Array} Returns the new duplicate free array.
  26147. * @example
  26148. *
  26149. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  26150. * // => [2.1, 1.2]
  26151. *
  26152. * // The `_.property` iteratee shorthand.
  26153. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  26154. * // => [{ 'x': 1 }, { 'x': 2 }]
  26155. */
  26156. function uniqBy(array, iteratee) {
  26157. return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
  26158. }
  26159. /**
  26160. * This method is like `_.uniq` except that it accepts `comparator` which
  26161. * is invoked to compare elements of `array`. The order of result values is
  26162. * determined by the order they occur in the array.The comparator is invoked
  26163. * with two arguments: (arrVal, othVal).
  26164. *
  26165. * @static
  26166. * @memberOf _
  26167. * @since 4.0.0
  26168. * @category Array
  26169. * @param {Array} array The array to inspect.
  26170. * @param {Function} [comparator] The comparator invoked per element.
  26171. * @returns {Array} Returns the new duplicate free array.
  26172. * @example
  26173. *
  26174. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26175. *
  26176. * _.uniqWith(objects, _.isEqual);
  26177. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
  26178. */
  26179. function uniqWith(array, comparator) {
  26180. comparator = typeof comparator == 'function' ? comparator : undefined;
  26181. return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
  26182. }
  26183. /**
  26184. * This method is like `_.zip` except that it accepts an array of grouped
  26185. * elements and creates an array regrouping the elements to their pre-zip
  26186. * configuration.
  26187. *
  26188. * @static
  26189. * @memberOf _
  26190. * @since 1.2.0
  26191. * @category Array
  26192. * @param {Array} array The array of grouped elements to process.
  26193. * @returns {Array} Returns the new array of regrouped elements.
  26194. * @example
  26195. *
  26196. * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
  26197. * // => [['a', 1, true], ['b', 2, false]]
  26198. *
  26199. * _.unzip(zipped);
  26200. * // => [['a', 'b'], [1, 2], [true, false]]
  26201. */
  26202. function unzip(array) {
  26203. if (!(array && array.length)) {
  26204. return [];
  26205. }
  26206. var length = 0;
  26207. array = arrayFilter(array, function(group) {
  26208. if (isArrayLikeObject(group)) {
  26209. length = nativeMax(group.length, length);
  26210. return true;
  26211. }
  26212. });
  26213. return baseTimes(length, function(index) {
  26214. return arrayMap(array, baseProperty(index));
  26215. });
  26216. }
  26217. /**
  26218. * This method is like `_.unzip` except that it accepts `iteratee` to specify
  26219. * how regrouped values should be combined. The iteratee is invoked with the
  26220. * elements of each group: (...group).
  26221. *
  26222. * @static
  26223. * @memberOf _
  26224. * @since 3.8.0
  26225. * @category Array
  26226. * @param {Array} array The array of grouped elements to process.
  26227. * @param {Function} [iteratee=_.identity] The function to combine
  26228. * regrouped values.
  26229. * @returns {Array} Returns the new array of regrouped elements.
  26230. * @example
  26231. *
  26232. * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
  26233. * // => [[1, 10, 100], [2, 20, 200]]
  26234. *
  26235. * _.unzipWith(zipped, _.add);
  26236. * // => [3, 30, 300]
  26237. */
  26238. function unzipWith(array, iteratee) {
  26239. if (!(array && array.length)) {
  26240. return [];
  26241. }
  26242. var result = unzip(array);
  26243. if (iteratee == null) {
  26244. return result;
  26245. }
  26246. return arrayMap(result, function(group) {
  26247. return apply(iteratee, undefined, group);
  26248. });
  26249. }
  26250. /**
  26251. * Creates an array excluding all given values using
  26252. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26253. * for equality comparisons.
  26254. *
  26255. * **Note:** Unlike `_.pull`, this method returns a new array.
  26256. *
  26257. * @static
  26258. * @memberOf _
  26259. * @since 0.1.0
  26260. * @category Array
  26261. * @param {Array} array The array to inspect.
  26262. * @param {...*} [values] The values to exclude.
  26263. * @returns {Array} Returns the new array of filtered values.
  26264. * @see _.difference, _.xor
  26265. * @example
  26266. *
  26267. * _.without([2, 1, 2, 3], 1, 2);
  26268. * // => [3]
  26269. */
  26270. var without = baseRest(function(array, values) {
  26271. return isArrayLikeObject(array)
  26272. ? baseDifference(array, values)
  26273. : [];
  26274. });
  26275. /**
  26276. * Creates an array of unique values that is the
  26277. * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
  26278. * of the given arrays. The order of result values is determined by the order
  26279. * they occur in the arrays.
  26280. *
  26281. * @static
  26282. * @memberOf _
  26283. * @since 2.4.0
  26284. * @category Array
  26285. * @param {...Array} [arrays] The arrays to inspect.
  26286. * @returns {Array} Returns the new array of filtered values.
  26287. * @see _.difference, _.without
  26288. * @example
  26289. *
  26290. * _.xor([2, 1], [2, 3]);
  26291. * // => [1, 3]
  26292. */
  26293. var xor = baseRest(function(arrays) {
  26294. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  26295. });
  26296. /**
  26297. * This method is like `_.xor` except that it accepts `iteratee` which is
  26298. * invoked for each element of each `arrays` to generate the criterion by
  26299. * which by which they're compared. The order of result values is determined
  26300. * by the order they occur in the arrays. The iteratee is invoked with one
  26301. * argument: (value).
  26302. *
  26303. * @static
  26304. * @memberOf _
  26305. * @since 4.0.0
  26306. * @category Array
  26307. * @param {...Array} [arrays] The arrays to inspect.
  26308. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26309. * @returns {Array} Returns the new array of filtered values.
  26310. * @example
  26311. *
  26312. * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  26313. * // => [1.2, 3.4]
  26314. *
  26315. * // The `_.property` iteratee shorthand.
  26316. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  26317. * // => [{ 'x': 2 }]
  26318. */
  26319. var xorBy = baseRest(function(arrays) {
  26320. var iteratee = last(arrays);
  26321. if (isArrayLikeObject(iteratee)) {
  26322. iteratee = undefined;
  26323. }
  26324. return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
  26325. });
  26326. /**
  26327. * This method is like `_.xor` except that it accepts `comparator` which is
  26328. * invoked to compare elements of `arrays`. The order of result values is
  26329. * determined by the order they occur in the arrays. The comparator is invoked
  26330. * with two arguments: (arrVal, othVal).
  26331. *
  26332. * @static
  26333. * @memberOf _
  26334. * @since 4.0.0
  26335. * @category Array
  26336. * @param {...Array} [arrays] The arrays to inspect.
  26337. * @param {Function} [comparator] The comparator invoked per element.
  26338. * @returns {Array} Returns the new array of filtered values.
  26339. * @example
  26340. *
  26341. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  26342. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26343. *
  26344. * _.xorWith(objects, others, _.isEqual);
  26345. * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  26346. */
  26347. var xorWith = baseRest(function(arrays) {
  26348. var comparator = last(arrays);
  26349. comparator = typeof comparator == 'function' ? comparator : undefined;
  26350. return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
  26351. });
  26352. /**
  26353. * Creates an array of grouped elements, the first of which contains the
  26354. * first elements of the given arrays, the second of which contains the
  26355. * second elements of the given arrays, and so on.
  26356. *
  26357. * @static
  26358. * @memberOf _
  26359. * @since 0.1.0
  26360. * @category Array
  26361. * @param {...Array} [arrays] The arrays to process.
  26362. * @returns {Array} Returns the new array of grouped elements.
  26363. * @example
  26364. *
  26365. * _.zip(['a', 'b'], [1, 2], [true, false]);
  26366. * // => [['a', 1, true], ['b', 2, false]]
  26367. */
  26368. var zip = baseRest(unzip);
  26369. /**
  26370. * This method is like `_.fromPairs` except that it accepts two arrays,
  26371. * one of property identifiers and one of corresponding values.
  26372. *
  26373. * @static
  26374. * @memberOf _
  26375. * @since 0.4.0
  26376. * @category Array
  26377. * @param {Array} [props=[]] The property identifiers.
  26378. * @param {Array} [values=[]] The property values.
  26379. * @returns {Object} Returns the new object.
  26380. * @example
  26381. *
  26382. * _.zipObject(['a', 'b'], [1, 2]);
  26383. * // => { 'a': 1, 'b': 2 }
  26384. */
  26385. function zipObject(props, values) {
  26386. return baseZipObject(props || [], values || [], assignValue);
  26387. }
  26388. /**
  26389. * This method is like `_.zipObject` except that it supports property paths.
  26390. *
  26391. * @static
  26392. * @memberOf _
  26393. * @since 4.1.0
  26394. * @category Array
  26395. * @param {Array} [props=[]] The property identifiers.
  26396. * @param {Array} [values=[]] The property values.
  26397. * @returns {Object} Returns the new object.
  26398. * @example
  26399. *
  26400. * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
  26401. * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
  26402. */
  26403. function zipObjectDeep(props, values) {
  26404. return baseZipObject(props || [], values || [], baseSet);
  26405. }
  26406. /**
  26407. * This method is like `_.zip` except that it accepts `iteratee` to specify
  26408. * how grouped values should be combined. The iteratee is invoked with the
  26409. * elements of each group: (...group).
  26410. *
  26411. * @static
  26412. * @memberOf _
  26413. * @since 3.8.0
  26414. * @category Array
  26415. * @param {...Array} [arrays] The arrays to process.
  26416. * @param {Function} [iteratee=_.identity] The function to combine
  26417. * grouped values.
  26418. * @returns {Array} Returns the new array of grouped elements.
  26419. * @example
  26420. *
  26421. * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
  26422. * return a + b + c;
  26423. * });
  26424. * // => [111, 222]
  26425. */
  26426. var zipWith = baseRest(function(arrays) {
  26427. var length = arrays.length,
  26428. iteratee = length > 1 ? arrays[length - 1] : undefined;
  26429. iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
  26430. return unzipWith(arrays, iteratee);
  26431. });
  26432. /*------------------------------------------------------------------------*/
  26433. /**
  26434. * Creates a `lodash` wrapper instance that wraps `value` with explicit method
  26435. * chain sequences enabled. The result of such sequences must be unwrapped
  26436. * with `_#value`.
  26437. *
  26438. * @static
  26439. * @memberOf _
  26440. * @since 1.3.0
  26441. * @category Seq
  26442. * @param {*} value The value to wrap.
  26443. * @returns {Object} Returns the new `lodash` wrapper instance.
  26444. * @example
  26445. *
  26446. * var users = [
  26447. * { 'user': 'barney', 'age': 36 },
  26448. * { 'user': 'fred', 'age': 40 },
  26449. * { 'user': 'pebbles', 'age': 1 }
  26450. * ];
  26451. *
  26452. * var youngest = _
  26453. * .chain(users)
  26454. * .sortBy('age')
  26455. * .map(function(o) {
  26456. * return o.user + ' is ' + o.age;
  26457. * })
  26458. * .head()
  26459. * .value();
  26460. * // => 'pebbles is 1'
  26461. */
  26462. function chain(value) {
  26463. var result = lodash(value);
  26464. result.__chain__ = true;
  26465. return result;
  26466. }
  26467. /**
  26468. * This method invokes `interceptor` and returns `value`. The interceptor
  26469. * is invoked with one argument; (value). The purpose of this method is to
  26470. * "tap into" a method chain sequence in order to modify intermediate results.
  26471. *
  26472. * @static
  26473. * @memberOf _
  26474. * @since 0.1.0
  26475. * @category Seq
  26476. * @param {*} value The value to provide to `interceptor`.
  26477. * @param {Function} interceptor The function to invoke.
  26478. * @returns {*} Returns `value`.
  26479. * @example
  26480. *
  26481. * _([1, 2, 3])
  26482. * .tap(function(array) {
  26483. * // Mutate input array.
  26484. * array.pop();
  26485. * })
  26486. * .reverse()
  26487. * .value();
  26488. * // => [2, 1]
  26489. */
  26490. function tap(value, interceptor) {
  26491. interceptor(value);
  26492. return value;
  26493. }
  26494. /**
  26495. * This method is like `_.tap` except that it returns the result of `interceptor`.
  26496. * The purpose of this method is to "pass thru" values replacing intermediate
  26497. * results in a method chain sequence.
  26498. *
  26499. * @static
  26500. * @memberOf _
  26501. * @since 3.0.0
  26502. * @category Seq
  26503. * @param {*} value The value to provide to `interceptor`.
  26504. * @param {Function} interceptor The function to invoke.
  26505. * @returns {*} Returns the result of `interceptor`.
  26506. * @example
  26507. *
  26508. * _(' abc ')
  26509. * .chain()
  26510. * .trim()
  26511. * .thru(function(value) {
  26512. * return [value];
  26513. * })
  26514. * .value();
  26515. * // => ['abc']
  26516. */
  26517. function thru(value, interceptor) {
  26518. return interceptor(value);
  26519. }
  26520. /**
  26521. * This method is the wrapper version of `_.at`.
  26522. *
  26523. * @name at
  26524. * @memberOf _
  26525. * @since 1.0.0
  26526. * @category Seq
  26527. * @param {...(string|string[])} [paths] The property paths to pick.
  26528. * @returns {Object} Returns the new `lodash` wrapper instance.
  26529. * @example
  26530. *
  26531. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  26532. *
  26533. * _(object).at(['a[0].b.c', 'a[1]']).value();
  26534. * // => [3, 4]
  26535. */
  26536. var wrapperAt = flatRest(function(paths) {
  26537. var length = paths.length,
  26538. start = length ? paths[0] : 0,
  26539. value = this.__wrapped__,
  26540. interceptor = function(object) { return baseAt(object, paths); };
  26541. if (length > 1 || this.__actions__.length ||
  26542. !(value instanceof LazyWrapper) || !isIndex(start)) {
  26543. return this.thru(interceptor);
  26544. }
  26545. value = value.slice(start, +start + (length ? 1 : 0));
  26546. value.__actions__.push({
  26547. 'func': thru,
  26548. 'args': [interceptor],
  26549. 'thisArg': undefined
  26550. });
  26551. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  26552. if (length && !array.length) {
  26553. array.push(undefined);
  26554. }
  26555. return array;
  26556. });
  26557. });
  26558. /**
  26559. * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
  26560. *
  26561. * @name chain
  26562. * @memberOf _
  26563. * @since 0.1.0
  26564. * @category Seq
  26565. * @returns {Object} Returns the new `lodash` wrapper instance.
  26566. * @example
  26567. *
  26568. * var users = [
  26569. * { 'user': 'barney', 'age': 36 },
  26570. * { 'user': 'fred', 'age': 40 }
  26571. * ];
  26572. *
  26573. * // A sequence without explicit chaining.
  26574. * _(users).head();
  26575. * // => { 'user': 'barney', 'age': 36 }
  26576. *
  26577. * // A sequence with explicit chaining.
  26578. * _(users)
  26579. * .chain()
  26580. * .head()
  26581. * .pick('user')
  26582. * .value();
  26583. * // => { 'user': 'barney' }
  26584. */
  26585. function wrapperChain() {
  26586. return chain(this);
  26587. }
  26588. /**
  26589. * Executes the chain sequence and returns the wrapped result.
  26590. *
  26591. * @name commit
  26592. * @memberOf _
  26593. * @since 3.2.0
  26594. * @category Seq
  26595. * @returns {Object} Returns the new `lodash` wrapper instance.
  26596. * @example
  26597. *
  26598. * var array = [1, 2];
  26599. * var wrapped = _(array).push(3);
  26600. *
  26601. * console.log(array);
  26602. * // => [1, 2]
  26603. *
  26604. * wrapped = wrapped.commit();
  26605. * console.log(array);
  26606. * // => [1, 2, 3]
  26607. *
  26608. * wrapped.last();
  26609. * // => 3
  26610. *
  26611. * console.log(array);
  26612. * // => [1, 2, 3]
  26613. */
  26614. function wrapperCommit() {
  26615. return new LodashWrapper(this.value(), this.__chain__);
  26616. }
  26617. /**
  26618. * Gets the next value on a wrapped object following the
  26619. * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
  26620. *
  26621. * @name next
  26622. * @memberOf _
  26623. * @since 4.0.0
  26624. * @category Seq
  26625. * @returns {Object} Returns the next iterator value.
  26626. * @example
  26627. *
  26628. * var wrapped = _([1, 2]);
  26629. *
  26630. * wrapped.next();
  26631. * // => { 'done': false, 'value': 1 }
  26632. *
  26633. * wrapped.next();
  26634. * // => { 'done': false, 'value': 2 }
  26635. *
  26636. * wrapped.next();
  26637. * // => { 'done': true, 'value': undefined }
  26638. */
  26639. function wrapperNext() {
  26640. if (this.__values__ === undefined) {
  26641. this.__values__ = toArray(this.value());
  26642. }
  26643. var done = this.__index__ >= this.__values__.length,
  26644. value = done ? undefined : this.__values__[this.__index__++];
  26645. return { 'done': done, 'value': value };
  26646. }
  26647. /**
  26648. * Enables the wrapper to be iterable.
  26649. *
  26650. * @name Symbol.iterator
  26651. * @memberOf _
  26652. * @since 4.0.0
  26653. * @category Seq
  26654. * @returns {Object} Returns the wrapper object.
  26655. * @example
  26656. *
  26657. * var wrapped = _([1, 2]);
  26658. *
  26659. * wrapped[Symbol.iterator]() === wrapped;
  26660. * // => true
  26661. *
  26662. * Array.from(wrapped);
  26663. * // => [1, 2]
  26664. */
  26665. function wrapperToIterator() {
  26666. return this;
  26667. }
  26668. /**
  26669. * Creates a clone of the chain sequence planting `value` as the wrapped value.
  26670. *
  26671. * @name plant
  26672. * @memberOf _
  26673. * @since 3.2.0
  26674. * @category Seq
  26675. * @param {*} value The value to plant.
  26676. * @returns {Object} Returns the new `lodash` wrapper instance.
  26677. * @example
  26678. *
  26679. * function square(n) {
  26680. * return n * n;
  26681. * }
  26682. *
  26683. * var wrapped = _([1, 2]).map(square);
  26684. * var other = wrapped.plant([3, 4]);
  26685. *
  26686. * other.value();
  26687. * // => [9, 16]
  26688. *
  26689. * wrapped.value();
  26690. * // => [1, 4]
  26691. */
  26692. function wrapperPlant(value) {
  26693. var result,
  26694. parent = this;
  26695. while (parent instanceof baseLodash) {
  26696. var clone = wrapperClone(parent);
  26697. clone.__index__ = 0;
  26698. clone.__values__ = undefined;
  26699. if (result) {
  26700. previous.__wrapped__ = clone;
  26701. } else {
  26702. result = clone;
  26703. }
  26704. var previous = clone;
  26705. parent = parent.__wrapped__;
  26706. }
  26707. previous.__wrapped__ = value;
  26708. return result;
  26709. }
  26710. /**
  26711. * This method is the wrapper version of `_.reverse`.
  26712. *
  26713. * **Note:** This method mutates the wrapped array.
  26714. *
  26715. * @name reverse
  26716. * @memberOf _
  26717. * @since 0.1.0
  26718. * @category Seq
  26719. * @returns {Object} Returns the new `lodash` wrapper instance.
  26720. * @example
  26721. *
  26722. * var array = [1, 2, 3];
  26723. *
  26724. * _(array).reverse().value()
  26725. * // => [3, 2, 1]
  26726. *
  26727. * console.log(array);
  26728. * // => [3, 2, 1]
  26729. */
  26730. function wrapperReverse() {
  26731. var value = this.__wrapped__;
  26732. if (value instanceof LazyWrapper) {
  26733. var wrapped = value;
  26734. if (this.__actions__.length) {
  26735. wrapped = new LazyWrapper(this);
  26736. }
  26737. wrapped = wrapped.reverse();
  26738. wrapped.__actions__.push({
  26739. 'func': thru,
  26740. 'args': [reverse],
  26741. 'thisArg': undefined
  26742. });
  26743. return new LodashWrapper(wrapped, this.__chain__);
  26744. }
  26745. return this.thru(reverse);
  26746. }
  26747. /**
  26748. * Executes the chain sequence to resolve the unwrapped value.
  26749. *
  26750. * @name value
  26751. * @memberOf _
  26752. * @since 0.1.0
  26753. * @alias toJSON, valueOf
  26754. * @category Seq
  26755. * @returns {*} Returns the resolved unwrapped value.
  26756. * @example
  26757. *
  26758. * _([1, 2, 3]).value();
  26759. * // => [1, 2, 3]
  26760. */
  26761. function wrapperValue() {
  26762. return baseWrapperValue(this.__wrapped__, this.__actions__);
  26763. }
  26764. /*------------------------------------------------------------------------*/
  26765. /**
  26766. * Creates an object composed of keys generated from the results of running
  26767. * each element of `collection` thru `iteratee`. The corresponding value of
  26768. * each key is the number of times the key was returned by `iteratee`. The
  26769. * iteratee is invoked with one argument: (value).
  26770. *
  26771. * @static
  26772. * @memberOf _
  26773. * @since 0.5.0
  26774. * @category Collection
  26775. * @param {Array|Object} collection The collection to iterate over.
  26776. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  26777. * @returns {Object} Returns the composed aggregate object.
  26778. * @example
  26779. *
  26780. * _.countBy([6.1, 4.2, 6.3], Math.floor);
  26781. * // => { '4': 1, '6': 2 }
  26782. *
  26783. * // The `_.property` iteratee shorthand.
  26784. * _.countBy(['one', 'two', 'three'], 'length');
  26785. * // => { '3': 2, '5': 1 }
  26786. */
  26787. var countBy = createAggregator(function(result, value, key) {
  26788. if (hasOwnProperty.call(result, key)) {
  26789. ++result[key];
  26790. } else {
  26791. baseAssignValue(result, key, 1);
  26792. }
  26793. });
  26794. /**
  26795. * Checks if `predicate` returns truthy for **all** elements of `collection`.
  26796. * Iteration is stopped once `predicate` returns falsey. The predicate is
  26797. * invoked with three arguments: (value, index|key, collection).
  26798. *
  26799. * **Note:** This method returns `true` for
  26800. * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
  26801. * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
  26802. * elements of empty collections.
  26803. *
  26804. * @static
  26805. * @memberOf _
  26806. * @since 0.1.0
  26807. * @category Collection
  26808. * @param {Array|Object} collection The collection to iterate over.
  26809. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26810. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  26811. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  26812. * else `false`.
  26813. * @example
  26814. *
  26815. * _.every([true, 1, null, 'yes'], Boolean);
  26816. * // => false
  26817. *
  26818. * var users = [
  26819. * { 'user': 'barney', 'age': 36, 'active': false },
  26820. * { 'user': 'fred', 'age': 40, 'active': false }
  26821. * ];
  26822. *
  26823. * // The `_.matches` iteratee shorthand.
  26824. * _.every(users, { 'user': 'barney', 'active': false });
  26825. * // => false
  26826. *
  26827. * // The `_.matchesProperty` iteratee shorthand.
  26828. * _.every(users, ['active', false]);
  26829. * // => true
  26830. *
  26831. * // The `_.property` iteratee shorthand.
  26832. * _.every(users, 'active');
  26833. * // => false
  26834. */
  26835. function every(collection, predicate, guard) {
  26836. var func = isArray(collection) ? arrayEvery : baseEvery;
  26837. if (guard && isIterateeCall(collection, predicate, guard)) {
  26838. predicate = undefined;
  26839. }
  26840. return func(collection, getIteratee(predicate, 3));
  26841. }
  26842. /**
  26843. * Iterates over elements of `collection`, returning an array of all elements
  26844. * `predicate` returns truthy for. The predicate is invoked with three
  26845. * arguments: (value, index|key, collection).
  26846. *
  26847. * **Note:** Unlike `_.remove`, this method returns a new array.
  26848. *
  26849. * @static
  26850. * @memberOf _
  26851. * @since 0.1.0
  26852. * @category Collection
  26853. * @param {Array|Object} collection The collection to iterate over.
  26854. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26855. * @returns {Array} Returns the new filtered array.
  26856. * @see _.reject
  26857. * @example
  26858. *
  26859. * var users = [
  26860. * { 'user': 'barney', 'age': 36, 'active': true },
  26861. * { 'user': 'fred', 'age': 40, 'active': false }
  26862. * ];
  26863. *
  26864. * _.filter(users, function(o) { return !o.active; });
  26865. * // => objects for ['fred']
  26866. *
  26867. * // The `_.matches` iteratee shorthand.
  26868. * _.filter(users, { 'age': 36, 'active': true });
  26869. * // => objects for ['barney']
  26870. *
  26871. * // The `_.matchesProperty` iteratee shorthand.
  26872. * _.filter(users, ['active', false]);
  26873. * // => objects for ['fred']
  26874. *
  26875. * // The `_.property` iteratee shorthand.
  26876. * _.filter(users, 'active');
  26877. * // => objects for ['barney']
  26878. */
  26879. function filter(collection, predicate) {
  26880. var func = isArray(collection) ? arrayFilter : baseFilter;
  26881. return func(collection, getIteratee(predicate, 3));
  26882. }
  26883. /**
  26884. * Iterates over elements of `collection`, returning the first element
  26885. * `predicate` returns truthy for. The predicate is invoked with three
  26886. * arguments: (value, index|key, collection).
  26887. *
  26888. * @static
  26889. * @memberOf _
  26890. * @since 0.1.0
  26891. * @category Collection
  26892. * @param {Array|Object} collection The collection to inspect.
  26893. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26894. * @param {number} [fromIndex=0] The index to search from.
  26895. * @returns {*} Returns the matched element, else `undefined`.
  26896. * @example
  26897. *
  26898. * var users = [
  26899. * { 'user': 'barney', 'age': 36, 'active': true },
  26900. * { 'user': 'fred', 'age': 40, 'active': false },
  26901. * { 'user': 'pebbles', 'age': 1, 'active': true }
  26902. * ];
  26903. *
  26904. * _.find(users, function(o) { return o.age < 40; });
  26905. * // => object for 'barney'
  26906. *
  26907. * // The `_.matches` iteratee shorthand.
  26908. * _.find(users, { 'age': 1, 'active': true });
  26909. * // => object for 'pebbles'
  26910. *
  26911. * // The `_.matchesProperty` iteratee shorthand.
  26912. * _.find(users, ['active', false]);
  26913. * // => object for 'fred'
  26914. *
  26915. * // The `_.property` iteratee shorthand.
  26916. * _.find(users, 'active');
  26917. * // => object for 'barney'
  26918. */
  26919. var find = createFind(findIndex);
  26920. /**
  26921. * This method is like `_.find` except that it iterates over elements of
  26922. * `collection` from right to left.
  26923. *
  26924. * @static
  26925. * @memberOf _
  26926. * @since 2.0.0
  26927. * @category Collection
  26928. * @param {Array|Object} collection The collection to inspect.
  26929. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26930. * @param {number} [fromIndex=collection.length-1] The index to search from.
  26931. * @returns {*} Returns the matched element, else `undefined`.
  26932. * @example
  26933. *
  26934. * _.findLast([1, 2, 3, 4], function(n) {
  26935. * return n % 2 == 1;
  26936. * });
  26937. * // => 3
  26938. */
  26939. var findLast = createFind(findLastIndex);
  26940. /**
  26941. * Creates a flattened array of values by running each element in `collection`
  26942. * thru `iteratee` and flattening the mapped results. The iteratee is invoked
  26943. * with three arguments: (value, index|key, collection).
  26944. *
  26945. * @static
  26946. * @memberOf _
  26947. * @since 4.0.0
  26948. * @category Collection
  26949. * @param {Array|Object} collection The collection to iterate over.
  26950. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26951. * @returns {Array} Returns the new flattened array.
  26952. * @example
  26953. *
  26954. * function duplicate(n) {
  26955. * return [n, n];
  26956. * }
  26957. *
  26958. * _.flatMap([1, 2], duplicate);
  26959. * // => [1, 1, 2, 2]
  26960. */
  26961. function flatMap(collection, iteratee) {
  26962. return baseFlatten(map(collection, iteratee), 1);
  26963. }
  26964. /**
  26965. * This method is like `_.flatMap` except that it recursively flattens the
  26966. * mapped results.
  26967. *
  26968. * @static
  26969. * @memberOf _
  26970. * @since 4.7.0
  26971. * @category Collection
  26972. * @param {Array|Object} collection The collection to iterate over.
  26973. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26974. * @returns {Array} Returns the new flattened array.
  26975. * @example
  26976. *
  26977. * function duplicate(n) {
  26978. * return [[[n, n]]];
  26979. * }
  26980. *
  26981. * _.flatMapDeep([1, 2], duplicate);
  26982. * // => [1, 1, 2, 2]
  26983. */
  26984. function flatMapDeep(collection, iteratee) {
  26985. return baseFlatten(map(collection, iteratee), INFINITY);
  26986. }
  26987. /**
  26988. * This method is like `_.flatMap` except that it recursively flattens the
  26989. * mapped results up to `depth` times.
  26990. *
  26991. * @static
  26992. * @memberOf _
  26993. * @since 4.7.0
  26994. * @category Collection
  26995. * @param {Array|Object} collection The collection to iterate over.
  26996. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26997. * @param {number} [depth=1] The maximum recursion depth.
  26998. * @returns {Array} Returns the new flattened array.
  26999. * @example
  27000. *
  27001. * function duplicate(n) {
  27002. * return [[[n, n]]];
  27003. * }
  27004. *
  27005. * _.flatMapDepth([1, 2], duplicate, 2);
  27006. * // => [[1, 1], [2, 2]]
  27007. */
  27008. function flatMapDepth(collection, iteratee, depth) {
  27009. depth = depth === undefined ? 1 : toInteger(depth);
  27010. return baseFlatten(map(collection, iteratee), depth);
  27011. }
  27012. /**
  27013. * Iterates over elements of `collection` and invokes `iteratee` for each element.
  27014. * The iteratee is invoked with three arguments: (value, index|key, collection).
  27015. * Iteratee functions may exit iteration early by explicitly returning `false`.
  27016. *
  27017. * **Note:** As with other "Collections" methods, objects with a "length"
  27018. * property are iterated like arrays. To avoid this behavior use `_.forIn`
  27019. * or `_.forOwn` for object iteration.
  27020. *
  27021. * @static
  27022. * @memberOf _
  27023. * @since 0.1.0
  27024. * @alias each
  27025. * @category Collection
  27026. * @param {Array|Object} collection The collection to iterate over.
  27027. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27028. * @returns {Array|Object} Returns `collection`.
  27029. * @see _.forEachRight
  27030. * @example
  27031. *
  27032. * _.forEach([1, 2], function(value) {
  27033. * console.log(value);
  27034. * });
  27035. * // => Logs `1` then `2`.
  27036. *
  27037. * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
  27038. * console.log(key);
  27039. * });
  27040. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  27041. */
  27042. function forEach(collection, iteratee) {
  27043. var func = isArray(collection) ? arrayEach : baseEach;
  27044. return func(collection, getIteratee(iteratee, 3));
  27045. }
  27046. /**
  27047. * This method is like `_.forEach` except that it iterates over elements of
  27048. * `collection` from right to left.
  27049. *
  27050. * @static
  27051. * @memberOf _
  27052. * @since 2.0.0
  27053. * @alias eachRight
  27054. * @category Collection
  27055. * @param {Array|Object} collection The collection to iterate over.
  27056. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27057. * @returns {Array|Object} Returns `collection`.
  27058. * @see _.forEach
  27059. * @example
  27060. *
  27061. * _.forEachRight([1, 2], function(value) {
  27062. * console.log(value);
  27063. * });
  27064. * // => Logs `2` then `1`.
  27065. */
  27066. function forEachRight(collection, iteratee) {
  27067. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  27068. return func(collection, getIteratee(iteratee, 3));
  27069. }
  27070. /**
  27071. * Creates an object composed of keys generated from the results of running
  27072. * each element of `collection` thru `iteratee`. The order of grouped values
  27073. * is determined by the order they occur in `collection`. The corresponding
  27074. * value of each key is an array of elements responsible for generating the
  27075. * key. The iteratee is invoked with one argument: (value).
  27076. *
  27077. * @static
  27078. * @memberOf _
  27079. * @since 0.1.0
  27080. * @category Collection
  27081. * @param {Array|Object} collection The collection to iterate over.
  27082. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  27083. * @returns {Object} Returns the composed aggregate object.
  27084. * @example
  27085. *
  27086. * _.groupBy([6.1, 4.2, 6.3], Math.floor);
  27087. * // => { '4': [4.2], '6': [6.1, 6.3] }
  27088. *
  27089. * // The `_.property` iteratee shorthand.
  27090. * _.groupBy(['one', 'two', 'three'], 'length');
  27091. * // => { '3': ['one', 'two'], '5': ['three'] }
  27092. */
  27093. var groupBy = createAggregator(function(result, value, key) {
  27094. if (hasOwnProperty.call(result, key)) {
  27095. result[key].push(value);
  27096. } else {
  27097. baseAssignValue(result, key, [value]);
  27098. }
  27099. });
  27100. /**
  27101. * Checks if `value` is in `collection`. If `collection` is a string, it's
  27102. * checked for a substring of `value`, otherwise
  27103. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  27104. * is used for equality comparisons. If `fromIndex` is negative, it's used as
  27105. * the offset from the end of `collection`.
  27106. *
  27107. * @static
  27108. * @memberOf _
  27109. * @since 0.1.0
  27110. * @category Collection
  27111. * @param {Array|Object|string} collection The collection to inspect.
  27112. * @param {*} value The value to search for.
  27113. * @param {number} [fromIndex=0] The index to search from.
  27114. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  27115. * @returns {boolean} Returns `true` if `value` is found, else `false`.
  27116. * @example
  27117. *
  27118. * _.includes([1, 2, 3], 1);
  27119. * // => true
  27120. *
  27121. * _.includes([1, 2, 3], 1, 2);
  27122. * // => false
  27123. *
  27124. * _.includes({ 'a': 1, 'b': 2 }, 1);
  27125. * // => true
  27126. *
  27127. * _.includes('abcd', 'bc');
  27128. * // => true
  27129. */
  27130. function includes(collection, value, fromIndex, guard) {
  27131. collection = isArrayLike(collection) ? collection : values(collection);
  27132. fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
  27133. var length = collection.length;
  27134. if (fromIndex < 0) {
  27135. fromIndex = nativeMax(length + fromIndex, 0);
  27136. }
  27137. return isString(collection)
  27138. ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
  27139. : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
  27140. }
  27141. /**
  27142. * Invokes the method at `path` of each element in `collection`, returning
  27143. * an array of the results of each invoked method. Any additional arguments
  27144. * are provided to each invoked method. If `path` is a function, it's invoked
  27145. * for, and `this` bound to, each element in `collection`.
  27146. *
  27147. * @static
  27148. * @memberOf _
  27149. * @since 4.0.0
  27150. * @category Collection
  27151. * @param {Array|Object} collection The collection to iterate over.
  27152. * @param {Array|Function|string} path The path of the method to invoke or
  27153. * the function invoked per iteration.
  27154. * @param {...*} [args] The arguments to invoke each method with.
  27155. * @returns {Array} Returns the array of results.
  27156. * @example
  27157. *
  27158. * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
  27159. * // => [[1, 5, 7], [1, 2, 3]]
  27160. *
  27161. * _.invokeMap([123, 456], String.prototype.split, '');
  27162. * // => [['1', '2', '3'], ['4', '5', '6']]
  27163. */
  27164. var invokeMap = baseRest(function(collection, path, args) {
  27165. var index = -1,
  27166. isFunc = typeof path == 'function',
  27167. result = isArrayLike(collection) ? Array(collection.length) : [];
  27168. baseEach(collection, function(value) {
  27169. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  27170. });
  27171. return result;
  27172. });
  27173. /**
  27174. * Creates an object composed of keys generated from the results of running
  27175. * each element of `collection` thru `iteratee`. The corresponding value of
  27176. * each key is the last element responsible for generating the key. The
  27177. * iteratee is invoked with one argument: (value).
  27178. *
  27179. * @static
  27180. * @memberOf _
  27181. * @since 4.0.0
  27182. * @category Collection
  27183. * @param {Array|Object} collection The collection to iterate over.
  27184. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  27185. * @returns {Object} Returns the composed aggregate object.
  27186. * @example
  27187. *
  27188. * var array = [
  27189. * { 'dir': 'left', 'code': 97 },
  27190. * { 'dir': 'right', 'code': 100 }
  27191. * ];
  27192. *
  27193. * _.keyBy(array, function(o) {
  27194. * return String.fromCharCode(o.code);
  27195. * });
  27196. * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
  27197. *
  27198. * _.keyBy(array, 'dir');
  27199. * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
  27200. */
  27201. var keyBy = createAggregator(function(result, value, key) {
  27202. baseAssignValue(result, key, value);
  27203. });
  27204. /**
  27205. * Creates an array of values by running each element in `collection` thru
  27206. * `iteratee`. The iteratee is invoked with three arguments:
  27207. * (value, index|key, collection).
  27208. *
  27209. * Many lodash methods are guarded to work as iteratees for methods like
  27210. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  27211. *
  27212. * The guarded methods are:
  27213. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  27214. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  27215. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  27216. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  27217. *
  27218. * @static
  27219. * @memberOf _
  27220. * @since 0.1.0
  27221. * @category Collection
  27222. * @param {Array|Object} collection The collection to iterate over.
  27223. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27224. * @returns {Array} Returns the new mapped array.
  27225. * @example
  27226. *
  27227. * function square(n) {
  27228. * return n * n;
  27229. * }
  27230. *
  27231. * _.map([4, 8], square);
  27232. * // => [16, 64]
  27233. *
  27234. * _.map({ 'a': 4, 'b': 8 }, square);
  27235. * // => [16, 64] (iteration order is not guaranteed)
  27236. *
  27237. * var users = [
  27238. * { 'user': 'barney' },
  27239. * { 'user': 'fred' }
  27240. * ];
  27241. *
  27242. * // The `_.property` iteratee shorthand.
  27243. * _.map(users, 'user');
  27244. * // => ['barney', 'fred']
  27245. */
  27246. function map(collection, iteratee) {
  27247. var func = isArray(collection) ? arrayMap : baseMap;
  27248. return func(collection, getIteratee(iteratee, 3));
  27249. }
  27250. /**
  27251. * This method is like `_.sortBy` except that it allows specifying the sort
  27252. * orders of the iteratees to sort by. If `orders` is unspecified, all values
  27253. * are sorted in ascending order. Otherwise, specify an order of "desc" for
  27254. * descending or "asc" for ascending sort order of corresponding values.
  27255. *
  27256. * @static
  27257. * @memberOf _
  27258. * @since 4.0.0
  27259. * @category Collection
  27260. * @param {Array|Object} collection The collection to iterate over.
  27261. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
  27262. * The iteratees to sort by.
  27263. * @param {string[]} [orders] The sort orders of `iteratees`.
  27264. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  27265. * @returns {Array} Returns the new sorted array.
  27266. * @example
  27267. *
  27268. * var users = [
  27269. * { 'user': 'fred', 'age': 48 },
  27270. * { 'user': 'barney', 'age': 34 },
  27271. * { 'user': 'fred', 'age': 40 },
  27272. * { 'user': 'barney', 'age': 36 }
  27273. * ];
  27274. *
  27275. * // Sort by `user` in ascending order and by `age` in descending order.
  27276. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
  27277. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  27278. */
  27279. function orderBy(collection, iteratees, orders, guard) {
  27280. if (collection == null) {
  27281. return [];
  27282. }
  27283. if (!isArray(iteratees)) {
  27284. iteratees = iteratees == null ? [] : [iteratees];
  27285. }
  27286. orders = guard ? undefined : orders;
  27287. if (!isArray(orders)) {
  27288. orders = orders == null ? [] : [orders];
  27289. }
  27290. return baseOrderBy(collection, iteratees, orders);
  27291. }
  27292. /**
  27293. * Creates an array of elements split into two groups, the first of which
  27294. * contains elements `predicate` returns truthy for, the second of which
  27295. * contains elements `predicate` returns falsey for. The predicate is
  27296. * invoked with one argument: (value).
  27297. *
  27298. * @static
  27299. * @memberOf _
  27300. * @since 3.0.0
  27301. * @category Collection
  27302. * @param {Array|Object} collection The collection to iterate over.
  27303. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27304. * @returns {Array} Returns the array of grouped elements.
  27305. * @example
  27306. *
  27307. * var users = [
  27308. * { 'user': 'barney', 'age': 36, 'active': false },
  27309. * { 'user': 'fred', 'age': 40, 'active': true },
  27310. * { 'user': 'pebbles', 'age': 1, 'active': false }
  27311. * ];
  27312. *
  27313. * _.partition(users, function(o) { return o.active; });
  27314. * // => objects for [['fred'], ['barney', 'pebbles']]
  27315. *
  27316. * // The `_.matches` iteratee shorthand.
  27317. * _.partition(users, { 'age': 1, 'active': false });
  27318. * // => objects for [['pebbles'], ['barney', 'fred']]
  27319. *
  27320. * // The `_.matchesProperty` iteratee shorthand.
  27321. * _.partition(users, ['active', false]);
  27322. * // => objects for [['barney', 'pebbles'], ['fred']]
  27323. *
  27324. * // The `_.property` iteratee shorthand.
  27325. * _.partition(users, 'active');
  27326. * // => objects for [['fred'], ['barney', 'pebbles']]
  27327. */
  27328. var partition = createAggregator(function(result, value, key) {
  27329. result[key ? 0 : 1].push(value);
  27330. }, function() { return [[], []]; });
  27331. /**
  27332. * Reduces `collection` to a value which is the accumulated result of running
  27333. * each element in `collection` thru `iteratee`, where each successive
  27334. * invocation is supplied the return value of the previous. If `accumulator`
  27335. * is not given, the first element of `collection` is used as the initial
  27336. * value. The iteratee is invoked with four arguments:
  27337. * (accumulator, value, index|key, collection).
  27338. *
  27339. * Many lodash methods are guarded to work as iteratees for methods like
  27340. * `_.reduce`, `_.reduceRight`, and `_.transform`.
  27341. *
  27342. * The guarded methods are:
  27343. * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
  27344. * and `sortBy`
  27345. *
  27346. * @static
  27347. * @memberOf _
  27348. * @since 0.1.0
  27349. * @category Collection
  27350. * @param {Array|Object} collection The collection to iterate over.
  27351. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27352. * @param {*} [accumulator] The initial value.
  27353. * @returns {*} Returns the accumulated value.
  27354. * @see _.reduceRight
  27355. * @example
  27356. *
  27357. * _.reduce([1, 2], function(sum, n) {
  27358. * return sum + n;
  27359. * }, 0);
  27360. * // => 3
  27361. *
  27362. * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  27363. * (result[value] || (result[value] = [])).push(key);
  27364. * return result;
  27365. * }, {});
  27366. * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
  27367. */
  27368. function reduce(collection, iteratee, accumulator) {
  27369. var func = isArray(collection) ? arrayReduce : baseReduce,
  27370. initAccum = arguments.length < 3;
  27371. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
  27372. }
  27373. /**
  27374. * This method is like `_.reduce` except that it iterates over elements of
  27375. * `collection` from right to left.
  27376. *
  27377. * @static
  27378. * @memberOf _
  27379. * @since 0.1.0
  27380. * @category Collection
  27381. * @param {Array|Object} collection The collection to iterate over.
  27382. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27383. * @param {*} [accumulator] The initial value.
  27384. * @returns {*} Returns the accumulated value.
  27385. * @see _.reduce
  27386. * @example
  27387. *
  27388. * var array = [[0, 1], [2, 3], [4, 5]];
  27389. *
  27390. * _.reduceRight(array, function(flattened, other) {
  27391. * return flattened.concat(other);
  27392. * }, []);
  27393. * // => [4, 5, 2, 3, 0, 1]
  27394. */
  27395. function reduceRight(collection, iteratee, accumulator) {
  27396. var func = isArray(collection) ? arrayReduceRight : baseReduce,
  27397. initAccum = arguments.length < 3;
  27398. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
  27399. }
  27400. /**
  27401. * The opposite of `_.filter`; this method returns the elements of `collection`
  27402. * that `predicate` does **not** return truthy for.
  27403. *
  27404. * @static
  27405. * @memberOf _
  27406. * @since 0.1.0
  27407. * @category Collection
  27408. * @param {Array|Object} collection The collection to iterate over.
  27409. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27410. * @returns {Array} Returns the new filtered array.
  27411. * @see _.filter
  27412. * @example
  27413. *
  27414. * var users = [
  27415. * { 'user': 'barney', 'age': 36, 'active': false },
  27416. * { 'user': 'fred', 'age': 40, 'active': true }
  27417. * ];
  27418. *
  27419. * _.reject(users, function(o) { return !o.active; });
  27420. * // => objects for ['fred']
  27421. *
  27422. * // The `_.matches` iteratee shorthand.
  27423. * _.reject(users, { 'age': 40, 'active': true });
  27424. * // => objects for ['barney']
  27425. *
  27426. * // The `_.matchesProperty` iteratee shorthand.
  27427. * _.reject(users, ['active', false]);
  27428. * // => objects for ['fred']
  27429. *
  27430. * // The `_.property` iteratee shorthand.
  27431. * _.reject(users, 'active');
  27432. * // => objects for ['barney']
  27433. */
  27434. function reject(collection, predicate) {
  27435. var func = isArray(collection) ? arrayFilter : baseFilter;
  27436. return func(collection, negate(getIteratee(predicate, 3)));
  27437. }
  27438. /**
  27439. * Gets a random element from `collection`.
  27440. *
  27441. * @static
  27442. * @memberOf _
  27443. * @since 2.0.0
  27444. * @category Collection
  27445. * @param {Array|Object} collection The collection to sample.
  27446. * @returns {*} Returns the random element.
  27447. * @example
  27448. *
  27449. * _.sample([1, 2, 3, 4]);
  27450. * // => 2
  27451. */
  27452. function sample(collection) {
  27453. var func = isArray(collection) ? arraySample : baseSample;
  27454. return func(collection);
  27455. }
  27456. /**
  27457. * Gets `n` random elements at unique keys from `collection` up to the
  27458. * size of `collection`.
  27459. *
  27460. * @static
  27461. * @memberOf _
  27462. * @since 4.0.0
  27463. * @category Collection
  27464. * @param {Array|Object} collection The collection to sample.
  27465. * @param {number} [n=1] The number of elements to sample.
  27466. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27467. * @returns {Array} Returns the random elements.
  27468. * @example
  27469. *
  27470. * _.sampleSize([1, 2, 3], 2);
  27471. * // => [3, 1]
  27472. *
  27473. * _.sampleSize([1, 2, 3], 4);
  27474. * // => [2, 3, 1]
  27475. */
  27476. function sampleSize(collection, n, guard) {
  27477. if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
  27478. n = 1;
  27479. } else {
  27480. n = toInteger(n);
  27481. }
  27482. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  27483. return func(collection, n);
  27484. }
  27485. /**
  27486. * Creates an array of shuffled values, using a version of the
  27487. * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
  27488. *
  27489. * @static
  27490. * @memberOf _
  27491. * @since 0.1.0
  27492. * @category Collection
  27493. * @param {Array|Object} collection The collection to shuffle.
  27494. * @returns {Array} Returns the new shuffled array.
  27495. * @example
  27496. *
  27497. * _.shuffle([1, 2, 3, 4]);
  27498. * // => [4, 1, 3, 2]
  27499. */
  27500. function shuffle(collection) {
  27501. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  27502. return func(collection);
  27503. }
  27504. /**
  27505. * Gets the size of `collection` by returning its length for array-like
  27506. * values or the number of own enumerable string keyed properties for objects.
  27507. *
  27508. * @static
  27509. * @memberOf _
  27510. * @since 0.1.0
  27511. * @category Collection
  27512. * @param {Array|Object|string} collection The collection to inspect.
  27513. * @returns {number} Returns the collection size.
  27514. * @example
  27515. *
  27516. * _.size([1, 2, 3]);
  27517. * // => 3
  27518. *
  27519. * _.size({ 'a': 1, 'b': 2 });
  27520. * // => 2
  27521. *
  27522. * _.size('pebbles');
  27523. * // => 7
  27524. */
  27525. function size(collection) {
  27526. if (collection == null) {
  27527. return 0;
  27528. }
  27529. if (isArrayLike(collection)) {
  27530. return isString(collection) ? stringSize(collection) : collection.length;
  27531. }
  27532. var tag = getTag(collection);
  27533. if (tag == mapTag || tag == setTag) {
  27534. return collection.size;
  27535. }
  27536. return baseKeys(collection).length;
  27537. }
  27538. /**
  27539. * Checks if `predicate` returns truthy for **any** element of `collection`.
  27540. * Iteration is stopped once `predicate` returns truthy. The predicate is
  27541. * invoked with three arguments: (value, index|key, collection).
  27542. *
  27543. * @static
  27544. * @memberOf _
  27545. * @since 0.1.0
  27546. * @category Collection
  27547. * @param {Array|Object} collection The collection to iterate over.
  27548. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27549. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27550. * @returns {boolean} Returns `true` if any element passes the predicate check,
  27551. * else `false`.
  27552. * @example
  27553. *
  27554. * _.some([null, 0, 'yes', false], Boolean);
  27555. * // => true
  27556. *
  27557. * var users = [
  27558. * { 'user': 'barney', 'active': true },
  27559. * { 'user': 'fred', 'active': false }
  27560. * ];
  27561. *
  27562. * // The `_.matches` iteratee shorthand.
  27563. * _.some(users, { 'user': 'barney', 'active': false });
  27564. * // => false
  27565. *
  27566. * // The `_.matchesProperty` iteratee shorthand.
  27567. * _.some(users, ['active', false]);
  27568. * // => true
  27569. *
  27570. * // The `_.property` iteratee shorthand.
  27571. * _.some(users, 'active');
  27572. * // => true
  27573. */
  27574. function some(collection, predicate, guard) {
  27575. var func = isArray(collection) ? arraySome : baseSome;
  27576. if (guard && isIterateeCall(collection, predicate, guard)) {
  27577. predicate = undefined;
  27578. }
  27579. return func(collection, getIteratee(predicate, 3));
  27580. }
  27581. /**
  27582. * Creates an array of elements, sorted in ascending order by the results of
  27583. * running each element in a collection thru each iteratee. This method
  27584. * performs a stable sort, that is, it preserves the original sort order of
  27585. * equal elements. The iteratees are invoked with one argument: (value).
  27586. *
  27587. * @static
  27588. * @memberOf _
  27589. * @since 0.1.0
  27590. * @category Collection
  27591. * @param {Array|Object} collection The collection to iterate over.
  27592. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  27593. * The iteratees to sort by.
  27594. * @returns {Array} Returns the new sorted array.
  27595. * @example
  27596. *
  27597. * var users = [
  27598. * { 'user': 'fred', 'age': 48 },
  27599. * { 'user': 'barney', 'age': 36 },
  27600. * { 'user': 'fred', 'age': 40 },
  27601. * { 'user': 'barney', 'age': 34 }
  27602. * ];
  27603. *
  27604. * _.sortBy(users, [function(o) { return o.user; }]);
  27605. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  27606. *
  27607. * _.sortBy(users, ['user', 'age']);
  27608. * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
  27609. */
  27610. var sortBy = baseRest(function(collection, iteratees) {
  27611. if (collection == null) {
  27612. return [];
  27613. }
  27614. var length = iteratees.length;
  27615. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  27616. iteratees = [];
  27617. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  27618. iteratees = [iteratees[0]];
  27619. }
  27620. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  27621. });
  27622. /*------------------------------------------------------------------------*/
  27623. /**
  27624. * Gets the timestamp of the number of milliseconds that have elapsed since
  27625. * the Unix epoch (1 January 1970 00:00:00 UTC).
  27626. *
  27627. * @static
  27628. * @memberOf _
  27629. * @since 2.4.0
  27630. * @category Date
  27631. * @returns {number} Returns the timestamp.
  27632. * @example
  27633. *
  27634. * _.defer(function(stamp) {
  27635. * console.log(_.now() - stamp);
  27636. * }, _.now());
  27637. * // => Logs the number of milliseconds it took for the deferred invocation.
  27638. */
  27639. var now = ctxNow || function() {
  27640. return root.Date.now();
  27641. };
  27642. /*------------------------------------------------------------------------*/
  27643. /**
  27644. * The opposite of `_.before`; this method creates a function that invokes
  27645. * `func` once it's called `n` or more times.
  27646. *
  27647. * @static
  27648. * @memberOf _
  27649. * @since 0.1.0
  27650. * @category Function
  27651. * @param {number} n The number of calls before `func` is invoked.
  27652. * @param {Function} func The function to restrict.
  27653. * @returns {Function} Returns the new restricted function.
  27654. * @example
  27655. *
  27656. * var saves = ['profile', 'settings'];
  27657. *
  27658. * var done = _.after(saves.length, function() {
  27659. * console.log('done saving!');
  27660. * });
  27661. *
  27662. * _.forEach(saves, function(type) {
  27663. * asyncSave({ 'type': type, 'complete': done });
  27664. * });
  27665. * // => Logs 'done saving!' after the two async saves have completed.
  27666. */
  27667. function after(n, func) {
  27668. if (typeof func != 'function') {
  27669. throw new TypeError(FUNC_ERROR_TEXT);
  27670. }
  27671. n = toInteger(n);
  27672. return function() {
  27673. if (--n < 1) {
  27674. return func.apply(this, arguments);
  27675. }
  27676. };
  27677. }
  27678. /**
  27679. * Creates a function that invokes `func`, with up to `n` arguments,
  27680. * ignoring any additional arguments.
  27681. *
  27682. * @static
  27683. * @memberOf _
  27684. * @since 3.0.0
  27685. * @category Function
  27686. * @param {Function} func The function to cap arguments for.
  27687. * @param {number} [n=func.length] The arity cap.
  27688. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27689. * @returns {Function} Returns the new capped function.
  27690. * @example
  27691. *
  27692. * _.map(['6', '8', '10'], _.ary(parseInt, 1));
  27693. * // => [6, 8, 10]
  27694. */
  27695. function ary(func, n, guard) {
  27696. n = guard ? undefined : n;
  27697. n = (func && n == null) ? func.length : n;
  27698. return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
  27699. }
  27700. /**
  27701. * Creates a function that invokes `func`, with the `this` binding and arguments
  27702. * of the created function, while it's called less than `n` times. Subsequent
  27703. * calls to the created function return the result of the last `func` invocation.
  27704. *
  27705. * @static
  27706. * @memberOf _
  27707. * @since 3.0.0
  27708. * @category Function
  27709. * @param {number} n The number of calls at which `func` is no longer invoked.
  27710. * @param {Function} func The function to restrict.
  27711. * @returns {Function} Returns the new restricted function.
  27712. * @example
  27713. *
  27714. * jQuery(element).on('click', _.before(5, addContactToList));
  27715. * // => Allows adding up to 4 contacts to the list.
  27716. */
  27717. function before(n, func) {
  27718. var result;
  27719. if (typeof func != 'function') {
  27720. throw new TypeError(FUNC_ERROR_TEXT);
  27721. }
  27722. n = toInteger(n);
  27723. return function() {
  27724. if (--n > 0) {
  27725. result = func.apply(this, arguments);
  27726. }
  27727. if (n <= 1) {
  27728. func = undefined;
  27729. }
  27730. return result;
  27731. };
  27732. }
  27733. /**
  27734. * Creates a function that invokes `func` with the `this` binding of `thisArg`
  27735. * and `partials` prepended to the arguments it receives.
  27736. *
  27737. * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
  27738. * may be used as a placeholder for partially applied arguments.
  27739. *
  27740. * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
  27741. * property of bound functions.
  27742. *
  27743. * @static
  27744. * @memberOf _
  27745. * @since 0.1.0
  27746. * @category Function
  27747. * @param {Function} func The function to bind.
  27748. * @param {*} thisArg The `this` binding of `func`.
  27749. * @param {...*} [partials] The arguments to be partially applied.
  27750. * @returns {Function} Returns the new bound function.
  27751. * @example
  27752. *
  27753. * function greet(greeting, punctuation) {
  27754. * return greeting + ' ' + this.user + punctuation;
  27755. * }
  27756. *
  27757. * var object = { 'user': 'fred' };
  27758. *
  27759. * var bound = _.bind(greet, object, 'hi');
  27760. * bound('!');
  27761. * // => 'hi fred!'
  27762. *
  27763. * // Bound with placeholders.
  27764. * var bound = _.bind(greet, object, _, '!');
  27765. * bound('hi');
  27766. * // => 'hi fred!'
  27767. */
  27768. var bind = baseRest(function(func, thisArg, partials) {
  27769. var bitmask = WRAP_BIND_FLAG;
  27770. if (partials.length) {
  27771. var holders = replaceHolders(partials, getHolder(bind));
  27772. bitmask |= WRAP_PARTIAL_FLAG;
  27773. }
  27774. return createWrap(func, bitmask, thisArg, partials, holders);
  27775. });
  27776. /**
  27777. * Creates a function that invokes the method at `object[key]` with `partials`
  27778. * prepended to the arguments it receives.
  27779. *
  27780. * This method differs from `_.bind` by allowing bound functions to reference
  27781. * methods that may be redefined or don't yet exist. See
  27782. * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
  27783. * for more details.
  27784. *
  27785. * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
  27786. * builds, may be used as a placeholder for partially applied arguments.
  27787. *
  27788. * @static
  27789. * @memberOf _
  27790. * @since 0.10.0
  27791. * @category Function
  27792. * @param {Object} object The object to invoke the method on.
  27793. * @param {string} key The key of the method.
  27794. * @param {...*} [partials] The arguments to be partially applied.
  27795. * @returns {Function} Returns the new bound function.
  27796. * @example
  27797. *
  27798. * var object = {
  27799. * 'user': 'fred',
  27800. * 'greet': function(greeting, punctuation) {
  27801. * return greeting + ' ' + this.user + punctuation;
  27802. * }
  27803. * };
  27804. *
  27805. * var bound = _.bindKey(object, 'greet', 'hi');
  27806. * bound('!');
  27807. * // => 'hi fred!'
  27808. *
  27809. * object.greet = function(greeting, punctuation) {
  27810. * return greeting + 'ya ' + this.user + punctuation;
  27811. * };
  27812. *
  27813. * bound('!');
  27814. * // => 'hiya fred!'
  27815. *
  27816. * // Bound with placeholders.
  27817. * var bound = _.bindKey(object, 'greet', _, '!');
  27818. * bound('hi');
  27819. * // => 'hiya fred!'
  27820. */
  27821. var bindKey = baseRest(function(object, key, partials) {
  27822. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
  27823. if (partials.length) {
  27824. var holders = replaceHolders(partials, getHolder(bindKey));
  27825. bitmask |= WRAP_PARTIAL_FLAG;
  27826. }
  27827. return createWrap(key, bitmask, object, partials, holders);
  27828. });
  27829. /**
  27830. * Creates a function that accepts arguments of `func` and either invokes
  27831. * `func` returning its result, if at least `arity` number of arguments have
  27832. * been provided, or returns a function that accepts the remaining `func`
  27833. * arguments, and so on. The arity of `func` may be specified if `func.length`
  27834. * is not sufficient.
  27835. *
  27836. * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
  27837. * may be used as a placeholder for provided arguments.
  27838. *
  27839. * **Note:** This method doesn't set the "length" property of curried functions.
  27840. *
  27841. * @static
  27842. * @memberOf _
  27843. * @since 2.0.0
  27844. * @category Function
  27845. * @param {Function} func The function to curry.
  27846. * @param {number} [arity=func.length] The arity of `func`.
  27847. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27848. * @returns {Function} Returns the new curried function.
  27849. * @example
  27850. *
  27851. * var abc = function(a, b, c) {
  27852. * return [a, b, c];
  27853. * };
  27854. *
  27855. * var curried = _.curry(abc);
  27856. *
  27857. * curried(1)(2)(3);
  27858. * // => [1, 2, 3]
  27859. *
  27860. * curried(1, 2)(3);
  27861. * // => [1, 2, 3]
  27862. *
  27863. * curried(1, 2, 3);
  27864. * // => [1, 2, 3]
  27865. *
  27866. * // Curried with placeholders.
  27867. * curried(1)(_, 3)(2);
  27868. * // => [1, 2, 3]
  27869. */
  27870. function curry(func, arity, guard) {
  27871. arity = guard ? undefined : arity;
  27872. var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  27873. result.placeholder = curry.placeholder;
  27874. return result;
  27875. }
  27876. /**
  27877. * This method is like `_.curry` except that arguments are applied to `func`
  27878. * in the manner of `_.partialRight` instead of `_.partial`.
  27879. *
  27880. * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
  27881. * builds, may be used as a placeholder for provided arguments.
  27882. *
  27883. * **Note:** This method doesn't set the "length" property of curried functions.
  27884. *
  27885. * @static
  27886. * @memberOf _
  27887. * @since 3.0.0
  27888. * @category Function
  27889. * @param {Function} func The function to curry.
  27890. * @param {number} [arity=func.length] The arity of `func`.
  27891. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27892. * @returns {Function} Returns the new curried function.
  27893. * @example
  27894. *
  27895. * var abc = function(a, b, c) {
  27896. * return [a, b, c];
  27897. * };
  27898. *
  27899. * var curried = _.curryRight(abc);
  27900. *
  27901. * curried(3)(2)(1);
  27902. * // => [1, 2, 3]
  27903. *
  27904. * curried(2, 3)(1);
  27905. * // => [1, 2, 3]
  27906. *
  27907. * curried(1, 2, 3);
  27908. * // => [1, 2, 3]
  27909. *
  27910. * // Curried with placeholders.
  27911. * curried(3)(1, _)(2);
  27912. * // => [1, 2, 3]
  27913. */
  27914. function curryRight(func, arity, guard) {
  27915. arity = guard ? undefined : arity;
  27916. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  27917. result.placeholder = curryRight.placeholder;
  27918. return result;
  27919. }
  27920. /**
  27921. * Creates a debounced function that delays invoking `func` until after `wait`
  27922. * milliseconds have elapsed since the last time the debounced function was
  27923. * invoked. The debounced function comes with a `cancel` method to cancel
  27924. * delayed `func` invocations and a `flush` method to immediately invoke them.
  27925. * Provide `options` to indicate whether `func` should be invoked on the
  27926. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  27927. * with the last arguments provided to the debounced function. Subsequent
  27928. * calls to the debounced function return the result of the last `func`
  27929. * invocation.
  27930. *
  27931. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  27932. * invoked on the trailing edge of the timeout only if the debounced function
  27933. * is invoked more than once during the `wait` timeout.
  27934. *
  27935. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  27936. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  27937. *
  27938. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  27939. * for details over the differences between `_.debounce` and `_.throttle`.
  27940. *
  27941. * @static
  27942. * @memberOf _
  27943. * @since 0.1.0
  27944. * @category Function
  27945. * @param {Function} func The function to debounce.
  27946. * @param {number} [wait=0] The number of milliseconds to delay.
  27947. * @param {Object} [options={}] The options object.
  27948. * @param {boolean} [options.leading=false]
  27949. * Specify invoking on the leading edge of the timeout.
  27950. * @param {number} [options.maxWait]
  27951. * The maximum time `func` is allowed to be delayed before it's invoked.
  27952. * @param {boolean} [options.trailing=true]
  27953. * Specify invoking on the trailing edge of the timeout.
  27954. * @returns {Function} Returns the new debounced function.
  27955. * @example
  27956. *
  27957. * // Avoid costly calculations while the window size is in flux.
  27958. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  27959. *
  27960. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  27961. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  27962. * 'leading': true,
  27963. * 'trailing': false
  27964. * }));
  27965. *
  27966. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  27967. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  27968. * var source = new EventSource('/stream');
  27969. * jQuery(source).on('message', debounced);
  27970. *
  27971. * // Cancel the trailing debounced invocation.
  27972. * jQuery(window).on('popstate', debounced.cancel);
  27973. */
  27974. function debounce(func, wait, options) {
  27975. var lastArgs,
  27976. lastThis,
  27977. maxWait,
  27978. result,
  27979. timerId,
  27980. lastCallTime,
  27981. lastInvokeTime = 0,
  27982. leading = false,
  27983. maxing = false,
  27984. trailing = true;
  27985. if (typeof func != 'function') {
  27986. throw new TypeError(FUNC_ERROR_TEXT);
  27987. }
  27988. wait = toNumber(wait) || 0;
  27989. if (isObject(options)) {
  27990. leading = !!options.leading;
  27991. maxing = 'maxWait' in options;
  27992. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  27993. trailing = 'trailing' in options ? !!options.trailing : trailing;
  27994. }
  27995. function invokeFunc(time) {
  27996. var args = lastArgs,
  27997. thisArg = lastThis;
  27998. lastArgs = lastThis = undefined;
  27999. lastInvokeTime = time;
  28000. result = func.apply(thisArg, args);
  28001. return result;
  28002. }
  28003. function leadingEdge(time) {
  28004. // Reset any `maxWait` timer.
  28005. lastInvokeTime = time;
  28006. // Start the timer for the trailing edge.
  28007. timerId = setTimeout(timerExpired, wait);
  28008. // Invoke the leading edge.
  28009. return leading ? invokeFunc(time) : result;
  28010. }
  28011. function remainingWait(time) {
  28012. var timeSinceLastCall = time - lastCallTime,
  28013. timeSinceLastInvoke = time - lastInvokeTime,
  28014. timeWaiting = wait - timeSinceLastCall;
  28015. return maxing
  28016. ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
  28017. : timeWaiting;
  28018. }
  28019. function shouldInvoke(time) {
  28020. var timeSinceLastCall = time - lastCallTime,
  28021. timeSinceLastInvoke = time - lastInvokeTime;
  28022. // Either this is the first call, activity has stopped and we're at the
  28023. // trailing edge, the system time has gone backwards and we're treating
  28024. // it as the trailing edge, or we've hit the `maxWait` limit.
  28025. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  28026. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  28027. }
  28028. function timerExpired() {
  28029. var time = now();
  28030. if (shouldInvoke(time)) {
  28031. return trailingEdge(time);
  28032. }
  28033. // Restart the timer.
  28034. timerId = setTimeout(timerExpired, remainingWait(time));
  28035. }
  28036. function trailingEdge(time) {
  28037. timerId = undefined;
  28038. // Only invoke if we have `lastArgs` which means `func` has been
  28039. // debounced at least once.
  28040. if (trailing && lastArgs) {
  28041. return invokeFunc(time);
  28042. }
  28043. lastArgs = lastThis = undefined;
  28044. return result;
  28045. }
  28046. function cancel() {
  28047. if (timerId !== undefined) {
  28048. clearTimeout(timerId);
  28049. }
  28050. lastInvokeTime = 0;
  28051. lastArgs = lastCallTime = lastThis = timerId = undefined;
  28052. }
  28053. function flush() {
  28054. return timerId === undefined ? result : trailingEdge(now());
  28055. }
  28056. function debounced() {
  28057. var time = now(),
  28058. isInvoking = shouldInvoke(time);
  28059. lastArgs = arguments;
  28060. lastThis = this;
  28061. lastCallTime = time;
  28062. if (isInvoking) {
  28063. if (timerId === undefined) {
  28064. return leadingEdge(lastCallTime);
  28065. }
  28066. if (maxing) {
  28067. // Handle invocations in a tight loop.
  28068. clearTimeout(timerId);
  28069. timerId = setTimeout(timerExpired, wait);
  28070. return invokeFunc(lastCallTime);
  28071. }
  28072. }
  28073. if (timerId === undefined) {
  28074. timerId = setTimeout(timerExpired, wait);
  28075. }
  28076. return result;
  28077. }
  28078. debounced.cancel = cancel;
  28079. debounced.flush = flush;
  28080. return debounced;
  28081. }
  28082. /**
  28083. * Defers invoking the `func` until the current call stack has cleared. Any
  28084. * additional arguments are provided to `func` when it's invoked.
  28085. *
  28086. * @static
  28087. * @memberOf _
  28088. * @since 0.1.0
  28089. * @category Function
  28090. * @param {Function} func The function to defer.
  28091. * @param {...*} [args] The arguments to invoke `func` with.
  28092. * @returns {number} Returns the timer id.
  28093. * @example
  28094. *
  28095. * _.defer(function(text) {
  28096. * console.log(text);
  28097. * }, 'deferred');
  28098. * // => Logs 'deferred' after one millisecond.
  28099. */
  28100. var defer = baseRest(function(func, args) {
  28101. return baseDelay(func, 1, args);
  28102. });
  28103. /**
  28104. * Invokes `func` after `wait` milliseconds. Any additional arguments are
  28105. * provided to `func` when it's invoked.
  28106. *
  28107. * @static
  28108. * @memberOf _
  28109. * @since 0.1.0
  28110. * @category Function
  28111. * @param {Function} func The function to delay.
  28112. * @param {number} wait The number of milliseconds to delay invocation.
  28113. * @param {...*} [args] The arguments to invoke `func` with.
  28114. * @returns {number} Returns the timer id.
  28115. * @example
  28116. *
  28117. * _.delay(function(text) {
  28118. * console.log(text);
  28119. * }, 1000, 'later');
  28120. * // => Logs 'later' after one second.
  28121. */
  28122. var delay = baseRest(function(func, wait, args) {
  28123. return baseDelay(func, toNumber(wait) || 0, args);
  28124. });
  28125. /**
  28126. * Creates a function that invokes `func` with arguments reversed.
  28127. *
  28128. * @static
  28129. * @memberOf _
  28130. * @since 4.0.0
  28131. * @category Function
  28132. * @param {Function} func The function to flip arguments for.
  28133. * @returns {Function} Returns the new flipped function.
  28134. * @example
  28135. *
  28136. * var flipped = _.flip(function() {
  28137. * return _.toArray(arguments);
  28138. * });
  28139. *
  28140. * flipped('a', 'b', 'c', 'd');
  28141. * // => ['d', 'c', 'b', 'a']
  28142. */
  28143. function flip(func) {
  28144. return createWrap(func, WRAP_FLIP_FLAG);
  28145. }
  28146. /**
  28147. * Creates a function that memoizes the result of `func`. If `resolver` is
  28148. * provided, it determines the cache key for storing the result based on the
  28149. * arguments provided to the memoized function. By default, the first argument
  28150. * provided to the memoized function is used as the map cache key. The `func`
  28151. * is invoked with the `this` binding of the memoized function.
  28152. *
  28153. * **Note:** The cache is exposed as the `cache` property on the memoized
  28154. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  28155. * constructor with one whose instances implement the
  28156. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  28157. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  28158. *
  28159. * @static
  28160. * @memberOf _
  28161. * @since 0.1.0
  28162. * @category Function
  28163. * @param {Function} func The function to have its output memoized.
  28164. * @param {Function} [resolver] The function to resolve the cache key.
  28165. * @returns {Function} Returns the new memoized function.
  28166. * @example
  28167. *
  28168. * var object = { 'a': 1, 'b': 2 };
  28169. * var other = { 'c': 3, 'd': 4 };
  28170. *
  28171. * var values = _.memoize(_.values);
  28172. * values(object);
  28173. * // => [1, 2]
  28174. *
  28175. * values(other);
  28176. * // => [3, 4]
  28177. *
  28178. * object.a = 2;
  28179. * values(object);
  28180. * // => [1, 2]
  28181. *
  28182. * // Modify the result cache.
  28183. * values.cache.set(object, ['a', 'b']);
  28184. * values(object);
  28185. * // => ['a', 'b']
  28186. *
  28187. * // Replace `_.memoize.Cache`.
  28188. * _.memoize.Cache = WeakMap;
  28189. */
  28190. function memoize(func, resolver) {
  28191. if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
  28192. throw new TypeError(FUNC_ERROR_TEXT);
  28193. }
  28194. var memoized = function() {
  28195. var args = arguments,
  28196. key = resolver ? resolver.apply(this, args) : args[0],
  28197. cache = memoized.cache;
  28198. if (cache.has(key)) {
  28199. return cache.get(key);
  28200. }
  28201. var result = func.apply(this, args);
  28202. memoized.cache = cache.set(key, result) || cache;
  28203. return result;
  28204. };
  28205. memoized.cache = new (memoize.Cache || MapCache);
  28206. return memoized;
  28207. }
  28208. // Expose `MapCache`.
  28209. memoize.Cache = MapCache;
  28210. /**
  28211. * Creates a function that negates the result of the predicate `func`. The
  28212. * `func` predicate is invoked with the `this` binding and arguments of the
  28213. * created function.
  28214. *
  28215. * @static
  28216. * @memberOf _
  28217. * @since 3.0.0
  28218. * @category Function
  28219. * @param {Function} predicate The predicate to negate.
  28220. * @returns {Function} Returns the new negated function.
  28221. * @example
  28222. *
  28223. * function isEven(n) {
  28224. * return n % 2 == 0;
  28225. * }
  28226. *
  28227. * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
  28228. * // => [1, 3, 5]
  28229. */
  28230. function negate(predicate) {
  28231. if (typeof predicate != 'function') {
  28232. throw new TypeError(FUNC_ERROR_TEXT);
  28233. }
  28234. return function() {
  28235. var args = arguments;
  28236. switch (args.length) {
  28237. case 0: return !predicate.call(this);
  28238. case 1: return !predicate.call(this, args[0]);
  28239. case 2: return !predicate.call(this, args[0], args[1]);
  28240. case 3: return !predicate.call(this, args[0], args[1], args[2]);
  28241. }
  28242. return !predicate.apply(this, args);
  28243. };
  28244. }
  28245. /**
  28246. * Creates a function that is restricted to invoking `func` once. Repeat calls
  28247. * to the function return the value of the first invocation. The `func` is
  28248. * invoked with the `this` binding and arguments of the created function.
  28249. *
  28250. * @static
  28251. * @memberOf _
  28252. * @since 0.1.0
  28253. * @category Function
  28254. * @param {Function} func The function to restrict.
  28255. * @returns {Function} Returns the new restricted function.
  28256. * @example
  28257. *
  28258. * var initialize = _.once(createApplication);
  28259. * initialize();
  28260. * initialize();
  28261. * // => `createApplication` is invoked once
  28262. */
  28263. function once(func) {
  28264. return before(2, func);
  28265. }
  28266. /**
  28267. * Creates a function that invokes `func` with its arguments transformed.
  28268. *
  28269. * @static
  28270. * @since 4.0.0
  28271. * @memberOf _
  28272. * @category Function
  28273. * @param {Function} func The function to wrap.
  28274. * @param {...(Function|Function[])} [transforms=[_.identity]]
  28275. * The argument transforms.
  28276. * @returns {Function} Returns the new function.
  28277. * @example
  28278. *
  28279. * function doubled(n) {
  28280. * return n * 2;
  28281. * }
  28282. *
  28283. * function square(n) {
  28284. * return n * n;
  28285. * }
  28286. *
  28287. * var func = _.overArgs(function(x, y) {
  28288. * return [x, y];
  28289. * }, [square, doubled]);
  28290. *
  28291. * func(9, 3);
  28292. * // => [81, 6]
  28293. *
  28294. * func(10, 5);
  28295. * // => [100, 10]
  28296. */
  28297. var overArgs = castRest(function(func, transforms) {
  28298. transforms = (transforms.length == 1 && isArray(transforms[0]))
  28299. ? arrayMap(transforms[0], baseUnary(getIteratee()))
  28300. : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
  28301. var funcsLength = transforms.length;
  28302. return baseRest(function(args) {
  28303. var index = -1,
  28304. length = nativeMin(args.length, funcsLength);
  28305. while (++index < length) {
  28306. args[index] = transforms[index].call(this, args[index]);
  28307. }
  28308. return apply(func, this, args);
  28309. });
  28310. });
  28311. /**
  28312. * Creates a function that invokes `func` with `partials` prepended to the
  28313. * arguments it receives. This method is like `_.bind` except it does **not**
  28314. * alter the `this` binding.
  28315. *
  28316. * The `_.partial.placeholder` value, which defaults to `_` in monolithic
  28317. * builds, may be used as a placeholder for partially applied arguments.
  28318. *
  28319. * **Note:** This method doesn't set the "length" property of partially
  28320. * applied functions.
  28321. *
  28322. * @static
  28323. * @memberOf _
  28324. * @since 0.2.0
  28325. * @category Function
  28326. * @param {Function} func The function to partially apply arguments to.
  28327. * @param {...*} [partials] The arguments to be partially applied.
  28328. * @returns {Function} Returns the new partially applied function.
  28329. * @example
  28330. *
  28331. * function greet(greeting, name) {
  28332. * return greeting + ' ' + name;
  28333. * }
  28334. *
  28335. * var sayHelloTo = _.partial(greet, 'hello');
  28336. * sayHelloTo('fred');
  28337. * // => 'hello fred'
  28338. *
  28339. * // Partially applied with placeholders.
  28340. * var greetFred = _.partial(greet, _, 'fred');
  28341. * greetFred('hi');
  28342. * // => 'hi fred'
  28343. */
  28344. var partial = baseRest(function(func, partials) {
  28345. var holders = replaceHolders(partials, getHolder(partial));
  28346. return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
  28347. });
  28348. /**
  28349. * This method is like `_.partial` except that partially applied arguments
  28350. * are appended to the arguments it receives.
  28351. *
  28352. * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
  28353. * builds, may be used as a placeholder for partially applied arguments.
  28354. *
  28355. * **Note:** This method doesn't set the "length" property of partially
  28356. * applied functions.
  28357. *
  28358. * @static
  28359. * @memberOf _
  28360. * @since 1.0.0
  28361. * @category Function
  28362. * @param {Function} func The function to partially apply arguments to.
  28363. * @param {...*} [partials] The arguments to be partially applied.
  28364. * @returns {Function} Returns the new partially applied function.
  28365. * @example
  28366. *
  28367. * function greet(greeting, name) {
  28368. * return greeting + ' ' + name;
  28369. * }
  28370. *
  28371. * var greetFred = _.partialRight(greet, 'fred');
  28372. * greetFred('hi');
  28373. * // => 'hi fred'
  28374. *
  28375. * // Partially applied with placeholders.
  28376. * var sayHelloTo = _.partialRight(greet, 'hello', _);
  28377. * sayHelloTo('fred');
  28378. * // => 'hello fred'
  28379. */
  28380. var partialRight = baseRest(function(func, partials) {
  28381. var holders = replaceHolders(partials, getHolder(partialRight));
  28382. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
  28383. });
  28384. /**
  28385. * Creates a function that invokes `func` with arguments arranged according
  28386. * to the specified `indexes` where the argument value at the first index is
  28387. * provided as the first argument, the argument value at the second index is
  28388. * provided as the second argument, and so on.
  28389. *
  28390. * @static
  28391. * @memberOf _
  28392. * @since 3.0.0
  28393. * @category Function
  28394. * @param {Function} func The function to rearrange arguments for.
  28395. * @param {...(number|number[])} indexes The arranged argument indexes.
  28396. * @returns {Function} Returns the new function.
  28397. * @example
  28398. *
  28399. * var rearged = _.rearg(function(a, b, c) {
  28400. * return [a, b, c];
  28401. * }, [2, 0, 1]);
  28402. *
  28403. * rearged('b', 'c', 'a')
  28404. * // => ['a', 'b', 'c']
  28405. */
  28406. var rearg = flatRest(function(func, indexes) {
  28407. return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
  28408. });
  28409. /**
  28410. * Creates a function that invokes `func` with the `this` binding of the
  28411. * created function and arguments from `start` and beyond provided as
  28412. * an array.
  28413. *
  28414. * **Note:** This method is based on the
  28415. * [rest parameter](https://mdn.io/rest_parameters).
  28416. *
  28417. * @static
  28418. * @memberOf _
  28419. * @since 4.0.0
  28420. * @category Function
  28421. * @param {Function} func The function to apply a rest parameter to.
  28422. * @param {number} [start=func.length-1] The start position of the rest parameter.
  28423. * @returns {Function} Returns the new function.
  28424. * @example
  28425. *
  28426. * var say = _.rest(function(what, names) {
  28427. * return what + ' ' + _.initial(names).join(', ') +
  28428. * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
  28429. * });
  28430. *
  28431. * say('hello', 'fred', 'barney', 'pebbles');
  28432. * // => 'hello fred, barney, & pebbles'
  28433. */
  28434. function rest(func, start) {
  28435. if (typeof func != 'function') {
  28436. throw new TypeError(FUNC_ERROR_TEXT);
  28437. }
  28438. start = start === undefined ? start : toInteger(start);
  28439. return baseRest(func, start);
  28440. }
  28441. /**
  28442. * Creates a function that invokes `func` with the `this` binding of the
  28443. * create function and an array of arguments much like
  28444. * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
  28445. *
  28446. * **Note:** This method is based on the
  28447. * [spread operator](https://mdn.io/spread_operator).
  28448. *
  28449. * @static
  28450. * @memberOf _
  28451. * @since 3.2.0
  28452. * @category Function
  28453. * @param {Function} func The function to spread arguments over.
  28454. * @param {number} [start=0] The start position of the spread.
  28455. * @returns {Function} Returns the new function.
  28456. * @example
  28457. *
  28458. * var say = _.spread(function(who, what) {
  28459. * return who + ' says ' + what;
  28460. * });
  28461. *
  28462. * say(['fred', 'hello']);
  28463. * // => 'fred says hello'
  28464. *
  28465. * var numbers = Promise.all([
  28466. * Promise.resolve(40),
  28467. * Promise.resolve(36)
  28468. * ]);
  28469. *
  28470. * numbers.then(_.spread(function(x, y) {
  28471. * return x + y;
  28472. * }));
  28473. * // => a Promise of 76
  28474. */
  28475. function spread(func, start) {
  28476. if (typeof func != 'function') {
  28477. throw new TypeError(FUNC_ERROR_TEXT);
  28478. }
  28479. start = start == null ? 0 : nativeMax(toInteger(start), 0);
  28480. return baseRest(function(args) {
  28481. var array = args[start],
  28482. otherArgs = castSlice(args, 0, start);
  28483. if (array) {
  28484. arrayPush(otherArgs, array);
  28485. }
  28486. return apply(func, this, otherArgs);
  28487. });
  28488. }
  28489. /**
  28490. * Creates a throttled function that only invokes `func` at most once per
  28491. * every `wait` milliseconds. The throttled function comes with a `cancel`
  28492. * method to cancel delayed `func` invocations and a `flush` method to
  28493. * immediately invoke them. Provide `options` to indicate whether `func`
  28494. * should be invoked on the leading and/or trailing edge of the `wait`
  28495. * timeout. The `func` is invoked with the last arguments provided to the
  28496. * throttled function. Subsequent calls to the throttled function return the
  28497. * result of the last `func` invocation.
  28498. *
  28499. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  28500. * invoked on the trailing edge of the timeout only if the throttled function
  28501. * is invoked more than once during the `wait` timeout.
  28502. *
  28503. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  28504. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  28505. *
  28506. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  28507. * for details over the differences between `_.throttle` and `_.debounce`.
  28508. *
  28509. * @static
  28510. * @memberOf _
  28511. * @since 0.1.0
  28512. * @category Function
  28513. * @param {Function} func The function to throttle.
  28514. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  28515. * @param {Object} [options={}] The options object.
  28516. * @param {boolean} [options.leading=true]
  28517. * Specify invoking on the leading edge of the timeout.
  28518. * @param {boolean} [options.trailing=true]
  28519. * Specify invoking on the trailing edge of the timeout.
  28520. * @returns {Function} Returns the new throttled function.
  28521. * @example
  28522. *
  28523. * // Avoid excessively updating the position while scrolling.
  28524. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  28525. *
  28526. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  28527. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  28528. * jQuery(element).on('click', throttled);
  28529. *
  28530. * // Cancel the trailing throttled invocation.
  28531. * jQuery(window).on('popstate', throttled.cancel);
  28532. */
  28533. function throttle(func, wait, options) {
  28534. var leading = true,
  28535. trailing = true;
  28536. if (typeof func != 'function') {
  28537. throw new TypeError(FUNC_ERROR_TEXT);
  28538. }
  28539. if (isObject(options)) {
  28540. leading = 'leading' in options ? !!options.leading : leading;
  28541. trailing = 'trailing' in options ? !!options.trailing : trailing;
  28542. }
  28543. return debounce(func, wait, {
  28544. 'leading': leading,
  28545. 'maxWait': wait,
  28546. 'trailing': trailing
  28547. });
  28548. }
  28549. /**
  28550. * Creates a function that accepts up to one argument, ignoring any
  28551. * additional arguments.
  28552. *
  28553. * @static
  28554. * @memberOf _
  28555. * @since 4.0.0
  28556. * @category Function
  28557. * @param {Function} func The function to cap arguments for.
  28558. * @returns {Function} Returns the new capped function.
  28559. * @example
  28560. *
  28561. * _.map(['6', '8', '10'], _.unary(parseInt));
  28562. * // => [6, 8, 10]
  28563. */
  28564. function unary(func) {
  28565. return ary(func, 1);
  28566. }
  28567. /**
  28568. * Creates a function that provides `value` to `wrapper` as its first
  28569. * argument. Any additional arguments provided to the function are appended
  28570. * to those provided to the `wrapper`. The wrapper is invoked with the `this`
  28571. * binding of the created function.
  28572. *
  28573. * @static
  28574. * @memberOf _
  28575. * @since 0.1.0
  28576. * @category Function
  28577. * @param {*} value The value to wrap.
  28578. * @param {Function} [wrapper=identity] The wrapper function.
  28579. * @returns {Function} Returns the new function.
  28580. * @example
  28581. *
  28582. * var p = _.wrap(_.escape, function(func, text) {
  28583. * return '<p>' + func(text) + '</p>';
  28584. * });
  28585. *
  28586. * p('fred, barney, & pebbles');
  28587. * // => '<p>fred, barney, &amp; pebbles</p>'
  28588. */
  28589. function wrap(value, wrapper) {
  28590. return partial(castFunction(wrapper), value);
  28591. }
  28592. /*------------------------------------------------------------------------*/
  28593. /**
  28594. * Casts `value` as an array if it's not one.
  28595. *
  28596. * @static
  28597. * @memberOf _
  28598. * @since 4.4.0
  28599. * @category Lang
  28600. * @param {*} value The value to inspect.
  28601. * @returns {Array} Returns the cast array.
  28602. * @example
  28603. *
  28604. * _.castArray(1);
  28605. * // => [1]
  28606. *
  28607. * _.castArray({ 'a': 1 });
  28608. * // => [{ 'a': 1 }]
  28609. *
  28610. * _.castArray('abc');
  28611. * // => ['abc']
  28612. *
  28613. * _.castArray(null);
  28614. * // => [null]
  28615. *
  28616. * _.castArray(undefined);
  28617. * // => [undefined]
  28618. *
  28619. * _.castArray();
  28620. * // => []
  28621. *
  28622. * var array = [1, 2, 3];
  28623. * console.log(_.castArray(array) === array);
  28624. * // => true
  28625. */
  28626. function castArray() {
  28627. if (!arguments.length) {
  28628. return [];
  28629. }
  28630. var value = arguments[0];
  28631. return isArray(value) ? value : [value];
  28632. }
  28633. /**
  28634. * Creates a shallow clone of `value`.
  28635. *
  28636. * **Note:** This method is loosely based on the
  28637. * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
  28638. * and supports cloning arrays, array buffers, booleans, date objects, maps,
  28639. * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
  28640. * arrays. The own enumerable properties of `arguments` objects are cloned
  28641. * as plain objects. An empty object is returned for uncloneable values such
  28642. * as error objects, functions, DOM nodes, and WeakMaps.
  28643. *
  28644. * @static
  28645. * @memberOf _
  28646. * @since 0.1.0
  28647. * @category Lang
  28648. * @param {*} value The value to clone.
  28649. * @returns {*} Returns the cloned value.
  28650. * @see _.cloneDeep
  28651. * @example
  28652. *
  28653. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  28654. *
  28655. * var shallow = _.clone(objects);
  28656. * console.log(shallow[0] === objects[0]);
  28657. * // => true
  28658. */
  28659. function clone(value) {
  28660. return baseClone(value, CLONE_SYMBOLS_FLAG);
  28661. }
  28662. /**
  28663. * This method is like `_.clone` except that it accepts `customizer` which
  28664. * is invoked to produce the cloned value. If `customizer` returns `undefined`,
  28665. * cloning is handled by the method instead. The `customizer` is invoked with
  28666. * up to four arguments; (value [, index|key, object, stack]).
  28667. *
  28668. * @static
  28669. * @memberOf _
  28670. * @since 4.0.0
  28671. * @category Lang
  28672. * @param {*} value The value to clone.
  28673. * @param {Function} [customizer] The function to customize cloning.
  28674. * @returns {*} Returns the cloned value.
  28675. * @see _.cloneDeepWith
  28676. * @example
  28677. *
  28678. * function customizer(value) {
  28679. * if (_.isElement(value)) {
  28680. * return value.cloneNode(false);
  28681. * }
  28682. * }
  28683. *
  28684. * var el = _.cloneWith(document.body, customizer);
  28685. *
  28686. * console.log(el === document.body);
  28687. * // => false
  28688. * console.log(el.nodeName);
  28689. * // => 'BODY'
  28690. * console.log(el.childNodes.length);
  28691. * // => 0
  28692. */
  28693. function cloneWith(value, customizer) {
  28694. customizer = typeof customizer == 'function' ? customizer : undefined;
  28695. return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
  28696. }
  28697. /**
  28698. * This method is like `_.clone` except that it recursively clones `value`.
  28699. *
  28700. * @static
  28701. * @memberOf _
  28702. * @since 1.0.0
  28703. * @category Lang
  28704. * @param {*} value The value to recursively clone.
  28705. * @returns {*} Returns the deep cloned value.
  28706. * @see _.clone
  28707. * @example
  28708. *
  28709. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  28710. *
  28711. * var deep = _.cloneDeep(objects);
  28712. * console.log(deep[0] === objects[0]);
  28713. * // => false
  28714. */
  28715. function cloneDeep(value) {
  28716. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  28717. }
  28718. /**
  28719. * This method is like `_.cloneWith` except that it recursively clones `value`.
  28720. *
  28721. * @static
  28722. * @memberOf _
  28723. * @since 4.0.0
  28724. * @category Lang
  28725. * @param {*} value The value to recursively clone.
  28726. * @param {Function} [customizer] The function to customize cloning.
  28727. * @returns {*} Returns the deep cloned value.
  28728. * @see _.cloneWith
  28729. * @example
  28730. *
  28731. * function customizer(value) {
  28732. * if (_.isElement(value)) {
  28733. * return value.cloneNode(true);
  28734. * }
  28735. * }
  28736. *
  28737. * var el = _.cloneDeepWith(document.body, customizer);
  28738. *
  28739. * console.log(el === document.body);
  28740. * // => false
  28741. * console.log(el.nodeName);
  28742. * // => 'BODY'
  28743. * console.log(el.childNodes.length);
  28744. * // => 20
  28745. */
  28746. function cloneDeepWith(value, customizer) {
  28747. customizer = typeof customizer == 'function' ? customizer : undefined;
  28748. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
  28749. }
  28750. /**
  28751. * Checks if `object` conforms to `source` by invoking the predicate
  28752. * properties of `source` with the corresponding property values of `object`.
  28753. *
  28754. * **Note:** This method is equivalent to `_.conforms` when `source` is
  28755. * partially applied.
  28756. *
  28757. * @static
  28758. * @memberOf _
  28759. * @since 4.14.0
  28760. * @category Lang
  28761. * @param {Object} object The object to inspect.
  28762. * @param {Object} source The object of property predicates to conform to.
  28763. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  28764. * @example
  28765. *
  28766. * var object = { 'a': 1, 'b': 2 };
  28767. *
  28768. * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
  28769. * // => true
  28770. *
  28771. * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
  28772. * // => false
  28773. */
  28774. function conformsTo(object, source) {
  28775. return source == null || baseConformsTo(object, source, keys(source));
  28776. }
  28777. /**
  28778. * Performs a
  28779. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  28780. * comparison between two values to determine if they are equivalent.
  28781. *
  28782. * @static
  28783. * @memberOf _
  28784. * @since 4.0.0
  28785. * @category Lang
  28786. * @param {*} value The value to compare.
  28787. * @param {*} other The other value to compare.
  28788. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  28789. * @example
  28790. *
  28791. * var object = { 'a': 1 };
  28792. * var other = { 'a': 1 };
  28793. *
  28794. * _.eq(object, object);
  28795. * // => true
  28796. *
  28797. * _.eq(object, other);
  28798. * // => false
  28799. *
  28800. * _.eq('a', 'a');
  28801. * // => true
  28802. *
  28803. * _.eq('a', Object('a'));
  28804. * // => false
  28805. *
  28806. * _.eq(NaN, NaN);
  28807. * // => true
  28808. */
  28809. function eq(value, other) {
  28810. return value === other || (value !== value && other !== other);
  28811. }
  28812. /**
  28813. * Checks if `value` is greater than `other`.
  28814. *
  28815. * @static
  28816. * @memberOf _
  28817. * @since 3.9.0
  28818. * @category Lang
  28819. * @param {*} value The value to compare.
  28820. * @param {*} other The other value to compare.
  28821. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  28822. * else `false`.
  28823. * @see _.lt
  28824. * @example
  28825. *
  28826. * _.gt(3, 1);
  28827. * // => true
  28828. *
  28829. * _.gt(3, 3);
  28830. * // => false
  28831. *
  28832. * _.gt(1, 3);
  28833. * // => false
  28834. */
  28835. var gt = createRelationalOperation(baseGt);
  28836. /**
  28837. * Checks if `value` is greater than or equal to `other`.
  28838. *
  28839. * @static
  28840. * @memberOf _
  28841. * @since 3.9.0
  28842. * @category Lang
  28843. * @param {*} value The value to compare.
  28844. * @param {*} other The other value to compare.
  28845. * @returns {boolean} Returns `true` if `value` is greater than or equal to
  28846. * `other`, else `false`.
  28847. * @see _.lte
  28848. * @example
  28849. *
  28850. * _.gte(3, 1);
  28851. * // => true
  28852. *
  28853. * _.gte(3, 3);
  28854. * // => true
  28855. *
  28856. * _.gte(1, 3);
  28857. * // => false
  28858. */
  28859. var gte = createRelationalOperation(function(value, other) {
  28860. return value >= other;
  28861. });
  28862. /**
  28863. * Checks if `value` is likely an `arguments` object.
  28864. *
  28865. * @static
  28866. * @memberOf _
  28867. * @since 0.1.0
  28868. * @category Lang
  28869. * @param {*} value The value to check.
  28870. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  28871. * else `false`.
  28872. * @example
  28873. *
  28874. * _.isArguments(function() { return arguments; }());
  28875. * // => true
  28876. *
  28877. * _.isArguments([1, 2, 3]);
  28878. * // => false
  28879. */
  28880. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  28881. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  28882. !propertyIsEnumerable.call(value, 'callee');
  28883. };
  28884. /**
  28885. * Checks if `value` is classified as an `Array` object.
  28886. *
  28887. * @static
  28888. * @memberOf _
  28889. * @since 0.1.0
  28890. * @category Lang
  28891. * @param {*} value The value to check.
  28892. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  28893. * @example
  28894. *
  28895. * _.isArray([1, 2, 3]);
  28896. * // => true
  28897. *
  28898. * _.isArray(document.body.children);
  28899. * // => false
  28900. *
  28901. * _.isArray('abc');
  28902. * // => false
  28903. *
  28904. * _.isArray(_.noop);
  28905. * // => false
  28906. */
  28907. var isArray = Array.isArray;
  28908. /**
  28909. * Checks if `value` is classified as an `ArrayBuffer` object.
  28910. *
  28911. * @static
  28912. * @memberOf _
  28913. * @since 4.3.0
  28914. * @category Lang
  28915. * @param {*} value The value to check.
  28916. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  28917. * @example
  28918. *
  28919. * _.isArrayBuffer(new ArrayBuffer(2));
  28920. * // => true
  28921. *
  28922. * _.isArrayBuffer(new Array(2));
  28923. * // => false
  28924. */
  28925. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  28926. /**
  28927. * Checks if `value` is array-like. A value is considered array-like if it's
  28928. * not a function and has a `value.length` that's an integer greater than or
  28929. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  28930. *
  28931. * @static
  28932. * @memberOf _
  28933. * @since 4.0.0
  28934. * @category Lang
  28935. * @param {*} value The value to check.
  28936. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  28937. * @example
  28938. *
  28939. * _.isArrayLike([1, 2, 3]);
  28940. * // => true
  28941. *
  28942. * _.isArrayLike(document.body.children);
  28943. * // => true
  28944. *
  28945. * _.isArrayLike('abc');
  28946. * // => true
  28947. *
  28948. * _.isArrayLike(_.noop);
  28949. * // => false
  28950. */
  28951. function isArrayLike(value) {
  28952. return value != null && isLength(value.length) && !isFunction(value);
  28953. }
  28954. /**
  28955. * This method is like `_.isArrayLike` except that it also checks if `value`
  28956. * is an object.
  28957. *
  28958. * @static
  28959. * @memberOf _
  28960. * @since 4.0.0
  28961. * @category Lang
  28962. * @param {*} value The value to check.
  28963. * @returns {boolean} Returns `true` if `value` is an array-like object,
  28964. * else `false`.
  28965. * @example
  28966. *
  28967. * _.isArrayLikeObject([1, 2, 3]);
  28968. * // => true
  28969. *
  28970. * _.isArrayLikeObject(document.body.children);
  28971. * // => true
  28972. *
  28973. * _.isArrayLikeObject('abc');
  28974. * // => false
  28975. *
  28976. * _.isArrayLikeObject(_.noop);
  28977. * // => false
  28978. */
  28979. function isArrayLikeObject(value) {
  28980. return isObjectLike(value) && isArrayLike(value);
  28981. }
  28982. /**
  28983. * Checks if `value` is classified as a boolean primitive or object.
  28984. *
  28985. * @static
  28986. * @memberOf _
  28987. * @since 0.1.0
  28988. * @category Lang
  28989. * @param {*} value The value to check.
  28990. * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
  28991. * @example
  28992. *
  28993. * _.isBoolean(false);
  28994. * // => true
  28995. *
  28996. * _.isBoolean(null);
  28997. * // => false
  28998. */
  28999. function isBoolean(value) {
  29000. return value === true || value === false ||
  29001. (isObjectLike(value) && baseGetTag(value) == boolTag);
  29002. }
  29003. /**
  29004. * Checks if `value` is a buffer.
  29005. *
  29006. * @static
  29007. * @memberOf _
  29008. * @since 4.3.0
  29009. * @category Lang
  29010. * @param {*} value The value to check.
  29011. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  29012. * @example
  29013. *
  29014. * _.isBuffer(new Buffer(2));
  29015. * // => true
  29016. *
  29017. * _.isBuffer(new Uint8Array(2));
  29018. * // => false
  29019. */
  29020. var isBuffer = nativeIsBuffer || stubFalse;
  29021. /**
  29022. * Checks if `value` is classified as a `Date` object.
  29023. *
  29024. * @static
  29025. * @memberOf _
  29026. * @since 0.1.0
  29027. * @category Lang
  29028. * @param {*} value The value to check.
  29029. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  29030. * @example
  29031. *
  29032. * _.isDate(new Date);
  29033. * // => true
  29034. *
  29035. * _.isDate('Mon April 23 2012');
  29036. * // => false
  29037. */
  29038. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  29039. /**
  29040. * Checks if `value` is likely a DOM element.
  29041. *
  29042. * @static
  29043. * @memberOf _
  29044. * @since 0.1.0
  29045. * @category Lang
  29046. * @param {*} value The value to check.
  29047. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
  29048. * @example
  29049. *
  29050. * _.isElement(document.body);
  29051. * // => true
  29052. *
  29053. * _.isElement('<body>');
  29054. * // => false
  29055. */
  29056. function isElement(value) {
  29057. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  29058. }
  29059. /**
  29060. * Checks if `value` is an empty object, collection, map, or set.
  29061. *
  29062. * Objects are considered empty if they have no own enumerable string keyed
  29063. * properties.
  29064. *
  29065. * Array-like values such as `arguments` objects, arrays, buffers, strings, or
  29066. * jQuery-like collections are considered empty if they have a `length` of `0`.
  29067. * Similarly, maps and sets are considered empty if they have a `size` of `0`.
  29068. *
  29069. * @static
  29070. * @memberOf _
  29071. * @since 0.1.0
  29072. * @category Lang
  29073. * @param {*} value The value to check.
  29074. * @returns {boolean} Returns `true` if `value` is empty, else `false`.
  29075. * @example
  29076. *
  29077. * _.isEmpty(null);
  29078. * // => true
  29079. *
  29080. * _.isEmpty(true);
  29081. * // => true
  29082. *
  29083. * _.isEmpty(1);
  29084. * // => true
  29085. *
  29086. * _.isEmpty([1, 2, 3]);
  29087. * // => false
  29088. *
  29089. * _.isEmpty({ 'a': 1 });
  29090. * // => false
  29091. */
  29092. function isEmpty(value) {
  29093. if (value == null) {
  29094. return true;
  29095. }
  29096. if (isArrayLike(value) &&
  29097. (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
  29098. isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  29099. return !value.length;
  29100. }
  29101. var tag = getTag(value);
  29102. if (tag == mapTag || tag == setTag) {
  29103. return !value.size;
  29104. }
  29105. if (isPrototype(value)) {
  29106. return !baseKeys(value).length;
  29107. }
  29108. for (var key in value) {
  29109. if (hasOwnProperty.call(value, key)) {
  29110. return false;
  29111. }
  29112. }
  29113. return true;
  29114. }
  29115. /**
  29116. * Performs a deep comparison between two values to determine if they are
  29117. * equivalent.
  29118. *
  29119. * **Note:** This method supports comparing arrays, array buffers, booleans,
  29120. * date objects, error objects, maps, numbers, `Object` objects, regexes,
  29121. * sets, strings, symbols, and typed arrays. `Object` objects are compared
  29122. * by their own, not inherited, enumerable properties. Functions and DOM
  29123. * nodes are compared by strict equality, i.e. `===`.
  29124. *
  29125. * @static
  29126. * @memberOf _
  29127. * @since 0.1.0
  29128. * @category Lang
  29129. * @param {*} value The value to compare.
  29130. * @param {*} other The other value to compare.
  29131. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  29132. * @example
  29133. *
  29134. * var object = { 'a': 1 };
  29135. * var other = { 'a': 1 };
  29136. *
  29137. * _.isEqual(object, other);
  29138. * // => true
  29139. *
  29140. * object === other;
  29141. * // => false
  29142. */
  29143. function isEqual(value, other) {
  29144. return baseIsEqual(value, other);
  29145. }
  29146. /**
  29147. * This method is like `_.isEqual` except that it accepts `customizer` which
  29148. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  29149. * are handled by the method instead. The `customizer` is invoked with up to
  29150. * six arguments: (objValue, othValue [, index|key, object, other, stack]).
  29151. *
  29152. * @static
  29153. * @memberOf _
  29154. * @since 4.0.0
  29155. * @category Lang
  29156. * @param {*} value The value to compare.
  29157. * @param {*} other The other value to compare.
  29158. * @param {Function} [customizer] The function to customize comparisons.
  29159. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  29160. * @example
  29161. *
  29162. * function isGreeting(value) {
  29163. * return /^h(?:i|ello)$/.test(value);
  29164. * }
  29165. *
  29166. * function customizer(objValue, othValue) {
  29167. * if (isGreeting(objValue) && isGreeting(othValue)) {
  29168. * return true;
  29169. * }
  29170. * }
  29171. *
  29172. * var array = ['hello', 'goodbye'];
  29173. * var other = ['hi', 'goodbye'];
  29174. *
  29175. * _.isEqualWith(array, other, customizer);
  29176. * // => true
  29177. */
  29178. function isEqualWith(value, other, customizer) {
  29179. customizer = typeof customizer == 'function' ? customizer : undefined;
  29180. var result = customizer ? customizer(value, other) : undefined;
  29181. return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
  29182. }
  29183. /**
  29184. * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
  29185. * `SyntaxError`, `TypeError`, or `URIError` object.
  29186. *
  29187. * @static
  29188. * @memberOf _
  29189. * @since 3.0.0
  29190. * @category Lang
  29191. * @param {*} value The value to check.
  29192. * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
  29193. * @example
  29194. *
  29195. * _.isError(new Error);
  29196. * // => true
  29197. *
  29198. * _.isError(Error);
  29199. * // => false
  29200. */
  29201. function isError(value) {
  29202. if (!isObjectLike(value)) {
  29203. return false;
  29204. }
  29205. var tag = baseGetTag(value);
  29206. return tag == errorTag || tag == domExcTag ||
  29207. (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
  29208. }
  29209. /**
  29210. * Checks if `value` is a finite primitive number.
  29211. *
  29212. * **Note:** This method is based on
  29213. * [`Number.isFinite`](https://mdn.io/Number/isFinite).
  29214. *
  29215. * @static
  29216. * @memberOf _
  29217. * @since 0.1.0
  29218. * @category Lang
  29219. * @param {*} value The value to check.
  29220. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
  29221. * @example
  29222. *
  29223. * _.isFinite(3);
  29224. * // => true
  29225. *
  29226. * _.isFinite(Number.MIN_VALUE);
  29227. * // => true
  29228. *
  29229. * _.isFinite(Infinity);
  29230. * // => false
  29231. *
  29232. * _.isFinite('3');
  29233. * // => false
  29234. */
  29235. function isFinite(value) {
  29236. return typeof value == 'number' && nativeIsFinite(value);
  29237. }
  29238. /**
  29239. * Checks if `value` is classified as a `Function` object.
  29240. *
  29241. * @static
  29242. * @memberOf _
  29243. * @since 0.1.0
  29244. * @category Lang
  29245. * @param {*} value The value to check.
  29246. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  29247. * @example
  29248. *
  29249. * _.isFunction(_);
  29250. * // => true
  29251. *
  29252. * _.isFunction(/abc/);
  29253. * // => false
  29254. */
  29255. function isFunction(value) {
  29256. if (!isObject(value)) {
  29257. return false;
  29258. }
  29259. // The use of `Object#toString` avoids issues with the `typeof` operator
  29260. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  29261. var tag = baseGetTag(value);
  29262. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  29263. }
  29264. /**
  29265. * Checks if `value` is an integer.
  29266. *
  29267. * **Note:** This method is based on
  29268. * [`Number.isInteger`](https://mdn.io/Number/isInteger).
  29269. *
  29270. * @static
  29271. * @memberOf _
  29272. * @since 4.0.0
  29273. * @category Lang
  29274. * @param {*} value The value to check.
  29275. * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
  29276. * @example
  29277. *
  29278. * _.isInteger(3);
  29279. * // => true
  29280. *
  29281. * _.isInteger(Number.MIN_VALUE);
  29282. * // => false
  29283. *
  29284. * _.isInteger(Infinity);
  29285. * // => false
  29286. *
  29287. * _.isInteger('3');
  29288. * // => false
  29289. */
  29290. function isInteger(value) {
  29291. return typeof value == 'number' && value == toInteger(value);
  29292. }
  29293. /**
  29294. * Checks if `value` is a valid array-like length.
  29295. *
  29296. * **Note:** This method is loosely based on
  29297. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  29298. *
  29299. * @static
  29300. * @memberOf _
  29301. * @since 4.0.0
  29302. * @category Lang
  29303. * @param {*} value The value to check.
  29304. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  29305. * @example
  29306. *
  29307. * _.isLength(3);
  29308. * // => true
  29309. *
  29310. * _.isLength(Number.MIN_VALUE);
  29311. * // => false
  29312. *
  29313. * _.isLength(Infinity);
  29314. * // => false
  29315. *
  29316. * _.isLength('3');
  29317. * // => false
  29318. */
  29319. function isLength(value) {
  29320. return typeof value == 'number' &&
  29321. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  29322. }
  29323. /**
  29324. * Checks if `value` is the
  29325. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  29326. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  29327. *
  29328. * @static
  29329. * @memberOf _
  29330. * @since 0.1.0
  29331. * @category Lang
  29332. * @param {*} value The value to check.
  29333. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  29334. * @example
  29335. *
  29336. * _.isObject({});
  29337. * // => true
  29338. *
  29339. * _.isObject([1, 2, 3]);
  29340. * // => true
  29341. *
  29342. * _.isObject(_.noop);
  29343. * // => true
  29344. *
  29345. * _.isObject(null);
  29346. * // => false
  29347. */
  29348. function isObject(value) {
  29349. var type = typeof value;
  29350. return value != null && (type == 'object' || type == 'function');
  29351. }
  29352. /**
  29353. * Checks if `value` is object-like. A value is object-like if it's not `null`
  29354. * and has a `typeof` result of "object".
  29355. *
  29356. * @static
  29357. * @memberOf _
  29358. * @since 4.0.0
  29359. * @category Lang
  29360. * @param {*} value The value to check.
  29361. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  29362. * @example
  29363. *
  29364. * _.isObjectLike({});
  29365. * // => true
  29366. *
  29367. * _.isObjectLike([1, 2, 3]);
  29368. * // => true
  29369. *
  29370. * _.isObjectLike(_.noop);
  29371. * // => false
  29372. *
  29373. * _.isObjectLike(null);
  29374. * // => false
  29375. */
  29376. function isObjectLike(value) {
  29377. return value != null && typeof value == 'object';
  29378. }
  29379. /**
  29380. * Checks if `value` is classified as a `Map` object.
  29381. *
  29382. * @static
  29383. * @memberOf _
  29384. * @since 4.3.0
  29385. * @category Lang
  29386. * @param {*} value The value to check.
  29387. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  29388. * @example
  29389. *
  29390. * _.isMap(new Map);
  29391. * // => true
  29392. *
  29393. * _.isMap(new WeakMap);
  29394. * // => false
  29395. */
  29396. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  29397. /**
  29398. * Performs a partial deep comparison between `object` and `source` to
  29399. * determine if `object` contains equivalent property values.
  29400. *
  29401. * **Note:** This method is equivalent to `_.matches` when `source` is
  29402. * partially applied.
  29403. *
  29404. * Partial comparisons will match empty array and empty object `source`
  29405. * values against any array or object value, respectively. See `_.isEqual`
  29406. * for a list of supported value comparisons.
  29407. *
  29408. * @static
  29409. * @memberOf _
  29410. * @since 3.0.0
  29411. * @category Lang
  29412. * @param {Object} object The object to inspect.
  29413. * @param {Object} source The object of property values to match.
  29414. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  29415. * @example
  29416. *
  29417. * var object = { 'a': 1, 'b': 2 };
  29418. *
  29419. * _.isMatch(object, { 'b': 2 });
  29420. * // => true
  29421. *
  29422. * _.isMatch(object, { 'b': 1 });
  29423. * // => false
  29424. */
  29425. function isMatch(object, source) {
  29426. return object === source || baseIsMatch(object, source, getMatchData(source));
  29427. }
  29428. /**
  29429. * This method is like `_.isMatch` except that it accepts `customizer` which
  29430. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  29431. * are handled by the method instead. The `customizer` is invoked with five
  29432. * arguments: (objValue, srcValue, index|key, object, source).
  29433. *
  29434. * @static
  29435. * @memberOf _
  29436. * @since 4.0.0
  29437. * @category Lang
  29438. * @param {Object} object The object to inspect.
  29439. * @param {Object} source The object of property values to match.
  29440. * @param {Function} [customizer] The function to customize comparisons.
  29441. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  29442. * @example
  29443. *
  29444. * function isGreeting(value) {
  29445. * return /^h(?:i|ello)$/.test(value);
  29446. * }
  29447. *
  29448. * function customizer(objValue, srcValue) {
  29449. * if (isGreeting(objValue) && isGreeting(srcValue)) {
  29450. * return true;
  29451. * }
  29452. * }
  29453. *
  29454. * var object = { 'greeting': 'hello' };
  29455. * var source = { 'greeting': 'hi' };
  29456. *
  29457. * _.isMatchWith(object, source, customizer);
  29458. * // => true
  29459. */
  29460. function isMatchWith(object, source, customizer) {
  29461. customizer = typeof customizer == 'function' ? customizer : undefined;
  29462. return baseIsMatch(object, source, getMatchData(source), customizer);
  29463. }
  29464. /**
  29465. * Checks if `value` is `NaN`.
  29466. *
  29467. * **Note:** This method is based on
  29468. * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
  29469. * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
  29470. * `undefined` and other non-number values.
  29471. *
  29472. * @static
  29473. * @memberOf _
  29474. * @since 0.1.0
  29475. * @category Lang
  29476. * @param {*} value The value to check.
  29477. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  29478. * @example
  29479. *
  29480. * _.isNaN(NaN);
  29481. * // => true
  29482. *
  29483. * _.isNaN(new Number(NaN));
  29484. * // => true
  29485. *
  29486. * isNaN(undefined);
  29487. * // => true
  29488. *
  29489. * _.isNaN(undefined);
  29490. * // => false
  29491. */
  29492. function isNaN(value) {
  29493. // An `NaN` primitive is the only value that is not equal to itself.
  29494. // Perform the `toStringTag` check first to avoid errors with some
  29495. // ActiveX objects in IE.
  29496. return isNumber(value) && value != +value;
  29497. }
  29498. /**
  29499. * Checks if `value` is a pristine native function.
  29500. *
  29501. * **Note:** This method can't reliably detect native functions in the presence
  29502. * of the core-js package because core-js circumvents this kind of detection.
  29503. * Despite multiple requests, the core-js maintainer has made it clear: any
  29504. * attempt to fix the detection will be obstructed. As a result, we're left
  29505. * with little choice but to throw an error. Unfortunately, this also affects
  29506. * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
  29507. * which rely on core-js.
  29508. *
  29509. * @static
  29510. * @memberOf _
  29511. * @since 3.0.0
  29512. * @category Lang
  29513. * @param {*} value The value to check.
  29514. * @returns {boolean} Returns `true` if `value` is a native function,
  29515. * else `false`.
  29516. * @example
  29517. *
  29518. * _.isNative(Array.prototype.push);
  29519. * // => true
  29520. *
  29521. * _.isNative(_);
  29522. * // => false
  29523. */
  29524. function isNative(value) {
  29525. if (isMaskable(value)) {
  29526. throw new Error(CORE_ERROR_TEXT);
  29527. }
  29528. return baseIsNative(value);
  29529. }
  29530. /**
  29531. * Checks if `value` is `null`.
  29532. *
  29533. * @static
  29534. * @memberOf _
  29535. * @since 0.1.0
  29536. * @category Lang
  29537. * @param {*} value The value to check.
  29538. * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
  29539. * @example
  29540. *
  29541. * _.isNull(null);
  29542. * // => true
  29543. *
  29544. * _.isNull(void 0);
  29545. * // => false
  29546. */
  29547. function isNull(value) {
  29548. return value === null;
  29549. }
  29550. /**
  29551. * Checks if `value` is `null` or `undefined`.
  29552. *
  29553. * @static
  29554. * @memberOf _
  29555. * @since 4.0.0
  29556. * @category Lang
  29557. * @param {*} value The value to check.
  29558. * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
  29559. * @example
  29560. *
  29561. * _.isNil(null);
  29562. * // => true
  29563. *
  29564. * _.isNil(void 0);
  29565. * // => true
  29566. *
  29567. * _.isNil(NaN);
  29568. * // => false
  29569. */
  29570. function isNil(value) {
  29571. return value == null;
  29572. }
  29573. /**
  29574. * Checks if `value` is classified as a `Number` primitive or object.
  29575. *
  29576. * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
  29577. * classified as numbers, use the `_.isFinite` method.
  29578. *
  29579. * @static
  29580. * @memberOf _
  29581. * @since 0.1.0
  29582. * @category Lang
  29583. * @param {*} value The value to check.
  29584. * @returns {boolean} Returns `true` if `value` is a number, else `false`.
  29585. * @example
  29586. *
  29587. * _.isNumber(3);
  29588. * // => true
  29589. *
  29590. * _.isNumber(Number.MIN_VALUE);
  29591. * // => true
  29592. *
  29593. * _.isNumber(Infinity);
  29594. * // => true
  29595. *
  29596. * _.isNumber('3');
  29597. * // => false
  29598. */
  29599. function isNumber(value) {
  29600. return typeof value == 'number' ||
  29601. (isObjectLike(value) && baseGetTag(value) == numberTag);
  29602. }
  29603. /**
  29604. * Checks if `value` is a plain object, that is, an object created by the
  29605. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  29606. *
  29607. * @static
  29608. * @memberOf _
  29609. * @since 0.8.0
  29610. * @category Lang
  29611. * @param {*} value The value to check.
  29612. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  29613. * @example
  29614. *
  29615. * function Foo() {
  29616. * this.a = 1;
  29617. * }
  29618. *
  29619. * _.isPlainObject(new Foo);
  29620. * // => false
  29621. *
  29622. * _.isPlainObject([1, 2, 3]);
  29623. * // => false
  29624. *
  29625. * _.isPlainObject({ 'x': 0, 'y': 0 });
  29626. * // => true
  29627. *
  29628. * _.isPlainObject(Object.create(null));
  29629. * // => true
  29630. */
  29631. function isPlainObject(value) {
  29632. if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
  29633. return false;
  29634. }
  29635. var proto = getPrototype(value);
  29636. if (proto === null) {
  29637. return true;
  29638. }
  29639. var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  29640. return typeof Ctor == 'function' && Ctor instanceof Ctor &&
  29641. funcToString.call(Ctor) == objectCtorString;
  29642. }
  29643. /**
  29644. * Checks if `value` is classified as a `RegExp` object.
  29645. *
  29646. * @static
  29647. * @memberOf _
  29648. * @since 0.1.0
  29649. * @category Lang
  29650. * @param {*} value The value to check.
  29651. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  29652. * @example
  29653. *
  29654. * _.isRegExp(/abc/);
  29655. * // => true
  29656. *
  29657. * _.isRegExp('/abc/');
  29658. * // => false
  29659. */
  29660. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  29661. /**
  29662. * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
  29663. * double precision number which isn't the result of a rounded unsafe integer.
  29664. *
  29665. * **Note:** This method is based on
  29666. * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
  29667. *
  29668. * @static
  29669. * @memberOf _
  29670. * @since 4.0.0
  29671. * @category Lang
  29672. * @param {*} value The value to check.
  29673. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
  29674. * @example
  29675. *
  29676. * _.isSafeInteger(3);
  29677. * // => true
  29678. *
  29679. * _.isSafeInteger(Number.MIN_VALUE);
  29680. * // => false
  29681. *
  29682. * _.isSafeInteger(Infinity);
  29683. * // => false
  29684. *
  29685. * _.isSafeInteger('3');
  29686. * // => false
  29687. */
  29688. function isSafeInteger(value) {
  29689. return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
  29690. }
  29691. /**
  29692. * Checks if `value` is classified as a `Set` object.
  29693. *
  29694. * @static
  29695. * @memberOf _
  29696. * @since 4.3.0
  29697. * @category Lang
  29698. * @param {*} value The value to check.
  29699. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  29700. * @example
  29701. *
  29702. * _.isSet(new Set);
  29703. * // => true
  29704. *
  29705. * _.isSet(new WeakSet);
  29706. * // => false
  29707. */
  29708. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  29709. /**
  29710. * Checks if `value` is classified as a `String` primitive or object.
  29711. *
  29712. * @static
  29713. * @since 0.1.0
  29714. * @memberOf _
  29715. * @category Lang
  29716. * @param {*} value The value to check.
  29717. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  29718. * @example
  29719. *
  29720. * _.isString('abc');
  29721. * // => true
  29722. *
  29723. * _.isString(1);
  29724. * // => false
  29725. */
  29726. function isString(value) {
  29727. return typeof value == 'string' ||
  29728. (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
  29729. }
  29730. /**
  29731. * Checks if `value` is classified as a `Symbol` primitive or object.
  29732. *
  29733. * @static
  29734. * @memberOf _
  29735. * @since 4.0.0
  29736. * @category Lang
  29737. * @param {*} value The value to check.
  29738. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  29739. * @example
  29740. *
  29741. * _.isSymbol(Symbol.iterator);
  29742. * // => true
  29743. *
  29744. * _.isSymbol('abc');
  29745. * // => false
  29746. */
  29747. function isSymbol(value) {
  29748. return typeof value == 'symbol' ||
  29749. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  29750. }
  29751. /**
  29752. * Checks if `value` is classified as a typed array.
  29753. *
  29754. * @static
  29755. * @memberOf _
  29756. * @since 3.0.0
  29757. * @category Lang
  29758. * @param {*} value The value to check.
  29759. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  29760. * @example
  29761. *
  29762. * _.isTypedArray(new Uint8Array);
  29763. * // => true
  29764. *
  29765. * _.isTypedArray([]);
  29766. * // => false
  29767. */
  29768. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  29769. /**
  29770. * Checks if `value` is `undefined`.
  29771. *
  29772. * @static
  29773. * @since 0.1.0
  29774. * @memberOf _
  29775. * @category Lang
  29776. * @param {*} value The value to check.
  29777. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  29778. * @example
  29779. *
  29780. * _.isUndefined(void 0);
  29781. * // => true
  29782. *
  29783. * _.isUndefined(null);
  29784. * // => false
  29785. */
  29786. function isUndefined(value) {
  29787. return value === undefined;
  29788. }
  29789. /**
  29790. * Checks if `value` is classified as a `WeakMap` object.
  29791. *
  29792. * @static
  29793. * @memberOf _
  29794. * @since 4.3.0
  29795. * @category Lang
  29796. * @param {*} value The value to check.
  29797. * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
  29798. * @example
  29799. *
  29800. * _.isWeakMap(new WeakMap);
  29801. * // => true
  29802. *
  29803. * _.isWeakMap(new Map);
  29804. * // => false
  29805. */
  29806. function isWeakMap(value) {
  29807. return isObjectLike(value) && getTag(value) == weakMapTag;
  29808. }
  29809. /**
  29810. * Checks if `value` is classified as a `WeakSet` object.
  29811. *
  29812. * @static
  29813. * @memberOf _
  29814. * @since 4.3.0
  29815. * @category Lang
  29816. * @param {*} value The value to check.
  29817. * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
  29818. * @example
  29819. *
  29820. * _.isWeakSet(new WeakSet);
  29821. * // => true
  29822. *
  29823. * _.isWeakSet(new Set);
  29824. * // => false
  29825. */
  29826. function isWeakSet(value) {
  29827. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  29828. }
  29829. /**
  29830. * Checks if `value` is less than `other`.
  29831. *
  29832. * @static
  29833. * @memberOf _
  29834. * @since 3.9.0
  29835. * @category Lang
  29836. * @param {*} value The value to compare.
  29837. * @param {*} other The other value to compare.
  29838. * @returns {boolean} Returns `true` if `value` is less than `other`,
  29839. * else `false`.
  29840. * @see _.gt
  29841. * @example
  29842. *
  29843. * _.lt(1, 3);
  29844. * // => true
  29845. *
  29846. * _.lt(3, 3);
  29847. * // => false
  29848. *
  29849. * _.lt(3, 1);
  29850. * // => false
  29851. */
  29852. var lt = createRelationalOperation(baseLt);
  29853. /**
  29854. * Checks if `value` is less than or equal to `other`.
  29855. *
  29856. * @static
  29857. * @memberOf _
  29858. * @since 3.9.0
  29859. * @category Lang
  29860. * @param {*} value The value to compare.
  29861. * @param {*} other The other value to compare.
  29862. * @returns {boolean} Returns `true` if `value` is less than or equal to
  29863. * `other`, else `false`.
  29864. * @see _.gte
  29865. * @example
  29866. *
  29867. * _.lte(1, 3);
  29868. * // => true
  29869. *
  29870. * _.lte(3, 3);
  29871. * // => true
  29872. *
  29873. * _.lte(3, 1);
  29874. * // => false
  29875. */
  29876. var lte = createRelationalOperation(function(value, other) {
  29877. return value <= other;
  29878. });
  29879. /**
  29880. * Converts `value` to an array.
  29881. *
  29882. * @static
  29883. * @since 0.1.0
  29884. * @memberOf _
  29885. * @category Lang
  29886. * @param {*} value The value to convert.
  29887. * @returns {Array} Returns the converted array.
  29888. * @example
  29889. *
  29890. * _.toArray({ 'a': 1, 'b': 2 });
  29891. * // => [1, 2]
  29892. *
  29893. * _.toArray('abc');
  29894. * // => ['a', 'b', 'c']
  29895. *
  29896. * _.toArray(1);
  29897. * // => []
  29898. *
  29899. * _.toArray(null);
  29900. * // => []
  29901. */
  29902. function toArray(value) {
  29903. if (!value) {
  29904. return [];
  29905. }
  29906. if (isArrayLike(value)) {
  29907. return isString(value) ? stringToArray(value) : copyArray(value);
  29908. }
  29909. if (symIterator && value[symIterator]) {
  29910. return iteratorToArray(value[symIterator]());
  29911. }
  29912. var tag = getTag(value),
  29913. func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
  29914. return func(value);
  29915. }
  29916. /**
  29917. * Converts `value` to a finite number.
  29918. *
  29919. * @static
  29920. * @memberOf _
  29921. * @since 4.12.0
  29922. * @category Lang
  29923. * @param {*} value The value to convert.
  29924. * @returns {number} Returns the converted number.
  29925. * @example
  29926. *
  29927. * _.toFinite(3.2);
  29928. * // => 3.2
  29929. *
  29930. * _.toFinite(Number.MIN_VALUE);
  29931. * // => 5e-324
  29932. *
  29933. * _.toFinite(Infinity);
  29934. * // => 1.7976931348623157e+308
  29935. *
  29936. * _.toFinite('3.2');
  29937. * // => 3.2
  29938. */
  29939. function toFinite(value) {
  29940. if (!value) {
  29941. return value === 0 ? value : 0;
  29942. }
  29943. value = toNumber(value);
  29944. if (value === INFINITY || value === -INFINITY) {
  29945. var sign = (value < 0 ? -1 : 1);
  29946. return sign * MAX_INTEGER;
  29947. }
  29948. return value === value ? value : 0;
  29949. }
  29950. /**
  29951. * Converts `value` to an integer.
  29952. *
  29953. * **Note:** This method is loosely based on
  29954. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  29955. *
  29956. * @static
  29957. * @memberOf _
  29958. * @since 4.0.0
  29959. * @category Lang
  29960. * @param {*} value The value to convert.
  29961. * @returns {number} Returns the converted integer.
  29962. * @example
  29963. *
  29964. * _.toInteger(3.2);
  29965. * // => 3
  29966. *
  29967. * _.toInteger(Number.MIN_VALUE);
  29968. * // => 0
  29969. *
  29970. * _.toInteger(Infinity);
  29971. * // => 1.7976931348623157e+308
  29972. *
  29973. * _.toInteger('3.2');
  29974. * // => 3
  29975. */
  29976. function toInteger(value) {
  29977. var result = toFinite(value),
  29978. remainder = result % 1;
  29979. return result === result ? (remainder ? result - remainder : result) : 0;
  29980. }
  29981. /**
  29982. * Converts `value` to an integer suitable for use as the length of an
  29983. * array-like object.
  29984. *
  29985. * **Note:** This method is based on
  29986. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  29987. *
  29988. * @static
  29989. * @memberOf _
  29990. * @since 4.0.0
  29991. * @category Lang
  29992. * @param {*} value The value to convert.
  29993. * @returns {number} Returns the converted integer.
  29994. * @example
  29995. *
  29996. * _.toLength(3.2);
  29997. * // => 3
  29998. *
  29999. * _.toLength(Number.MIN_VALUE);
  30000. * // => 0
  30001. *
  30002. * _.toLength(Infinity);
  30003. * // => 4294967295
  30004. *
  30005. * _.toLength('3.2');
  30006. * // => 3
  30007. */
  30008. function toLength(value) {
  30009. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
  30010. }
  30011. /**
  30012. * Converts `value` to a number.
  30013. *
  30014. * @static
  30015. * @memberOf _
  30016. * @since 4.0.0
  30017. * @category Lang
  30018. * @param {*} value The value to process.
  30019. * @returns {number} Returns the number.
  30020. * @example
  30021. *
  30022. * _.toNumber(3.2);
  30023. * // => 3.2
  30024. *
  30025. * _.toNumber(Number.MIN_VALUE);
  30026. * // => 5e-324
  30027. *
  30028. * _.toNumber(Infinity);
  30029. * // => Infinity
  30030. *
  30031. * _.toNumber('3.2');
  30032. * // => 3.2
  30033. */
  30034. function toNumber(value) {
  30035. if (typeof value == 'number') {
  30036. return value;
  30037. }
  30038. if (isSymbol(value)) {
  30039. return NAN;
  30040. }
  30041. if (isObject(value)) {
  30042. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  30043. value = isObject(other) ? (other + '') : other;
  30044. }
  30045. if (typeof value != 'string') {
  30046. return value === 0 ? value : +value;
  30047. }
  30048. value = value.replace(reTrim, '');
  30049. var isBinary = reIsBinary.test(value);
  30050. return (isBinary || reIsOctal.test(value))
  30051. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  30052. : (reIsBadHex.test(value) ? NAN : +value);
  30053. }
  30054. /**
  30055. * Converts `value` to a plain object flattening inherited enumerable string
  30056. * keyed properties of `value` to own properties of the plain object.
  30057. *
  30058. * @static
  30059. * @memberOf _
  30060. * @since 3.0.0
  30061. * @category Lang
  30062. * @param {*} value The value to convert.
  30063. * @returns {Object} Returns the converted plain object.
  30064. * @example
  30065. *
  30066. * function Foo() {
  30067. * this.b = 2;
  30068. * }
  30069. *
  30070. * Foo.prototype.c = 3;
  30071. *
  30072. * _.assign({ 'a': 1 }, new Foo);
  30073. * // => { 'a': 1, 'b': 2 }
  30074. *
  30075. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  30076. * // => { 'a': 1, 'b': 2, 'c': 3 }
  30077. */
  30078. function toPlainObject(value) {
  30079. return copyObject(value, keysIn(value));
  30080. }
  30081. /**
  30082. * Converts `value` to a safe integer. A safe integer can be compared and
  30083. * represented correctly.
  30084. *
  30085. * @static
  30086. * @memberOf _
  30087. * @since 4.0.0
  30088. * @category Lang
  30089. * @param {*} value The value to convert.
  30090. * @returns {number} Returns the converted integer.
  30091. * @example
  30092. *
  30093. * _.toSafeInteger(3.2);
  30094. * // => 3
  30095. *
  30096. * _.toSafeInteger(Number.MIN_VALUE);
  30097. * // => 0
  30098. *
  30099. * _.toSafeInteger(Infinity);
  30100. * // => 9007199254740991
  30101. *
  30102. * _.toSafeInteger('3.2');
  30103. * // => 3
  30104. */
  30105. function toSafeInteger(value) {
  30106. return value
  30107. ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
  30108. : (value === 0 ? value : 0);
  30109. }
  30110. /**
  30111. * Converts `value` to a string. An empty string is returned for `null`
  30112. * and `undefined` values. The sign of `-0` is preserved.
  30113. *
  30114. * @static
  30115. * @memberOf _
  30116. * @since 4.0.0
  30117. * @category Lang
  30118. * @param {*} value The value to convert.
  30119. * @returns {string} Returns the converted string.
  30120. * @example
  30121. *
  30122. * _.toString(null);
  30123. * // => ''
  30124. *
  30125. * _.toString(-0);
  30126. * // => '-0'
  30127. *
  30128. * _.toString([1, 2, 3]);
  30129. * // => '1,2,3'
  30130. */
  30131. function toString(value) {
  30132. return value == null ? '' : baseToString(value);
  30133. }
  30134. /*------------------------------------------------------------------------*/
  30135. /**
  30136. * Assigns own enumerable string keyed properties of source objects to the
  30137. * destination object. Source objects are applied from left to right.
  30138. * Subsequent sources overwrite property assignments of previous sources.
  30139. *
  30140. * **Note:** This method mutates `object` and is loosely based on
  30141. * [`Object.assign`](https://mdn.io/Object/assign).
  30142. *
  30143. * @static
  30144. * @memberOf _
  30145. * @since 0.10.0
  30146. * @category Object
  30147. * @param {Object} object The destination object.
  30148. * @param {...Object} [sources] The source objects.
  30149. * @returns {Object} Returns `object`.
  30150. * @see _.assignIn
  30151. * @example
  30152. *
  30153. * function Foo() {
  30154. * this.a = 1;
  30155. * }
  30156. *
  30157. * function Bar() {
  30158. * this.c = 3;
  30159. * }
  30160. *
  30161. * Foo.prototype.b = 2;
  30162. * Bar.prototype.d = 4;
  30163. *
  30164. * _.assign({ 'a': 0 }, new Foo, new Bar);
  30165. * // => { 'a': 1, 'c': 3 }
  30166. */
  30167. var assign = createAssigner(function(object, source) {
  30168. if (isPrototype(source) || isArrayLike(source)) {
  30169. copyObject(source, keys(source), object);
  30170. return;
  30171. }
  30172. for (var key in source) {
  30173. if (hasOwnProperty.call(source, key)) {
  30174. assignValue(object, key, source[key]);
  30175. }
  30176. }
  30177. });
  30178. /**
  30179. * This method is like `_.assign` except that it iterates over own and
  30180. * inherited source properties.
  30181. *
  30182. * **Note:** This method mutates `object`.
  30183. *
  30184. * @static
  30185. * @memberOf _
  30186. * @since 4.0.0
  30187. * @alias extend
  30188. * @category Object
  30189. * @param {Object} object The destination object.
  30190. * @param {...Object} [sources] The source objects.
  30191. * @returns {Object} Returns `object`.
  30192. * @see _.assign
  30193. * @example
  30194. *
  30195. * function Foo() {
  30196. * this.a = 1;
  30197. * }
  30198. *
  30199. * function Bar() {
  30200. * this.c = 3;
  30201. * }
  30202. *
  30203. * Foo.prototype.b = 2;
  30204. * Bar.prototype.d = 4;
  30205. *
  30206. * _.assignIn({ 'a': 0 }, new Foo, new Bar);
  30207. * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
  30208. */
  30209. var assignIn = createAssigner(function(object, source) {
  30210. copyObject(source, keysIn(source), object);
  30211. });
  30212. /**
  30213. * This method is like `_.assignIn` except that it accepts `customizer`
  30214. * which is invoked to produce the assigned values. If `customizer` returns
  30215. * `undefined`, assignment is handled by the method instead. The `customizer`
  30216. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  30217. *
  30218. * **Note:** This method mutates `object`.
  30219. *
  30220. * @static
  30221. * @memberOf _
  30222. * @since 4.0.0
  30223. * @alias extendWith
  30224. * @category Object
  30225. * @param {Object} object The destination object.
  30226. * @param {...Object} sources The source objects.
  30227. * @param {Function} [customizer] The function to customize assigned values.
  30228. * @returns {Object} Returns `object`.
  30229. * @see _.assignWith
  30230. * @example
  30231. *
  30232. * function customizer(objValue, srcValue) {
  30233. * return _.isUndefined(objValue) ? srcValue : objValue;
  30234. * }
  30235. *
  30236. * var defaults = _.partialRight(_.assignInWith, customizer);
  30237. *
  30238. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30239. * // => { 'a': 1, 'b': 2 }
  30240. */
  30241. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  30242. copyObject(source, keysIn(source), object, customizer);
  30243. });
  30244. /**
  30245. * This method is like `_.assign` except that it accepts `customizer`
  30246. * which is invoked to produce the assigned values. If `customizer` returns
  30247. * `undefined`, assignment is handled by the method instead. The `customizer`
  30248. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  30249. *
  30250. * **Note:** This method mutates `object`.
  30251. *
  30252. * @static
  30253. * @memberOf _
  30254. * @since 4.0.0
  30255. * @category Object
  30256. * @param {Object} object The destination object.
  30257. * @param {...Object} sources The source objects.
  30258. * @param {Function} [customizer] The function to customize assigned values.
  30259. * @returns {Object} Returns `object`.
  30260. * @see _.assignInWith
  30261. * @example
  30262. *
  30263. * function customizer(objValue, srcValue) {
  30264. * return _.isUndefined(objValue) ? srcValue : objValue;
  30265. * }
  30266. *
  30267. * var defaults = _.partialRight(_.assignWith, customizer);
  30268. *
  30269. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30270. * // => { 'a': 1, 'b': 2 }
  30271. */
  30272. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  30273. copyObject(source, keys(source), object, customizer);
  30274. });
  30275. /**
  30276. * Creates an array of values corresponding to `paths` of `object`.
  30277. *
  30278. * @static
  30279. * @memberOf _
  30280. * @since 1.0.0
  30281. * @category Object
  30282. * @param {Object} object The object to iterate over.
  30283. * @param {...(string|string[])} [paths] The property paths to pick.
  30284. * @returns {Array} Returns the picked values.
  30285. * @example
  30286. *
  30287. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  30288. *
  30289. * _.at(object, ['a[0].b.c', 'a[1]']);
  30290. * // => [3, 4]
  30291. */
  30292. var at = flatRest(baseAt);
  30293. /**
  30294. * Creates an object that inherits from the `prototype` object. If a
  30295. * `properties` object is given, its own enumerable string keyed properties
  30296. * are assigned to the created object.
  30297. *
  30298. * @static
  30299. * @memberOf _
  30300. * @since 2.3.0
  30301. * @category Object
  30302. * @param {Object} prototype The object to inherit from.
  30303. * @param {Object} [properties] The properties to assign to the object.
  30304. * @returns {Object} Returns the new object.
  30305. * @example
  30306. *
  30307. * function Shape() {
  30308. * this.x = 0;
  30309. * this.y = 0;
  30310. * }
  30311. *
  30312. * function Circle() {
  30313. * Shape.call(this);
  30314. * }
  30315. *
  30316. * Circle.prototype = _.create(Shape.prototype, {
  30317. * 'constructor': Circle
  30318. * });
  30319. *
  30320. * var circle = new Circle;
  30321. * circle instanceof Circle;
  30322. * // => true
  30323. *
  30324. * circle instanceof Shape;
  30325. * // => true
  30326. */
  30327. function create(prototype, properties) {
  30328. var result = baseCreate(prototype);
  30329. return properties == null ? result : baseAssign(result, properties);
  30330. }
  30331. /**
  30332. * Assigns own and inherited enumerable string keyed properties of source
  30333. * objects to the destination object for all destination properties that
  30334. * resolve to `undefined`. Source objects are applied from left to right.
  30335. * Once a property is set, additional values of the same property are ignored.
  30336. *
  30337. * **Note:** This method mutates `object`.
  30338. *
  30339. * @static
  30340. * @since 0.1.0
  30341. * @memberOf _
  30342. * @category Object
  30343. * @param {Object} object The destination object.
  30344. * @param {...Object} [sources] The source objects.
  30345. * @returns {Object} Returns `object`.
  30346. * @see _.defaultsDeep
  30347. * @example
  30348. *
  30349. * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30350. * // => { 'a': 1, 'b': 2 }
  30351. */
  30352. var defaults = baseRest(function(object, sources) {
  30353. object = Object(object);
  30354. var index = -1;
  30355. var length = sources.length;
  30356. var guard = length > 2 ? sources[2] : undefined;
  30357. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  30358. length = 1;
  30359. }
  30360. while (++index < length) {
  30361. var source = sources[index];
  30362. var props = keysIn(source);
  30363. var propsIndex = -1;
  30364. var propsLength = props.length;
  30365. while (++propsIndex < propsLength) {
  30366. var key = props[propsIndex];
  30367. var value = object[key];
  30368. if (value === undefined ||
  30369. (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  30370. object[key] = source[key];
  30371. }
  30372. }
  30373. }
  30374. return object;
  30375. });
  30376. /**
  30377. * This method is like `_.defaults` except that it recursively assigns
  30378. * default properties.
  30379. *
  30380. * **Note:** This method mutates `object`.
  30381. *
  30382. * @static
  30383. * @memberOf _
  30384. * @since 3.10.0
  30385. * @category Object
  30386. * @param {Object} object The destination object.
  30387. * @param {...Object} [sources] The source objects.
  30388. * @returns {Object} Returns `object`.
  30389. * @see _.defaults
  30390. * @example
  30391. *
  30392. * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
  30393. * // => { 'a': { 'b': 2, 'c': 3 } }
  30394. */
  30395. var defaultsDeep = baseRest(function(args) {
  30396. args.push(undefined, customDefaultsMerge);
  30397. return apply(mergeWith, undefined, args);
  30398. });
  30399. /**
  30400. * This method is like `_.find` except that it returns the key of the first
  30401. * element `predicate` returns truthy for instead of the element itself.
  30402. *
  30403. * @static
  30404. * @memberOf _
  30405. * @since 1.1.0
  30406. * @category Object
  30407. * @param {Object} object The object to inspect.
  30408. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  30409. * @returns {string|undefined} Returns the key of the matched element,
  30410. * else `undefined`.
  30411. * @example
  30412. *
  30413. * var users = {
  30414. * 'barney': { 'age': 36, 'active': true },
  30415. * 'fred': { 'age': 40, 'active': false },
  30416. * 'pebbles': { 'age': 1, 'active': true }
  30417. * };
  30418. *
  30419. * _.findKey(users, function(o) { return o.age < 40; });
  30420. * // => 'barney' (iteration order is not guaranteed)
  30421. *
  30422. * // The `_.matches` iteratee shorthand.
  30423. * _.findKey(users, { 'age': 1, 'active': true });
  30424. * // => 'pebbles'
  30425. *
  30426. * // The `_.matchesProperty` iteratee shorthand.
  30427. * _.findKey(users, ['active', false]);
  30428. * // => 'fred'
  30429. *
  30430. * // The `_.property` iteratee shorthand.
  30431. * _.findKey(users, 'active');
  30432. * // => 'barney'
  30433. */
  30434. function findKey(object, predicate) {
  30435. return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
  30436. }
  30437. /**
  30438. * This method is like `_.findKey` except that it iterates over elements of
  30439. * a collection in the opposite order.
  30440. *
  30441. * @static
  30442. * @memberOf _
  30443. * @since 2.0.0
  30444. * @category Object
  30445. * @param {Object} object The object to inspect.
  30446. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  30447. * @returns {string|undefined} Returns the key of the matched element,
  30448. * else `undefined`.
  30449. * @example
  30450. *
  30451. * var users = {
  30452. * 'barney': { 'age': 36, 'active': true },
  30453. * 'fred': { 'age': 40, 'active': false },
  30454. * 'pebbles': { 'age': 1, 'active': true }
  30455. * };
  30456. *
  30457. * _.findLastKey(users, function(o) { return o.age < 40; });
  30458. * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
  30459. *
  30460. * // The `_.matches` iteratee shorthand.
  30461. * _.findLastKey(users, { 'age': 36, 'active': true });
  30462. * // => 'barney'
  30463. *
  30464. * // The `_.matchesProperty` iteratee shorthand.
  30465. * _.findLastKey(users, ['active', false]);
  30466. * // => 'fred'
  30467. *
  30468. * // The `_.property` iteratee shorthand.
  30469. * _.findLastKey(users, 'active');
  30470. * // => 'pebbles'
  30471. */
  30472. function findLastKey(object, predicate) {
  30473. return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
  30474. }
  30475. /**
  30476. * Iterates over own and inherited enumerable string keyed properties of an
  30477. * object and invokes `iteratee` for each property. The iteratee is invoked
  30478. * with three arguments: (value, key, object). Iteratee functions may exit
  30479. * iteration early by explicitly returning `false`.
  30480. *
  30481. * @static
  30482. * @memberOf _
  30483. * @since 0.3.0
  30484. * @category Object
  30485. * @param {Object} object The object to iterate over.
  30486. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30487. * @returns {Object} Returns `object`.
  30488. * @see _.forInRight
  30489. * @example
  30490. *
  30491. * function Foo() {
  30492. * this.a = 1;
  30493. * this.b = 2;
  30494. * }
  30495. *
  30496. * Foo.prototype.c = 3;
  30497. *
  30498. * _.forIn(new Foo, function(value, key) {
  30499. * console.log(key);
  30500. * });
  30501. * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
  30502. */
  30503. function forIn(object, iteratee) {
  30504. return object == null
  30505. ? object
  30506. : baseFor(object, getIteratee(iteratee, 3), keysIn);
  30507. }
  30508. /**
  30509. * This method is like `_.forIn` except that it iterates over properties of
  30510. * `object` in the opposite order.
  30511. *
  30512. * @static
  30513. * @memberOf _
  30514. * @since 2.0.0
  30515. * @category Object
  30516. * @param {Object} object The object to iterate over.
  30517. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30518. * @returns {Object} Returns `object`.
  30519. * @see _.forIn
  30520. * @example
  30521. *
  30522. * function Foo() {
  30523. * this.a = 1;
  30524. * this.b = 2;
  30525. * }
  30526. *
  30527. * Foo.prototype.c = 3;
  30528. *
  30529. * _.forInRight(new Foo, function(value, key) {
  30530. * console.log(key);
  30531. * });
  30532. * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
  30533. */
  30534. function forInRight(object, iteratee) {
  30535. return object == null
  30536. ? object
  30537. : baseForRight(object, getIteratee(iteratee, 3), keysIn);
  30538. }
  30539. /**
  30540. * Iterates over own enumerable string keyed properties of an object and
  30541. * invokes `iteratee` for each property. The iteratee is invoked with three
  30542. * arguments: (value, key, object). Iteratee functions may exit iteration
  30543. * early by explicitly returning `false`.
  30544. *
  30545. * @static
  30546. * @memberOf _
  30547. * @since 0.3.0
  30548. * @category Object
  30549. * @param {Object} object The object to iterate over.
  30550. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30551. * @returns {Object} Returns `object`.
  30552. * @see _.forOwnRight
  30553. * @example
  30554. *
  30555. * function Foo() {
  30556. * this.a = 1;
  30557. * this.b = 2;
  30558. * }
  30559. *
  30560. * Foo.prototype.c = 3;
  30561. *
  30562. * _.forOwn(new Foo, function(value, key) {
  30563. * console.log(key);
  30564. * });
  30565. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  30566. */
  30567. function forOwn(object, iteratee) {
  30568. return object && baseForOwn(object, getIteratee(iteratee, 3));
  30569. }
  30570. /**
  30571. * This method is like `_.forOwn` except that it iterates over properties of
  30572. * `object` in the opposite order.
  30573. *
  30574. * @static
  30575. * @memberOf _
  30576. * @since 2.0.0
  30577. * @category Object
  30578. * @param {Object} object The object to iterate over.
  30579. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30580. * @returns {Object} Returns `object`.
  30581. * @see _.forOwn
  30582. * @example
  30583. *
  30584. * function Foo() {
  30585. * this.a = 1;
  30586. * this.b = 2;
  30587. * }
  30588. *
  30589. * Foo.prototype.c = 3;
  30590. *
  30591. * _.forOwnRight(new Foo, function(value, key) {
  30592. * console.log(key);
  30593. * });
  30594. * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
  30595. */
  30596. function forOwnRight(object, iteratee) {
  30597. return object && baseForOwnRight(object, getIteratee(iteratee, 3));
  30598. }
  30599. /**
  30600. * Creates an array of function property names from own enumerable properties
  30601. * of `object`.
  30602. *
  30603. * @static
  30604. * @since 0.1.0
  30605. * @memberOf _
  30606. * @category Object
  30607. * @param {Object} object The object to inspect.
  30608. * @returns {Array} Returns the function names.
  30609. * @see _.functionsIn
  30610. * @example
  30611. *
  30612. * function Foo() {
  30613. * this.a = _.constant('a');
  30614. * this.b = _.constant('b');
  30615. * }
  30616. *
  30617. * Foo.prototype.c = _.constant('c');
  30618. *
  30619. * _.functions(new Foo);
  30620. * // => ['a', 'b']
  30621. */
  30622. function functions(object) {
  30623. return object == null ? [] : baseFunctions(object, keys(object));
  30624. }
  30625. /**
  30626. * Creates an array of function property names from own and inherited
  30627. * enumerable properties of `object`.
  30628. *
  30629. * @static
  30630. * @memberOf _
  30631. * @since 4.0.0
  30632. * @category Object
  30633. * @param {Object} object The object to inspect.
  30634. * @returns {Array} Returns the function names.
  30635. * @see _.functions
  30636. * @example
  30637. *
  30638. * function Foo() {
  30639. * this.a = _.constant('a');
  30640. * this.b = _.constant('b');
  30641. * }
  30642. *
  30643. * Foo.prototype.c = _.constant('c');
  30644. *
  30645. * _.functionsIn(new Foo);
  30646. * // => ['a', 'b', 'c']
  30647. */
  30648. function functionsIn(object) {
  30649. return object == null ? [] : baseFunctions(object, keysIn(object));
  30650. }
  30651. /**
  30652. * Gets the value at `path` of `object`. If the resolved value is
  30653. * `undefined`, the `defaultValue` is returned in its place.
  30654. *
  30655. * @static
  30656. * @memberOf _
  30657. * @since 3.7.0
  30658. * @category Object
  30659. * @param {Object} object The object to query.
  30660. * @param {Array|string} path The path of the property to get.
  30661. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  30662. * @returns {*} Returns the resolved value.
  30663. * @example
  30664. *
  30665. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  30666. *
  30667. * _.get(object, 'a[0].b.c');
  30668. * // => 3
  30669. *
  30670. * _.get(object, ['a', '0', 'b', 'c']);
  30671. * // => 3
  30672. *
  30673. * _.get(object, 'a.b.c', 'default');
  30674. * // => 'default'
  30675. */
  30676. function get(object, path, defaultValue) {
  30677. var result = object == null ? undefined : baseGet(object, path);
  30678. return result === undefined ? defaultValue : result;
  30679. }
  30680. /**
  30681. * Checks if `path` is a direct property of `object`.
  30682. *
  30683. * @static
  30684. * @since 0.1.0
  30685. * @memberOf _
  30686. * @category Object
  30687. * @param {Object} object The object to query.
  30688. * @param {Array|string} path The path to check.
  30689. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  30690. * @example
  30691. *
  30692. * var object = { 'a': { 'b': 2 } };
  30693. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  30694. *
  30695. * _.has(object, 'a');
  30696. * // => true
  30697. *
  30698. * _.has(object, 'a.b');
  30699. * // => true
  30700. *
  30701. * _.has(object, ['a', 'b']);
  30702. * // => true
  30703. *
  30704. * _.has(other, 'a');
  30705. * // => false
  30706. */
  30707. function has(object, path) {
  30708. return object != null && hasPath(object, path, baseHas);
  30709. }
  30710. /**
  30711. * Checks if `path` is a direct or inherited property of `object`.
  30712. *
  30713. * @static
  30714. * @memberOf _
  30715. * @since 4.0.0
  30716. * @category Object
  30717. * @param {Object} object The object to query.
  30718. * @param {Array|string} path The path to check.
  30719. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  30720. * @example
  30721. *
  30722. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  30723. *
  30724. * _.hasIn(object, 'a');
  30725. * // => true
  30726. *
  30727. * _.hasIn(object, 'a.b');
  30728. * // => true
  30729. *
  30730. * _.hasIn(object, ['a', 'b']);
  30731. * // => true
  30732. *
  30733. * _.hasIn(object, 'b');
  30734. * // => false
  30735. */
  30736. function hasIn(object, path) {
  30737. return object != null && hasPath(object, path, baseHasIn);
  30738. }
  30739. /**
  30740. * Creates an object composed of the inverted keys and values of `object`.
  30741. * If `object` contains duplicate values, subsequent values overwrite
  30742. * property assignments of previous values.
  30743. *
  30744. * @static
  30745. * @memberOf _
  30746. * @since 0.7.0
  30747. * @category Object
  30748. * @param {Object} object The object to invert.
  30749. * @returns {Object} Returns the new inverted object.
  30750. * @example
  30751. *
  30752. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  30753. *
  30754. * _.invert(object);
  30755. * // => { '1': 'c', '2': 'b' }
  30756. */
  30757. var invert = createInverter(function(result, value, key) {
  30758. if (value != null &&
  30759. typeof value.toString != 'function') {
  30760. value = nativeObjectToString.call(value);
  30761. }
  30762. result[value] = key;
  30763. }, constant(identity));
  30764. /**
  30765. * This method is like `_.invert` except that the inverted object is generated
  30766. * from the results of running each element of `object` thru `iteratee`. The
  30767. * corresponding inverted value of each inverted key is an array of keys
  30768. * responsible for generating the inverted value. The iteratee is invoked
  30769. * with one argument: (value).
  30770. *
  30771. * @static
  30772. * @memberOf _
  30773. * @since 4.1.0
  30774. * @category Object
  30775. * @param {Object} object The object to invert.
  30776. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  30777. * @returns {Object} Returns the new inverted object.
  30778. * @example
  30779. *
  30780. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  30781. *
  30782. * _.invertBy(object);
  30783. * // => { '1': ['a', 'c'], '2': ['b'] }
  30784. *
  30785. * _.invertBy(object, function(value) {
  30786. * return 'group' + value;
  30787. * });
  30788. * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
  30789. */
  30790. var invertBy = createInverter(function(result, value, key) {
  30791. if (value != null &&
  30792. typeof value.toString != 'function') {
  30793. value = nativeObjectToString.call(value);
  30794. }
  30795. if (hasOwnProperty.call(result, value)) {
  30796. result[value].push(key);
  30797. } else {
  30798. result[value] = [key];
  30799. }
  30800. }, getIteratee);
  30801. /**
  30802. * Invokes the method at `path` of `object`.
  30803. *
  30804. * @static
  30805. * @memberOf _
  30806. * @since 4.0.0
  30807. * @category Object
  30808. * @param {Object} object The object to query.
  30809. * @param {Array|string} path The path of the method to invoke.
  30810. * @param {...*} [args] The arguments to invoke the method with.
  30811. * @returns {*} Returns the result of the invoked method.
  30812. * @example
  30813. *
  30814. * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
  30815. *
  30816. * _.invoke(object, 'a[0].b.c.slice', 1, 3);
  30817. * // => [2, 3]
  30818. */
  30819. var invoke = baseRest(baseInvoke);
  30820. /**
  30821. * Creates an array of the own enumerable property names of `object`.
  30822. *
  30823. * **Note:** Non-object values are coerced to objects. See the
  30824. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  30825. * for more details.
  30826. *
  30827. * @static
  30828. * @since 0.1.0
  30829. * @memberOf _
  30830. * @category Object
  30831. * @param {Object} object The object to query.
  30832. * @returns {Array} Returns the array of property names.
  30833. * @example
  30834. *
  30835. * function Foo() {
  30836. * this.a = 1;
  30837. * this.b = 2;
  30838. * }
  30839. *
  30840. * Foo.prototype.c = 3;
  30841. *
  30842. * _.keys(new Foo);
  30843. * // => ['a', 'b'] (iteration order is not guaranteed)
  30844. *
  30845. * _.keys('hi');
  30846. * // => ['0', '1']
  30847. */
  30848. function keys(object) {
  30849. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  30850. }
  30851. /**
  30852. * Creates an array of the own and inherited enumerable property names of `object`.
  30853. *
  30854. * **Note:** Non-object values are coerced to objects.
  30855. *
  30856. * @static
  30857. * @memberOf _
  30858. * @since 3.0.0
  30859. * @category Object
  30860. * @param {Object} object The object to query.
  30861. * @returns {Array} Returns the array of property names.
  30862. * @example
  30863. *
  30864. * function Foo() {
  30865. * this.a = 1;
  30866. * this.b = 2;
  30867. * }
  30868. *
  30869. * Foo.prototype.c = 3;
  30870. *
  30871. * _.keysIn(new Foo);
  30872. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  30873. */
  30874. function keysIn(object) {
  30875. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  30876. }
  30877. /**
  30878. * The opposite of `_.mapValues`; this method creates an object with the
  30879. * same values as `object` and keys generated by running each own enumerable
  30880. * string keyed property of `object` thru `iteratee`. The iteratee is invoked
  30881. * with three arguments: (value, key, object).
  30882. *
  30883. * @static
  30884. * @memberOf _
  30885. * @since 3.8.0
  30886. * @category Object
  30887. * @param {Object} object The object to iterate over.
  30888. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30889. * @returns {Object} Returns the new mapped object.
  30890. * @see _.mapValues
  30891. * @example
  30892. *
  30893. * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
  30894. * return key + value;
  30895. * });
  30896. * // => { 'a1': 1, 'b2': 2 }
  30897. */
  30898. function mapKeys(object, iteratee) {
  30899. var result = {};
  30900. iteratee = getIteratee(iteratee, 3);
  30901. baseForOwn(object, function(value, key, object) {
  30902. baseAssignValue(result, iteratee(value, key, object), value);
  30903. });
  30904. return result;
  30905. }
  30906. /**
  30907. * Creates an object with the same keys as `object` and values generated
  30908. * by running each own enumerable string keyed property of `object` thru
  30909. * `iteratee`. The iteratee is invoked with three arguments:
  30910. * (value, key, object).
  30911. *
  30912. * @static
  30913. * @memberOf _
  30914. * @since 2.4.0
  30915. * @category Object
  30916. * @param {Object} object The object to iterate over.
  30917. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30918. * @returns {Object} Returns the new mapped object.
  30919. * @see _.mapKeys
  30920. * @example
  30921. *
  30922. * var users = {
  30923. * 'fred': { 'user': 'fred', 'age': 40 },
  30924. * 'pebbles': { 'user': 'pebbles', 'age': 1 }
  30925. * };
  30926. *
  30927. * _.mapValues(users, function(o) { return o.age; });
  30928. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  30929. *
  30930. * // The `_.property` iteratee shorthand.
  30931. * _.mapValues(users, 'age');
  30932. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  30933. */
  30934. function mapValues(object, iteratee) {
  30935. var result = {};
  30936. iteratee = getIteratee(iteratee, 3);
  30937. baseForOwn(object, function(value, key, object) {
  30938. baseAssignValue(result, key, iteratee(value, key, object));
  30939. });
  30940. return result;
  30941. }
  30942. /**
  30943. * This method is like `_.assign` except that it recursively merges own and
  30944. * inherited enumerable string keyed properties of source objects into the
  30945. * destination object. Source properties that resolve to `undefined` are
  30946. * skipped if a destination value exists. Array and plain object properties
  30947. * are merged recursively. Other objects and value types are overridden by
  30948. * assignment. Source objects are applied from left to right. Subsequent
  30949. * sources overwrite property assignments of previous sources.
  30950. *
  30951. * **Note:** This method mutates `object`.
  30952. *
  30953. * @static
  30954. * @memberOf _
  30955. * @since 0.5.0
  30956. * @category Object
  30957. * @param {Object} object The destination object.
  30958. * @param {...Object} [sources] The source objects.
  30959. * @returns {Object} Returns `object`.
  30960. * @example
  30961. *
  30962. * var object = {
  30963. * 'a': [{ 'b': 2 }, { 'd': 4 }]
  30964. * };
  30965. *
  30966. * var other = {
  30967. * 'a': [{ 'c': 3 }, { 'e': 5 }]
  30968. * };
  30969. *
  30970. * _.merge(object, other);
  30971. * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
  30972. */
  30973. var merge = createAssigner(function(object, source, srcIndex) {
  30974. baseMerge(object, source, srcIndex);
  30975. });
  30976. /**
  30977. * This method is like `_.merge` except that it accepts `customizer` which
  30978. * is invoked to produce the merged values of the destination and source
  30979. * properties. If `customizer` returns `undefined`, merging is handled by the
  30980. * method instead. The `customizer` is invoked with six arguments:
  30981. * (objValue, srcValue, key, object, source, stack).
  30982. *
  30983. * **Note:** This method mutates `object`.
  30984. *
  30985. * @static
  30986. * @memberOf _
  30987. * @since 4.0.0
  30988. * @category Object
  30989. * @param {Object} object The destination object.
  30990. * @param {...Object} sources The source objects.
  30991. * @param {Function} customizer The function to customize assigned values.
  30992. * @returns {Object} Returns `object`.
  30993. * @example
  30994. *
  30995. * function customizer(objValue, srcValue) {
  30996. * if (_.isArray(objValue)) {
  30997. * return objValue.concat(srcValue);
  30998. * }
  30999. * }
  31000. *
  31001. * var object = { 'a': [1], 'b': [2] };
  31002. * var other = { 'a': [3], 'b': [4] };
  31003. *
  31004. * _.mergeWith(object, other, customizer);
  31005. * // => { 'a': [1, 3], 'b': [2, 4] }
  31006. */
  31007. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  31008. baseMerge(object, source, srcIndex, customizer);
  31009. });
  31010. /**
  31011. * The opposite of `_.pick`; this method creates an object composed of the
  31012. * own and inherited enumerable property paths of `object` that are not omitted.
  31013. *
  31014. * **Note:** This method is considerably slower than `_.pick`.
  31015. *
  31016. * @static
  31017. * @since 0.1.0
  31018. * @memberOf _
  31019. * @category Object
  31020. * @param {Object} object The source object.
  31021. * @param {...(string|string[])} [paths] The property paths to omit.
  31022. * @returns {Object} Returns the new object.
  31023. * @example
  31024. *
  31025. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31026. *
  31027. * _.omit(object, ['a', 'c']);
  31028. * // => { 'b': '2' }
  31029. */
  31030. var omit = flatRest(function(object, paths) {
  31031. var result = {};
  31032. if (object == null) {
  31033. return result;
  31034. }
  31035. var isDeep = false;
  31036. paths = arrayMap(paths, function(path) {
  31037. path = castPath(path, object);
  31038. isDeep || (isDeep = path.length > 1);
  31039. return path;
  31040. });
  31041. copyObject(object, getAllKeysIn(object), result);
  31042. if (isDeep) {
  31043. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  31044. }
  31045. var length = paths.length;
  31046. while (length--) {
  31047. baseUnset(result, paths[length]);
  31048. }
  31049. return result;
  31050. });
  31051. /**
  31052. * The opposite of `_.pickBy`; this method creates an object composed of
  31053. * the own and inherited enumerable string keyed properties of `object` that
  31054. * `predicate` doesn't return truthy for. The predicate is invoked with two
  31055. * arguments: (value, key).
  31056. *
  31057. * @static
  31058. * @memberOf _
  31059. * @since 4.0.0
  31060. * @category Object
  31061. * @param {Object} object The source object.
  31062. * @param {Function} [predicate=_.identity] The function invoked per property.
  31063. * @returns {Object} Returns the new object.
  31064. * @example
  31065. *
  31066. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31067. *
  31068. * _.omitBy(object, _.isNumber);
  31069. * // => { 'b': '2' }
  31070. */
  31071. function omitBy(object, predicate) {
  31072. return pickBy(object, negate(getIteratee(predicate)));
  31073. }
  31074. /**
  31075. * Creates an object composed of the picked `object` properties.
  31076. *
  31077. * @static
  31078. * @since 0.1.0
  31079. * @memberOf _
  31080. * @category Object
  31081. * @param {Object} object The source object.
  31082. * @param {...(string|string[])} [paths] The property paths to pick.
  31083. * @returns {Object} Returns the new object.
  31084. * @example
  31085. *
  31086. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31087. *
  31088. * _.pick(object, ['a', 'c']);
  31089. * // => { 'a': 1, 'c': 3 }
  31090. */
  31091. var pick = flatRest(function(object, paths) {
  31092. return object == null ? {} : basePick(object, paths);
  31093. });
  31094. /**
  31095. * Creates an object composed of the `object` properties `predicate` returns
  31096. * truthy for. The predicate is invoked with two arguments: (value, key).
  31097. *
  31098. * @static
  31099. * @memberOf _
  31100. * @since 4.0.0
  31101. * @category Object
  31102. * @param {Object} object The source object.
  31103. * @param {Function} [predicate=_.identity] The function invoked per property.
  31104. * @returns {Object} Returns the new object.
  31105. * @example
  31106. *
  31107. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31108. *
  31109. * _.pickBy(object, _.isNumber);
  31110. * // => { 'a': 1, 'c': 3 }
  31111. */
  31112. function pickBy(object, predicate) {
  31113. if (object == null) {
  31114. return {};
  31115. }
  31116. var props = arrayMap(getAllKeysIn(object), function(prop) {
  31117. return [prop];
  31118. });
  31119. predicate = getIteratee(predicate);
  31120. return basePickBy(object, props, function(value, path) {
  31121. return predicate(value, path[0]);
  31122. });
  31123. }
  31124. /**
  31125. * This method is like `_.get` except that if the resolved value is a
  31126. * function it's invoked with the `this` binding of its parent object and
  31127. * its result is returned.
  31128. *
  31129. * @static
  31130. * @since 0.1.0
  31131. * @memberOf _
  31132. * @category Object
  31133. * @param {Object} object The object to query.
  31134. * @param {Array|string} path The path of the property to resolve.
  31135. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  31136. * @returns {*} Returns the resolved value.
  31137. * @example
  31138. *
  31139. * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
  31140. *
  31141. * _.result(object, 'a[0].b.c1');
  31142. * // => 3
  31143. *
  31144. * _.result(object, 'a[0].b.c2');
  31145. * // => 4
  31146. *
  31147. * _.result(object, 'a[0].b.c3', 'default');
  31148. * // => 'default'
  31149. *
  31150. * _.result(object, 'a[0].b.c3', _.constant('default'));
  31151. * // => 'default'
  31152. */
  31153. function result(object, path, defaultValue) {
  31154. path = castPath(path, object);
  31155. var index = -1,
  31156. length = path.length;
  31157. // Ensure the loop is entered when path is empty.
  31158. if (!length) {
  31159. length = 1;
  31160. object = undefined;
  31161. }
  31162. while (++index < length) {
  31163. var value = object == null ? undefined : object[toKey(path[index])];
  31164. if (value === undefined) {
  31165. index = length;
  31166. value = defaultValue;
  31167. }
  31168. object = isFunction(value) ? value.call(object) : value;
  31169. }
  31170. return object;
  31171. }
  31172. /**
  31173. * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
  31174. * it's created. Arrays are created for missing index properties while objects
  31175. * are created for all other missing properties. Use `_.setWith` to customize
  31176. * `path` creation.
  31177. *
  31178. * **Note:** This method mutates `object`.
  31179. *
  31180. * @static
  31181. * @memberOf _
  31182. * @since 3.7.0
  31183. * @category Object
  31184. * @param {Object} object The object to modify.
  31185. * @param {Array|string} path The path of the property to set.
  31186. * @param {*} value The value to set.
  31187. * @returns {Object} Returns `object`.
  31188. * @example
  31189. *
  31190. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  31191. *
  31192. * _.set(object, 'a[0].b.c', 4);
  31193. * console.log(object.a[0].b.c);
  31194. * // => 4
  31195. *
  31196. * _.set(object, ['x', '0', 'y', 'z'], 5);
  31197. * console.log(object.x[0].y.z);
  31198. * // => 5
  31199. */
  31200. function set(object, path, value) {
  31201. return object == null ? object : baseSet(object, path, value);
  31202. }
  31203. /**
  31204. * This method is like `_.set` except that it accepts `customizer` which is
  31205. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  31206. * path creation is handled by the method instead. The `customizer` is invoked
  31207. * with three arguments: (nsValue, key, nsObject).
  31208. *
  31209. * **Note:** This method mutates `object`.
  31210. *
  31211. * @static
  31212. * @memberOf _
  31213. * @since 4.0.0
  31214. * @category Object
  31215. * @param {Object} object The object to modify.
  31216. * @param {Array|string} path The path of the property to set.
  31217. * @param {*} value The value to set.
  31218. * @param {Function} [customizer] The function to customize assigned values.
  31219. * @returns {Object} Returns `object`.
  31220. * @example
  31221. *
  31222. * var object = {};
  31223. *
  31224. * _.setWith(object, '[0][1]', 'a', Object);
  31225. * // => { '0': { '1': 'a' } }
  31226. */
  31227. function setWith(object, path, value, customizer) {
  31228. customizer = typeof customizer == 'function' ? customizer : undefined;
  31229. return object == null ? object : baseSet(object, path, value, customizer);
  31230. }
  31231. /**
  31232. * Creates an array of own enumerable string keyed-value pairs for `object`
  31233. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  31234. * entries are returned.
  31235. *
  31236. * @static
  31237. * @memberOf _
  31238. * @since 4.0.0
  31239. * @alias entries
  31240. * @category Object
  31241. * @param {Object} object The object to query.
  31242. * @returns {Array} Returns the key-value pairs.
  31243. * @example
  31244. *
  31245. * function Foo() {
  31246. * this.a = 1;
  31247. * this.b = 2;
  31248. * }
  31249. *
  31250. * Foo.prototype.c = 3;
  31251. *
  31252. * _.toPairs(new Foo);
  31253. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  31254. */
  31255. var toPairs = createToPairs(keys);
  31256. /**
  31257. * Creates an array of own and inherited enumerable string keyed-value pairs
  31258. * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
  31259. * or set, its entries are returned.
  31260. *
  31261. * @static
  31262. * @memberOf _
  31263. * @since 4.0.0
  31264. * @alias entriesIn
  31265. * @category Object
  31266. * @param {Object} object The object to query.
  31267. * @returns {Array} Returns the key-value pairs.
  31268. * @example
  31269. *
  31270. * function Foo() {
  31271. * this.a = 1;
  31272. * this.b = 2;
  31273. * }
  31274. *
  31275. * Foo.prototype.c = 3;
  31276. *
  31277. * _.toPairsIn(new Foo);
  31278. * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
  31279. */
  31280. var toPairsIn = createToPairs(keysIn);
  31281. /**
  31282. * An alternative to `_.reduce`; this method transforms `object` to a new
  31283. * `accumulator` object which is the result of running each of its own
  31284. * enumerable string keyed properties thru `iteratee`, with each invocation
  31285. * potentially mutating the `accumulator` object. If `accumulator` is not
  31286. * provided, a new object with the same `[[Prototype]]` will be used. The
  31287. * iteratee is invoked with four arguments: (accumulator, value, key, object).
  31288. * Iteratee functions may exit iteration early by explicitly returning `false`.
  31289. *
  31290. * @static
  31291. * @memberOf _
  31292. * @since 1.3.0
  31293. * @category Object
  31294. * @param {Object} object The object to iterate over.
  31295. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31296. * @param {*} [accumulator] The custom accumulator value.
  31297. * @returns {*} Returns the accumulated value.
  31298. * @example
  31299. *
  31300. * _.transform([2, 3, 4], function(result, n) {
  31301. * result.push(n *= n);
  31302. * return n % 2 == 0;
  31303. * }, []);
  31304. * // => [4, 9]
  31305. *
  31306. * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  31307. * (result[value] || (result[value] = [])).push(key);
  31308. * }, {});
  31309. * // => { '1': ['a', 'c'], '2': ['b'] }
  31310. */
  31311. function transform(object, iteratee, accumulator) {
  31312. var isArr = isArray(object),
  31313. isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  31314. iteratee = getIteratee(iteratee, 4);
  31315. if (accumulator == null) {
  31316. var Ctor = object && object.constructor;
  31317. if (isArrLike) {
  31318. accumulator = isArr ? new Ctor : [];
  31319. }
  31320. else if (isObject(object)) {
  31321. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  31322. }
  31323. else {
  31324. accumulator = {};
  31325. }
  31326. }
  31327. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
  31328. return iteratee(accumulator, value, index, object);
  31329. });
  31330. return accumulator;
  31331. }
  31332. /**
  31333. * Removes the property at `path` of `object`.
  31334. *
  31335. * **Note:** This method mutates `object`.
  31336. *
  31337. * @static
  31338. * @memberOf _
  31339. * @since 4.0.0
  31340. * @category Object
  31341. * @param {Object} object The object to modify.
  31342. * @param {Array|string} path The path of the property to unset.
  31343. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  31344. * @example
  31345. *
  31346. * var object = { 'a': [{ 'b': { 'c': 7 } }] };
  31347. * _.unset(object, 'a[0].b.c');
  31348. * // => true
  31349. *
  31350. * console.log(object);
  31351. * // => { 'a': [{ 'b': {} }] };
  31352. *
  31353. * _.unset(object, ['a', '0', 'b', 'c']);
  31354. * // => true
  31355. *
  31356. * console.log(object);
  31357. * // => { 'a': [{ 'b': {} }] };
  31358. */
  31359. function unset(object, path) {
  31360. return object == null ? true : baseUnset(object, path);
  31361. }
  31362. /**
  31363. * This method is like `_.set` except that accepts `updater` to produce the
  31364. * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
  31365. * is invoked with one argument: (value).
  31366. *
  31367. * **Note:** This method mutates `object`.
  31368. *
  31369. * @static
  31370. * @memberOf _
  31371. * @since 4.6.0
  31372. * @category Object
  31373. * @param {Object} object The object to modify.
  31374. * @param {Array|string} path The path of the property to set.
  31375. * @param {Function} updater The function to produce the updated value.
  31376. * @returns {Object} Returns `object`.
  31377. * @example
  31378. *
  31379. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  31380. *
  31381. * _.update(object, 'a[0].b.c', function(n) { return n * n; });
  31382. * console.log(object.a[0].b.c);
  31383. * // => 9
  31384. *
  31385. * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
  31386. * console.log(object.x[0].y.z);
  31387. * // => 0
  31388. */
  31389. function update(object, path, updater) {
  31390. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  31391. }
  31392. /**
  31393. * This method is like `_.update` except that it accepts `customizer` which is
  31394. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  31395. * path creation is handled by the method instead. The `customizer` is invoked
  31396. * with three arguments: (nsValue, key, nsObject).
  31397. *
  31398. * **Note:** This method mutates `object`.
  31399. *
  31400. * @static
  31401. * @memberOf _
  31402. * @since 4.6.0
  31403. * @category Object
  31404. * @param {Object} object The object to modify.
  31405. * @param {Array|string} path The path of the property to set.
  31406. * @param {Function} updater The function to produce the updated value.
  31407. * @param {Function} [customizer] The function to customize assigned values.
  31408. * @returns {Object} Returns `object`.
  31409. * @example
  31410. *
  31411. * var object = {};
  31412. *
  31413. * _.updateWith(object, '[0][1]', _.constant('a'), Object);
  31414. * // => { '0': { '1': 'a' } }
  31415. */
  31416. function updateWith(object, path, updater, customizer) {
  31417. customizer = typeof customizer == 'function' ? customizer : undefined;
  31418. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  31419. }
  31420. /**
  31421. * Creates an array of the own enumerable string keyed property values of `object`.
  31422. *
  31423. * **Note:** Non-object values are coerced to objects.
  31424. *
  31425. * @static
  31426. * @since 0.1.0
  31427. * @memberOf _
  31428. * @category Object
  31429. * @param {Object} object The object to query.
  31430. * @returns {Array} Returns the array of property values.
  31431. * @example
  31432. *
  31433. * function Foo() {
  31434. * this.a = 1;
  31435. * this.b = 2;
  31436. * }
  31437. *
  31438. * Foo.prototype.c = 3;
  31439. *
  31440. * _.values(new Foo);
  31441. * // => [1, 2] (iteration order is not guaranteed)
  31442. *
  31443. * _.values('hi');
  31444. * // => ['h', 'i']
  31445. */
  31446. function values(object) {
  31447. return object == null ? [] : baseValues(object, keys(object));
  31448. }
  31449. /**
  31450. * Creates an array of the own and inherited enumerable string keyed property
  31451. * values of `object`.
  31452. *
  31453. * **Note:** Non-object values are coerced to objects.
  31454. *
  31455. * @static
  31456. * @memberOf _
  31457. * @since 3.0.0
  31458. * @category Object
  31459. * @param {Object} object The object to query.
  31460. * @returns {Array} Returns the array of property values.
  31461. * @example
  31462. *
  31463. * function Foo() {
  31464. * this.a = 1;
  31465. * this.b = 2;
  31466. * }
  31467. *
  31468. * Foo.prototype.c = 3;
  31469. *
  31470. * _.valuesIn(new Foo);
  31471. * // => [1, 2, 3] (iteration order is not guaranteed)
  31472. */
  31473. function valuesIn(object) {
  31474. return object == null ? [] : baseValues(object, keysIn(object));
  31475. }
  31476. /*------------------------------------------------------------------------*/
  31477. /**
  31478. * Clamps `number` within the inclusive `lower` and `upper` bounds.
  31479. *
  31480. * @static
  31481. * @memberOf _
  31482. * @since 4.0.0
  31483. * @category Number
  31484. * @param {number} number The number to clamp.
  31485. * @param {number} [lower] The lower bound.
  31486. * @param {number} upper The upper bound.
  31487. * @returns {number} Returns the clamped number.
  31488. * @example
  31489. *
  31490. * _.clamp(-10, -5, 5);
  31491. * // => -5
  31492. *
  31493. * _.clamp(10, -5, 5);
  31494. * // => 5
  31495. */
  31496. function clamp(number, lower, upper) {
  31497. if (upper === undefined) {
  31498. upper = lower;
  31499. lower = undefined;
  31500. }
  31501. if (upper !== undefined) {
  31502. upper = toNumber(upper);
  31503. upper = upper === upper ? upper : 0;
  31504. }
  31505. if (lower !== undefined) {
  31506. lower = toNumber(lower);
  31507. lower = lower === lower ? lower : 0;
  31508. }
  31509. return baseClamp(toNumber(number), lower, upper);
  31510. }
  31511. /**
  31512. * Checks if `n` is between `start` and up to, but not including, `end`. If
  31513. * `end` is not specified, it's set to `start` with `start` then set to `0`.
  31514. * If `start` is greater than `end` the params are swapped to support
  31515. * negative ranges.
  31516. *
  31517. * @static
  31518. * @memberOf _
  31519. * @since 3.3.0
  31520. * @category Number
  31521. * @param {number} number The number to check.
  31522. * @param {number} [start=0] The start of the range.
  31523. * @param {number} end The end of the range.
  31524. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  31525. * @see _.range, _.rangeRight
  31526. * @example
  31527. *
  31528. * _.inRange(3, 2, 4);
  31529. * // => true
  31530. *
  31531. * _.inRange(4, 8);
  31532. * // => true
  31533. *
  31534. * _.inRange(4, 2);
  31535. * // => false
  31536. *
  31537. * _.inRange(2, 2);
  31538. * // => false
  31539. *
  31540. * _.inRange(1.2, 2);
  31541. * // => true
  31542. *
  31543. * _.inRange(5.2, 4);
  31544. * // => false
  31545. *
  31546. * _.inRange(-3, -2, -6);
  31547. * // => true
  31548. */
  31549. function inRange(number, start, end) {
  31550. start = toFinite(start);
  31551. if (end === undefined) {
  31552. end = start;
  31553. start = 0;
  31554. } else {
  31555. end = toFinite(end);
  31556. }
  31557. number = toNumber(number);
  31558. return baseInRange(number, start, end);
  31559. }
  31560. /**
  31561. * Produces a random number between the inclusive `lower` and `upper` bounds.
  31562. * If only one argument is provided a number between `0` and the given number
  31563. * is returned. If `floating` is `true`, or either `lower` or `upper` are
  31564. * floats, a floating-point number is returned instead of an integer.
  31565. *
  31566. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  31567. * floating-point values which can produce unexpected results.
  31568. *
  31569. * @static
  31570. * @memberOf _
  31571. * @since 0.7.0
  31572. * @category Number
  31573. * @param {number} [lower=0] The lower bound.
  31574. * @param {number} [upper=1] The upper bound.
  31575. * @param {boolean} [floating] Specify returning a floating-point number.
  31576. * @returns {number} Returns the random number.
  31577. * @example
  31578. *
  31579. * _.random(0, 5);
  31580. * // => an integer between 0 and 5
  31581. *
  31582. * _.random(5);
  31583. * // => also an integer between 0 and 5
  31584. *
  31585. * _.random(5, true);
  31586. * // => a floating-point number between 0 and 5
  31587. *
  31588. * _.random(1.2, 5.2);
  31589. * // => a floating-point number between 1.2 and 5.2
  31590. */
  31591. function random(lower, upper, floating) {
  31592. if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
  31593. upper = floating = undefined;
  31594. }
  31595. if (floating === undefined) {
  31596. if (typeof upper == 'boolean') {
  31597. floating = upper;
  31598. upper = undefined;
  31599. }
  31600. else if (typeof lower == 'boolean') {
  31601. floating = lower;
  31602. lower = undefined;
  31603. }
  31604. }
  31605. if (lower === undefined && upper === undefined) {
  31606. lower = 0;
  31607. upper = 1;
  31608. }
  31609. else {
  31610. lower = toFinite(lower);
  31611. if (upper === undefined) {
  31612. upper = lower;
  31613. lower = 0;
  31614. } else {
  31615. upper = toFinite(upper);
  31616. }
  31617. }
  31618. if (lower > upper) {
  31619. var temp = lower;
  31620. lower = upper;
  31621. upper = temp;
  31622. }
  31623. if (floating || lower % 1 || upper % 1) {
  31624. var rand = nativeRandom();
  31625. return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
  31626. }
  31627. return baseRandom(lower, upper);
  31628. }
  31629. /*------------------------------------------------------------------------*/
  31630. /**
  31631. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  31632. *
  31633. * @static
  31634. * @memberOf _
  31635. * @since 3.0.0
  31636. * @category String
  31637. * @param {string} [string=''] The string to convert.
  31638. * @returns {string} Returns the camel cased string.
  31639. * @example
  31640. *
  31641. * _.camelCase('Foo Bar');
  31642. * // => 'fooBar'
  31643. *
  31644. * _.camelCase('--foo-bar--');
  31645. * // => 'fooBar'
  31646. *
  31647. * _.camelCase('__FOO_BAR__');
  31648. * // => 'fooBar'
  31649. */
  31650. var camelCase = createCompounder(function(result, word, index) {
  31651. word = word.toLowerCase();
  31652. return result + (index ? capitalize(word) : word);
  31653. });
  31654. /**
  31655. * Converts the first character of `string` to upper case and the remaining
  31656. * to lower case.
  31657. *
  31658. * @static
  31659. * @memberOf _
  31660. * @since 3.0.0
  31661. * @category String
  31662. * @param {string} [string=''] The string to capitalize.
  31663. * @returns {string} Returns the capitalized string.
  31664. * @example
  31665. *
  31666. * _.capitalize('FRED');
  31667. * // => 'Fred'
  31668. */
  31669. function capitalize(string) {
  31670. return upperFirst(toString(string).toLowerCase());
  31671. }
  31672. /**
  31673. * Deburrs `string` by converting
  31674. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  31675. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  31676. * letters to basic Latin letters and removing
  31677. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  31678. *
  31679. * @static
  31680. * @memberOf _
  31681. * @since 3.0.0
  31682. * @category String
  31683. * @param {string} [string=''] The string to deburr.
  31684. * @returns {string} Returns the deburred string.
  31685. * @example
  31686. *
  31687. * _.deburr('déjà vu');
  31688. * // => 'deja vu'
  31689. */
  31690. function deburr(string) {
  31691. string = toString(string);
  31692. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  31693. }
  31694. /**
  31695. * Checks if `string` ends with the given target string.
  31696. *
  31697. * @static
  31698. * @memberOf _
  31699. * @since 3.0.0
  31700. * @category String
  31701. * @param {string} [string=''] The string to inspect.
  31702. * @param {string} [target] The string to search for.
  31703. * @param {number} [position=string.length] The position to search up to.
  31704. * @returns {boolean} Returns `true` if `string` ends with `target`,
  31705. * else `false`.
  31706. * @example
  31707. *
  31708. * _.endsWith('abc', 'c');
  31709. * // => true
  31710. *
  31711. * _.endsWith('abc', 'b');
  31712. * // => false
  31713. *
  31714. * _.endsWith('abc', 'b', 2);
  31715. * // => true
  31716. */
  31717. function endsWith(string, target, position) {
  31718. string = toString(string);
  31719. target = baseToString(target);
  31720. var length = string.length;
  31721. position = position === undefined
  31722. ? length
  31723. : baseClamp(toInteger(position), 0, length);
  31724. var end = position;
  31725. position -= target.length;
  31726. return position >= 0 && string.slice(position, end) == target;
  31727. }
  31728. /**
  31729. * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
  31730. * corresponding HTML entities.
  31731. *
  31732. * **Note:** No other characters are escaped. To escape additional
  31733. * characters use a third-party library like [_he_](https://mths.be/he).
  31734. *
  31735. * Though the ">" character is escaped for symmetry, characters like
  31736. * ">" and "/" don't need escaping in HTML and have no special meaning
  31737. * unless they're part of a tag or unquoted attribute value. See
  31738. * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
  31739. * (under "semi-related fun fact") for more details.
  31740. *
  31741. * When working with HTML you should always
  31742. * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
  31743. * XSS vectors.
  31744. *
  31745. * @static
  31746. * @since 0.1.0
  31747. * @memberOf _
  31748. * @category String
  31749. * @param {string} [string=''] The string to escape.
  31750. * @returns {string} Returns the escaped string.
  31751. * @example
  31752. *
  31753. * _.escape('fred, barney, & pebbles');
  31754. * // => 'fred, barney, &amp; pebbles'
  31755. */
  31756. function escape(string) {
  31757. string = toString(string);
  31758. return (string && reHasUnescapedHtml.test(string))
  31759. ? string.replace(reUnescapedHtml, escapeHtmlChar)
  31760. : string;
  31761. }
  31762. /**
  31763. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  31764. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  31765. *
  31766. * @static
  31767. * @memberOf _
  31768. * @since 3.0.0
  31769. * @category String
  31770. * @param {string} [string=''] The string to escape.
  31771. * @returns {string} Returns the escaped string.
  31772. * @example
  31773. *
  31774. * _.escapeRegExp('[lodash](https://lodash.com/)');
  31775. * // => '\[lodash\]\(https://lodash\.com/\)'
  31776. */
  31777. function escapeRegExp(string) {
  31778. string = toString(string);
  31779. return (string && reHasRegExpChar.test(string))
  31780. ? string.replace(reRegExpChar, '\\$&')
  31781. : string;
  31782. }
  31783. /**
  31784. * Converts `string` to
  31785. * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
  31786. *
  31787. * @static
  31788. * @memberOf _
  31789. * @since 3.0.0
  31790. * @category String
  31791. * @param {string} [string=''] The string to convert.
  31792. * @returns {string} Returns the kebab cased string.
  31793. * @example
  31794. *
  31795. * _.kebabCase('Foo Bar');
  31796. * // => 'foo-bar'
  31797. *
  31798. * _.kebabCase('fooBar');
  31799. * // => 'foo-bar'
  31800. *
  31801. * _.kebabCase('__FOO_BAR__');
  31802. * // => 'foo-bar'
  31803. */
  31804. var kebabCase = createCompounder(function(result, word, index) {
  31805. return result + (index ? '-' : '') + word.toLowerCase();
  31806. });
  31807. /**
  31808. * Converts `string`, as space separated words, to lower case.
  31809. *
  31810. * @static
  31811. * @memberOf _
  31812. * @since 4.0.0
  31813. * @category String
  31814. * @param {string} [string=''] The string to convert.
  31815. * @returns {string} Returns the lower cased string.
  31816. * @example
  31817. *
  31818. * _.lowerCase('--Foo-Bar--');
  31819. * // => 'foo bar'
  31820. *
  31821. * _.lowerCase('fooBar');
  31822. * // => 'foo bar'
  31823. *
  31824. * _.lowerCase('__FOO_BAR__');
  31825. * // => 'foo bar'
  31826. */
  31827. var lowerCase = createCompounder(function(result, word, index) {
  31828. return result + (index ? ' ' : '') + word.toLowerCase();
  31829. });
  31830. /**
  31831. * Converts the first character of `string` to lower case.
  31832. *
  31833. * @static
  31834. * @memberOf _
  31835. * @since 4.0.0
  31836. * @category String
  31837. * @param {string} [string=''] The string to convert.
  31838. * @returns {string} Returns the converted string.
  31839. * @example
  31840. *
  31841. * _.lowerFirst('Fred');
  31842. * // => 'fred'
  31843. *
  31844. * _.lowerFirst('FRED');
  31845. * // => 'fRED'
  31846. */
  31847. var lowerFirst = createCaseFirst('toLowerCase');
  31848. /**
  31849. * Pads `string` on the left and right sides if it's shorter than `length`.
  31850. * Padding characters are truncated if they can't be evenly divided by `length`.
  31851. *
  31852. * @static
  31853. * @memberOf _
  31854. * @since 3.0.0
  31855. * @category String
  31856. * @param {string} [string=''] The string to pad.
  31857. * @param {number} [length=0] The padding length.
  31858. * @param {string} [chars=' '] The string used as padding.
  31859. * @returns {string} Returns the padded string.
  31860. * @example
  31861. *
  31862. * _.pad('abc', 8);
  31863. * // => ' abc '
  31864. *
  31865. * _.pad('abc', 8, '_-');
  31866. * // => '_-abc_-_'
  31867. *
  31868. * _.pad('abc', 3);
  31869. * // => 'abc'
  31870. */
  31871. function pad(string, length, chars) {
  31872. string = toString(string);
  31873. length = toInteger(length);
  31874. var strLength = length ? stringSize(string) : 0;
  31875. if (!length || strLength >= length) {
  31876. return string;
  31877. }
  31878. var mid = (length - strLength) / 2;
  31879. return (
  31880. createPadding(nativeFloor(mid), chars) +
  31881. string +
  31882. createPadding(nativeCeil(mid), chars)
  31883. );
  31884. }
  31885. /**
  31886. * Pads `string` on the right side if it's shorter than `length`. Padding
  31887. * characters are truncated if they exceed `length`.
  31888. *
  31889. * @static
  31890. * @memberOf _
  31891. * @since 4.0.0
  31892. * @category String
  31893. * @param {string} [string=''] The string to pad.
  31894. * @param {number} [length=0] The padding length.
  31895. * @param {string} [chars=' '] The string used as padding.
  31896. * @returns {string} Returns the padded string.
  31897. * @example
  31898. *
  31899. * _.padEnd('abc', 6);
  31900. * // => 'abc '
  31901. *
  31902. * _.padEnd('abc', 6, '_-');
  31903. * // => 'abc_-_'
  31904. *
  31905. * _.padEnd('abc', 3);
  31906. * // => 'abc'
  31907. */
  31908. function padEnd(string, length, chars) {
  31909. string = toString(string);
  31910. length = toInteger(length);
  31911. var strLength = length ? stringSize(string) : 0;
  31912. return (length && strLength < length)
  31913. ? (string + createPadding(length - strLength, chars))
  31914. : string;
  31915. }
  31916. /**
  31917. * Pads `string` on the left side if it's shorter than `length`. Padding
  31918. * characters are truncated if they exceed `length`.
  31919. *
  31920. * @static
  31921. * @memberOf _
  31922. * @since 4.0.0
  31923. * @category String
  31924. * @param {string} [string=''] The string to pad.
  31925. * @param {number} [length=0] The padding length.
  31926. * @param {string} [chars=' '] The string used as padding.
  31927. * @returns {string} Returns the padded string.
  31928. * @example
  31929. *
  31930. * _.padStart('abc', 6);
  31931. * // => ' abc'
  31932. *
  31933. * _.padStart('abc', 6, '_-');
  31934. * // => '_-_abc'
  31935. *
  31936. * _.padStart('abc', 3);
  31937. * // => 'abc'
  31938. */
  31939. function padStart(string, length, chars) {
  31940. string = toString(string);
  31941. length = toInteger(length);
  31942. var strLength = length ? stringSize(string) : 0;
  31943. return (length && strLength < length)
  31944. ? (createPadding(length - strLength, chars) + string)
  31945. : string;
  31946. }
  31947. /**
  31948. * Converts `string` to an integer of the specified radix. If `radix` is
  31949. * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
  31950. * hexadecimal, in which case a `radix` of `16` is used.
  31951. *
  31952. * **Note:** This method aligns with the
  31953. * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
  31954. *
  31955. * @static
  31956. * @memberOf _
  31957. * @since 1.1.0
  31958. * @category String
  31959. * @param {string} string The string to convert.
  31960. * @param {number} [radix=10] The radix to interpret `value` by.
  31961. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31962. * @returns {number} Returns the converted integer.
  31963. * @example
  31964. *
  31965. * _.parseInt('08');
  31966. * // => 8
  31967. *
  31968. * _.map(['6', '08', '10'], _.parseInt);
  31969. * // => [6, 8, 10]
  31970. */
  31971. function parseInt(string, radix, guard) {
  31972. if (guard || radix == null) {
  31973. radix = 0;
  31974. } else if (radix) {
  31975. radix = +radix;
  31976. }
  31977. return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
  31978. }
  31979. /**
  31980. * Repeats the given string `n` times.
  31981. *
  31982. * @static
  31983. * @memberOf _
  31984. * @since 3.0.0
  31985. * @category String
  31986. * @param {string} [string=''] The string to repeat.
  31987. * @param {number} [n=1] The number of times to repeat the string.
  31988. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31989. * @returns {string} Returns the repeated string.
  31990. * @example
  31991. *
  31992. * _.repeat('*', 3);
  31993. * // => '***'
  31994. *
  31995. * _.repeat('abc', 2);
  31996. * // => 'abcabc'
  31997. *
  31998. * _.repeat('abc', 0);
  31999. * // => ''
  32000. */
  32001. function repeat(string, n, guard) {
  32002. if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
  32003. n = 1;
  32004. } else {
  32005. n = toInteger(n);
  32006. }
  32007. return baseRepeat(toString(string), n);
  32008. }
  32009. /**
  32010. * Replaces matches for `pattern` in `string` with `replacement`.
  32011. *
  32012. * **Note:** This method is based on
  32013. * [`String#replace`](https://mdn.io/String/replace).
  32014. *
  32015. * @static
  32016. * @memberOf _
  32017. * @since 4.0.0
  32018. * @category String
  32019. * @param {string} [string=''] The string to modify.
  32020. * @param {RegExp|string} pattern The pattern to replace.
  32021. * @param {Function|string} replacement The match replacement.
  32022. * @returns {string} Returns the modified string.
  32023. * @example
  32024. *
  32025. * _.replace('Hi Fred', 'Fred', 'Barney');
  32026. * // => 'Hi Barney'
  32027. */
  32028. function replace() {
  32029. var args = arguments,
  32030. string = toString(args[0]);
  32031. return args.length < 3 ? string : string.replace(args[1], args[2]);
  32032. }
  32033. /**
  32034. * Converts `string` to
  32035. * [snake case](https://en.wikipedia.org/wiki/Snake_case).
  32036. *
  32037. * @static
  32038. * @memberOf _
  32039. * @since 3.0.0
  32040. * @category String
  32041. * @param {string} [string=''] The string to convert.
  32042. * @returns {string} Returns the snake cased string.
  32043. * @example
  32044. *
  32045. * _.snakeCase('Foo Bar');
  32046. * // => 'foo_bar'
  32047. *
  32048. * _.snakeCase('fooBar');
  32049. * // => 'foo_bar'
  32050. *
  32051. * _.snakeCase('--FOO-BAR--');
  32052. * // => 'foo_bar'
  32053. */
  32054. var snakeCase = createCompounder(function(result, word, index) {
  32055. return result + (index ? '_' : '') + word.toLowerCase();
  32056. });
  32057. /**
  32058. * Splits `string` by `separator`.
  32059. *
  32060. * **Note:** This method is based on
  32061. * [`String#split`](https://mdn.io/String/split).
  32062. *
  32063. * @static
  32064. * @memberOf _
  32065. * @since 4.0.0
  32066. * @category String
  32067. * @param {string} [string=''] The string to split.
  32068. * @param {RegExp|string} separator The separator pattern to split by.
  32069. * @param {number} [limit] The length to truncate results to.
  32070. * @returns {Array} Returns the string segments.
  32071. * @example
  32072. *
  32073. * _.split('a-b-c', '-', 2);
  32074. * // => ['a', 'b']
  32075. */
  32076. function split(string, separator, limit) {
  32077. if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
  32078. separator = limit = undefined;
  32079. }
  32080. limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
  32081. if (!limit) {
  32082. return [];
  32083. }
  32084. string = toString(string);
  32085. if (string && (
  32086. typeof separator == 'string' ||
  32087. (separator != null && !isRegExp(separator))
  32088. )) {
  32089. separator = baseToString(separator);
  32090. if (!separator && hasUnicode(string)) {
  32091. return castSlice(stringToArray(string), 0, limit);
  32092. }
  32093. }
  32094. return string.split(separator, limit);
  32095. }
  32096. /**
  32097. * Converts `string` to
  32098. * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
  32099. *
  32100. * @static
  32101. * @memberOf _
  32102. * @since 3.1.0
  32103. * @category String
  32104. * @param {string} [string=''] The string to convert.
  32105. * @returns {string} Returns the start cased string.
  32106. * @example
  32107. *
  32108. * _.startCase('--foo-bar--');
  32109. * // => 'Foo Bar'
  32110. *
  32111. * _.startCase('fooBar');
  32112. * // => 'Foo Bar'
  32113. *
  32114. * _.startCase('__FOO_BAR__');
  32115. * // => 'FOO BAR'
  32116. */
  32117. var startCase = createCompounder(function(result, word, index) {
  32118. return result + (index ? ' ' : '') + upperFirst(word);
  32119. });
  32120. /**
  32121. * Checks if `string` starts with the given target string.
  32122. *
  32123. * @static
  32124. * @memberOf _
  32125. * @since 3.0.0
  32126. * @category String
  32127. * @param {string} [string=''] The string to inspect.
  32128. * @param {string} [target] The string to search for.
  32129. * @param {number} [position=0] The position to search from.
  32130. * @returns {boolean} Returns `true` if `string` starts with `target`,
  32131. * else `false`.
  32132. * @example
  32133. *
  32134. * _.startsWith('abc', 'a');
  32135. * // => true
  32136. *
  32137. * _.startsWith('abc', 'b');
  32138. * // => false
  32139. *
  32140. * _.startsWith('abc', 'b', 1);
  32141. * // => true
  32142. */
  32143. function startsWith(string, target, position) {
  32144. string = toString(string);
  32145. position = position == null
  32146. ? 0
  32147. : baseClamp(toInteger(position), 0, string.length);
  32148. target = baseToString(target);
  32149. return string.slice(position, position + target.length) == target;
  32150. }
  32151. /**
  32152. * Creates a compiled template function that can interpolate data properties
  32153. * in "interpolate" delimiters, HTML-escape interpolated data properties in
  32154. * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
  32155. * properties may be accessed as free variables in the template. If a setting
  32156. * object is given, it takes precedence over `_.templateSettings` values.
  32157. *
  32158. * **Note:** In the development build `_.template` utilizes
  32159. * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
  32160. * for easier debugging.
  32161. *
  32162. * For more information on precompiling templates see
  32163. * [lodash's custom builds documentation](https://lodash.com/custom-builds).
  32164. *
  32165. * For more information on Chrome extension sandboxes see
  32166. * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
  32167. *
  32168. * @static
  32169. * @since 0.1.0
  32170. * @memberOf _
  32171. * @category String
  32172. * @param {string} [string=''] The template string.
  32173. * @param {Object} [options={}] The options object.
  32174. * @param {RegExp} [options.escape=_.templateSettings.escape]
  32175. * The HTML "escape" delimiter.
  32176. * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
  32177. * The "evaluate" delimiter.
  32178. * @param {Object} [options.imports=_.templateSettings.imports]
  32179. * An object to import into the template as free variables.
  32180. * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
  32181. * The "interpolate" delimiter.
  32182. * @param {string} [options.sourceURL='lodash.templateSources[n]']
  32183. * The sourceURL of the compiled template.
  32184. * @param {string} [options.variable='obj']
  32185. * The data object variable name.
  32186. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32187. * @returns {Function} Returns the compiled template function.
  32188. * @example
  32189. *
  32190. * // Use the "interpolate" delimiter to create a compiled template.
  32191. * var compiled = _.template('hello <%= user %>!');
  32192. * compiled({ 'user': 'fred' });
  32193. * // => 'hello fred!'
  32194. *
  32195. * // Use the HTML "escape" delimiter to escape data property values.
  32196. * var compiled = _.template('<b><%- value %></b>');
  32197. * compiled({ 'value': '<script>' });
  32198. * // => '<b>&lt;script&gt;</b>'
  32199. *
  32200. * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
  32201. * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
  32202. * compiled({ 'users': ['fred', 'barney'] });
  32203. * // => '<li>fred</li><li>barney</li>'
  32204. *
  32205. * // Use the internal `print` function in "evaluate" delimiters.
  32206. * var compiled = _.template('<% print("hello " + user); %>!');
  32207. * compiled({ 'user': 'barney' });
  32208. * // => 'hello barney!'
  32209. *
  32210. * // Use the ES template literal delimiter as an "interpolate" delimiter.
  32211. * // Disable support by replacing the "interpolate" delimiter.
  32212. * var compiled = _.template('hello ${ user }!');
  32213. * compiled({ 'user': 'pebbles' });
  32214. * // => 'hello pebbles!'
  32215. *
  32216. * // Use backslashes to treat delimiters as plain text.
  32217. * var compiled = _.template('<%= "\\<%- value %\\>" %>');
  32218. * compiled({ 'value': 'ignored' });
  32219. * // => '<%- value %>'
  32220. *
  32221. * // Use the `imports` option to import `jQuery` as `jq`.
  32222. * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
  32223. * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
  32224. * compiled({ 'users': ['fred', 'barney'] });
  32225. * // => '<li>fred</li><li>barney</li>'
  32226. *
  32227. * // Use the `sourceURL` option to specify a custom sourceURL for the template.
  32228. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
  32229. * compiled(data);
  32230. * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
  32231. *
  32232. * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
  32233. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
  32234. * compiled.source;
  32235. * // => function(data) {
  32236. * // var __t, __p = '';
  32237. * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
  32238. * // return __p;
  32239. * // }
  32240. *
  32241. * // Use custom template delimiters.
  32242. * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
  32243. * var compiled = _.template('hello {{ user }}!');
  32244. * compiled({ 'user': 'mustache' });
  32245. * // => 'hello mustache!'
  32246. *
  32247. * // Use the `source` property to inline compiled templates for meaningful
  32248. * // line numbers in error messages and stack traces.
  32249. * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
  32250. * var JST = {\
  32251. * "main": ' + _.template(mainText).source + '\
  32252. * };\
  32253. * ');
  32254. */
  32255. function template(string, options, guard) {
  32256. // Based on John Resig's `tmpl` implementation
  32257. // (http://ejohn.org/blog/javascript-micro-templating/)
  32258. // and Laura Doktorova's doT.js (https://github.com/olado/doT).
  32259. var settings = lodash.templateSettings;
  32260. if (guard && isIterateeCall(string, options, guard)) {
  32261. options = undefined;
  32262. }
  32263. string = toString(string);
  32264. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  32265. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
  32266. importsKeys = keys(imports),
  32267. importsValues = baseValues(imports, importsKeys);
  32268. var isEscaping,
  32269. isEvaluating,
  32270. index = 0,
  32271. interpolate = options.interpolate || reNoMatch,
  32272. source = "__p += '";
  32273. // Compile the regexp to match each delimiter.
  32274. var reDelimiters = RegExp(
  32275. (options.escape || reNoMatch).source + '|' +
  32276. interpolate.source + '|' +
  32277. (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
  32278. (options.evaluate || reNoMatch).source + '|$'
  32279. , 'g');
  32280. // Use a sourceURL for easier debugging.
  32281. // The sourceURL gets injected into the source that's eval-ed, so be careful
  32282. // with lookup (in case of e.g. prototype pollution), and strip newlines if any.
  32283. // A newline wouldn't be a valid sourceURL anyway, and it'd enable code injection.
  32284. var sourceURL = '//# sourceURL=' +
  32285. (hasOwnProperty.call(options, 'sourceURL')
  32286. ? (options.sourceURL + '').replace(/[\r\n]/g, ' ')
  32287. : ('lodash.templateSources[' + (++templateCounter) + ']')
  32288. ) + '\n';
  32289. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  32290. interpolateValue || (interpolateValue = esTemplateValue);
  32291. // Escape characters that can't be included in string literals.
  32292. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  32293. // Replace delimiters with snippets.
  32294. if (escapeValue) {
  32295. isEscaping = true;
  32296. source += "' +\n__e(" + escapeValue + ") +\n'";
  32297. }
  32298. if (evaluateValue) {
  32299. isEvaluating = true;
  32300. source += "';\n" + evaluateValue + ";\n__p += '";
  32301. }
  32302. if (interpolateValue) {
  32303. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  32304. }
  32305. index = offset + match.length;
  32306. // The JS engine embedded in Adobe products needs `match` returned in
  32307. // order to produce the correct `offset` value.
  32308. return match;
  32309. });
  32310. source += "';\n";
  32311. // If `variable` is not specified wrap a with-statement around the generated
  32312. // code to add the data object to the top of the scope chain.
  32313. // Like with sourceURL, we take care to not check the option's prototype,
  32314. // as this configuration is a code injection vector.
  32315. var variable = hasOwnProperty.call(options, 'variable') && options.variable;
  32316. if (!variable) {
  32317. source = 'with (obj) {\n' + source + '\n}\n';
  32318. }
  32319. // Cleanup code by stripping empty strings.
  32320. source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
  32321. .replace(reEmptyStringMiddle, '$1')
  32322. .replace(reEmptyStringTrailing, '$1;');
  32323. // Frame code as the function body.
  32324. source = 'function(' + (variable || 'obj') + ') {\n' +
  32325. (variable
  32326. ? ''
  32327. : 'obj || (obj = {});\n'
  32328. ) +
  32329. "var __t, __p = ''" +
  32330. (isEscaping
  32331. ? ', __e = _.escape'
  32332. : ''
  32333. ) +
  32334. (isEvaluating
  32335. ? ', __j = Array.prototype.join;\n' +
  32336. "function print() { __p += __j.call(arguments, '') }\n"
  32337. : ';\n'
  32338. ) +
  32339. source +
  32340. 'return __p\n}';
  32341. var result = attempt(function() {
  32342. return Function(importsKeys, sourceURL + 'return ' + source)
  32343. .apply(undefined, importsValues);
  32344. });
  32345. // Provide the compiled function's source by its `toString` method or
  32346. // the `source` property as a convenience for inlining compiled templates.
  32347. result.source = source;
  32348. if (isError(result)) {
  32349. throw result;
  32350. }
  32351. return result;
  32352. }
  32353. /**
  32354. * Converts `string`, as a whole, to lower case just like
  32355. * [String#toLowerCase](https://mdn.io/toLowerCase).
  32356. *
  32357. * @static
  32358. * @memberOf _
  32359. * @since 4.0.0
  32360. * @category String
  32361. * @param {string} [string=''] The string to convert.
  32362. * @returns {string} Returns the lower cased string.
  32363. * @example
  32364. *
  32365. * _.toLower('--Foo-Bar--');
  32366. * // => '--foo-bar--'
  32367. *
  32368. * _.toLower('fooBar');
  32369. * // => 'foobar'
  32370. *
  32371. * _.toLower('__FOO_BAR__');
  32372. * // => '__foo_bar__'
  32373. */
  32374. function toLower(value) {
  32375. return toString(value).toLowerCase();
  32376. }
  32377. /**
  32378. * Converts `string`, as a whole, to upper case just like
  32379. * [String#toUpperCase](https://mdn.io/toUpperCase).
  32380. *
  32381. * @static
  32382. * @memberOf _
  32383. * @since 4.0.0
  32384. * @category String
  32385. * @param {string} [string=''] The string to convert.
  32386. * @returns {string} Returns the upper cased string.
  32387. * @example
  32388. *
  32389. * _.toUpper('--foo-bar--');
  32390. * // => '--FOO-BAR--'
  32391. *
  32392. * _.toUpper('fooBar');
  32393. * // => 'FOOBAR'
  32394. *
  32395. * _.toUpper('__foo_bar__');
  32396. * // => '__FOO_BAR__'
  32397. */
  32398. function toUpper(value) {
  32399. return toString(value).toUpperCase();
  32400. }
  32401. /**
  32402. * Removes leading and trailing whitespace or specified characters from `string`.
  32403. *
  32404. * @static
  32405. * @memberOf _
  32406. * @since 3.0.0
  32407. * @category String
  32408. * @param {string} [string=''] The string to trim.
  32409. * @param {string} [chars=whitespace] The characters to trim.
  32410. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32411. * @returns {string} Returns the trimmed string.
  32412. * @example
  32413. *
  32414. * _.trim(' abc ');
  32415. * // => 'abc'
  32416. *
  32417. * _.trim('-_-abc-_-', '_-');
  32418. * // => 'abc'
  32419. *
  32420. * _.map([' foo ', ' bar '], _.trim);
  32421. * // => ['foo', 'bar']
  32422. */
  32423. function trim(string, chars, guard) {
  32424. string = toString(string);
  32425. if (string && (guard || chars === undefined)) {
  32426. return string.replace(reTrim, '');
  32427. }
  32428. if (!string || !(chars = baseToString(chars))) {
  32429. return string;
  32430. }
  32431. var strSymbols = stringToArray(string),
  32432. chrSymbols = stringToArray(chars),
  32433. start = charsStartIndex(strSymbols, chrSymbols),
  32434. end = charsEndIndex(strSymbols, chrSymbols) + 1;
  32435. return castSlice(strSymbols, start, end).join('');
  32436. }
  32437. /**
  32438. * Removes trailing whitespace or specified characters from `string`.
  32439. *
  32440. * @static
  32441. * @memberOf _
  32442. * @since 4.0.0
  32443. * @category String
  32444. * @param {string} [string=''] The string to trim.
  32445. * @param {string} [chars=whitespace] The characters to trim.
  32446. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32447. * @returns {string} Returns the trimmed string.
  32448. * @example
  32449. *
  32450. * _.trimEnd(' abc ');
  32451. * // => ' abc'
  32452. *
  32453. * _.trimEnd('-_-abc-_-', '_-');
  32454. * // => '-_-abc'
  32455. */
  32456. function trimEnd(string, chars, guard) {
  32457. string = toString(string);
  32458. if (string && (guard || chars === undefined)) {
  32459. return string.replace(reTrimEnd, '');
  32460. }
  32461. if (!string || !(chars = baseToString(chars))) {
  32462. return string;
  32463. }
  32464. var strSymbols = stringToArray(string),
  32465. end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  32466. return castSlice(strSymbols, 0, end).join('');
  32467. }
  32468. /**
  32469. * Removes leading whitespace or specified characters from `string`.
  32470. *
  32471. * @static
  32472. * @memberOf _
  32473. * @since 4.0.0
  32474. * @category String
  32475. * @param {string} [string=''] The string to trim.
  32476. * @param {string} [chars=whitespace] The characters to trim.
  32477. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32478. * @returns {string} Returns the trimmed string.
  32479. * @example
  32480. *
  32481. * _.trimStart(' abc ');
  32482. * // => 'abc '
  32483. *
  32484. * _.trimStart('-_-abc-_-', '_-');
  32485. * // => 'abc-_-'
  32486. */
  32487. function trimStart(string, chars, guard) {
  32488. string = toString(string);
  32489. if (string && (guard || chars === undefined)) {
  32490. return string.replace(reTrimStart, '');
  32491. }
  32492. if (!string || !(chars = baseToString(chars))) {
  32493. return string;
  32494. }
  32495. var strSymbols = stringToArray(string),
  32496. start = charsStartIndex(strSymbols, stringToArray(chars));
  32497. return castSlice(strSymbols, start).join('');
  32498. }
  32499. /**
  32500. * Truncates `string` if it's longer than the given maximum string length.
  32501. * The last characters of the truncated string are replaced with the omission
  32502. * string which defaults to "...".
  32503. *
  32504. * @static
  32505. * @memberOf _
  32506. * @since 4.0.0
  32507. * @category String
  32508. * @param {string} [string=''] The string to truncate.
  32509. * @param {Object} [options={}] The options object.
  32510. * @param {number} [options.length=30] The maximum string length.
  32511. * @param {string} [options.omission='...'] The string to indicate text is omitted.
  32512. * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
  32513. * @returns {string} Returns the truncated string.
  32514. * @example
  32515. *
  32516. * _.truncate('hi-diddly-ho there, neighborino');
  32517. * // => 'hi-diddly-ho there, neighbo...'
  32518. *
  32519. * _.truncate('hi-diddly-ho there, neighborino', {
  32520. * 'length': 24,
  32521. * 'separator': ' '
  32522. * });
  32523. * // => 'hi-diddly-ho there,...'
  32524. *
  32525. * _.truncate('hi-diddly-ho there, neighborino', {
  32526. * 'length': 24,
  32527. * 'separator': /,? +/
  32528. * });
  32529. * // => 'hi-diddly-ho there...'
  32530. *
  32531. * _.truncate('hi-diddly-ho there, neighborino', {
  32532. * 'omission': ' [...]'
  32533. * });
  32534. * // => 'hi-diddly-ho there, neig [...]'
  32535. */
  32536. function truncate(string, options) {
  32537. var length = DEFAULT_TRUNC_LENGTH,
  32538. omission = DEFAULT_TRUNC_OMISSION;
  32539. if (isObject(options)) {
  32540. var separator = 'separator' in options ? options.separator : separator;
  32541. length = 'length' in options ? toInteger(options.length) : length;
  32542. omission = 'omission' in options ? baseToString(options.omission) : omission;
  32543. }
  32544. string = toString(string);
  32545. var strLength = string.length;
  32546. if (hasUnicode(string)) {
  32547. var strSymbols = stringToArray(string);
  32548. strLength = strSymbols.length;
  32549. }
  32550. if (length >= strLength) {
  32551. return string;
  32552. }
  32553. var end = length - stringSize(omission);
  32554. if (end < 1) {
  32555. return omission;
  32556. }
  32557. var result = strSymbols
  32558. ? castSlice(strSymbols, 0, end).join('')
  32559. : string.slice(0, end);
  32560. if (separator === undefined) {
  32561. return result + omission;
  32562. }
  32563. if (strSymbols) {
  32564. end += (result.length - end);
  32565. }
  32566. if (isRegExp(separator)) {
  32567. if (string.slice(end).search(separator)) {
  32568. var match,
  32569. substring = result;
  32570. if (!separator.global) {
  32571. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
  32572. }
  32573. separator.lastIndex = 0;
  32574. while ((match = separator.exec(substring))) {
  32575. var newEnd = match.index;
  32576. }
  32577. result = result.slice(0, newEnd === undefined ? end : newEnd);
  32578. }
  32579. } else if (string.indexOf(baseToString(separator), end) != end) {
  32580. var index = result.lastIndexOf(separator);
  32581. if (index > -1) {
  32582. result = result.slice(0, index);
  32583. }
  32584. }
  32585. return result + omission;
  32586. }
  32587. /**
  32588. * The inverse of `_.escape`; this method converts the HTML entities
  32589. * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
  32590. * their corresponding characters.
  32591. *
  32592. * **Note:** No other HTML entities are unescaped. To unescape additional
  32593. * HTML entities use a third-party library like [_he_](https://mths.be/he).
  32594. *
  32595. * @static
  32596. * @memberOf _
  32597. * @since 0.6.0
  32598. * @category String
  32599. * @param {string} [string=''] The string to unescape.
  32600. * @returns {string} Returns the unescaped string.
  32601. * @example
  32602. *
  32603. * _.unescape('fred, barney, &amp; pebbles');
  32604. * // => 'fred, barney, & pebbles'
  32605. */
  32606. function unescape(string) {
  32607. string = toString(string);
  32608. return (string && reHasEscapedHtml.test(string))
  32609. ? string.replace(reEscapedHtml, unescapeHtmlChar)
  32610. : string;
  32611. }
  32612. /**
  32613. * Converts `string`, as space separated words, to upper case.
  32614. *
  32615. * @static
  32616. * @memberOf _
  32617. * @since 4.0.0
  32618. * @category String
  32619. * @param {string} [string=''] The string to convert.
  32620. * @returns {string} Returns the upper cased string.
  32621. * @example
  32622. *
  32623. * _.upperCase('--foo-bar');
  32624. * // => 'FOO BAR'
  32625. *
  32626. * _.upperCase('fooBar');
  32627. * // => 'FOO BAR'
  32628. *
  32629. * _.upperCase('__foo_bar__');
  32630. * // => 'FOO BAR'
  32631. */
  32632. var upperCase = createCompounder(function(result, word, index) {
  32633. return result + (index ? ' ' : '') + word.toUpperCase();
  32634. });
  32635. /**
  32636. * Converts the first character of `string` to upper case.
  32637. *
  32638. * @static
  32639. * @memberOf _
  32640. * @since 4.0.0
  32641. * @category String
  32642. * @param {string} [string=''] The string to convert.
  32643. * @returns {string} Returns the converted string.
  32644. * @example
  32645. *
  32646. * _.upperFirst('fred');
  32647. * // => 'Fred'
  32648. *
  32649. * _.upperFirst('FRED');
  32650. * // => 'FRED'
  32651. */
  32652. var upperFirst = createCaseFirst('toUpperCase');
  32653. /**
  32654. * Splits `string` into an array of its words.
  32655. *
  32656. * @static
  32657. * @memberOf _
  32658. * @since 3.0.0
  32659. * @category String
  32660. * @param {string} [string=''] The string to inspect.
  32661. * @param {RegExp|string} [pattern] The pattern to match words.
  32662. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32663. * @returns {Array} Returns the words of `string`.
  32664. * @example
  32665. *
  32666. * _.words('fred, barney, & pebbles');
  32667. * // => ['fred', 'barney', 'pebbles']
  32668. *
  32669. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  32670. * // => ['fred', 'barney', '&', 'pebbles']
  32671. */
  32672. function words(string, pattern, guard) {
  32673. string = toString(string);
  32674. pattern = guard ? undefined : pattern;
  32675. if (pattern === undefined) {
  32676. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  32677. }
  32678. return string.match(pattern) || [];
  32679. }
  32680. /*------------------------------------------------------------------------*/
  32681. /**
  32682. * Attempts to invoke `func`, returning either the result or the caught error
  32683. * object. Any additional arguments are provided to `func` when it's invoked.
  32684. *
  32685. * @static
  32686. * @memberOf _
  32687. * @since 3.0.0
  32688. * @category Util
  32689. * @param {Function} func The function to attempt.
  32690. * @param {...*} [args] The arguments to invoke `func` with.
  32691. * @returns {*} Returns the `func` result or error object.
  32692. * @example
  32693. *
  32694. * // Avoid throwing errors for invalid selectors.
  32695. * var elements = _.attempt(function(selector) {
  32696. * return document.querySelectorAll(selector);
  32697. * }, '>_>');
  32698. *
  32699. * if (_.isError(elements)) {
  32700. * elements = [];
  32701. * }
  32702. */
  32703. var attempt = baseRest(function(func, args) {
  32704. try {
  32705. return apply(func, undefined, args);
  32706. } catch (e) {
  32707. return isError(e) ? e : new Error(e);
  32708. }
  32709. });
  32710. /**
  32711. * Binds methods of an object to the object itself, overwriting the existing
  32712. * method.
  32713. *
  32714. * **Note:** This method doesn't set the "length" property of bound functions.
  32715. *
  32716. * @static
  32717. * @since 0.1.0
  32718. * @memberOf _
  32719. * @category Util
  32720. * @param {Object} object The object to bind and assign the bound methods to.
  32721. * @param {...(string|string[])} methodNames The object method names to bind.
  32722. * @returns {Object} Returns `object`.
  32723. * @example
  32724. *
  32725. * var view = {
  32726. * 'label': 'docs',
  32727. * 'click': function() {
  32728. * console.log('clicked ' + this.label);
  32729. * }
  32730. * };
  32731. *
  32732. * _.bindAll(view, ['click']);
  32733. * jQuery(element).on('click', view.click);
  32734. * // => Logs 'clicked docs' when clicked.
  32735. */
  32736. var bindAll = flatRest(function(object, methodNames) {
  32737. arrayEach(methodNames, function(key) {
  32738. key = toKey(key);
  32739. baseAssignValue(object, key, bind(object[key], object));
  32740. });
  32741. return object;
  32742. });
  32743. /**
  32744. * Creates a function that iterates over `pairs` and invokes the corresponding
  32745. * function of the first predicate to return truthy. The predicate-function
  32746. * pairs are invoked with the `this` binding and arguments of the created
  32747. * function.
  32748. *
  32749. * @static
  32750. * @memberOf _
  32751. * @since 4.0.0
  32752. * @category Util
  32753. * @param {Array} pairs The predicate-function pairs.
  32754. * @returns {Function} Returns the new composite function.
  32755. * @example
  32756. *
  32757. * var func = _.cond([
  32758. * [_.matches({ 'a': 1 }), _.constant('matches A')],
  32759. * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
  32760. * [_.stubTrue, _.constant('no match')]
  32761. * ]);
  32762. *
  32763. * func({ 'a': 1, 'b': 2 });
  32764. * // => 'matches A'
  32765. *
  32766. * func({ 'a': 0, 'b': 1 });
  32767. * // => 'matches B'
  32768. *
  32769. * func({ 'a': '1', 'b': '2' });
  32770. * // => 'no match'
  32771. */
  32772. function cond(pairs) {
  32773. var length = pairs == null ? 0 : pairs.length,
  32774. toIteratee = getIteratee();
  32775. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  32776. if (typeof pair[1] != 'function') {
  32777. throw new TypeError(FUNC_ERROR_TEXT);
  32778. }
  32779. return [toIteratee(pair[0]), pair[1]];
  32780. });
  32781. return baseRest(function(args) {
  32782. var index = -1;
  32783. while (++index < length) {
  32784. var pair = pairs[index];
  32785. if (apply(pair[0], this, args)) {
  32786. return apply(pair[1], this, args);
  32787. }
  32788. }
  32789. });
  32790. }
  32791. /**
  32792. * Creates a function that invokes the predicate properties of `source` with
  32793. * the corresponding property values of a given object, returning `true` if
  32794. * all predicates return truthy, else `false`.
  32795. *
  32796. * **Note:** The created function is equivalent to `_.conformsTo` with
  32797. * `source` partially applied.
  32798. *
  32799. * @static
  32800. * @memberOf _
  32801. * @since 4.0.0
  32802. * @category Util
  32803. * @param {Object} source The object of property predicates to conform to.
  32804. * @returns {Function} Returns the new spec function.
  32805. * @example
  32806. *
  32807. * var objects = [
  32808. * { 'a': 2, 'b': 1 },
  32809. * { 'a': 1, 'b': 2 }
  32810. * ];
  32811. *
  32812. * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
  32813. * // => [{ 'a': 1, 'b': 2 }]
  32814. */
  32815. function conforms(source) {
  32816. return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
  32817. }
  32818. /**
  32819. * Creates a function that returns `value`.
  32820. *
  32821. * @static
  32822. * @memberOf _
  32823. * @since 2.4.0
  32824. * @category Util
  32825. * @param {*} value The value to return from the new function.
  32826. * @returns {Function} Returns the new constant function.
  32827. * @example
  32828. *
  32829. * var objects = _.times(2, _.constant({ 'a': 1 }));
  32830. *
  32831. * console.log(objects);
  32832. * // => [{ 'a': 1 }, { 'a': 1 }]
  32833. *
  32834. * console.log(objects[0] === objects[1]);
  32835. * // => true
  32836. */
  32837. function constant(value) {
  32838. return function() {
  32839. return value;
  32840. };
  32841. }
  32842. /**
  32843. * Checks `value` to determine whether a default value should be returned in
  32844. * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
  32845. * or `undefined`.
  32846. *
  32847. * @static
  32848. * @memberOf _
  32849. * @since 4.14.0
  32850. * @category Util
  32851. * @param {*} value The value to check.
  32852. * @param {*} defaultValue The default value.
  32853. * @returns {*} Returns the resolved value.
  32854. * @example
  32855. *
  32856. * _.defaultTo(1, 10);
  32857. * // => 1
  32858. *
  32859. * _.defaultTo(undefined, 10);
  32860. * // => 10
  32861. */
  32862. function defaultTo(value, defaultValue) {
  32863. return (value == null || value !== value) ? defaultValue : value;
  32864. }
  32865. /**
  32866. * Creates a function that returns the result of invoking the given functions
  32867. * with the `this` binding of the created function, where each successive
  32868. * invocation is supplied the return value of the previous.
  32869. *
  32870. * @static
  32871. * @memberOf _
  32872. * @since 3.0.0
  32873. * @category Util
  32874. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  32875. * @returns {Function} Returns the new composite function.
  32876. * @see _.flowRight
  32877. * @example
  32878. *
  32879. * function square(n) {
  32880. * return n * n;
  32881. * }
  32882. *
  32883. * var addSquare = _.flow([_.add, square]);
  32884. * addSquare(1, 2);
  32885. * // => 9
  32886. */
  32887. var flow = createFlow();
  32888. /**
  32889. * This method is like `_.flow` except that it creates a function that
  32890. * invokes the given functions from right to left.
  32891. *
  32892. * @static
  32893. * @since 3.0.0
  32894. * @memberOf _
  32895. * @category Util
  32896. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  32897. * @returns {Function} Returns the new composite function.
  32898. * @see _.flow
  32899. * @example
  32900. *
  32901. * function square(n) {
  32902. * return n * n;
  32903. * }
  32904. *
  32905. * var addSquare = _.flowRight([square, _.add]);
  32906. * addSquare(1, 2);
  32907. * // => 9
  32908. */
  32909. var flowRight = createFlow(true);
  32910. /**
  32911. * This method returns the first argument it receives.
  32912. *
  32913. * @static
  32914. * @since 0.1.0
  32915. * @memberOf _
  32916. * @category Util
  32917. * @param {*} value Any value.
  32918. * @returns {*} Returns `value`.
  32919. * @example
  32920. *
  32921. * var object = { 'a': 1 };
  32922. *
  32923. * console.log(_.identity(object) === object);
  32924. * // => true
  32925. */
  32926. function identity(value) {
  32927. return value;
  32928. }
  32929. /**
  32930. * Creates a function that invokes `func` with the arguments of the created
  32931. * function. If `func` is a property name, the created function returns the
  32932. * property value for a given element. If `func` is an array or object, the
  32933. * created function returns `true` for elements that contain the equivalent
  32934. * source properties, otherwise it returns `false`.
  32935. *
  32936. * @static
  32937. * @since 4.0.0
  32938. * @memberOf _
  32939. * @category Util
  32940. * @param {*} [func=_.identity] The value to convert to a callback.
  32941. * @returns {Function} Returns the callback.
  32942. * @example
  32943. *
  32944. * var users = [
  32945. * { 'user': 'barney', 'age': 36, 'active': true },
  32946. * { 'user': 'fred', 'age': 40, 'active': false }
  32947. * ];
  32948. *
  32949. * // The `_.matches` iteratee shorthand.
  32950. * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
  32951. * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
  32952. *
  32953. * // The `_.matchesProperty` iteratee shorthand.
  32954. * _.filter(users, _.iteratee(['user', 'fred']));
  32955. * // => [{ 'user': 'fred', 'age': 40 }]
  32956. *
  32957. * // The `_.property` iteratee shorthand.
  32958. * _.map(users, _.iteratee('user'));
  32959. * // => ['barney', 'fred']
  32960. *
  32961. * // Create custom iteratee shorthands.
  32962. * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
  32963. * return !_.isRegExp(func) ? iteratee(func) : function(string) {
  32964. * return func.test(string);
  32965. * };
  32966. * });
  32967. *
  32968. * _.filter(['abc', 'def'], /ef/);
  32969. * // => ['def']
  32970. */
  32971. function iteratee(func) {
  32972. return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
  32973. }
  32974. /**
  32975. * Creates a function that performs a partial deep comparison between a given
  32976. * object and `source`, returning `true` if the given object has equivalent
  32977. * property values, else `false`.
  32978. *
  32979. * **Note:** The created function is equivalent to `_.isMatch` with `source`
  32980. * partially applied.
  32981. *
  32982. * Partial comparisons will match empty array and empty object `source`
  32983. * values against any array or object value, respectively. See `_.isEqual`
  32984. * for a list of supported value comparisons.
  32985. *
  32986. * @static
  32987. * @memberOf _
  32988. * @since 3.0.0
  32989. * @category Util
  32990. * @param {Object} source The object of property values to match.
  32991. * @returns {Function} Returns the new spec function.
  32992. * @example
  32993. *
  32994. * var objects = [
  32995. * { 'a': 1, 'b': 2, 'c': 3 },
  32996. * { 'a': 4, 'b': 5, 'c': 6 }
  32997. * ];
  32998. *
  32999. * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
  33000. * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
  33001. */
  33002. function matches(source) {
  33003. return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
  33004. }
  33005. /**
  33006. * Creates a function that performs a partial deep comparison between the
  33007. * value at `path` of a given object to `srcValue`, returning `true` if the
  33008. * object value is equivalent, else `false`.
  33009. *
  33010. * **Note:** Partial comparisons will match empty array and empty object
  33011. * `srcValue` values against any array or object value, respectively. See
  33012. * `_.isEqual` for a list of supported value comparisons.
  33013. *
  33014. * @static
  33015. * @memberOf _
  33016. * @since 3.2.0
  33017. * @category Util
  33018. * @param {Array|string} path The path of the property to get.
  33019. * @param {*} srcValue The value to match.
  33020. * @returns {Function} Returns the new spec function.
  33021. * @example
  33022. *
  33023. * var objects = [
  33024. * { 'a': 1, 'b': 2, 'c': 3 },
  33025. * { 'a': 4, 'b': 5, 'c': 6 }
  33026. * ];
  33027. *
  33028. * _.find(objects, _.matchesProperty('a', 4));
  33029. * // => { 'a': 4, 'b': 5, 'c': 6 }
  33030. */
  33031. function matchesProperty(path, srcValue) {
  33032. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
  33033. }
  33034. /**
  33035. * Creates a function that invokes the method at `path` of a given object.
  33036. * Any additional arguments are provided to the invoked method.
  33037. *
  33038. * @static
  33039. * @memberOf _
  33040. * @since 3.7.0
  33041. * @category Util
  33042. * @param {Array|string} path The path of the method to invoke.
  33043. * @param {...*} [args] The arguments to invoke the method with.
  33044. * @returns {Function} Returns the new invoker function.
  33045. * @example
  33046. *
  33047. * var objects = [
  33048. * { 'a': { 'b': _.constant(2) } },
  33049. * { 'a': { 'b': _.constant(1) } }
  33050. * ];
  33051. *
  33052. * _.map(objects, _.method('a.b'));
  33053. * // => [2, 1]
  33054. *
  33055. * _.map(objects, _.method(['a', 'b']));
  33056. * // => [2, 1]
  33057. */
  33058. var method = baseRest(function(path, args) {
  33059. return function(object) {
  33060. return baseInvoke(object, path, args);
  33061. };
  33062. });
  33063. /**
  33064. * The opposite of `_.method`; this method creates a function that invokes
  33065. * the method at a given path of `object`. Any additional arguments are
  33066. * provided to the invoked method.
  33067. *
  33068. * @static
  33069. * @memberOf _
  33070. * @since 3.7.0
  33071. * @category Util
  33072. * @param {Object} object The object to query.
  33073. * @param {...*} [args] The arguments to invoke the method with.
  33074. * @returns {Function} Returns the new invoker function.
  33075. * @example
  33076. *
  33077. * var array = _.times(3, _.constant),
  33078. * object = { 'a': array, 'b': array, 'c': array };
  33079. *
  33080. * _.map(['a[2]', 'c[0]'], _.methodOf(object));
  33081. * // => [2, 0]
  33082. *
  33083. * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
  33084. * // => [2, 0]
  33085. */
  33086. var methodOf = baseRest(function(object, args) {
  33087. return function(path) {
  33088. return baseInvoke(object, path, args);
  33089. };
  33090. });
  33091. /**
  33092. * Adds all own enumerable string keyed function properties of a source
  33093. * object to the destination object. If `object` is a function, then methods
  33094. * are added to its prototype as well.
  33095. *
  33096. * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
  33097. * avoid conflicts caused by modifying the original.
  33098. *
  33099. * @static
  33100. * @since 0.1.0
  33101. * @memberOf _
  33102. * @category Util
  33103. * @param {Function|Object} [object=lodash] The destination object.
  33104. * @param {Object} source The object of functions to add.
  33105. * @param {Object} [options={}] The options object.
  33106. * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
  33107. * @returns {Function|Object} Returns `object`.
  33108. * @example
  33109. *
  33110. * function vowels(string) {
  33111. * return _.filter(string, function(v) {
  33112. * return /[aeiou]/i.test(v);
  33113. * });
  33114. * }
  33115. *
  33116. * _.mixin({ 'vowels': vowels });
  33117. * _.vowels('fred');
  33118. * // => ['e']
  33119. *
  33120. * _('fred').vowels().value();
  33121. * // => ['e']
  33122. *
  33123. * _.mixin({ 'vowels': vowels }, { 'chain': false });
  33124. * _('fred').vowels();
  33125. * // => ['e']
  33126. */
  33127. function mixin(object, source, options) {
  33128. var props = keys(source),
  33129. methodNames = baseFunctions(source, props);
  33130. if (options == null &&
  33131. !(isObject(source) && (methodNames.length || !props.length))) {
  33132. options = source;
  33133. source = object;
  33134. object = this;
  33135. methodNames = baseFunctions(source, keys(source));
  33136. }
  33137. var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
  33138. isFunc = isFunction(object);
  33139. arrayEach(methodNames, function(methodName) {
  33140. var func = source[methodName];
  33141. object[methodName] = func;
  33142. if (isFunc) {
  33143. object.prototype[methodName] = function() {
  33144. var chainAll = this.__chain__;
  33145. if (chain || chainAll) {
  33146. var result = object(this.__wrapped__),
  33147. actions = result.__actions__ = copyArray(this.__actions__);
  33148. actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
  33149. result.__chain__ = chainAll;
  33150. return result;
  33151. }
  33152. return func.apply(object, arrayPush([this.value()], arguments));
  33153. };
  33154. }
  33155. });
  33156. return object;
  33157. }
  33158. /**
  33159. * Reverts the `_` variable to its previous value and returns a reference to
  33160. * the `lodash` function.
  33161. *
  33162. * @static
  33163. * @since 0.1.0
  33164. * @memberOf _
  33165. * @category Util
  33166. * @returns {Function} Returns the `lodash` function.
  33167. * @example
  33168. *
  33169. * var lodash = _.noConflict();
  33170. */
  33171. function noConflict() {
  33172. if (root._ === this) {
  33173. root._ = oldDash;
  33174. }
  33175. return this;
  33176. }
  33177. /**
  33178. * This method returns `undefined`.
  33179. *
  33180. * @static
  33181. * @memberOf _
  33182. * @since 2.3.0
  33183. * @category Util
  33184. * @example
  33185. *
  33186. * _.times(2, _.noop);
  33187. * // => [undefined, undefined]
  33188. */
  33189. function noop() {
  33190. // No operation performed.
  33191. }
  33192. /**
  33193. * Creates a function that gets the argument at index `n`. If `n` is negative,
  33194. * the nth argument from the end is returned.
  33195. *
  33196. * @static
  33197. * @memberOf _
  33198. * @since 4.0.0
  33199. * @category Util
  33200. * @param {number} [n=0] The index of the argument to return.
  33201. * @returns {Function} Returns the new pass-thru function.
  33202. * @example
  33203. *
  33204. * var func = _.nthArg(1);
  33205. * func('a', 'b', 'c', 'd');
  33206. * // => 'b'
  33207. *
  33208. * var func = _.nthArg(-2);
  33209. * func('a', 'b', 'c', 'd');
  33210. * // => 'c'
  33211. */
  33212. function nthArg(n) {
  33213. n = toInteger(n);
  33214. return baseRest(function(args) {
  33215. return baseNth(args, n);
  33216. });
  33217. }
  33218. /**
  33219. * Creates a function that invokes `iteratees` with the arguments it receives
  33220. * and returns their results.
  33221. *
  33222. * @static
  33223. * @memberOf _
  33224. * @since 4.0.0
  33225. * @category Util
  33226. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  33227. * The iteratees to invoke.
  33228. * @returns {Function} Returns the new function.
  33229. * @example
  33230. *
  33231. * var func = _.over([Math.max, Math.min]);
  33232. *
  33233. * func(1, 2, 3, 4);
  33234. * // => [4, 1]
  33235. */
  33236. var over = createOver(arrayMap);
  33237. /**
  33238. * Creates a function that checks if **all** of the `predicates` return
  33239. * truthy when invoked with the arguments it receives.
  33240. *
  33241. * @static
  33242. * @memberOf _
  33243. * @since 4.0.0
  33244. * @category Util
  33245. * @param {...(Function|Function[])} [predicates=[_.identity]]
  33246. * The predicates to check.
  33247. * @returns {Function} Returns the new function.
  33248. * @example
  33249. *
  33250. * var func = _.overEvery([Boolean, isFinite]);
  33251. *
  33252. * func('1');
  33253. * // => true
  33254. *
  33255. * func(null);
  33256. * // => false
  33257. *
  33258. * func(NaN);
  33259. * // => false
  33260. */
  33261. var overEvery = createOver(arrayEvery);
  33262. /**
  33263. * Creates a function that checks if **any** of the `predicates` return
  33264. * truthy when invoked with the arguments it receives.
  33265. *
  33266. * @static
  33267. * @memberOf _
  33268. * @since 4.0.0
  33269. * @category Util
  33270. * @param {...(Function|Function[])} [predicates=[_.identity]]
  33271. * The predicates to check.
  33272. * @returns {Function} Returns the new function.
  33273. * @example
  33274. *
  33275. * var func = _.overSome([Boolean, isFinite]);
  33276. *
  33277. * func('1');
  33278. * // => true
  33279. *
  33280. * func(null);
  33281. * // => true
  33282. *
  33283. * func(NaN);
  33284. * // => false
  33285. */
  33286. var overSome = createOver(arraySome);
  33287. /**
  33288. * Creates a function that returns the value at `path` of a given object.
  33289. *
  33290. * @static
  33291. * @memberOf _
  33292. * @since 2.4.0
  33293. * @category Util
  33294. * @param {Array|string} path The path of the property to get.
  33295. * @returns {Function} Returns the new accessor function.
  33296. * @example
  33297. *
  33298. * var objects = [
  33299. * { 'a': { 'b': 2 } },
  33300. * { 'a': { 'b': 1 } }
  33301. * ];
  33302. *
  33303. * _.map(objects, _.property('a.b'));
  33304. * // => [2, 1]
  33305. *
  33306. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  33307. * // => [1, 2]
  33308. */
  33309. function property(path) {
  33310. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  33311. }
  33312. /**
  33313. * The opposite of `_.property`; this method creates a function that returns
  33314. * the value at a given path of `object`.
  33315. *
  33316. * @static
  33317. * @memberOf _
  33318. * @since 3.0.0
  33319. * @category Util
  33320. * @param {Object} object The object to query.
  33321. * @returns {Function} Returns the new accessor function.
  33322. * @example
  33323. *
  33324. * var array = [0, 1, 2],
  33325. * object = { 'a': array, 'b': array, 'c': array };
  33326. *
  33327. * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
  33328. * // => [2, 0]
  33329. *
  33330. * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
  33331. * // => [2, 0]
  33332. */
  33333. function propertyOf(object) {
  33334. return function(path) {
  33335. return object == null ? undefined : baseGet(object, path);
  33336. };
  33337. }
  33338. /**
  33339. * Creates an array of numbers (positive and/or negative) progressing from
  33340. * `start` up to, but not including, `end`. A step of `-1` is used if a negative
  33341. * `start` is specified without an `end` or `step`. If `end` is not specified,
  33342. * it's set to `start` with `start` then set to `0`.
  33343. *
  33344. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  33345. * floating-point values which can produce unexpected results.
  33346. *
  33347. * @static
  33348. * @since 0.1.0
  33349. * @memberOf _
  33350. * @category Util
  33351. * @param {number} [start=0] The start of the range.
  33352. * @param {number} end The end of the range.
  33353. * @param {number} [step=1] The value to increment or decrement by.
  33354. * @returns {Array} Returns the range of numbers.
  33355. * @see _.inRange, _.rangeRight
  33356. * @example
  33357. *
  33358. * _.range(4);
  33359. * // => [0, 1, 2, 3]
  33360. *
  33361. * _.range(-4);
  33362. * // => [0, -1, -2, -3]
  33363. *
  33364. * _.range(1, 5);
  33365. * // => [1, 2, 3, 4]
  33366. *
  33367. * _.range(0, 20, 5);
  33368. * // => [0, 5, 10, 15]
  33369. *
  33370. * _.range(0, -4, -1);
  33371. * // => [0, -1, -2, -3]
  33372. *
  33373. * _.range(1, 4, 0);
  33374. * // => [1, 1, 1]
  33375. *
  33376. * _.range(0);
  33377. * // => []
  33378. */
  33379. var range = createRange();
  33380. /**
  33381. * This method is like `_.range` except that it populates values in
  33382. * descending order.
  33383. *
  33384. * @static
  33385. * @memberOf _
  33386. * @since 4.0.0
  33387. * @category Util
  33388. * @param {number} [start=0] The start of the range.
  33389. * @param {number} end The end of the range.
  33390. * @param {number} [step=1] The value to increment or decrement by.
  33391. * @returns {Array} Returns the range of numbers.
  33392. * @see _.inRange, _.range
  33393. * @example
  33394. *
  33395. * _.rangeRight(4);
  33396. * // => [3, 2, 1, 0]
  33397. *
  33398. * _.rangeRight(-4);
  33399. * // => [-3, -2, -1, 0]
  33400. *
  33401. * _.rangeRight(1, 5);
  33402. * // => [4, 3, 2, 1]
  33403. *
  33404. * _.rangeRight(0, 20, 5);
  33405. * // => [15, 10, 5, 0]
  33406. *
  33407. * _.rangeRight(0, -4, -1);
  33408. * // => [-3, -2, -1, 0]
  33409. *
  33410. * _.rangeRight(1, 4, 0);
  33411. * // => [1, 1, 1]
  33412. *
  33413. * _.rangeRight(0);
  33414. * // => []
  33415. */
  33416. var rangeRight = createRange(true);
  33417. /**
  33418. * This method returns a new empty array.
  33419. *
  33420. * @static
  33421. * @memberOf _
  33422. * @since 4.13.0
  33423. * @category Util
  33424. * @returns {Array} Returns the new empty array.
  33425. * @example
  33426. *
  33427. * var arrays = _.times(2, _.stubArray);
  33428. *
  33429. * console.log(arrays);
  33430. * // => [[], []]
  33431. *
  33432. * console.log(arrays[0] === arrays[1]);
  33433. * // => false
  33434. */
  33435. function stubArray() {
  33436. return [];
  33437. }
  33438. /**
  33439. * This method returns `false`.
  33440. *
  33441. * @static
  33442. * @memberOf _
  33443. * @since 4.13.0
  33444. * @category Util
  33445. * @returns {boolean} Returns `false`.
  33446. * @example
  33447. *
  33448. * _.times(2, _.stubFalse);
  33449. * // => [false, false]
  33450. */
  33451. function stubFalse() {
  33452. return false;
  33453. }
  33454. /**
  33455. * This method returns a new empty object.
  33456. *
  33457. * @static
  33458. * @memberOf _
  33459. * @since 4.13.0
  33460. * @category Util
  33461. * @returns {Object} Returns the new empty object.
  33462. * @example
  33463. *
  33464. * var objects = _.times(2, _.stubObject);
  33465. *
  33466. * console.log(objects);
  33467. * // => [{}, {}]
  33468. *
  33469. * console.log(objects[0] === objects[1]);
  33470. * // => false
  33471. */
  33472. function stubObject() {
  33473. return {};
  33474. }
  33475. /**
  33476. * This method returns an empty string.
  33477. *
  33478. * @static
  33479. * @memberOf _
  33480. * @since 4.13.0
  33481. * @category Util
  33482. * @returns {string} Returns the empty string.
  33483. * @example
  33484. *
  33485. * _.times(2, _.stubString);
  33486. * // => ['', '']
  33487. */
  33488. function stubString() {
  33489. return '';
  33490. }
  33491. /**
  33492. * This method returns `true`.
  33493. *
  33494. * @static
  33495. * @memberOf _
  33496. * @since 4.13.0
  33497. * @category Util
  33498. * @returns {boolean} Returns `true`.
  33499. * @example
  33500. *
  33501. * _.times(2, _.stubTrue);
  33502. * // => [true, true]
  33503. */
  33504. function stubTrue() {
  33505. return true;
  33506. }
  33507. /**
  33508. * Invokes the iteratee `n` times, returning an array of the results of
  33509. * each invocation. The iteratee is invoked with one argument; (index).
  33510. *
  33511. * @static
  33512. * @since 0.1.0
  33513. * @memberOf _
  33514. * @category Util
  33515. * @param {number} n The number of times to invoke `iteratee`.
  33516. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  33517. * @returns {Array} Returns the array of results.
  33518. * @example
  33519. *
  33520. * _.times(3, String);
  33521. * // => ['0', '1', '2']
  33522. *
  33523. * _.times(4, _.constant(0));
  33524. * // => [0, 0, 0, 0]
  33525. */
  33526. function times(n, iteratee) {
  33527. n = toInteger(n);
  33528. if (n < 1 || n > MAX_SAFE_INTEGER) {
  33529. return [];
  33530. }
  33531. var index = MAX_ARRAY_LENGTH,
  33532. length = nativeMin(n, MAX_ARRAY_LENGTH);
  33533. iteratee = getIteratee(iteratee);
  33534. n -= MAX_ARRAY_LENGTH;
  33535. var result = baseTimes(length, iteratee);
  33536. while (++index < n) {
  33537. iteratee(index);
  33538. }
  33539. return result;
  33540. }
  33541. /**
  33542. * Converts `value` to a property path array.
  33543. *
  33544. * @static
  33545. * @memberOf _
  33546. * @since 4.0.0
  33547. * @category Util
  33548. * @param {*} value The value to convert.
  33549. * @returns {Array} Returns the new property path array.
  33550. * @example
  33551. *
  33552. * _.toPath('a.b.c');
  33553. * // => ['a', 'b', 'c']
  33554. *
  33555. * _.toPath('a[0].b.c');
  33556. * // => ['a', '0', 'b', 'c']
  33557. */
  33558. function toPath(value) {
  33559. if (isArray(value)) {
  33560. return arrayMap(value, toKey);
  33561. }
  33562. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  33563. }
  33564. /**
  33565. * Generates a unique ID. If `prefix` is given, the ID is appended to it.
  33566. *
  33567. * @static
  33568. * @since 0.1.0
  33569. * @memberOf _
  33570. * @category Util
  33571. * @param {string} [prefix=''] The value to prefix the ID with.
  33572. * @returns {string} Returns the unique ID.
  33573. * @example
  33574. *
  33575. * _.uniqueId('contact_');
  33576. * // => 'contact_104'
  33577. *
  33578. * _.uniqueId();
  33579. * // => '105'
  33580. */
  33581. function uniqueId(prefix) {
  33582. var id = ++idCounter;
  33583. return toString(prefix) + id;
  33584. }
  33585. /*------------------------------------------------------------------------*/
  33586. /**
  33587. * Adds two numbers.
  33588. *
  33589. * @static
  33590. * @memberOf _
  33591. * @since 3.4.0
  33592. * @category Math
  33593. * @param {number} augend The first number in an addition.
  33594. * @param {number} addend The second number in an addition.
  33595. * @returns {number} Returns the total.
  33596. * @example
  33597. *
  33598. * _.add(6, 4);
  33599. * // => 10
  33600. */
  33601. var add = createMathOperation(function(augend, addend) {
  33602. return augend + addend;
  33603. }, 0);
  33604. /**
  33605. * Computes `number` rounded up to `precision`.
  33606. *
  33607. * @static
  33608. * @memberOf _
  33609. * @since 3.10.0
  33610. * @category Math
  33611. * @param {number} number The number to round up.
  33612. * @param {number} [precision=0] The precision to round up to.
  33613. * @returns {number} Returns the rounded up number.
  33614. * @example
  33615. *
  33616. * _.ceil(4.006);
  33617. * // => 5
  33618. *
  33619. * _.ceil(6.004, 2);
  33620. * // => 6.01
  33621. *
  33622. * _.ceil(6040, -2);
  33623. * // => 6100
  33624. */
  33625. var ceil = createRound('ceil');
  33626. /**
  33627. * Divide two numbers.
  33628. *
  33629. * @static
  33630. * @memberOf _
  33631. * @since 4.7.0
  33632. * @category Math
  33633. * @param {number} dividend The first number in a division.
  33634. * @param {number} divisor The second number in a division.
  33635. * @returns {number} Returns the quotient.
  33636. * @example
  33637. *
  33638. * _.divide(6, 4);
  33639. * // => 1.5
  33640. */
  33641. var divide = createMathOperation(function(dividend, divisor) {
  33642. return dividend / divisor;
  33643. }, 1);
  33644. /**
  33645. * Computes `number` rounded down to `precision`.
  33646. *
  33647. * @static
  33648. * @memberOf _
  33649. * @since 3.10.0
  33650. * @category Math
  33651. * @param {number} number The number to round down.
  33652. * @param {number} [precision=0] The precision to round down to.
  33653. * @returns {number} Returns the rounded down number.
  33654. * @example
  33655. *
  33656. * _.floor(4.006);
  33657. * // => 4
  33658. *
  33659. * _.floor(0.046, 2);
  33660. * // => 0.04
  33661. *
  33662. * _.floor(4060, -2);
  33663. * // => 4000
  33664. */
  33665. var floor = createRound('floor');
  33666. /**
  33667. * Computes the maximum value of `array`. If `array` is empty or falsey,
  33668. * `undefined` is returned.
  33669. *
  33670. * @static
  33671. * @since 0.1.0
  33672. * @memberOf _
  33673. * @category Math
  33674. * @param {Array} array The array to iterate over.
  33675. * @returns {*} Returns the maximum value.
  33676. * @example
  33677. *
  33678. * _.max([4, 2, 8, 6]);
  33679. * // => 8
  33680. *
  33681. * _.max([]);
  33682. * // => undefined
  33683. */
  33684. function max(array) {
  33685. return (array && array.length)
  33686. ? baseExtremum(array, identity, baseGt)
  33687. : undefined;
  33688. }
  33689. /**
  33690. * This method is like `_.max` except that it accepts `iteratee` which is
  33691. * invoked for each element in `array` to generate the criterion by which
  33692. * the value is ranked. The iteratee is invoked with one argument: (value).
  33693. *
  33694. * @static
  33695. * @memberOf _
  33696. * @since 4.0.0
  33697. * @category Math
  33698. * @param {Array} array The array to iterate over.
  33699. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33700. * @returns {*} Returns the maximum value.
  33701. * @example
  33702. *
  33703. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  33704. *
  33705. * _.maxBy(objects, function(o) { return o.n; });
  33706. * // => { 'n': 2 }
  33707. *
  33708. * // The `_.property` iteratee shorthand.
  33709. * _.maxBy(objects, 'n');
  33710. * // => { 'n': 2 }
  33711. */
  33712. function maxBy(array, iteratee) {
  33713. return (array && array.length)
  33714. ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
  33715. : undefined;
  33716. }
  33717. /**
  33718. * Computes the mean of the values in `array`.
  33719. *
  33720. * @static
  33721. * @memberOf _
  33722. * @since 4.0.0
  33723. * @category Math
  33724. * @param {Array} array The array to iterate over.
  33725. * @returns {number} Returns the mean.
  33726. * @example
  33727. *
  33728. * _.mean([4, 2, 8, 6]);
  33729. * // => 5
  33730. */
  33731. function mean(array) {
  33732. return baseMean(array, identity);
  33733. }
  33734. /**
  33735. * This method is like `_.mean` except that it accepts `iteratee` which is
  33736. * invoked for each element in `array` to generate the value to be averaged.
  33737. * The iteratee is invoked with one argument: (value).
  33738. *
  33739. * @static
  33740. * @memberOf _
  33741. * @since 4.7.0
  33742. * @category Math
  33743. * @param {Array} array The array to iterate over.
  33744. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33745. * @returns {number} Returns the mean.
  33746. * @example
  33747. *
  33748. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  33749. *
  33750. * _.meanBy(objects, function(o) { return o.n; });
  33751. * // => 5
  33752. *
  33753. * // The `_.property` iteratee shorthand.
  33754. * _.meanBy(objects, 'n');
  33755. * // => 5
  33756. */
  33757. function meanBy(array, iteratee) {
  33758. return baseMean(array, getIteratee(iteratee, 2));
  33759. }
  33760. /**
  33761. * Computes the minimum value of `array`. If `array` is empty or falsey,
  33762. * `undefined` is returned.
  33763. *
  33764. * @static
  33765. * @since 0.1.0
  33766. * @memberOf _
  33767. * @category Math
  33768. * @param {Array} array The array to iterate over.
  33769. * @returns {*} Returns the minimum value.
  33770. * @example
  33771. *
  33772. * _.min([4, 2, 8, 6]);
  33773. * // => 2
  33774. *
  33775. * _.min([]);
  33776. * // => undefined
  33777. */
  33778. function min(array) {
  33779. return (array && array.length)
  33780. ? baseExtremum(array, identity, baseLt)
  33781. : undefined;
  33782. }
  33783. /**
  33784. * This method is like `_.min` except that it accepts `iteratee` which is
  33785. * invoked for each element in `array` to generate the criterion by which
  33786. * the value is ranked. The iteratee is invoked with one argument: (value).
  33787. *
  33788. * @static
  33789. * @memberOf _
  33790. * @since 4.0.0
  33791. * @category Math
  33792. * @param {Array} array The array to iterate over.
  33793. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33794. * @returns {*} Returns the minimum value.
  33795. * @example
  33796. *
  33797. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  33798. *
  33799. * _.minBy(objects, function(o) { return o.n; });
  33800. * // => { 'n': 1 }
  33801. *
  33802. * // The `_.property` iteratee shorthand.
  33803. * _.minBy(objects, 'n');
  33804. * // => { 'n': 1 }
  33805. */
  33806. function minBy(array, iteratee) {
  33807. return (array && array.length)
  33808. ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
  33809. : undefined;
  33810. }
  33811. /**
  33812. * Multiply two numbers.
  33813. *
  33814. * @static
  33815. * @memberOf _
  33816. * @since 4.7.0
  33817. * @category Math
  33818. * @param {number} multiplier The first number in a multiplication.
  33819. * @param {number} multiplicand The second number in a multiplication.
  33820. * @returns {number} Returns the product.
  33821. * @example
  33822. *
  33823. * _.multiply(6, 4);
  33824. * // => 24
  33825. */
  33826. var multiply = createMathOperation(function(multiplier, multiplicand) {
  33827. return multiplier * multiplicand;
  33828. }, 1);
  33829. /**
  33830. * Computes `number` rounded to `precision`.
  33831. *
  33832. * @static
  33833. * @memberOf _
  33834. * @since 3.10.0
  33835. * @category Math
  33836. * @param {number} number The number to round.
  33837. * @param {number} [precision=0] The precision to round to.
  33838. * @returns {number} Returns the rounded number.
  33839. * @example
  33840. *
  33841. * _.round(4.006);
  33842. * // => 4
  33843. *
  33844. * _.round(4.006, 2);
  33845. * // => 4.01
  33846. *
  33847. * _.round(4060, -2);
  33848. * // => 4100
  33849. */
  33850. var round = createRound('round');
  33851. /**
  33852. * Subtract two numbers.
  33853. *
  33854. * @static
  33855. * @memberOf _
  33856. * @since 4.0.0
  33857. * @category Math
  33858. * @param {number} minuend The first number in a subtraction.
  33859. * @param {number} subtrahend The second number in a subtraction.
  33860. * @returns {number} Returns the difference.
  33861. * @example
  33862. *
  33863. * _.subtract(6, 4);
  33864. * // => 2
  33865. */
  33866. var subtract = createMathOperation(function(minuend, subtrahend) {
  33867. return minuend - subtrahend;
  33868. }, 0);
  33869. /**
  33870. * Computes the sum of the values in `array`.
  33871. *
  33872. * @static
  33873. * @memberOf _
  33874. * @since 3.4.0
  33875. * @category Math
  33876. * @param {Array} array The array to iterate over.
  33877. * @returns {number} Returns the sum.
  33878. * @example
  33879. *
  33880. * _.sum([4, 2, 8, 6]);
  33881. * // => 20
  33882. */
  33883. function sum(array) {
  33884. return (array && array.length)
  33885. ? baseSum(array, identity)
  33886. : 0;
  33887. }
  33888. /**
  33889. * This method is like `_.sum` except that it accepts `iteratee` which is
  33890. * invoked for each element in `array` to generate the value to be summed.
  33891. * The iteratee is invoked with one argument: (value).
  33892. *
  33893. * @static
  33894. * @memberOf _
  33895. * @since 4.0.0
  33896. * @category Math
  33897. * @param {Array} array The array to iterate over.
  33898. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33899. * @returns {number} Returns the sum.
  33900. * @example
  33901. *
  33902. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  33903. *
  33904. * _.sumBy(objects, function(o) { return o.n; });
  33905. * // => 20
  33906. *
  33907. * // The `_.property` iteratee shorthand.
  33908. * _.sumBy(objects, 'n');
  33909. * // => 20
  33910. */
  33911. function sumBy(array, iteratee) {
  33912. return (array && array.length)
  33913. ? baseSum(array, getIteratee(iteratee, 2))
  33914. : 0;
  33915. }
  33916. /*------------------------------------------------------------------------*/
  33917. // Add methods that return wrapped values in chain sequences.
  33918. lodash.after = after;
  33919. lodash.ary = ary;
  33920. lodash.assign = assign;
  33921. lodash.assignIn = assignIn;
  33922. lodash.assignInWith = assignInWith;
  33923. lodash.assignWith = assignWith;
  33924. lodash.at = at;
  33925. lodash.before = before;
  33926. lodash.bind = bind;
  33927. lodash.bindAll = bindAll;
  33928. lodash.bindKey = bindKey;
  33929. lodash.castArray = castArray;
  33930. lodash.chain = chain;
  33931. lodash.chunk = chunk;
  33932. lodash.compact = compact;
  33933. lodash.concat = concat;
  33934. lodash.cond = cond;
  33935. lodash.conforms = conforms;
  33936. lodash.constant = constant;
  33937. lodash.countBy = countBy;
  33938. lodash.create = create;
  33939. lodash.curry = curry;
  33940. lodash.curryRight = curryRight;
  33941. lodash.debounce = debounce;
  33942. lodash.defaults = defaults;
  33943. lodash.defaultsDeep = defaultsDeep;
  33944. lodash.defer = defer;
  33945. lodash.delay = delay;
  33946. lodash.difference = difference;
  33947. lodash.differenceBy = differenceBy;
  33948. lodash.differenceWith = differenceWith;
  33949. lodash.drop = drop;
  33950. lodash.dropRight = dropRight;
  33951. lodash.dropRightWhile = dropRightWhile;
  33952. lodash.dropWhile = dropWhile;
  33953. lodash.fill = fill;
  33954. lodash.filter = filter;
  33955. lodash.flatMap = flatMap;
  33956. lodash.flatMapDeep = flatMapDeep;
  33957. lodash.flatMapDepth = flatMapDepth;
  33958. lodash.flatten = flatten;
  33959. lodash.flattenDeep = flattenDeep;
  33960. lodash.flattenDepth = flattenDepth;
  33961. lodash.flip = flip;
  33962. lodash.flow = flow;
  33963. lodash.flowRight = flowRight;
  33964. lodash.fromPairs = fromPairs;
  33965. lodash.functions = functions;
  33966. lodash.functionsIn = functionsIn;
  33967. lodash.groupBy = groupBy;
  33968. lodash.initial = initial;
  33969. lodash.intersection = intersection;
  33970. lodash.intersectionBy = intersectionBy;
  33971. lodash.intersectionWith = intersectionWith;
  33972. lodash.invert = invert;
  33973. lodash.invertBy = invertBy;
  33974. lodash.invokeMap = invokeMap;
  33975. lodash.iteratee = iteratee;
  33976. lodash.keyBy = keyBy;
  33977. lodash.keys = keys;
  33978. lodash.keysIn = keysIn;
  33979. lodash.map = map;
  33980. lodash.mapKeys = mapKeys;
  33981. lodash.mapValues = mapValues;
  33982. lodash.matches = matches;
  33983. lodash.matchesProperty = matchesProperty;
  33984. lodash.memoize = memoize;
  33985. lodash.merge = merge;
  33986. lodash.mergeWith = mergeWith;
  33987. lodash.method = method;
  33988. lodash.methodOf = methodOf;
  33989. lodash.mixin = mixin;
  33990. lodash.negate = negate;
  33991. lodash.nthArg = nthArg;
  33992. lodash.omit = omit;
  33993. lodash.omitBy = omitBy;
  33994. lodash.once = once;
  33995. lodash.orderBy = orderBy;
  33996. lodash.over = over;
  33997. lodash.overArgs = overArgs;
  33998. lodash.overEvery = overEvery;
  33999. lodash.overSome = overSome;
  34000. lodash.partial = partial;
  34001. lodash.partialRight = partialRight;
  34002. lodash.partition = partition;
  34003. lodash.pick = pick;
  34004. lodash.pickBy = pickBy;
  34005. lodash.property = property;
  34006. lodash.propertyOf = propertyOf;
  34007. lodash.pull = pull;
  34008. lodash.pullAll = pullAll;
  34009. lodash.pullAllBy = pullAllBy;
  34010. lodash.pullAllWith = pullAllWith;
  34011. lodash.pullAt = pullAt;
  34012. lodash.range = range;
  34013. lodash.rangeRight = rangeRight;
  34014. lodash.rearg = rearg;
  34015. lodash.reject = reject;
  34016. lodash.remove = remove;
  34017. lodash.rest = rest;
  34018. lodash.reverse = reverse;
  34019. lodash.sampleSize = sampleSize;
  34020. lodash.set = set;
  34021. lodash.setWith = setWith;
  34022. lodash.shuffle = shuffle;
  34023. lodash.slice = slice;
  34024. lodash.sortBy = sortBy;
  34025. lodash.sortedUniq = sortedUniq;
  34026. lodash.sortedUniqBy = sortedUniqBy;
  34027. lodash.split = split;
  34028. lodash.spread = spread;
  34029. lodash.tail = tail;
  34030. lodash.take = take;
  34031. lodash.takeRight = takeRight;
  34032. lodash.takeRightWhile = takeRightWhile;
  34033. lodash.takeWhile = takeWhile;
  34034. lodash.tap = tap;
  34035. lodash.throttle = throttle;
  34036. lodash.thru = thru;
  34037. lodash.toArray = toArray;
  34038. lodash.toPairs = toPairs;
  34039. lodash.toPairsIn = toPairsIn;
  34040. lodash.toPath = toPath;
  34041. lodash.toPlainObject = toPlainObject;
  34042. lodash.transform = transform;
  34043. lodash.unary = unary;
  34044. lodash.union = union;
  34045. lodash.unionBy = unionBy;
  34046. lodash.unionWith = unionWith;
  34047. lodash.uniq = uniq;
  34048. lodash.uniqBy = uniqBy;
  34049. lodash.uniqWith = uniqWith;
  34050. lodash.unset = unset;
  34051. lodash.unzip = unzip;
  34052. lodash.unzipWith = unzipWith;
  34053. lodash.update = update;
  34054. lodash.updateWith = updateWith;
  34055. lodash.values = values;
  34056. lodash.valuesIn = valuesIn;
  34057. lodash.without = without;
  34058. lodash.words = words;
  34059. lodash.wrap = wrap;
  34060. lodash.xor = xor;
  34061. lodash.xorBy = xorBy;
  34062. lodash.xorWith = xorWith;
  34063. lodash.zip = zip;
  34064. lodash.zipObject = zipObject;
  34065. lodash.zipObjectDeep = zipObjectDeep;
  34066. lodash.zipWith = zipWith;
  34067. // Add aliases.
  34068. lodash.entries = toPairs;
  34069. lodash.entriesIn = toPairsIn;
  34070. lodash.extend = assignIn;
  34071. lodash.extendWith = assignInWith;
  34072. // Add methods to `lodash.prototype`.
  34073. mixin(lodash, lodash);
  34074. /*------------------------------------------------------------------------*/
  34075. // Add methods that return unwrapped values in chain sequences.
  34076. lodash.add = add;
  34077. lodash.attempt = attempt;
  34078. lodash.camelCase = camelCase;
  34079. lodash.capitalize = capitalize;
  34080. lodash.ceil = ceil;
  34081. lodash.clamp = clamp;
  34082. lodash.clone = clone;
  34083. lodash.cloneDeep = cloneDeep;
  34084. lodash.cloneDeepWith = cloneDeepWith;
  34085. lodash.cloneWith = cloneWith;
  34086. lodash.conformsTo = conformsTo;
  34087. lodash.deburr = deburr;
  34088. lodash.defaultTo = defaultTo;
  34089. lodash.divide = divide;
  34090. lodash.endsWith = endsWith;
  34091. lodash.eq = eq;
  34092. lodash.escape = escape;
  34093. lodash.escapeRegExp = escapeRegExp;
  34094. lodash.every = every;
  34095. lodash.find = find;
  34096. lodash.findIndex = findIndex;
  34097. lodash.findKey = findKey;
  34098. lodash.findLast = findLast;
  34099. lodash.findLastIndex = findLastIndex;
  34100. lodash.findLastKey = findLastKey;
  34101. lodash.floor = floor;
  34102. lodash.forEach = forEach;
  34103. lodash.forEachRight = forEachRight;
  34104. lodash.forIn = forIn;
  34105. lodash.forInRight = forInRight;
  34106. lodash.forOwn = forOwn;
  34107. lodash.forOwnRight = forOwnRight;
  34108. lodash.get = get;
  34109. lodash.gt = gt;
  34110. lodash.gte = gte;
  34111. lodash.has = has;
  34112. lodash.hasIn = hasIn;
  34113. lodash.head = head;
  34114. lodash.identity = identity;
  34115. lodash.includes = includes;
  34116. lodash.indexOf = indexOf;
  34117. lodash.inRange = inRange;
  34118. lodash.invoke = invoke;
  34119. lodash.isArguments = isArguments;
  34120. lodash.isArray = isArray;
  34121. lodash.isArrayBuffer = isArrayBuffer;
  34122. lodash.isArrayLike = isArrayLike;
  34123. lodash.isArrayLikeObject = isArrayLikeObject;
  34124. lodash.isBoolean = isBoolean;
  34125. lodash.isBuffer = isBuffer;
  34126. lodash.isDate = isDate;
  34127. lodash.isElement = isElement;
  34128. lodash.isEmpty = isEmpty;
  34129. lodash.isEqual = isEqual;
  34130. lodash.isEqualWith = isEqualWith;
  34131. lodash.isError = isError;
  34132. lodash.isFinite = isFinite;
  34133. lodash.isFunction = isFunction;
  34134. lodash.isInteger = isInteger;
  34135. lodash.isLength = isLength;
  34136. lodash.isMap = isMap;
  34137. lodash.isMatch = isMatch;
  34138. lodash.isMatchWith = isMatchWith;
  34139. lodash.isNaN = isNaN;
  34140. lodash.isNative = isNative;
  34141. lodash.isNil = isNil;
  34142. lodash.isNull = isNull;
  34143. lodash.isNumber = isNumber;
  34144. lodash.isObject = isObject;
  34145. lodash.isObjectLike = isObjectLike;
  34146. lodash.isPlainObject = isPlainObject;
  34147. lodash.isRegExp = isRegExp;
  34148. lodash.isSafeInteger = isSafeInteger;
  34149. lodash.isSet = isSet;
  34150. lodash.isString = isString;
  34151. lodash.isSymbol = isSymbol;
  34152. lodash.isTypedArray = isTypedArray;
  34153. lodash.isUndefined = isUndefined;
  34154. lodash.isWeakMap = isWeakMap;
  34155. lodash.isWeakSet = isWeakSet;
  34156. lodash.join = join;
  34157. lodash.kebabCase = kebabCase;
  34158. lodash.last = last;
  34159. lodash.lastIndexOf = lastIndexOf;
  34160. lodash.lowerCase = lowerCase;
  34161. lodash.lowerFirst = lowerFirst;
  34162. lodash.lt = lt;
  34163. lodash.lte = lte;
  34164. lodash.max = max;
  34165. lodash.maxBy = maxBy;
  34166. lodash.mean = mean;
  34167. lodash.meanBy = meanBy;
  34168. lodash.min = min;
  34169. lodash.minBy = minBy;
  34170. lodash.stubArray = stubArray;
  34171. lodash.stubFalse = stubFalse;
  34172. lodash.stubObject = stubObject;
  34173. lodash.stubString = stubString;
  34174. lodash.stubTrue = stubTrue;
  34175. lodash.multiply = multiply;
  34176. lodash.nth = nth;
  34177. lodash.noConflict = noConflict;
  34178. lodash.noop = noop;
  34179. lodash.now = now;
  34180. lodash.pad = pad;
  34181. lodash.padEnd = padEnd;
  34182. lodash.padStart = padStart;
  34183. lodash.parseInt = parseInt;
  34184. lodash.random = random;
  34185. lodash.reduce = reduce;
  34186. lodash.reduceRight = reduceRight;
  34187. lodash.repeat = repeat;
  34188. lodash.replace = replace;
  34189. lodash.result = result;
  34190. lodash.round = round;
  34191. lodash.runInContext = runInContext;
  34192. lodash.sample = sample;
  34193. lodash.size = size;
  34194. lodash.snakeCase = snakeCase;
  34195. lodash.some = some;
  34196. lodash.sortedIndex = sortedIndex;
  34197. lodash.sortedIndexBy = sortedIndexBy;
  34198. lodash.sortedIndexOf = sortedIndexOf;
  34199. lodash.sortedLastIndex = sortedLastIndex;
  34200. lodash.sortedLastIndexBy = sortedLastIndexBy;
  34201. lodash.sortedLastIndexOf = sortedLastIndexOf;
  34202. lodash.startCase = startCase;
  34203. lodash.startsWith = startsWith;
  34204. lodash.subtract = subtract;
  34205. lodash.sum = sum;
  34206. lodash.sumBy = sumBy;
  34207. lodash.template = template;
  34208. lodash.times = times;
  34209. lodash.toFinite = toFinite;
  34210. lodash.toInteger = toInteger;
  34211. lodash.toLength = toLength;
  34212. lodash.toLower = toLower;
  34213. lodash.toNumber = toNumber;
  34214. lodash.toSafeInteger = toSafeInteger;
  34215. lodash.toString = toString;
  34216. lodash.toUpper = toUpper;
  34217. lodash.trim = trim;
  34218. lodash.trimEnd = trimEnd;
  34219. lodash.trimStart = trimStart;
  34220. lodash.truncate = truncate;
  34221. lodash.unescape = unescape;
  34222. lodash.uniqueId = uniqueId;
  34223. lodash.upperCase = upperCase;
  34224. lodash.upperFirst = upperFirst;
  34225. // Add aliases.
  34226. lodash.each = forEach;
  34227. lodash.eachRight = forEachRight;
  34228. lodash.first = head;
  34229. mixin(lodash, (function() {
  34230. var source = {};
  34231. baseForOwn(lodash, function(func, methodName) {
  34232. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  34233. source[methodName] = func;
  34234. }
  34235. });
  34236. return source;
  34237. }()), { 'chain': false });
  34238. /*------------------------------------------------------------------------*/
  34239. /**
  34240. * The semantic version number.
  34241. *
  34242. * @static
  34243. * @memberOf _
  34244. * @type {string}
  34245. */
  34246. lodash.VERSION = VERSION;
  34247. // Assign default placeholders.
  34248. arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
  34249. lodash[methodName].placeholder = lodash;
  34250. });
  34251. // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
  34252. arrayEach(['drop', 'take'], function(methodName, index) {
  34253. LazyWrapper.prototype[methodName] = function(n) {
  34254. n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
  34255. var result = (this.__filtered__ && !index)
  34256. ? new LazyWrapper(this)
  34257. : this.clone();
  34258. if (result.__filtered__) {
  34259. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  34260. } else {
  34261. result.__views__.push({
  34262. 'size': nativeMin(n, MAX_ARRAY_LENGTH),
  34263. 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
  34264. });
  34265. }
  34266. return result;
  34267. };
  34268. LazyWrapper.prototype[methodName + 'Right'] = function(n) {
  34269. return this.reverse()[methodName](n).reverse();
  34270. };
  34271. });
  34272. // Add `LazyWrapper` methods that accept an `iteratee` value.
  34273. arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
  34274. var type = index + 1,
  34275. isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  34276. LazyWrapper.prototype[methodName] = function(iteratee) {
  34277. var result = this.clone();
  34278. result.__iteratees__.push({
  34279. 'iteratee': getIteratee(iteratee, 3),
  34280. 'type': type
  34281. });
  34282. result.__filtered__ = result.__filtered__ || isFilter;
  34283. return result;
  34284. };
  34285. });
  34286. // Add `LazyWrapper` methods for `_.head` and `_.last`.
  34287. arrayEach(['head', 'last'], function(methodName, index) {
  34288. var takeName = 'take' + (index ? 'Right' : '');
  34289. LazyWrapper.prototype[methodName] = function() {
  34290. return this[takeName](1).value()[0];
  34291. };
  34292. });
  34293. // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
  34294. arrayEach(['initial', 'tail'], function(methodName, index) {
  34295. var dropName = 'drop' + (index ? '' : 'Right');
  34296. LazyWrapper.prototype[methodName] = function() {
  34297. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  34298. };
  34299. });
  34300. LazyWrapper.prototype.compact = function() {
  34301. return this.filter(identity);
  34302. };
  34303. LazyWrapper.prototype.find = function(predicate) {
  34304. return this.filter(predicate).head();
  34305. };
  34306. LazyWrapper.prototype.findLast = function(predicate) {
  34307. return this.reverse().find(predicate);
  34308. };
  34309. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  34310. if (typeof path == 'function') {
  34311. return new LazyWrapper(this);
  34312. }
  34313. return this.map(function(value) {
  34314. return baseInvoke(value, path, args);
  34315. });
  34316. });
  34317. LazyWrapper.prototype.reject = function(predicate) {
  34318. return this.filter(negate(getIteratee(predicate)));
  34319. };
  34320. LazyWrapper.prototype.slice = function(start, end) {
  34321. start = toInteger(start);
  34322. var result = this;
  34323. if (result.__filtered__ && (start > 0 || end < 0)) {
  34324. return new LazyWrapper(result);
  34325. }
  34326. if (start < 0) {
  34327. result = result.takeRight(-start);
  34328. } else if (start) {
  34329. result = result.drop(start);
  34330. }
  34331. if (end !== undefined) {
  34332. end = toInteger(end);
  34333. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  34334. }
  34335. return result;
  34336. };
  34337. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  34338. return this.reverse().takeWhile(predicate).reverse();
  34339. };
  34340. LazyWrapper.prototype.toArray = function() {
  34341. return this.take(MAX_ARRAY_LENGTH);
  34342. };
  34343. // Add `LazyWrapper` methods to `lodash.prototype`.
  34344. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  34345. var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
  34346. isTaker = /^(?:head|last)$/.test(methodName),
  34347. lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
  34348. retUnwrapped = isTaker || /^find/.test(methodName);
  34349. if (!lodashFunc) {
  34350. return;
  34351. }
  34352. lodash.prototype[methodName] = function() {
  34353. var value = this.__wrapped__,
  34354. args = isTaker ? [1] : arguments,
  34355. isLazy = value instanceof LazyWrapper,
  34356. iteratee = args[0],
  34357. useLazy = isLazy || isArray(value);
  34358. var interceptor = function(value) {
  34359. var result = lodashFunc.apply(lodash, arrayPush([value], args));
  34360. return (isTaker && chainAll) ? result[0] : result;
  34361. };
  34362. if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
  34363. // Avoid lazy use if the iteratee has a "length" value other than `1`.
  34364. isLazy = useLazy = false;
  34365. }
  34366. var chainAll = this.__chain__,
  34367. isHybrid = !!this.__actions__.length,
  34368. isUnwrapped = retUnwrapped && !chainAll,
  34369. onlyLazy = isLazy && !isHybrid;
  34370. if (!retUnwrapped && useLazy) {
  34371. value = onlyLazy ? value : new LazyWrapper(this);
  34372. var result = func.apply(value, args);
  34373. result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
  34374. return new LodashWrapper(result, chainAll);
  34375. }
  34376. if (isUnwrapped && onlyLazy) {
  34377. return func.apply(this, args);
  34378. }
  34379. result = this.thru(interceptor);
  34380. return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
  34381. };
  34382. });
  34383. // Add `Array` methods to `lodash.prototype`.
  34384. arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
  34385. var func = arrayProto[methodName],
  34386. chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
  34387. retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  34388. lodash.prototype[methodName] = function() {
  34389. var args = arguments;
  34390. if (retUnwrapped && !this.__chain__) {
  34391. var value = this.value();
  34392. return func.apply(isArray(value) ? value : [], args);
  34393. }
  34394. return this[chainName](function(value) {
  34395. return func.apply(isArray(value) ? value : [], args);
  34396. });
  34397. };
  34398. });
  34399. // Map minified method names to their real names.
  34400. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  34401. var lodashFunc = lodash[methodName];
  34402. if (lodashFunc) {
  34403. var key = lodashFunc.name + '';
  34404. if (!hasOwnProperty.call(realNames, key)) {
  34405. realNames[key] = [];
  34406. }
  34407. realNames[key].push({ 'name': methodName, 'func': lodashFunc });
  34408. }
  34409. });
  34410. realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
  34411. 'name': 'wrapper',
  34412. 'func': undefined
  34413. }];
  34414. // Add methods to `LazyWrapper`.
  34415. LazyWrapper.prototype.clone = lazyClone;
  34416. LazyWrapper.prototype.reverse = lazyReverse;
  34417. LazyWrapper.prototype.value = lazyValue;
  34418. // Add chain sequence methods to the `lodash` wrapper.
  34419. lodash.prototype.at = wrapperAt;
  34420. lodash.prototype.chain = wrapperChain;
  34421. lodash.prototype.commit = wrapperCommit;
  34422. lodash.prototype.next = wrapperNext;
  34423. lodash.prototype.plant = wrapperPlant;
  34424. lodash.prototype.reverse = wrapperReverse;
  34425. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
  34426. // Add lazy aliases.
  34427. lodash.prototype.first = lodash.prototype.head;
  34428. if (symIterator) {
  34429. lodash.prototype[symIterator] = wrapperToIterator;
  34430. }
  34431. return lodash;
  34432. });
  34433. /*--------------------------------------------------------------------------*/
  34434. // Export lodash.
  34435. var _ = runInContext();
  34436. // Some AMD build optimizers, like r.js, check for condition patterns like:
  34437. if (true) {
  34438. // Expose Lodash on the global object to prevent errors when Lodash is
  34439. // loaded by a script tag in the presence of an AMD loader.
  34440. // See http://requirejs.org/docs/errors.html#mismatch for more details.
  34441. // Use `_.noConflict` to remove Lodash from the global object.
  34442. root._ = _;
  34443. // Define as an anonymous module so, through path mapping, it can be
  34444. // referenced as the "underscore" module.
  34445. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  34446. return _;
  34447. }).call(exports, __webpack_require__, exports, module),
  34448. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  34449. }
  34450. // Check for `exports` after `define` in case a build optimizer adds it.
  34451. else {}
  34452. }.call(this));
  34453. /* 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)))
  34454. /***/ }),
  34455. /***/ "./node_modules/popper.js/dist/esm/popper.js":
  34456. /*!***************************************************!*\
  34457. !*** ./node_modules/popper.js/dist/esm/popper.js ***!
  34458. \***************************************************/
  34459. /*! exports provided: default */
  34460. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  34461. "use strict";
  34462. __webpack_require__.r(__webpack_exports__);
  34463. /* WEBPACK VAR INJECTION */(function(global) {/**!
  34464. * @fileOverview Kickass library to create and place poppers near their reference elements.
  34465. * @version 1.16.1
  34466. * @license
  34467. * Copyright (c) 2016 Federico Zivolo and contributors
  34468. *
  34469. * Permission is hereby granted, free of charge, to any person obtaining a copy
  34470. * of this software and associated documentation files (the "Software"), to deal
  34471. * in the Software without restriction, including without limitation the rights
  34472. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  34473. * copies of the Software, and to permit persons to whom the Software is
  34474. * furnished to do so, subject to the following conditions:
  34475. *
  34476. * The above copyright notice and this permission notice shall be included in all
  34477. * copies or substantial portions of the Software.
  34478. *
  34479. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  34480. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  34481. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  34482. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  34483. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  34484. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  34485. * SOFTWARE.
  34486. */
  34487. var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined';
  34488. var timeoutDuration = function () {
  34489. var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
  34490. for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
  34491. if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
  34492. return 1;
  34493. }
  34494. }
  34495. return 0;
  34496. }();
  34497. function microtaskDebounce(fn) {
  34498. var called = false;
  34499. return function () {
  34500. if (called) {
  34501. return;
  34502. }
  34503. called = true;
  34504. window.Promise.resolve().then(function () {
  34505. called = false;
  34506. fn();
  34507. });
  34508. };
  34509. }
  34510. function taskDebounce(fn) {
  34511. var scheduled = false;
  34512. return function () {
  34513. if (!scheduled) {
  34514. scheduled = true;
  34515. setTimeout(function () {
  34516. scheduled = false;
  34517. fn();
  34518. }, timeoutDuration);
  34519. }
  34520. };
  34521. }
  34522. var supportsMicroTasks = isBrowser && window.Promise;
  34523. /**
  34524. * Create a debounced version of a method, that's asynchronously deferred
  34525. * but called in the minimum time possible.
  34526. *
  34527. * @method
  34528. * @memberof Popper.Utils
  34529. * @argument {Function} fn
  34530. * @returns {Function}
  34531. */
  34532. var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
  34533. /**
  34534. * Check if the given variable is a function
  34535. * @method
  34536. * @memberof Popper.Utils
  34537. * @argument {Any} functionToCheck - variable to check
  34538. * @returns {Boolean} answer to: is a function?
  34539. */
  34540. function isFunction(functionToCheck) {
  34541. var getType = {};
  34542. return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
  34543. }
  34544. /**
  34545. * Get CSS computed property of the given element
  34546. * @method
  34547. * @memberof Popper.Utils
  34548. * @argument {Eement} element
  34549. * @argument {String} property
  34550. */
  34551. function getStyleComputedProperty(element, property) {
  34552. if (element.nodeType !== 1) {
  34553. return [];
  34554. }
  34555. // NOTE: 1 DOM access here
  34556. var window = element.ownerDocument.defaultView;
  34557. var css = window.getComputedStyle(element, null);
  34558. return property ? css[property] : css;
  34559. }
  34560. /**
  34561. * Returns the parentNode or the host of the element
  34562. * @method
  34563. * @memberof Popper.Utils
  34564. * @argument {Element} element
  34565. * @returns {Element} parent
  34566. */
  34567. function getParentNode(element) {
  34568. if (element.nodeName === 'HTML') {
  34569. return element;
  34570. }
  34571. return element.parentNode || element.host;
  34572. }
  34573. /**
  34574. * Returns the scrolling parent of the given element
  34575. * @method
  34576. * @memberof Popper.Utils
  34577. * @argument {Element} element
  34578. * @returns {Element} scroll parent
  34579. */
  34580. function getScrollParent(element) {
  34581. // Return body, `getScroll` will take care to get the correct `scrollTop` from it
  34582. if (!element) {
  34583. return document.body;
  34584. }
  34585. switch (element.nodeName) {
  34586. case 'HTML':
  34587. case 'BODY':
  34588. return element.ownerDocument.body;
  34589. case '#document':
  34590. return element.body;
  34591. }
  34592. // Firefox want us to check `-x` and `-y` variations as well
  34593. var _getStyleComputedProp = getStyleComputedProperty(element),
  34594. overflow = _getStyleComputedProp.overflow,
  34595. overflowX = _getStyleComputedProp.overflowX,
  34596. overflowY = _getStyleComputedProp.overflowY;
  34597. if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
  34598. return element;
  34599. }
  34600. return getScrollParent(getParentNode(element));
  34601. }
  34602. /**
  34603. * Returns the reference node of the reference object, or the reference object itself.
  34604. * @method
  34605. * @memberof Popper.Utils
  34606. * @param {Element|Object} reference - the reference element (the popper will be relative to this)
  34607. * @returns {Element} parent
  34608. */
  34609. function getReferenceNode(reference) {
  34610. return reference && reference.referenceNode ? reference.referenceNode : reference;
  34611. }
  34612. var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
  34613. var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
  34614. /**
  34615. * Determines if the browser is Internet Explorer
  34616. * @method
  34617. * @memberof Popper.Utils
  34618. * @param {Number} version to check
  34619. * @returns {Boolean} isIE
  34620. */
  34621. function isIE(version) {
  34622. if (version === 11) {
  34623. return isIE11;
  34624. }
  34625. if (version === 10) {
  34626. return isIE10;
  34627. }
  34628. return isIE11 || isIE10;
  34629. }
  34630. /**
  34631. * Returns the offset parent of the given element
  34632. * @method
  34633. * @memberof Popper.Utils
  34634. * @argument {Element} element
  34635. * @returns {Element} offset parent
  34636. */
  34637. function getOffsetParent(element) {
  34638. if (!element) {
  34639. return document.documentElement;
  34640. }
  34641. var noOffsetParent = isIE(10) ? document.body : null;
  34642. // NOTE: 1 DOM access here
  34643. var offsetParent = element.offsetParent || null;
  34644. // Skip hidden elements which don't have an offsetParent
  34645. while (offsetParent === noOffsetParent && element.nextElementSibling) {
  34646. offsetParent = (element = element.nextElementSibling).offsetParent;
  34647. }
  34648. var nodeName = offsetParent && offsetParent.nodeName;
  34649. if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
  34650. return element ? element.ownerDocument.documentElement : document.documentElement;
  34651. }
  34652. // .offsetParent will return the closest TH, TD or TABLE in case
  34653. // no offsetParent is present, I hate this job...
  34654. if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
  34655. return getOffsetParent(offsetParent);
  34656. }
  34657. return offsetParent;
  34658. }
  34659. function isOffsetContainer(element) {
  34660. var nodeName = element.nodeName;
  34661. if (nodeName === 'BODY') {
  34662. return false;
  34663. }
  34664. return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
  34665. }
  34666. /**
  34667. * Finds the root node (document, shadowDOM root) of the given element
  34668. * @method
  34669. * @memberof Popper.Utils
  34670. * @argument {Element} node
  34671. * @returns {Element} root node
  34672. */
  34673. function getRoot(node) {
  34674. if (node.parentNode !== null) {
  34675. return getRoot(node.parentNode);
  34676. }
  34677. return node;
  34678. }
  34679. /**
  34680. * Finds the offset parent common to the two provided nodes
  34681. * @method
  34682. * @memberof Popper.Utils
  34683. * @argument {Element} element1
  34684. * @argument {Element} element2
  34685. * @returns {Element} common offset parent
  34686. */
  34687. function findCommonOffsetParent(element1, element2) {
  34688. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  34689. if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
  34690. return document.documentElement;
  34691. }
  34692. // Here we make sure to give as "start" the element that comes first in the DOM
  34693. var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
  34694. var start = order ? element1 : element2;
  34695. var end = order ? element2 : element1;
  34696. // Get common ancestor container
  34697. var range = document.createRange();
  34698. range.setStart(start, 0);
  34699. range.setEnd(end, 0);
  34700. var commonAncestorContainer = range.commonAncestorContainer;
  34701. // Both nodes are inside #document
  34702. if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
  34703. if (isOffsetContainer(commonAncestorContainer)) {
  34704. return commonAncestorContainer;
  34705. }
  34706. return getOffsetParent(commonAncestorContainer);
  34707. }
  34708. // one of the nodes is inside shadowDOM, find which one
  34709. var element1root = getRoot(element1);
  34710. if (element1root.host) {
  34711. return findCommonOffsetParent(element1root.host, element2);
  34712. } else {
  34713. return findCommonOffsetParent(element1, getRoot(element2).host);
  34714. }
  34715. }
  34716. /**
  34717. * Gets the scroll value of the given element in the given side (top and left)
  34718. * @method
  34719. * @memberof Popper.Utils
  34720. * @argument {Element} element
  34721. * @argument {String} side `top` or `left`
  34722. * @returns {number} amount of scrolled pixels
  34723. */
  34724. function getScroll(element) {
  34725. var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
  34726. var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
  34727. var nodeName = element.nodeName;
  34728. if (nodeName === 'BODY' || nodeName === 'HTML') {
  34729. var html = element.ownerDocument.documentElement;
  34730. var scrollingElement = element.ownerDocument.scrollingElement || html;
  34731. return scrollingElement[upperSide];
  34732. }
  34733. return element[upperSide];
  34734. }
  34735. /*
  34736. * Sum or subtract the element scroll values (left and top) from a given rect object
  34737. * @method
  34738. * @memberof Popper.Utils
  34739. * @param {Object} rect - Rect object you want to change
  34740. * @param {HTMLElement} element - The element from the function reads the scroll values
  34741. * @param {Boolean} subtract - set to true if you want to subtract the scroll values
  34742. * @return {Object} rect - The modifier rect object
  34743. */
  34744. function includeScroll(rect, element) {
  34745. var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  34746. var scrollTop = getScroll(element, 'top');
  34747. var scrollLeft = getScroll(element, 'left');
  34748. var modifier = subtract ? -1 : 1;
  34749. rect.top += scrollTop * modifier;
  34750. rect.bottom += scrollTop * modifier;
  34751. rect.left += scrollLeft * modifier;
  34752. rect.right += scrollLeft * modifier;
  34753. return rect;
  34754. }
  34755. /*
  34756. * Helper to detect borders of a given element
  34757. * @method
  34758. * @memberof Popper.Utils
  34759. * @param {CSSStyleDeclaration} styles
  34760. * Result of `getStyleComputedProperty` on the given element
  34761. * @param {String} axis - `x` or `y`
  34762. * @return {number} borders - The borders size of the given axis
  34763. */
  34764. function getBordersSize(styles, axis) {
  34765. var sideA = axis === 'x' ? 'Left' : 'Top';
  34766. var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
  34767. return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']);
  34768. }
  34769. function getSize(axis, body, html, computedStyle) {
  34770. 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);
  34771. }
  34772. function getWindowSizes(document) {
  34773. var body = document.body;
  34774. var html = document.documentElement;
  34775. var computedStyle = isIE(10) && getComputedStyle(html);
  34776. return {
  34777. height: getSize('Height', body, html, computedStyle),
  34778. width: getSize('Width', body, html, computedStyle)
  34779. };
  34780. }
  34781. var classCallCheck = function (instance, Constructor) {
  34782. if (!(instance instanceof Constructor)) {
  34783. throw new TypeError("Cannot call a class as a function");
  34784. }
  34785. };
  34786. var createClass = function () {
  34787. function defineProperties(target, props) {
  34788. for (var i = 0; i < props.length; i++) {
  34789. var descriptor = props[i];
  34790. descriptor.enumerable = descriptor.enumerable || false;
  34791. descriptor.configurable = true;
  34792. if ("value" in descriptor) descriptor.writable = true;
  34793. Object.defineProperty(target, descriptor.key, descriptor);
  34794. }
  34795. }
  34796. return function (Constructor, protoProps, staticProps) {
  34797. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  34798. if (staticProps) defineProperties(Constructor, staticProps);
  34799. return Constructor;
  34800. };
  34801. }();
  34802. var defineProperty = function (obj, key, value) {
  34803. if (key in obj) {
  34804. Object.defineProperty(obj, key, {
  34805. value: value,
  34806. enumerable: true,
  34807. configurable: true,
  34808. writable: true
  34809. });
  34810. } else {
  34811. obj[key] = value;
  34812. }
  34813. return obj;
  34814. };
  34815. var _extends = Object.assign || function (target) {
  34816. for (var i = 1; i < arguments.length; i++) {
  34817. var source = arguments[i];
  34818. for (var key in source) {
  34819. if (Object.prototype.hasOwnProperty.call(source, key)) {
  34820. target[key] = source[key];
  34821. }
  34822. }
  34823. }
  34824. return target;
  34825. };
  34826. /**
  34827. * Given element offsets, generate an output similar to getBoundingClientRect
  34828. * @method
  34829. * @memberof Popper.Utils
  34830. * @argument {Object} offsets
  34831. * @returns {Object} ClientRect like output
  34832. */
  34833. function getClientRect(offsets) {
  34834. return _extends({}, offsets, {
  34835. right: offsets.left + offsets.width,
  34836. bottom: offsets.top + offsets.height
  34837. });
  34838. }
  34839. /**
  34840. * Get bounding client rect of given element
  34841. * @method
  34842. * @memberof Popper.Utils
  34843. * @param {HTMLElement} element
  34844. * @return {Object} client rect
  34845. */
  34846. function getBoundingClientRect(element) {
  34847. var rect = {};
  34848. // IE10 10 FIX: Please, don't ask, the element isn't
  34849. // considered in DOM in some circumstances...
  34850. // This isn't reproducible in IE10 compatibility mode of IE11
  34851. try {
  34852. if (isIE(10)) {
  34853. rect = element.getBoundingClientRect();
  34854. var scrollTop = getScroll(element, 'top');
  34855. var scrollLeft = getScroll(element, 'left');
  34856. rect.top += scrollTop;
  34857. rect.left += scrollLeft;
  34858. rect.bottom += scrollTop;
  34859. rect.right += scrollLeft;
  34860. } else {
  34861. rect = element.getBoundingClientRect();
  34862. }
  34863. } catch (e) {}
  34864. var result = {
  34865. left: rect.left,
  34866. top: rect.top,
  34867. width: rect.right - rect.left,
  34868. height: rect.bottom - rect.top
  34869. };
  34870. // subtract scrollbar size from sizes
  34871. var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
  34872. var width = sizes.width || element.clientWidth || result.width;
  34873. var height = sizes.height || element.clientHeight || result.height;
  34874. var horizScrollbar = element.offsetWidth - width;
  34875. var vertScrollbar = element.offsetHeight - height;
  34876. // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
  34877. // we make this check conditional for performance reasons
  34878. if (horizScrollbar || vertScrollbar) {
  34879. var styles = getStyleComputedProperty(element);
  34880. horizScrollbar -= getBordersSize(styles, 'x');
  34881. vertScrollbar -= getBordersSize(styles, 'y');
  34882. result.width -= horizScrollbar;
  34883. result.height -= vertScrollbar;
  34884. }
  34885. return getClientRect(result);
  34886. }
  34887. function getOffsetRectRelativeToArbitraryNode(children, parent) {
  34888. var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  34889. var isIE10 = isIE(10);
  34890. var isHTML = parent.nodeName === 'HTML';
  34891. var childrenRect = getBoundingClientRect(children);
  34892. var parentRect = getBoundingClientRect(parent);
  34893. var scrollParent = getScrollParent(children);
  34894. var styles = getStyleComputedProperty(parent);
  34895. var borderTopWidth = parseFloat(styles.borderTopWidth);
  34896. var borderLeftWidth = parseFloat(styles.borderLeftWidth);
  34897. // In cases where the parent is fixed, we must ignore negative scroll in offset calc
  34898. if (fixedPosition && isHTML) {
  34899. parentRect.top = Math.max(parentRect.top, 0);
  34900. parentRect.left = Math.max(parentRect.left, 0);
  34901. }
  34902. var offsets = getClientRect({
  34903. top: childrenRect.top - parentRect.top - borderTopWidth,
  34904. left: childrenRect.left - parentRect.left - borderLeftWidth,
  34905. width: childrenRect.width,
  34906. height: childrenRect.height
  34907. });
  34908. offsets.marginTop = 0;
  34909. offsets.marginLeft = 0;
  34910. // Subtract margins of documentElement in case it's being used as parent
  34911. // we do this only on HTML because it's the only element that behaves
  34912. // differently when margins are applied to it. The margins are included in
  34913. // the box of the documentElement, in the other cases not.
  34914. if (!isIE10 && isHTML) {
  34915. var marginTop = parseFloat(styles.marginTop);
  34916. var marginLeft = parseFloat(styles.marginLeft);
  34917. offsets.top -= borderTopWidth - marginTop;
  34918. offsets.bottom -= borderTopWidth - marginTop;
  34919. offsets.left -= borderLeftWidth - marginLeft;
  34920. offsets.right -= borderLeftWidth - marginLeft;
  34921. // Attach marginTop and marginLeft because in some circumstances we may need them
  34922. offsets.marginTop = marginTop;
  34923. offsets.marginLeft = marginLeft;
  34924. }
  34925. if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
  34926. offsets = includeScroll(offsets, parent);
  34927. }
  34928. return offsets;
  34929. }
  34930. function getViewportOffsetRectRelativeToArtbitraryNode(element) {
  34931. var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  34932. var html = element.ownerDocument.documentElement;
  34933. var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
  34934. var width = Math.max(html.clientWidth, window.innerWidth || 0);
  34935. var height = Math.max(html.clientHeight, window.innerHeight || 0);
  34936. var scrollTop = !excludeScroll ? getScroll(html) : 0;
  34937. var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
  34938. var offset = {
  34939. top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
  34940. left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
  34941. width: width,
  34942. height: height
  34943. };
  34944. return getClientRect(offset);
  34945. }
  34946. /**
  34947. * Check if the given element is fixed or is inside a fixed parent
  34948. * @method
  34949. * @memberof Popper.Utils
  34950. * @argument {Element} element
  34951. * @argument {Element} customContainer
  34952. * @returns {Boolean} answer to "isFixed?"
  34953. */
  34954. function isFixed(element) {
  34955. var nodeName = element.nodeName;
  34956. if (nodeName === 'BODY' || nodeName === 'HTML') {
  34957. return false;
  34958. }
  34959. if (getStyleComputedProperty(element, 'position') === 'fixed') {
  34960. return true;
  34961. }
  34962. var parentNode = getParentNode(element);
  34963. if (!parentNode) {
  34964. return false;
  34965. }
  34966. return isFixed(parentNode);
  34967. }
  34968. /**
  34969. * Finds the first parent of an element that has a transformed property defined
  34970. * @method
  34971. * @memberof Popper.Utils
  34972. * @argument {Element} element
  34973. * @returns {Element} first transformed parent or documentElement
  34974. */
  34975. function getFixedPositionOffsetParent(element) {
  34976. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  34977. if (!element || !element.parentElement || isIE()) {
  34978. return document.documentElement;
  34979. }
  34980. var el = element.parentElement;
  34981. while (el && getStyleComputedProperty(el, 'transform') === 'none') {
  34982. el = el.parentElement;
  34983. }
  34984. return el || document.documentElement;
  34985. }
  34986. /**
  34987. * Computed the boundaries limits and return them
  34988. * @method
  34989. * @memberof Popper.Utils
  34990. * @param {HTMLElement} popper
  34991. * @param {HTMLElement} reference
  34992. * @param {number} padding
  34993. * @param {HTMLElement} boundariesElement - Element used to define the boundaries
  34994. * @param {Boolean} fixedPosition - Is in fixed position mode
  34995. * @returns {Object} Coordinates of the boundaries
  34996. */
  34997. function getBoundaries(popper, reference, padding, boundariesElement) {
  34998. var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  34999. // NOTE: 1 DOM access here
  35000. var boundaries = { top: 0, left: 0 };
  35001. var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  35002. // Handle viewport case
  35003. if (boundariesElement === 'viewport') {
  35004. boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
  35005. } else {
  35006. // Handle other cases based on DOM element used as boundaries
  35007. var boundariesNode = void 0;
  35008. if (boundariesElement === 'scrollParent') {
  35009. boundariesNode = getScrollParent(getParentNode(reference));
  35010. if (boundariesNode.nodeName === 'BODY') {
  35011. boundariesNode = popper.ownerDocument.documentElement;
  35012. }
  35013. } else if (boundariesElement === 'window') {
  35014. boundariesNode = popper.ownerDocument.documentElement;
  35015. } else {
  35016. boundariesNode = boundariesElement;
  35017. }
  35018. var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
  35019. // In case of HTML, we need a different computation
  35020. if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
  35021. var _getWindowSizes = getWindowSizes(popper.ownerDocument),
  35022. height = _getWindowSizes.height,
  35023. width = _getWindowSizes.width;
  35024. boundaries.top += offsets.top - offsets.marginTop;
  35025. boundaries.bottom = height + offsets.top;
  35026. boundaries.left += offsets.left - offsets.marginLeft;
  35027. boundaries.right = width + offsets.left;
  35028. } else {
  35029. // for all the other DOM elements, this one is good
  35030. boundaries = offsets;
  35031. }
  35032. }
  35033. // Add paddings
  35034. padding = padding || 0;
  35035. var isPaddingNumber = typeof padding === 'number';
  35036. boundaries.left += isPaddingNumber ? padding : padding.left || 0;
  35037. boundaries.top += isPaddingNumber ? padding : padding.top || 0;
  35038. boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
  35039. boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
  35040. return boundaries;
  35041. }
  35042. function getArea(_ref) {
  35043. var width = _ref.width,
  35044. height = _ref.height;
  35045. return width * height;
  35046. }
  35047. /**
  35048. * Utility used to transform the `auto` placement to the placement with more
  35049. * available space.
  35050. * @method
  35051. * @memberof Popper.Utils
  35052. * @argument {Object} data - The data object generated by update method
  35053. * @argument {Object} options - Modifiers configuration and options
  35054. * @returns {Object} The data object, properly modified
  35055. */
  35056. function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
  35057. var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  35058. if (placement.indexOf('auto') === -1) {
  35059. return placement;
  35060. }
  35061. var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
  35062. var rects = {
  35063. top: {
  35064. width: boundaries.width,
  35065. height: refRect.top - boundaries.top
  35066. },
  35067. right: {
  35068. width: boundaries.right - refRect.right,
  35069. height: boundaries.height
  35070. },
  35071. bottom: {
  35072. width: boundaries.width,
  35073. height: boundaries.bottom - refRect.bottom
  35074. },
  35075. left: {
  35076. width: refRect.left - boundaries.left,
  35077. height: boundaries.height
  35078. }
  35079. };
  35080. var sortedAreas = Object.keys(rects).map(function (key) {
  35081. return _extends({
  35082. key: key
  35083. }, rects[key], {
  35084. area: getArea(rects[key])
  35085. });
  35086. }).sort(function (a, b) {
  35087. return b.area - a.area;
  35088. });
  35089. var filteredAreas = sortedAreas.filter(function (_ref2) {
  35090. var width = _ref2.width,
  35091. height = _ref2.height;
  35092. return width >= popper.clientWidth && height >= popper.clientHeight;
  35093. });
  35094. var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
  35095. var variation = placement.split('-')[1];
  35096. return computedPlacement + (variation ? '-' + variation : '');
  35097. }
  35098. /**
  35099. * Get offsets to the reference element
  35100. * @method
  35101. * @memberof Popper.Utils
  35102. * @param {Object} state
  35103. * @param {Element} popper - the popper element
  35104. * @param {Element} reference - the reference element (the popper will be relative to this)
  35105. * @param {Element} fixedPosition - is in fixed position mode
  35106. * @returns {Object} An object containing the offsets which will be applied to the popper
  35107. */
  35108. function getReferenceOffsets(state, popper, reference) {
  35109. var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  35110. var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  35111. return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
  35112. }
  35113. /**
  35114. * Get the outer sizes of the given element (offset size + margins)
  35115. * @method
  35116. * @memberof Popper.Utils
  35117. * @argument {Element} element
  35118. * @returns {Object} object containing width and height properties
  35119. */
  35120. function getOuterSizes(element) {
  35121. var window = element.ownerDocument.defaultView;
  35122. var styles = window.getComputedStyle(element);
  35123. var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
  35124. var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
  35125. var result = {
  35126. width: element.offsetWidth + y,
  35127. height: element.offsetHeight + x
  35128. };
  35129. return result;
  35130. }
  35131. /**
  35132. * Get the opposite placement of the given one
  35133. * @method
  35134. * @memberof Popper.Utils
  35135. * @argument {String} placement
  35136. * @returns {String} flipped placement
  35137. */
  35138. function getOppositePlacement(placement) {
  35139. var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
  35140. return placement.replace(/left|right|bottom|top/g, function (matched) {
  35141. return hash[matched];
  35142. });
  35143. }
  35144. /**
  35145. * Get offsets to the popper
  35146. * @method
  35147. * @memberof Popper.Utils
  35148. * @param {Object} position - CSS position the Popper will get applied
  35149. * @param {HTMLElement} popper - the popper element
  35150. * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
  35151. * @param {String} placement - one of the valid placement options
  35152. * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
  35153. */
  35154. function getPopperOffsets(popper, referenceOffsets, placement) {
  35155. placement = placement.split('-')[0];
  35156. // Get popper node sizes
  35157. var popperRect = getOuterSizes(popper);
  35158. // Add position, width and height to our offsets object
  35159. var popperOffsets = {
  35160. width: popperRect.width,
  35161. height: popperRect.height
  35162. };
  35163. // depending by the popper placement we have to compute its offsets slightly differently
  35164. var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
  35165. var mainSide = isHoriz ? 'top' : 'left';
  35166. var secondarySide = isHoriz ? 'left' : 'top';
  35167. var measurement = isHoriz ? 'height' : 'width';
  35168. var secondaryMeasurement = !isHoriz ? 'height' : 'width';
  35169. popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
  35170. if (placement === secondarySide) {
  35171. popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
  35172. } else {
  35173. popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
  35174. }
  35175. return popperOffsets;
  35176. }
  35177. /**
  35178. * Mimics the `find` method of Array
  35179. * @method
  35180. * @memberof Popper.Utils
  35181. * @argument {Array} arr
  35182. * @argument prop
  35183. * @argument value
  35184. * @returns index or -1
  35185. */
  35186. function find(arr, check) {
  35187. // use native find if supported
  35188. if (Array.prototype.find) {
  35189. return arr.find(check);
  35190. }
  35191. // use `filter` to obtain the same behavior of `find`
  35192. return arr.filter(check)[0];
  35193. }
  35194. /**
  35195. * Return the index of the matching object
  35196. * @method
  35197. * @memberof Popper.Utils
  35198. * @argument {Array} arr
  35199. * @argument prop
  35200. * @argument value
  35201. * @returns index or -1
  35202. */
  35203. function findIndex(arr, prop, value) {
  35204. // use native findIndex if supported
  35205. if (Array.prototype.findIndex) {
  35206. return arr.findIndex(function (cur) {
  35207. return cur[prop] === value;
  35208. });
  35209. }
  35210. // use `find` + `indexOf` if `findIndex` isn't supported
  35211. var match = find(arr, function (obj) {
  35212. return obj[prop] === value;
  35213. });
  35214. return arr.indexOf(match);
  35215. }
  35216. /**
  35217. * Loop trough the list of modifiers and run them in order,
  35218. * each of them will then edit the data object.
  35219. * @method
  35220. * @memberof Popper.Utils
  35221. * @param {dataObject} data
  35222. * @param {Array} modifiers
  35223. * @param {String} ends - Optional modifier name used as stopper
  35224. * @returns {dataObject}
  35225. */
  35226. function runModifiers(modifiers, data, ends) {
  35227. var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
  35228. modifiersToRun.forEach(function (modifier) {
  35229. if (modifier['function']) {
  35230. // eslint-disable-line dot-notation
  35231. console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
  35232. }
  35233. var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation
  35234. if (modifier.enabled && isFunction(fn)) {
  35235. // Add properties to offsets to make them a complete clientRect object
  35236. // we do this before each modifier to make sure the previous one doesn't
  35237. // mess with these values
  35238. data.offsets.popper = getClientRect(data.offsets.popper);
  35239. data.offsets.reference = getClientRect(data.offsets.reference);
  35240. data = fn(data, modifier);
  35241. }
  35242. });
  35243. return data;
  35244. }
  35245. /**
  35246. * Updates the position of the popper, computing the new offsets and applying
  35247. * the new style.<br />
  35248. * Prefer `scheduleUpdate` over `update` because of performance reasons.
  35249. * @method
  35250. * @memberof Popper
  35251. */
  35252. function update() {
  35253. // if popper is destroyed, don't perform any further update
  35254. if (this.state.isDestroyed) {
  35255. return;
  35256. }
  35257. var data = {
  35258. instance: this,
  35259. styles: {},
  35260. arrowStyles: {},
  35261. attributes: {},
  35262. flipped: false,
  35263. offsets: {}
  35264. };
  35265. // compute reference element offsets
  35266. data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);
  35267. // compute auto placement, store placement inside the data object,
  35268. // modifiers will be able to edit `placement` if needed
  35269. // and refer to originalPlacement to know the original value
  35270. data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
  35271. // store the computed placement inside `originalPlacement`
  35272. data.originalPlacement = data.placement;
  35273. data.positionFixed = this.options.positionFixed;
  35274. // compute the popper offsets
  35275. data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
  35276. data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';
  35277. // run the modifiers
  35278. data = runModifiers(this.modifiers, data);
  35279. // the first `update` will call `onCreate` callback
  35280. // the other ones will call `onUpdate` callback
  35281. if (!this.state.isCreated) {
  35282. this.state.isCreated = true;
  35283. this.options.onCreate(data);
  35284. } else {
  35285. this.options.onUpdate(data);
  35286. }
  35287. }
  35288. /**
  35289. * Helper used to know if the given modifier is enabled.
  35290. * @method
  35291. * @memberof Popper.Utils
  35292. * @returns {Boolean}
  35293. */
  35294. function isModifierEnabled(modifiers, modifierName) {
  35295. return modifiers.some(function (_ref) {
  35296. var name = _ref.name,
  35297. enabled = _ref.enabled;
  35298. return enabled && name === modifierName;
  35299. });
  35300. }
  35301. /**
  35302. * Get the prefixed supported property name
  35303. * @method
  35304. * @memberof Popper.Utils
  35305. * @argument {String} property (camelCase)
  35306. * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
  35307. */
  35308. function getSupportedPropertyName(property) {
  35309. var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
  35310. var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
  35311. for (var i = 0; i < prefixes.length; i++) {
  35312. var prefix = prefixes[i];
  35313. var toCheck = prefix ? '' + prefix + upperProp : property;
  35314. if (typeof document.body.style[toCheck] !== 'undefined') {
  35315. return toCheck;
  35316. }
  35317. }
  35318. return null;
  35319. }
  35320. /**
  35321. * Destroys the popper.
  35322. * @method
  35323. * @memberof Popper
  35324. */
  35325. function destroy() {
  35326. this.state.isDestroyed = true;
  35327. // touch DOM only if `applyStyle` modifier is enabled
  35328. if (isModifierEnabled(this.modifiers, 'applyStyle')) {
  35329. this.popper.removeAttribute('x-placement');
  35330. this.popper.style.position = '';
  35331. this.popper.style.top = '';
  35332. this.popper.style.left = '';
  35333. this.popper.style.right = '';
  35334. this.popper.style.bottom = '';
  35335. this.popper.style.willChange = '';
  35336. this.popper.style[getSupportedPropertyName('transform')] = '';
  35337. }
  35338. this.disableEventListeners();
  35339. // remove the popper if user explicitly asked for the deletion on destroy
  35340. // do not use `remove` because IE11 doesn't support it
  35341. if (this.options.removeOnDestroy) {
  35342. this.popper.parentNode.removeChild(this.popper);
  35343. }
  35344. return this;
  35345. }
  35346. /**
  35347. * Get the window associated with the element
  35348. * @argument {Element} element
  35349. * @returns {Window}
  35350. */
  35351. function getWindow(element) {
  35352. var ownerDocument = element.ownerDocument;
  35353. return ownerDocument ? ownerDocument.defaultView : window;
  35354. }
  35355. function attachToScrollParents(scrollParent, event, callback, scrollParents) {
  35356. var isBody = scrollParent.nodeName === 'BODY';
  35357. var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
  35358. target.addEventListener(event, callback, { passive: true });
  35359. if (!isBody) {
  35360. attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
  35361. }
  35362. scrollParents.push(target);
  35363. }
  35364. /**
  35365. * Setup needed event listeners used to update the popper position
  35366. * @method
  35367. * @memberof Popper.Utils
  35368. * @private
  35369. */
  35370. function setupEventListeners(reference, options, state, updateBound) {
  35371. // Resize event listener on window
  35372. state.updateBound = updateBound;
  35373. getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });
  35374. // Scroll event listener on scroll parents
  35375. var scrollElement = getScrollParent(reference);
  35376. attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
  35377. state.scrollElement = scrollElement;
  35378. state.eventsEnabled = true;
  35379. return state;
  35380. }
  35381. /**
  35382. * It will add resize/scroll events and start recalculating
  35383. * position of the popper element when they are triggered.
  35384. * @method
  35385. * @memberof Popper
  35386. */
  35387. function enableEventListeners() {
  35388. if (!this.state.eventsEnabled) {
  35389. this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
  35390. }
  35391. }
  35392. /**
  35393. * Remove event listeners used to update the popper position
  35394. * @method
  35395. * @memberof Popper.Utils
  35396. * @private
  35397. */
  35398. function removeEventListeners(reference, state) {
  35399. // Remove resize event listener on window
  35400. getWindow(reference).removeEventListener('resize', state.updateBound);
  35401. // Remove scroll event listener on scroll parents
  35402. state.scrollParents.forEach(function (target) {
  35403. target.removeEventListener('scroll', state.updateBound);
  35404. });
  35405. // Reset state
  35406. state.updateBound = null;
  35407. state.scrollParents = [];
  35408. state.scrollElement = null;
  35409. state.eventsEnabled = false;
  35410. return state;
  35411. }
  35412. /**
  35413. * It will remove resize/scroll events and won't recalculate popper position
  35414. * when they are triggered. It also won't trigger `onUpdate` callback anymore,
  35415. * unless you call `update` method manually.
  35416. * @method
  35417. * @memberof Popper
  35418. */
  35419. function disableEventListeners() {
  35420. if (this.state.eventsEnabled) {
  35421. cancelAnimationFrame(this.scheduleUpdate);
  35422. this.state = removeEventListeners(this.reference, this.state);
  35423. }
  35424. }
  35425. /**
  35426. * Tells if a given input is a number
  35427. * @method
  35428. * @memberof Popper.Utils
  35429. * @param {*} input to check
  35430. * @return {Boolean}
  35431. */
  35432. function isNumeric(n) {
  35433. return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
  35434. }
  35435. /**
  35436. * Set the style to the given popper
  35437. * @method
  35438. * @memberof Popper.Utils
  35439. * @argument {Element} element - Element to apply the style to
  35440. * @argument {Object} styles
  35441. * Object with a list of properties and values which will be applied to the element
  35442. */
  35443. function setStyles(element, styles) {
  35444. Object.keys(styles).forEach(function (prop) {
  35445. var unit = '';
  35446. // add unit if the value is numeric and is one of the following
  35447. if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
  35448. unit = 'px';
  35449. }
  35450. element.style[prop] = styles[prop] + unit;
  35451. });
  35452. }
  35453. /**
  35454. * Set the attributes to the given popper
  35455. * @method
  35456. * @memberof Popper.Utils
  35457. * @argument {Element} element - Element to apply the attributes to
  35458. * @argument {Object} styles
  35459. * Object with a list of properties and values which will be applied to the element
  35460. */
  35461. function setAttributes(element, attributes) {
  35462. Object.keys(attributes).forEach(function (prop) {
  35463. var value = attributes[prop];
  35464. if (value !== false) {
  35465. element.setAttribute(prop, attributes[prop]);
  35466. } else {
  35467. element.removeAttribute(prop);
  35468. }
  35469. });
  35470. }
  35471. /**
  35472. * @function
  35473. * @memberof Modifiers
  35474. * @argument {Object} data - The data object generated by `update` method
  35475. * @argument {Object} data.styles - List of style properties - values to apply to popper element
  35476. * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
  35477. * @argument {Object} options - Modifiers configuration and options
  35478. * @returns {Object} The same data object
  35479. */
  35480. function applyStyle(data) {
  35481. // any property present in `data.styles` will be applied to the popper,
  35482. // in this way we can make the 3rd party modifiers add custom styles to it
  35483. // Be aware, modifiers could override the properties defined in the previous
  35484. // lines of this modifier!
  35485. setStyles(data.instance.popper, data.styles);
  35486. // any property present in `data.attributes` will be applied to the popper,
  35487. // they will be set as HTML attributes of the element
  35488. setAttributes(data.instance.popper, data.attributes);
  35489. // if arrowElement is defined and arrowStyles has some properties
  35490. if (data.arrowElement && Object.keys(data.arrowStyles).length) {
  35491. setStyles(data.arrowElement, data.arrowStyles);
  35492. }
  35493. return data;
  35494. }
  35495. /**
  35496. * Set the x-placement attribute before everything else because it could be used
  35497. * to add margins to the popper margins needs to be calculated to get the
  35498. * correct popper offsets.
  35499. * @method
  35500. * @memberof Popper.modifiers
  35501. * @param {HTMLElement} reference - The reference element used to position the popper
  35502. * @param {HTMLElement} popper - The HTML element used as popper
  35503. * @param {Object} options - Popper.js options
  35504. */
  35505. function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
  35506. // compute reference element offsets
  35507. var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
  35508. // compute auto placement, store placement inside the data object,
  35509. // modifiers will be able to edit `placement` if needed
  35510. // and refer to originalPlacement to know the original value
  35511. var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
  35512. popper.setAttribute('x-placement', placement);
  35513. // Apply `position` to popper before anything else because
  35514. // without the position applied we can't guarantee correct computations
  35515. setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });
  35516. return options;
  35517. }
  35518. /**
  35519. * @function
  35520. * @memberof Popper.Utils
  35521. * @argument {Object} data - The data object generated by `update` method
  35522. * @argument {Boolean} shouldRound - If the offsets should be rounded at all
  35523. * @returns {Object} The popper's position offsets rounded
  35524. *
  35525. * The tale of pixel-perfect positioning. It's still not 100% perfect, but as
  35526. * good as it can be within reason.
  35527. * Discussion here: https://github.com/FezVrasta/popper.js/pull/715
  35528. *
  35529. * Low DPI screens cause a popper to be blurry if not using full pixels (Safari
  35530. * as well on High DPI screens).
  35531. *
  35532. * Firefox prefers no rounding for positioning and does not have blurriness on
  35533. * high DPI screens.
  35534. *
  35535. * Only horizontal placement and left/right values need to be considered.
  35536. */
  35537. function getRoundedOffsets(data, shouldRound) {
  35538. var _data$offsets = data.offsets,
  35539. popper = _data$offsets.popper,
  35540. reference = _data$offsets.reference;
  35541. var round = Math.round,
  35542. floor = Math.floor;
  35543. var noRound = function noRound(v) {
  35544. return v;
  35545. };
  35546. var referenceWidth = round(reference.width);
  35547. var popperWidth = round(popper.width);
  35548. var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
  35549. var isVariation = data.placement.indexOf('-') !== -1;
  35550. var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
  35551. var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
  35552. var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
  35553. var verticalToInteger = !shouldRound ? noRound : round;
  35554. return {
  35555. left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
  35556. top: verticalToInteger(popper.top),
  35557. bottom: verticalToInteger(popper.bottom),
  35558. right: horizontalToInteger(popper.right)
  35559. };
  35560. }
  35561. var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);
  35562. /**
  35563. * @function
  35564. * @memberof Modifiers
  35565. * @argument {Object} data - The data object generated by `update` method
  35566. * @argument {Object} options - Modifiers configuration and options
  35567. * @returns {Object} The data object, properly modified
  35568. */
  35569. function computeStyle(data, options) {
  35570. var x = options.x,
  35571. y = options.y;
  35572. var popper = data.offsets.popper;
  35573. // Remove this legacy support in Popper.js v2
  35574. var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
  35575. return modifier.name === 'applyStyle';
  35576. }).gpuAcceleration;
  35577. if (legacyGpuAccelerationOption !== undefined) {
  35578. console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
  35579. }
  35580. var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
  35581. var offsetParent = getOffsetParent(data.instance.popper);
  35582. var offsetParentRect = getBoundingClientRect(offsetParent);
  35583. // Styles
  35584. var styles = {
  35585. position: popper.position
  35586. };
  35587. var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
  35588. var sideA = x === 'bottom' ? 'top' : 'bottom';
  35589. var sideB = y === 'right' ? 'left' : 'right';
  35590. // if gpuAcceleration is set to `true` and transform is supported,
  35591. // we use `translate3d` to apply the position to the popper we
  35592. // automatically use the supported prefixed version if needed
  35593. var prefixedProperty = getSupportedPropertyName('transform');
  35594. // now, let's make a step back and look at this code closely (wtf?)
  35595. // If the content of the popper grows once it's been positioned, it
  35596. // may happen that the popper gets misplaced because of the new content
  35597. // overflowing its reference element
  35598. // To avoid this problem, we provide two options (x and y), which allow
  35599. // the consumer to define the offset origin.
  35600. // If we position a popper on top of a reference element, we can set
  35601. // `x` to `top` to make the popper grow towards its top instead of
  35602. // its bottom.
  35603. var left = void 0,
  35604. top = void 0;
  35605. if (sideA === 'bottom') {
  35606. // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
  35607. // and not the bottom of the html element
  35608. if (offsetParent.nodeName === 'HTML') {
  35609. top = -offsetParent.clientHeight + offsets.bottom;
  35610. } else {
  35611. top = -offsetParentRect.height + offsets.bottom;
  35612. }
  35613. } else {
  35614. top = offsets.top;
  35615. }
  35616. if (sideB === 'right') {
  35617. if (offsetParent.nodeName === 'HTML') {
  35618. left = -offsetParent.clientWidth + offsets.right;
  35619. } else {
  35620. left = -offsetParentRect.width + offsets.right;
  35621. }
  35622. } else {
  35623. left = offsets.left;
  35624. }
  35625. if (gpuAcceleration && prefixedProperty) {
  35626. styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
  35627. styles[sideA] = 0;
  35628. styles[sideB] = 0;
  35629. styles.willChange = 'transform';
  35630. } else {
  35631. // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
  35632. var invertTop = sideA === 'bottom' ? -1 : 1;
  35633. var invertLeft = sideB === 'right' ? -1 : 1;
  35634. styles[sideA] = top * invertTop;
  35635. styles[sideB] = left * invertLeft;
  35636. styles.willChange = sideA + ', ' + sideB;
  35637. }
  35638. // Attributes
  35639. var attributes = {
  35640. 'x-placement': data.placement
  35641. };
  35642. // Update `data` attributes, styles and arrowStyles
  35643. data.attributes = _extends({}, attributes, data.attributes);
  35644. data.styles = _extends({}, styles, data.styles);
  35645. data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles);
  35646. return data;
  35647. }
  35648. /**
  35649. * Helper used to know if the given modifier depends from another one.<br />
  35650. * It checks if the needed modifier is listed and enabled.
  35651. * @method
  35652. * @memberof Popper.Utils
  35653. * @param {Array} modifiers - list of modifiers
  35654. * @param {String} requestingName - name of requesting modifier
  35655. * @param {String} requestedName - name of requested modifier
  35656. * @returns {Boolean}
  35657. */
  35658. function isModifierRequired(modifiers, requestingName, requestedName) {
  35659. var requesting = find(modifiers, function (_ref) {
  35660. var name = _ref.name;
  35661. return name === requestingName;
  35662. });
  35663. var isRequired = !!requesting && modifiers.some(function (modifier) {
  35664. return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
  35665. });
  35666. if (!isRequired) {
  35667. var _requesting = '`' + requestingName + '`';
  35668. var requested = '`' + requestedName + '`';
  35669. console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
  35670. }
  35671. return isRequired;
  35672. }
  35673. /**
  35674. * @function
  35675. * @memberof Modifiers
  35676. * @argument {Object} data - The data object generated by update method
  35677. * @argument {Object} options - Modifiers configuration and options
  35678. * @returns {Object} The data object, properly modified
  35679. */
  35680. function arrow(data, options) {
  35681. var _data$offsets$arrow;
  35682. // arrow depends on keepTogether in order to work
  35683. if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
  35684. return data;
  35685. }
  35686. var arrowElement = options.element;
  35687. // if arrowElement is a string, suppose it's a CSS selector
  35688. if (typeof arrowElement === 'string') {
  35689. arrowElement = data.instance.popper.querySelector(arrowElement);
  35690. // if arrowElement is not found, don't run the modifier
  35691. if (!arrowElement) {
  35692. return data;
  35693. }
  35694. } else {
  35695. // if the arrowElement isn't a query selector we must check that the
  35696. // provided DOM node is child of its popper node
  35697. if (!data.instance.popper.contains(arrowElement)) {
  35698. console.warn('WARNING: `arrow.element` must be child of its popper element!');
  35699. return data;
  35700. }
  35701. }
  35702. var placement = data.placement.split('-')[0];
  35703. var _data$offsets = data.offsets,
  35704. popper = _data$offsets.popper,
  35705. reference = _data$offsets.reference;
  35706. var isVertical = ['left', 'right'].indexOf(placement) !== -1;
  35707. var len = isVertical ? 'height' : 'width';
  35708. var sideCapitalized = isVertical ? 'Top' : 'Left';
  35709. var side = sideCapitalized.toLowerCase();
  35710. var altSide = isVertical ? 'left' : 'top';
  35711. var opSide = isVertical ? 'bottom' : 'right';
  35712. var arrowElementSize = getOuterSizes(arrowElement)[len];
  35713. //
  35714. // extends keepTogether behavior making sure the popper and its
  35715. // reference have enough pixels in conjunction
  35716. //
  35717. // top/left side
  35718. if (reference[opSide] - arrowElementSize < popper[side]) {
  35719. data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
  35720. }
  35721. // bottom/right side
  35722. if (reference[side] + arrowElementSize > popper[opSide]) {
  35723. data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
  35724. }
  35725. data.offsets.popper = getClientRect(data.offsets.popper);
  35726. // compute center of the popper
  35727. var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
  35728. // Compute the sideValue using the updated popper offsets
  35729. // take popper margin in account because we don't have this info available
  35730. var css = getStyleComputedProperty(data.instance.popper);
  35731. var popperMarginSide = parseFloat(css['margin' + sideCapitalized]);
  35732. var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width']);
  35733. var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
  35734. // prevent arrowElement from being placed not contiguously to its popper
  35735. sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
  35736. data.arrowElement = arrowElement;
  35737. data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
  35738. return data;
  35739. }
  35740. /**
  35741. * Get the opposite placement variation of the given one
  35742. * @method
  35743. * @memberof Popper.Utils
  35744. * @argument {String} placement variation
  35745. * @returns {String} flipped placement variation
  35746. */
  35747. function getOppositeVariation(variation) {
  35748. if (variation === 'end') {
  35749. return 'start';
  35750. } else if (variation === 'start') {
  35751. return 'end';
  35752. }
  35753. return variation;
  35754. }
  35755. /**
  35756. * List of accepted placements to use as values of the `placement` option.<br />
  35757. * Valid placements are:
  35758. * - `auto`
  35759. * - `top`
  35760. * - `right`
  35761. * - `bottom`
  35762. * - `left`
  35763. *
  35764. * Each placement can have a variation from this list:
  35765. * - `-start`
  35766. * - `-end`
  35767. *
  35768. * Variations are interpreted easily if you think of them as the left to right
  35769. * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
  35770. * is right.<br />
  35771. * Vertically (`left` and `right`), `start` is top and `end` is bottom.
  35772. *
  35773. * Some valid examples are:
  35774. * - `top-end` (on top of reference, right aligned)
  35775. * - `right-start` (on right of reference, top aligned)
  35776. * - `bottom` (on bottom, centered)
  35777. * - `auto-end` (on the side with more space available, alignment depends by placement)
  35778. *
  35779. * @static
  35780. * @type {Array}
  35781. * @enum {String}
  35782. * @readonly
  35783. * @method placements
  35784. * @memberof Popper
  35785. */
  35786. 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'];
  35787. // Get rid of `auto` `auto-start` and `auto-end`
  35788. var validPlacements = placements.slice(3);
  35789. /**
  35790. * Given an initial placement, returns all the subsequent placements
  35791. * clockwise (or counter-clockwise).
  35792. *
  35793. * @method
  35794. * @memberof Popper.Utils
  35795. * @argument {String} placement - A valid placement (it accepts variations)
  35796. * @argument {Boolean} counter - Set to true to walk the placements counterclockwise
  35797. * @returns {Array} placements including their variations
  35798. */
  35799. function clockwise(placement) {
  35800. var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  35801. var index = validPlacements.indexOf(placement);
  35802. var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
  35803. return counter ? arr.reverse() : arr;
  35804. }
  35805. var BEHAVIORS = {
  35806. FLIP: 'flip',
  35807. CLOCKWISE: 'clockwise',
  35808. COUNTERCLOCKWISE: 'counterclockwise'
  35809. };
  35810. /**
  35811. * @function
  35812. * @memberof Modifiers
  35813. * @argument {Object} data - The data object generated by update method
  35814. * @argument {Object} options - Modifiers configuration and options
  35815. * @returns {Object} The data object, properly modified
  35816. */
  35817. function flip(data, options) {
  35818. // if `inner` modifier is enabled, we can't use the `flip` modifier
  35819. if (isModifierEnabled(data.instance.modifiers, 'inner')) {
  35820. return data;
  35821. }
  35822. if (data.flipped && data.placement === data.originalPlacement) {
  35823. // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
  35824. return data;
  35825. }
  35826. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
  35827. var placement = data.placement.split('-')[0];
  35828. var placementOpposite = getOppositePlacement(placement);
  35829. var variation = data.placement.split('-')[1] || '';
  35830. var flipOrder = [];
  35831. switch (options.behavior) {
  35832. case BEHAVIORS.FLIP:
  35833. flipOrder = [placement, placementOpposite];
  35834. break;
  35835. case BEHAVIORS.CLOCKWISE:
  35836. flipOrder = clockwise(placement);
  35837. break;
  35838. case BEHAVIORS.COUNTERCLOCKWISE:
  35839. flipOrder = clockwise(placement, true);
  35840. break;
  35841. default:
  35842. flipOrder = options.behavior;
  35843. }
  35844. flipOrder.forEach(function (step, index) {
  35845. if (placement !== step || flipOrder.length === index + 1) {
  35846. return data;
  35847. }
  35848. placement = data.placement.split('-')[0];
  35849. placementOpposite = getOppositePlacement(placement);
  35850. var popperOffsets = data.offsets.popper;
  35851. var refOffsets = data.offsets.reference;
  35852. // using floor because the reference offsets may contain decimals we are not going to consider here
  35853. var floor = Math.floor;
  35854. 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);
  35855. var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
  35856. var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
  35857. var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
  35858. var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
  35859. var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
  35860. // flip the variation if required
  35861. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  35862. // flips variation if reference element overflows boundaries
  35863. var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);
  35864. // flips variation if popper content overflows boundaries
  35865. var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop);
  35866. var flippedVariation = flippedVariationByRef || flippedVariationByContent;
  35867. if (overlapsRef || overflowsBoundaries || flippedVariation) {
  35868. // this boolean to detect any flip loop
  35869. data.flipped = true;
  35870. if (overlapsRef || overflowsBoundaries) {
  35871. placement = flipOrder[index + 1];
  35872. }
  35873. if (flippedVariation) {
  35874. variation = getOppositeVariation(variation);
  35875. }
  35876. data.placement = placement + (variation ? '-' + variation : '');
  35877. // this object contains `position`, we want to preserve it along with
  35878. // any additional property we may add in the future
  35879. data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
  35880. data = runModifiers(data.instance.modifiers, data, 'flip');
  35881. }
  35882. });
  35883. return data;
  35884. }
  35885. /**
  35886. * @function
  35887. * @memberof Modifiers
  35888. * @argument {Object} data - The data object generated by update method
  35889. * @argument {Object} options - Modifiers configuration and options
  35890. * @returns {Object} The data object, properly modified
  35891. */
  35892. function keepTogether(data) {
  35893. var _data$offsets = data.offsets,
  35894. popper = _data$offsets.popper,
  35895. reference = _data$offsets.reference;
  35896. var placement = data.placement.split('-')[0];
  35897. var floor = Math.floor;
  35898. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  35899. var side = isVertical ? 'right' : 'bottom';
  35900. var opSide = isVertical ? 'left' : 'top';
  35901. var measurement = isVertical ? 'width' : 'height';
  35902. if (popper[side] < floor(reference[opSide])) {
  35903. data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
  35904. }
  35905. if (popper[opSide] > floor(reference[side])) {
  35906. data.offsets.popper[opSide] = floor(reference[side]);
  35907. }
  35908. return data;
  35909. }
  35910. /**
  35911. * Converts a string containing value + unit into a px value number
  35912. * @function
  35913. * @memberof {modifiers~offset}
  35914. * @private
  35915. * @argument {String} str - Value + unit string
  35916. * @argument {String} measurement - `height` or `width`
  35917. * @argument {Object} popperOffsets
  35918. * @argument {Object} referenceOffsets
  35919. * @returns {Number|String}
  35920. * Value in pixels, or original string if no values were extracted
  35921. */
  35922. function toValue(str, measurement, popperOffsets, referenceOffsets) {
  35923. // separate value from unit
  35924. var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
  35925. var value = +split[1];
  35926. var unit = split[2];
  35927. // If it's not a number it's an operator, I guess
  35928. if (!value) {
  35929. return str;
  35930. }
  35931. if (unit.indexOf('%') === 0) {
  35932. var element = void 0;
  35933. switch (unit) {
  35934. case '%p':
  35935. element = popperOffsets;
  35936. break;
  35937. case '%':
  35938. case '%r':
  35939. default:
  35940. element = referenceOffsets;
  35941. }
  35942. var rect = getClientRect(element);
  35943. return rect[measurement] / 100 * value;
  35944. } else if (unit === 'vh' || unit === 'vw') {
  35945. // if is a vh or vw, we calculate the size based on the viewport
  35946. var size = void 0;
  35947. if (unit === 'vh') {
  35948. size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
  35949. } else {
  35950. size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
  35951. }
  35952. return size / 100 * value;
  35953. } else {
  35954. // if is an explicit pixel unit, we get rid of the unit and keep the value
  35955. // if is an implicit unit, it's px, and we return just the value
  35956. return value;
  35957. }
  35958. }
  35959. /**
  35960. * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
  35961. * @function
  35962. * @memberof {modifiers~offset}
  35963. * @private
  35964. * @argument {String} offset
  35965. * @argument {Object} popperOffsets
  35966. * @argument {Object} referenceOffsets
  35967. * @argument {String} basePlacement
  35968. * @returns {Array} a two cells array with x and y offsets in numbers
  35969. */
  35970. function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
  35971. var offsets = [0, 0];
  35972. // Use height if placement is left or right and index is 0 otherwise use width
  35973. // in this way the first offset will use an axis and the second one
  35974. // will use the other one
  35975. var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
  35976. // Split the offset string to obtain a list of values and operands
  35977. // The regex addresses values with the plus or minus sign in front (+10, -20, etc)
  35978. var fragments = offset.split(/(\+|\-)/).map(function (frag) {
  35979. return frag.trim();
  35980. });
  35981. // Detect if the offset string contains a pair of values or a single one
  35982. // they could be separated by comma or space
  35983. var divider = fragments.indexOf(find(fragments, function (frag) {
  35984. return frag.search(/,|\s/) !== -1;
  35985. }));
  35986. if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
  35987. console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
  35988. }
  35989. // If divider is found, we divide the list of values and operands to divide
  35990. // them by ofset X and Y.
  35991. var splitRegex = /\s*,\s*|\s+/;
  35992. 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];
  35993. // Convert the values with units to absolute pixels to allow our computations
  35994. ops = ops.map(function (op, index) {
  35995. // Most of the units rely on the orientation of the popper
  35996. var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
  35997. var mergeWithPrevious = false;
  35998. return op
  35999. // This aggregates any `+` or `-` sign that aren't considered operators
  36000. // e.g.: 10 + +5 => [10, +, +5]
  36001. .reduce(function (a, b) {
  36002. if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
  36003. a[a.length - 1] = b;
  36004. mergeWithPrevious = true;
  36005. return a;
  36006. } else if (mergeWithPrevious) {
  36007. a[a.length - 1] += b;
  36008. mergeWithPrevious = false;
  36009. return a;
  36010. } else {
  36011. return a.concat(b);
  36012. }
  36013. }, [])
  36014. // Here we convert the string values into number values (in px)
  36015. .map(function (str) {
  36016. return toValue(str, measurement, popperOffsets, referenceOffsets);
  36017. });
  36018. });
  36019. // Loop trough the offsets arrays and execute the operations
  36020. ops.forEach(function (op, index) {
  36021. op.forEach(function (frag, index2) {
  36022. if (isNumeric(frag)) {
  36023. offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
  36024. }
  36025. });
  36026. });
  36027. return offsets;
  36028. }
  36029. /**
  36030. * @function
  36031. * @memberof Modifiers
  36032. * @argument {Object} data - The data object generated by update method
  36033. * @argument {Object} options - Modifiers configuration and options
  36034. * @argument {Number|String} options.offset=0
  36035. * The offset value as described in the modifier description
  36036. * @returns {Object} The data object, properly modified
  36037. */
  36038. function offset(data, _ref) {
  36039. var offset = _ref.offset;
  36040. var placement = data.placement,
  36041. _data$offsets = data.offsets,
  36042. popper = _data$offsets.popper,
  36043. reference = _data$offsets.reference;
  36044. var basePlacement = placement.split('-')[0];
  36045. var offsets = void 0;
  36046. if (isNumeric(+offset)) {
  36047. offsets = [+offset, 0];
  36048. } else {
  36049. offsets = parseOffset(offset, popper, reference, basePlacement);
  36050. }
  36051. if (basePlacement === 'left') {
  36052. popper.top += offsets[0];
  36053. popper.left -= offsets[1];
  36054. } else if (basePlacement === 'right') {
  36055. popper.top += offsets[0];
  36056. popper.left += offsets[1];
  36057. } else if (basePlacement === 'top') {
  36058. popper.left += offsets[0];
  36059. popper.top -= offsets[1];
  36060. } else if (basePlacement === 'bottom') {
  36061. popper.left += offsets[0];
  36062. popper.top += offsets[1];
  36063. }
  36064. data.popper = popper;
  36065. return data;
  36066. }
  36067. /**
  36068. * @function
  36069. * @memberof Modifiers
  36070. * @argument {Object} data - The data object generated by `update` method
  36071. * @argument {Object} options - Modifiers configuration and options
  36072. * @returns {Object} The data object, properly modified
  36073. */
  36074. function preventOverflow(data, options) {
  36075. var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
  36076. // If offsetParent is the reference element, we really want to
  36077. // go one step up and use the next offsetParent as reference to
  36078. // avoid to make this modifier completely useless and look like broken
  36079. if (data.instance.reference === boundariesElement) {
  36080. boundariesElement = getOffsetParent(boundariesElement);
  36081. }
  36082. // NOTE: DOM access here
  36083. // resets the popper's position so that the document size can be calculated excluding
  36084. // the size of the popper element itself
  36085. var transformProp = getSupportedPropertyName('transform');
  36086. var popperStyles = data.instance.popper.style; // assignment to help minification
  36087. var top = popperStyles.top,
  36088. left = popperStyles.left,
  36089. transform = popperStyles[transformProp];
  36090. popperStyles.top = '';
  36091. popperStyles.left = '';
  36092. popperStyles[transformProp] = '';
  36093. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
  36094. // NOTE: DOM access here
  36095. // restores the original style properties after the offsets have been computed
  36096. popperStyles.top = top;
  36097. popperStyles.left = left;
  36098. popperStyles[transformProp] = transform;
  36099. options.boundaries = boundaries;
  36100. var order = options.priority;
  36101. var popper = data.offsets.popper;
  36102. var check = {
  36103. primary: function primary(placement) {
  36104. var value = popper[placement];
  36105. if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
  36106. value = Math.max(popper[placement], boundaries[placement]);
  36107. }
  36108. return defineProperty({}, placement, value);
  36109. },
  36110. secondary: function secondary(placement) {
  36111. var mainSide = placement === 'right' ? 'left' : 'top';
  36112. var value = popper[mainSide];
  36113. if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
  36114. value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
  36115. }
  36116. return defineProperty({}, mainSide, value);
  36117. }
  36118. };
  36119. order.forEach(function (placement) {
  36120. var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
  36121. popper = _extends({}, popper, check[side](placement));
  36122. });
  36123. data.offsets.popper = popper;
  36124. return data;
  36125. }
  36126. /**
  36127. * @function
  36128. * @memberof Modifiers
  36129. * @argument {Object} data - The data object generated by `update` method
  36130. * @argument {Object} options - Modifiers configuration and options
  36131. * @returns {Object} The data object, properly modified
  36132. */
  36133. function shift(data) {
  36134. var placement = data.placement;
  36135. var basePlacement = placement.split('-')[0];
  36136. var shiftvariation = placement.split('-')[1];
  36137. // if shift shiftvariation is specified, run the modifier
  36138. if (shiftvariation) {
  36139. var _data$offsets = data.offsets,
  36140. reference = _data$offsets.reference,
  36141. popper = _data$offsets.popper;
  36142. var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
  36143. var side = isVertical ? 'left' : 'top';
  36144. var measurement = isVertical ? 'width' : 'height';
  36145. var shiftOffsets = {
  36146. start: defineProperty({}, side, reference[side]),
  36147. end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
  36148. };
  36149. data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]);
  36150. }
  36151. return data;
  36152. }
  36153. /**
  36154. * @function
  36155. * @memberof Modifiers
  36156. * @argument {Object} data - The data object generated by update method
  36157. * @argument {Object} options - Modifiers configuration and options
  36158. * @returns {Object} The data object, properly modified
  36159. */
  36160. function hide(data) {
  36161. if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
  36162. return data;
  36163. }
  36164. var refRect = data.offsets.reference;
  36165. var bound = find(data.instance.modifiers, function (modifier) {
  36166. return modifier.name === 'preventOverflow';
  36167. }).boundaries;
  36168. if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
  36169. // Avoid unnecessary DOM access if visibility hasn't changed
  36170. if (data.hide === true) {
  36171. return data;
  36172. }
  36173. data.hide = true;
  36174. data.attributes['x-out-of-boundaries'] = '';
  36175. } else {
  36176. // Avoid unnecessary DOM access if visibility hasn't changed
  36177. if (data.hide === false) {
  36178. return data;
  36179. }
  36180. data.hide = false;
  36181. data.attributes['x-out-of-boundaries'] = false;
  36182. }
  36183. return data;
  36184. }
  36185. /**
  36186. * @function
  36187. * @memberof Modifiers
  36188. * @argument {Object} data - The data object generated by `update` method
  36189. * @argument {Object} options - Modifiers configuration and options
  36190. * @returns {Object} The data object, properly modified
  36191. */
  36192. function inner(data) {
  36193. var placement = data.placement;
  36194. var basePlacement = placement.split('-')[0];
  36195. var _data$offsets = data.offsets,
  36196. popper = _data$offsets.popper,
  36197. reference = _data$offsets.reference;
  36198. var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
  36199. var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
  36200. popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
  36201. data.placement = getOppositePlacement(placement);
  36202. data.offsets.popper = getClientRect(popper);
  36203. return data;
  36204. }
  36205. /**
  36206. * Modifier function, each modifier can have a function of this type assigned
  36207. * to its `fn` property.<br />
  36208. * These functions will be called on each update, this means that you must
  36209. * make sure they are performant enough to avoid performance bottlenecks.
  36210. *
  36211. * @function ModifierFn
  36212. * @argument {dataObject} data - The data object generated by `update` method
  36213. * @argument {Object} options - Modifiers configuration and options
  36214. * @returns {dataObject} The data object, properly modified
  36215. */
  36216. /**
  36217. * Modifiers are plugins used to alter the behavior of your poppers.<br />
  36218. * Popper.js uses a set of 9 modifiers to provide all the basic functionalities
  36219. * needed by the library.
  36220. *
  36221. * Usually you don't want to override the `order`, `fn` and `onLoad` props.
  36222. * All the other properties are configurations that could be tweaked.
  36223. * @namespace modifiers
  36224. */
  36225. var modifiers = {
  36226. /**
  36227. * Modifier used to shift the popper on the start or end of its reference
  36228. * element.<br />
  36229. * It will read the variation of the `placement` property.<br />
  36230. * It can be one either `-end` or `-start`.
  36231. * @memberof modifiers
  36232. * @inner
  36233. */
  36234. shift: {
  36235. /** @prop {number} order=100 - Index used to define the order of execution */
  36236. order: 100,
  36237. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36238. enabled: true,
  36239. /** @prop {ModifierFn} */
  36240. fn: shift
  36241. },
  36242. /**
  36243. * The `offset` modifier can shift your popper on both its axis.
  36244. *
  36245. * It accepts the following units:
  36246. * - `px` or unit-less, interpreted as pixels
  36247. * - `%` or `%r`, percentage relative to the length of the reference element
  36248. * - `%p`, percentage relative to the length of the popper element
  36249. * - `vw`, CSS viewport width unit
  36250. * - `vh`, CSS viewport height unit
  36251. *
  36252. * For length is intended the main axis relative to the placement of the popper.<br />
  36253. * This means that if the placement is `top` or `bottom`, the length will be the
  36254. * `width`. In case of `left` or `right`, it will be the `height`.
  36255. *
  36256. * You can provide a single value (as `Number` or `String`), or a pair of values
  36257. * as `String` divided by a comma or one (or more) white spaces.<br />
  36258. * The latter is a deprecated method because it leads to confusion and will be
  36259. * removed in v2.<br />
  36260. * Additionally, it accepts additions and subtractions between different units.
  36261. * Note that multiplications and divisions aren't supported.
  36262. *
  36263. * Valid examples are:
  36264. * ```
  36265. * 10
  36266. * '10%'
  36267. * '10, 10'
  36268. * '10%, 10'
  36269. * '10 + 10%'
  36270. * '10 - 5vh + 3%'
  36271. * '-10px + 5vh, 5px - 6%'
  36272. * ```
  36273. * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
  36274. * > with their reference element, unfortunately, you will have to disable the `flip` modifier.
  36275. * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).
  36276. *
  36277. * @memberof modifiers
  36278. * @inner
  36279. */
  36280. offset: {
  36281. /** @prop {number} order=200 - Index used to define the order of execution */
  36282. order: 200,
  36283. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36284. enabled: true,
  36285. /** @prop {ModifierFn} */
  36286. fn: offset,
  36287. /** @prop {Number|String} offset=0
  36288. * The offset value as described in the modifier description
  36289. */
  36290. offset: 0
  36291. },
  36292. /**
  36293. * Modifier used to prevent the popper from being positioned outside the boundary.
  36294. *
  36295. * A scenario exists where the reference itself is not within the boundaries.<br />
  36296. * We can say it has "escaped the boundaries" — or just "escaped".<br />
  36297. * In this case we need to decide whether the popper should either:
  36298. *
  36299. * - detach from the reference and remain "trapped" in the boundaries, or
  36300. * - if it should ignore the boundary and "escape with its reference"
  36301. *
  36302. * When `escapeWithReference` is set to`true` and reference is completely
  36303. * outside its boundaries, the popper will overflow (or completely leave)
  36304. * the boundaries in order to remain attached to the edge of the reference.
  36305. *
  36306. * @memberof modifiers
  36307. * @inner
  36308. */
  36309. preventOverflow: {
  36310. /** @prop {number} order=300 - Index used to define the order of execution */
  36311. order: 300,
  36312. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36313. enabled: true,
  36314. /** @prop {ModifierFn} */
  36315. fn: preventOverflow,
  36316. /**
  36317. * @prop {Array} [priority=['left','right','top','bottom']]
  36318. * Popper will try to prevent overflow following these priorities by default,
  36319. * then, it could overflow on the left and on top of the `boundariesElement`
  36320. */
  36321. priority: ['left', 'right', 'top', 'bottom'],
  36322. /**
  36323. * @prop {number} padding=5
  36324. * Amount of pixel used to define a minimum distance between the boundaries
  36325. * and the popper. This makes sure the popper always has a little padding
  36326. * between the edges of its container
  36327. */
  36328. padding: 5,
  36329. /**
  36330. * @prop {String|HTMLElement} boundariesElement='scrollParent'
  36331. * Boundaries used by the modifier. Can be `scrollParent`, `window`,
  36332. * `viewport` or any DOM element.
  36333. */
  36334. boundariesElement: 'scrollParent'
  36335. },
  36336. /**
  36337. * Modifier used to make sure the reference and its popper stay near each other
  36338. * without leaving any gap between the two. Especially useful when the arrow is
  36339. * enabled and you want to ensure that it points to its reference element.
  36340. * It cares only about the first axis. You can still have poppers with margin
  36341. * between the popper and its reference element.
  36342. * @memberof modifiers
  36343. * @inner
  36344. */
  36345. keepTogether: {
  36346. /** @prop {number} order=400 - Index used to define the order of execution */
  36347. order: 400,
  36348. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36349. enabled: true,
  36350. /** @prop {ModifierFn} */
  36351. fn: keepTogether
  36352. },
  36353. /**
  36354. * This modifier is used to move the `arrowElement` of the popper to make
  36355. * sure it is positioned between the reference element and its popper element.
  36356. * It will read the outer size of the `arrowElement` node to detect how many
  36357. * pixels of conjunction are needed.
  36358. *
  36359. * It has no effect if no `arrowElement` is provided.
  36360. * @memberof modifiers
  36361. * @inner
  36362. */
  36363. arrow: {
  36364. /** @prop {number} order=500 - Index used to define the order of execution */
  36365. order: 500,
  36366. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36367. enabled: true,
  36368. /** @prop {ModifierFn} */
  36369. fn: arrow,
  36370. /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
  36371. element: '[x-arrow]'
  36372. },
  36373. /**
  36374. * Modifier used to flip the popper's placement when it starts to overlap its
  36375. * reference element.
  36376. *
  36377. * Requires the `preventOverflow` modifier before it in order to work.
  36378. *
  36379. * **NOTE:** this modifier will interrupt the current update cycle and will
  36380. * restart it if it detects the need to flip the placement.
  36381. * @memberof modifiers
  36382. * @inner
  36383. */
  36384. flip: {
  36385. /** @prop {number} order=600 - Index used to define the order of execution */
  36386. order: 600,
  36387. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36388. enabled: true,
  36389. /** @prop {ModifierFn} */
  36390. fn: flip,
  36391. /**
  36392. * @prop {String|Array} behavior='flip'
  36393. * The behavior used to change the popper's placement. It can be one of
  36394. * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
  36395. * placements (with optional variations)
  36396. */
  36397. behavior: 'flip',
  36398. /**
  36399. * @prop {number} padding=5
  36400. * The popper will flip if it hits the edges of the `boundariesElement`
  36401. */
  36402. padding: 5,
  36403. /**
  36404. * @prop {String|HTMLElement} boundariesElement='viewport'
  36405. * The element which will define the boundaries of the popper position.
  36406. * The popper will never be placed outside of the defined boundaries
  36407. * (except if `keepTogether` is enabled)
  36408. */
  36409. boundariesElement: 'viewport',
  36410. /**
  36411. * @prop {Boolean} flipVariations=false
  36412. * The popper will switch placement variation between `-start` and `-end` when
  36413. * the reference element overlaps its boundaries.
  36414. *
  36415. * The original placement should have a set variation.
  36416. */
  36417. flipVariations: false,
  36418. /**
  36419. * @prop {Boolean} flipVariationsByContent=false
  36420. * The popper will switch placement variation between `-start` and `-end` when
  36421. * the popper element overlaps its reference boundaries.
  36422. *
  36423. * The original placement should have a set variation.
  36424. */
  36425. flipVariationsByContent: false
  36426. },
  36427. /**
  36428. * Modifier used to make the popper flow toward the inner of the reference element.
  36429. * By default, when this modifier is disabled, the popper will be placed outside
  36430. * the reference element.
  36431. * @memberof modifiers
  36432. * @inner
  36433. */
  36434. inner: {
  36435. /** @prop {number} order=700 - Index used to define the order of execution */
  36436. order: 700,
  36437. /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
  36438. enabled: false,
  36439. /** @prop {ModifierFn} */
  36440. fn: inner
  36441. },
  36442. /**
  36443. * Modifier used to hide the popper when its reference element is outside of the
  36444. * popper boundaries. It will set a `x-out-of-boundaries` attribute which can
  36445. * be used to hide with a CSS selector the popper when its reference is
  36446. * out of boundaries.
  36447. *
  36448. * Requires the `preventOverflow` modifier before it in order to work.
  36449. * @memberof modifiers
  36450. * @inner
  36451. */
  36452. hide: {
  36453. /** @prop {number} order=800 - Index used to define the order of execution */
  36454. order: 800,
  36455. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36456. enabled: true,
  36457. /** @prop {ModifierFn} */
  36458. fn: hide
  36459. },
  36460. /**
  36461. * Computes the style that will be applied to the popper element to gets
  36462. * properly positioned.
  36463. *
  36464. * Note that this modifier will not touch the DOM, it just prepares the styles
  36465. * so that `applyStyle` modifier can apply it. This separation is useful
  36466. * in case you need to replace `applyStyle` with a custom implementation.
  36467. *
  36468. * This modifier has `850` as `order` value to maintain backward compatibility
  36469. * with previous versions of Popper.js. Expect the modifiers ordering method
  36470. * to change in future major versions of the library.
  36471. *
  36472. * @memberof modifiers
  36473. * @inner
  36474. */
  36475. computeStyle: {
  36476. /** @prop {number} order=850 - Index used to define the order of execution */
  36477. order: 850,
  36478. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36479. enabled: true,
  36480. /** @prop {ModifierFn} */
  36481. fn: computeStyle,
  36482. /**
  36483. * @prop {Boolean} gpuAcceleration=true
  36484. * If true, it uses the CSS 3D transformation to position the popper.
  36485. * Otherwise, it will use the `top` and `left` properties
  36486. */
  36487. gpuAcceleration: true,
  36488. /**
  36489. * @prop {string} [x='bottom']
  36490. * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
  36491. * Change this if your popper should grow in a direction different from `bottom`
  36492. */
  36493. x: 'bottom',
  36494. /**
  36495. * @prop {string} [x='left']
  36496. * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
  36497. * Change this if your popper should grow in a direction different from `right`
  36498. */
  36499. y: 'right'
  36500. },
  36501. /**
  36502. * Applies the computed styles to the popper element.
  36503. *
  36504. * All the DOM manipulations are limited to this modifier. This is useful in case
  36505. * you want to integrate Popper.js inside a framework or view library and you
  36506. * want to delegate all the DOM manipulations to it.
  36507. *
  36508. * Note that if you disable this modifier, you must make sure the popper element
  36509. * has its position set to `absolute` before Popper.js can do its work!
  36510. *
  36511. * Just disable this modifier and define your own to achieve the desired effect.
  36512. *
  36513. * @memberof modifiers
  36514. * @inner
  36515. */
  36516. applyStyle: {
  36517. /** @prop {number} order=900 - Index used to define the order of execution */
  36518. order: 900,
  36519. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36520. enabled: true,
  36521. /** @prop {ModifierFn} */
  36522. fn: applyStyle,
  36523. /** @prop {Function} */
  36524. onLoad: applyStyleOnLoad,
  36525. /**
  36526. * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
  36527. * @prop {Boolean} gpuAcceleration=true
  36528. * If true, it uses the CSS 3D transformation to position the popper.
  36529. * Otherwise, it will use the `top` and `left` properties
  36530. */
  36531. gpuAcceleration: undefined
  36532. }
  36533. };
  36534. /**
  36535. * The `dataObject` is an object containing all the information used by Popper.js.
  36536. * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
  36537. * @name dataObject
  36538. * @property {Object} data.instance The Popper.js instance
  36539. * @property {String} data.placement Placement applied to popper
  36540. * @property {String} data.originalPlacement Placement originally defined on init
  36541. * @property {Boolean} data.flipped True if popper has been flipped by flip modifier
  36542. * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper
  36543. * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
  36544. * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)
  36545. * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)
  36546. * @property {Object} data.boundaries Offsets of the popper boundaries
  36547. * @property {Object} data.offsets The measurements of popper, reference and arrow elements
  36548. * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
  36549. * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
  36550. * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
  36551. */
  36552. /**
  36553. * Default options provided to Popper.js constructor.<br />
  36554. * These can be overridden using the `options` argument of Popper.js.<br />
  36555. * To override an option, simply pass an object with the same
  36556. * structure of the `options` object, as the 3rd argument. For example:
  36557. * ```
  36558. * new Popper(ref, pop, {
  36559. * modifiers: {
  36560. * preventOverflow: { enabled: false }
  36561. * }
  36562. * })
  36563. * ```
  36564. * @type {Object}
  36565. * @static
  36566. * @memberof Popper
  36567. */
  36568. var Defaults = {
  36569. /**
  36570. * Popper's placement.
  36571. * @prop {Popper.placements} placement='bottom'
  36572. */
  36573. placement: 'bottom',
  36574. /**
  36575. * Set this to true if you want popper to position it self in 'fixed' mode
  36576. * @prop {Boolean} positionFixed=false
  36577. */
  36578. positionFixed: false,
  36579. /**
  36580. * Whether events (resize, scroll) are initially enabled.
  36581. * @prop {Boolean} eventsEnabled=true
  36582. */
  36583. eventsEnabled: true,
  36584. /**
  36585. * Set to true if you want to automatically remove the popper when
  36586. * you call the `destroy` method.
  36587. * @prop {Boolean} removeOnDestroy=false
  36588. */
  36589. removeOnDestroy: false,
  36590. /**
  36591. * Callback called when the popper is created.<br />
  36592. * By default, it is set to no-op.<br />
  36593. * Access Popper.js instance with `data.instance`.
  36594. * @prop {onCreate}
  36595. */
  36596. onCreate: function onCreate() {},
  36597. /**
  36598. * Callback called when the popper is updated. This callback is not called
  36599. * on the initialization/creation of the popper, but only on subsequent
  36600. * updates.<br />
  36601. * By default, it is set to no-op.<br />
  36602. * Access Popper.js instance with `data.instance`.
  36603. * @prop {onUpdate}
  36604. */
  36605. onUpdate: function onUpdate() {},
  36606. /**
  36607. * List of modifiers used to modify the offsets before they are applied to the popper.
  36608. * They provide most of the functionalities of Popper.js.
  36609. * @prop {modifiers}
  36610. */
  36611. modifiers: modifiers
  36612. };
  36613. /**
  36614. * @callback onCreate
  36615. * @param {dataObject} data
  36616. */
  36617. /**
  36618. * @callback onUpdate
  36619. * @param {dataObject} data
  36620. */
  36621. // Utils
  36622. // Methods
  36623. var Popper = function () {
  36624. /**
  36625. * Creates a new Popper.js instance.
  36626. * @class Popper
  36627. * @param {Element|referenceObject} reference - The reference element used to position the popper
  36628. * @param {Element} popper - The HTML / XML element used as the popper
  36629. * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
  36630. * @return {Object} instance - The generated Popper.js instance
  36631. */
  36632. function Popper(reference, popper) {
  36633. var _this = this;
  36634. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  36635. classCallCheck(this, Popper);
  36636. this.scheduleUpdate = function () {
  36637. return requestAnimationFrame(_this.update);
  36638. };
  36639. // make update() debounced, so that it only runs at most once-per-tick
  36640. this.update = debounce(this.update.bind(this));
  36641. // with {} we create a new object with the options inside it
  36642. this.options = _extends({}, Popper.Defaults, options);
  36643. // init state
  36644. this.state = {
  36645. isDestroyed: false,
  36646. isCreated: false,
  36647. scrollParents: []
  36648. };
  36649. // get reference and popper elements (allow jQuery wrappers)
  36650. this.reference = reference && reference.jquery ? reference[0] : reference;
  36651. this.popper = popper && popper.jquery ? popper[0] : popper;
  36652. // Deep merge modifiers options
  36653. this.options.modifiers = {};
  36654. Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
  36655. _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
  36656. });
  36657. // Refactoring modifiers' list (Object => Array)
  36658. this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
  36659. return _extends({
  36660. name: name
  36661. }, _this.options.modifiers[name]);
  36662. })
  36663. // sort the modifiers by order
  36664. .sort(function (a, b) {
  36665. return a.order - b.order;
  36666. });
  36667. // modifiers have the ability to execute arbitrary code when Popper.js get inited
  36668. // such code is executed in the same order of its modifier
  36669. // they could add new properties to their options configuration
  36670. // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
  36671. this.modifiers.forEach(function (modifierOptions) {
  36672. if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
  36673. modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
  36674. }
  36675. });
  36676. // fire the first update to position the popper in the right place
  36677. this.update();
  36678. var eventsEnabled = this.options.eventsEnabled;
  36679. if (eventsEnabled) {
  36680. // setup event listeners, they will take care of update the position in specific situations
  36681. this.enableEventListeners();
  36682. }
  36683. this.state.eventsEnabled = eventsEnabled;
  36684. }
  36685. // We can't use class properties because they don't get listed in the
  36686. // class prototype and break stuff like Sinon stubs
  36687. createClass(Popper, [{
  36688. key: 'update',
  36689. value: function update$$1() {
  36690. return update.call(this);
  36691. }
  36692. }, {
  36693. key: 'destroy',
  36694. value: function destroy$$1() {
  36695. return destroy.call(this);
  36696. }
  36697. }, {
  36698. key: 'enableEventListeners',
  36699. value: function enableEventListeners$$1() {
  36700. return enableEventListeners.call(this);
  36701. }
  36702. }, {
  36703. key: 'disableEventListeners',
  36704. value: function disableEventListeners$$1() {
  36705. return disableEventListeners.call(this);
  36706. }
  36707. /**
  36708. * Schedules an update. It will run on the next UI update available.
  36709. * @method scheduleUpdate
  36710. * @memberof Popper
  36711. */
  36712. /**
  36713. * Collection of utilities useful when writing custom modifiers.
  36714. * Starting from version 1.7, this method is available only if you
  36715. * include `popper-utils.js` before `popper.js`.
  36716. *
  36717. * **DEPRECATION**: This way to access PopperUtils is deprecated
  36718. * and will be removed in v2! Use the PopperUtils module directly instead.
  36719. * Due to the high instability of the methods contained in Utils, we can't
  36720. * guarantee them to follow semver. Use them at your own risk!
  36721. * @static
  36722. * @private
  36723. * @type {Object}
  36724. * @deprecated since version 1.8
  36725. * @member Utils
  36726. * @memberof Popper
  36727. */
  36728. }]);
  36729. return Popper;
  36730. }();
  36731. /**
  36732. * The `referenceObject` is an object that provides an interface compatible with Popper.js
  36733. * and lets you use it as replacement of a real DOM node.<br />
  36734. * You can use this method to position a popper relatively to a set of coordinates
  36735. * in case you don't have a DOM node to use as reference.
  36736. *
  36737. * ```
  36738. * new Popper(referenceObject, popperNode);
  36739. * ```
  36740. *
  36741. * NB: This feature isn't supported in Internet Explorer 10.
  36742. * @name referenceObject
  36743. * @property {Function} data.getBoundingClientRect
  36744. * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
  36745. * @property {number} data.clientWidth
  36746. * An ES6 getter that will return the width of the virtual reference element.
  36747. * @property {number} data.clientHeight
  36748. * An ES6 getter that will return the height of the virtual reference element.
  36749. */
  36750. Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
  36751. Popper.placements = placements;
  36752. Popper.Defaults = Defaults;
  36753. /* harmony default export */ __webpack_exports__["default"] = (Popper);
  36754. //# sourceMappingURL=popper.js.map
  36755. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  36756. /***/ }),
  36757. /***/ "./node_modules/process/browser.js":
  36758. /*!*****************************************!*\
  36759. !*** ./node_modules/process/browser.js ***!
  36760. \*****************************************/
  36761. /*! no static exports found */
  36762. /***/ (function(module, exports) {
  36763. // shim for using process in browser
  36764. var process = module.exports = {};
  36765. // cached from whatever global is present so that test runners that stub it
  36766. // don't break things. But we need to wrap it in a try catch in case it is
  36767. // wrapped in strict mode code which doesn't define any globals. It's inside a
  36768. // function because try/catches deoptimize in certain engines.
  36769. var cachedSetTimeout;
  36770. var cachedClearTimeout;
  36771. function defaultSetTimout() {
  36772. throw new Error('setTimeout has not been defined');
  36773. }
  36774. function defaultClearTimeout () {
  36775. throw new Error('clearTimeout has not been defined');
  36776. }
  36777. (function () {
  36778. try {
  36779. if (typeof setTimeout === 'function') {
  36780. cachedSetTimeout = setTimeout;
  36781. } else {
  36782. cachedSetTimeout = defaultSetTimout;
  36783. }
  36784. } catch (e) {
  36785. cachedSetTimeout = defaultSetTimout;
  36786. }
  36787. try {
  36788. if (typeof clearTimeout === 'function') {
  36789. cachedClearTimeout = clearTimeout;
  36790. } else {
  36791. cachedClearTimeout = defaultClearTimeout;
  36792. }
  36793. } catch (e) {
  36794. cachedClearTimeout = defaultClearTimeout;
  36795. }
  36796. } ())
  36797. function runTimeout(fun) {
  36798. if (cachedSetTimeout === setTimeout) {
  36799. //normal enviroments in sane situations
  36800. return setTimeout(fun, 0);
  36801. }
  36802. // if setTimeout wasn't available but was latter defined
  36803. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  36804. cachedSetTimeout = setTimeout;
  36805. return setTimeout(fun, 0);
  36806. }
  36807. try {
  36808. // when when somebody has screwed with setTimeout but no I.E. maddness
  36809. return cachedSetTimeout(fun, 0);
  36810. } catch(e){
  36811. try {
  36812. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  36813. return cachedSetTimeout.call(null, fun, 0);
  36814. } catch(e){
  36815. // 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
  36816. return cachedSetTimeout.call(this, fun, 0);
  36817. }
  36818. }
  36819. }
  36820. function runClearTimeout(marker) {
  36821. if (cachedClearTimeout === clearTimeout) {
  36822. //normal enviroments in sane situations
  36823. return clearTimeout(marker);
  36824. }
  36825. // if clearTimeout wasn't available but was latter defined
  36826. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  36827. cachedClearTimeout = clearTimeout;
  36828. return clearTimeout(marker);
  36829. }
  36830. try {
  36831. // when when somebody has screwed with setTimeout but no I.E. maddness
  36832. return cachedClearTimeout(marker);
  36833. } catch (e){
  36834. try {
  36835. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  36836. return cachedClearTimeout.call(null, marker);
  36837. } catch (e){
  36838. // 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.
  36839. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  36840. return cachedClearTimeout.call(this, marker);
  36841. }
  36842. }
  36843. }
  36844. var queue = [];
  36845. var draining = false;
  36846. var currentQueue;
  36847. var queueIndex = -1;
  36848. function cleanUpNextTick() {
  36849. if (!draining || !currentQueue) {
  36850. return;
  36851. }
  36852. draining = false;
  36853. if (currentQueue.length) {
  36854. queue = currentQueue.concat(queue);
  36855. } else {
  36856. queueIndex = -1;
  36857. }
  36858. if (queue.length) {
  36859. drainQueue();
  36860. }
  36861. }
  36862. function drainQueue() {
  36863. if (draining) {
  36864. return;
  36865. }
  36866. var timeout = runTimeout(cleanUpNextTick);
  36867. draining = true;
  36868. var len = queue.length;
  36869. while(len) {
  36870. currentQueue = queue;
  36871. queue = [];
  36872. while (++queueIndex < len) {
  36873. if (currentQueue) {
  36874. currentQueue[queueIndex].run();
  36875. }
  36876. }
  36877. queueIndex = -1;
  36878. len = queue.length;
  36879. }
  36880. currentQueue = null;
  36881. draining = false;
  36882. runClearTimeout(timeout);
  36883. }
  36884. process.nextTick = function (fun) {
  36885. var args = new Array(arguments.length - 1);
  36886. if (arguments.length > 1) {
  36887. for (var i = 1; i < arguments.length; i++) {
  36888. args[i - 1] = arguments[i];
  36889. }
  36890. }
  36891. queue.push(new Item(fun, args));
  36892. if (queue.length === 1 && !draining) {
  36893. runTimeout(drainQueue);
  36894. }
  36895. };
  36896. // v8 likes predictible objects
  36897. function Item(fun, array) {
  36898. this.fun = fun;
  36899. this.array = array;
  36900. }
  36901. Item.prototype.run = function () {
  36902. this.fun.apply(null, this.array);
  36903. };
  36904. process.title = 'browser';
  36905. process.browser = true;
  36906. process.env = {};
  36907. process.argv = [];
  36908. process.version = ''; // empty string to avoid regexp issues
  36909. process.versions = {};
  36910. function noop() {}
  36911. process.on = noop;
  36912. process.addListener = noop;
  36913. process.once = noop;
  36914. process.off = noop;
  36915. process.removeListener = noop;
  36916. process.removeAllListeners = noop;
  36917. process.emit = noop;
  36918. process.prependListener = noop;
  36919. process.prependOnceListener = noop;
  36920. process.listeners = function (name) { return [] }
  36921. process.binding = function (name) {
  36922. throw new Error('process.binding is not supported');
  36923. };
  36924. process.cwd = function () { return '/' };
  36925. process.chdir = function (dir) {
  36926. throw new Error('process.chdir is not supported');
  36927. };
  36928. process.umask = function() { return 0; };
  36929. /***/ }),
  36930. /***/ "./node_modules/pusher-js/dist/web/pusher.js":
  36931. /*!***************************************************!*\
  36932. !*** ./node_modules/pusher-js/dist/web/pusher.js ***!
  36933. \***************************************************/
  36934. /*! no static exports found */
  36935. /***/ (function(module, exports, __webpack_require__) {
  36936. /* WEBPACK VAR INJECTION */(function(Buffer) {/*!
  36937. * Pusher JavaScript Library v5.0.3
  36938. * https://pusher.com/
  36939. *
  36940. * Copyright 2017, Pusher
  36941. * Released under the MIT licence.
  36942. */
  36943. (function webpackUniversalModuleDefinition(root, factory) {
  36944. if(true)
  36945. module.exports = factory();
  36946. else {}
  36947. })(window, function() {
  36948. return /******/ (function(modules) { // webpackBootstrap
  36949. /******/ // The module cache
  36950. /******/ var installedModules = {};
  36951. /******/
  36952. /******/ // The require function
  36953. /******/ function __webpack_require__(moduleId) {
  36954. /******/
  36955. /******/ // Check if module is in cache
  36956. /******/ if(installedModules[moduleId]) {
  36957. /******/ return installedModules[moduleId].exports;
  36958. /******/ }
  36959. /******/ // Create a new module (and put it into the cache)
  36960. /******/ var module = installedModules[moduleId] = {
  36961. /******/ i: moduleId,
  36962. /******/ l: false,
  36963. /******/ exports: {}
  36964. /******/ };
  36965. /******/
  36966. /******/ // Execute the module function
  36967. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  36968. /******/
  36969. /******/ // Flag the module as loaded
  36970. /******/ module.l = true;
  36971. /******/
  36972. /******/ // Return the exports of the module
  36973. /******/ return module.exports;
  36974. /******/ }
  36975. /******/
  36976. /******/
  36977. /******/ // expose the modules object (__webpack_modules__)
  36978. /******/ __webpack_require__.m = modules;
  36979. /******/
  36980. /******/ // expose the module cache
  36981. /******/ __webpack_require__.c = installedModules;
  36982. /******/
  36983. /******/ // define getter function for harmony exports
  36984. /******/ __webpack_require__.d = function(exports, name, getter) {
  36985. /******/ if(!__webpack_require__.o(exports, name)) {
  36986. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  36987. /******/ }
  36988. /******/ };
  36989. /******/
  36990. /******/ // define __esModule on exports
  36991. /******/ __webpack_require__.r = function(exports) {
  36992. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  36993. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  36994. /******/ }
  36995. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  36996. /******/ };
  36997. /******/
  36998. /******/ // create a fake namespace object
  36999. /******/ // mode & 1: value is a module id, require it
  37000. /******/ // mode & 2: merge all properties of value into the ns
  37001. /******/ // mode & 4: return value when already ns object
  37002. /******/ // mode & 8|1: behave like require
  37003. /******/ __webpack_require__.t = function(value, mode) {
  37004. /******/ if(mode & 1) value = __webpack_require__(value);
  37005. /******/ if(mode & 8) return value;
  37006. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  37007. /******/ var ns = Object.create(null);
  37008. /******/ __webpack_require__.r(ns);
  37009. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  37010. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  37011. /******/ return ns;
  37012. /******/ };
  37013. /******/
  37014. /******/ // getDefaultExport function for compatibility with non-harmony modules
  37015. /******/ __webpack_require__.n = function(module) {
  37016. /******/ var getter = module && module.__esModule ?
  37017. /******/ function getDefault() { return module['default']; } :
  37018. /******/ function getModuleExports() { return module; };
  37019. /******/ __webpack_require__.d(getter, 'a', getter);
  37020. /******/ return getter;
  37021. /******/ };
  37022. /******/
  37023. /******/ // Object.prototype.hasOwnProperty.call
  37024. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  37025. /******/
  37026. /******/ // __webpack_public_path__
  37027. /******/ __webpack_require__.p = "";
  37028. /******/
  37029. /******/
  37030. /******/ // Load entry module and return exports
  37031. /******/ return __webpack_require__(__webpack_require__.s = 2);
  37032. /******/ })
  37033. /************************************************************************/
  37034. /******/ ([
  37035. /* 0 */
  37036. /***/ (function(module, exports, __webpack_require__) {
  37037. (function(nacl) {
  37038. 'use strict';
  37039. // Ported in 2014 by Dmitry Chestnykh and Devi Mandiri.
  37040. // Public domain.
  37041. //
  37042. // Implementation derived from TweetNaCl version 20140427.
  37043. // See for details: http://tweetnacl.cr.yp.to/
  37044. var gf = function(init) {
  37045. var i, r = new Float64Array(16);
  37046. if (init) for (i = 0; i < init.length; i++) r[i] = init[i];
  37047. return r;
  37048. };
  37049. // Pluggable, initialized in high-level API below.
  37050. var randombytes = function(/* x, n */) { throw new Error('no PRNG'); };
  37051. var _0 = new Uint8Array(16);
  37052. var _9 = new Uint8Array(32); _9[0] = 9;
  37053. var gf0 = gf(),
  37054. gf1 = gf([1]),
  37055. _121665 = gf([0xdb41, 1]),
  37056. D = gf([0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203]),
  37057. D2 = gf([0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406]),
  37058. X = gf([0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169]),
  37059. Y = gf([0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666]),
  37060. I = gf([0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83]);
  37061. function ts64(x, i, h, l) {
  37062. x[i] = (h >> 24) & 0xff;
  37063. x[i+1] = (h >> 16) & 0xff;
  37064. x[i+2] = (h >> 8) & 0xff;
  37065. x[i+3] = h & 0xff;
  37066. x[i+4] = (l >> 24) & 0xff;
  37067. x[i+5] = (l >> 16) & 0xff;
  37068. x[i+6] = (l >> 8) & 0xff;
  37069. x[i+7] = l & 0xff;
  37070. }
  37071. function vn(x, xi, y, yi, n) {
  37072. var i,d = 0;
  37073. for (i = 0; i < n; i++) d |= x[xi+i]^y[yi+i];
  37074. return (1 & ((d - 1) >>> 8)) - 1;
  37075. }
  37076. function crypto_verify_16(x, xi, y, yi) {
  37077. return vn(x,xi,y,yi,16);
  37078. }
  37079. function crypto_verify_32(x, xi, y, yi) {
  37080. return vn(x,xi,y,yi,32);
  37081. }
  37082. function core_salsa20(o, p, k, c) {
  37083. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  37084. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  37085. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  37086. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  37087. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  37088. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  37089. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  37090. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  37091. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  37092. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  37093. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  37094. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  37095. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  37096. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  37097. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  37098. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  37099. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  37100. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  37101. x15 = j15, u;
  37102. for (var i = 0; i < 20; i += 2) {
  37103. u = x0 + x12 | 0;
  37104. x4 ^= u<<7 | u>>>(32-7);
  37105. u = x4 + x0 | 0;
  37106. x8 ^= u<<9 | u>>>(32-9);
  37107. u = x8 + x4 | 0;
  37108. x12 ^= u<<13 | u>>>(32-13);
  37109. u = x12 + x8 | 0;
  37110. x0 ^= u<<18 | u>>>(32-18);
  37111. u = x5 + x1 | 0;
  37112. x9 ^= u<<7 | u>>>(32-7);
  37113. u = x9 + x5 | 0;
  37114. x13 ^= u<<9 | u>>>(32-9);
  37115. u = x13 + x9 | 0;
  37116. x1 ^= u<<13 | u>>>(32-13);
  37117. u = x1 + x13 | 0;
  37118. x5 ^= u<<18 | u>>>(32-18);
  37119. u = x10 + x6 | 0;
  37120. x14 ^= u<<7 | u>>>(32-7);
  37121. u = x14 + x10 | 0;
  37122. x2 ^= u<<9 | u>>>(32-9);
  37123. u = x2 + x14 | 0;
  37124. x6 ^= u<<13 | u>>>(32-13);
  37125. u = x6 + x2 | 0;
  37126. x10 ^= u<<18 | u>>>(32-18);
  37127. u = x15 + x11 | 0;
  37128. x3 ^= u<<7 | u>>>(32-7);
  37129. u = x3 + x15 | 0;
  37130. x7 ^= u<<9 | u>>>(32-9);
  37131. u = x7 + x3 | 0;
  37132. x11 ^= u<<13 | u>>>(32-13);
  37133. u = x11 + x7 | 0;
  37134. x15 ^= u<<18 | u>>>(32-18);
  37135. u = x0 + x3 | 0;
  37136. x1 ^= u<<7 | u>>>(32-7);
  37137. u = x1 + x0 | 0;
  37138. x2 ^= u<<9 | u>>>(32-9);
  37139. u = x2 + x1 | 0;
  37140. x3 ^= u<<13 | u>>>(32-13);
  37141. u = x3 + x2 | 0;
  37142. x0 ^= u<<18 | u>>>(32-18);
  37143. u = x5 + x4 | 0;
  37144. x6 ^= u<<7 | u>>>(32-7);
  37145. u = x6 + x5 | 0;
  37146. x7 ^= u<<9 | u>>>(32-9);
  37147. u = x7 + x6 | 0;
  37148. x4 ^= u<<13 | u>>>(32-13);
  37149. u = x4 + x7 | 0;
  37150. x5 ^= u<<18 | u>>>(32-18);
  37151. u = x10 + x9 | 0;
  37152. x11 ^= u<<7 | u>>>(32-7);
  37153. u = x11 + x10 | 0;
  37154. x8 ^= u<<9 | u>>>(32-9);
  37155. u = x8 + x11 | 0;
  37156. x9 ^= u<<13 | u>>>(32-13);
  37157. u = x9 + x8 | 0;
  37158. x10 ^= u<<18 | u>>>(32-18);
  37159. u = x15 + x14 | 0;
  37160. x12 ^= u<<7 | u>>>(32-7);
  37161. u = x12 + x15 | 0;
  37162. x13 ^= u<<9 | u>>>(32-9);
  37163. u = x13 + x12 | 0;
  37164. x14 ^= u<<13 | u>>>(32-13);
  37165. u = x14 + x13 | 0;
  37166. x15 ^= u<<18 | u>>>(32-18);
  37167. }
  37168. x0 = x0 + j0 | 0;
  37169. x1 = x1 + j1 | 0;
  37170. x2 = x2 + j2 | 0;
  37171. x3 = x3 + j3 | 0;
  37172. x4 = x4 + j4 | 0;
  37173. x5 = x5 + j5 | 0;
  37174. x6 = x6 + j6 | 0;
  37175. x7 = x7 + j7 | 0;
  37176. x8 = x8 + j8 | 0;
  37177. x9 = x9 + j9 | 0;
  37178. x10 = x10 + j10 | 0;
  37179. x11 = x11 + j11 | 0;
  37180. x12 = x12 + j12 | 0;
  37181. x13 = x13 + j13 | 0;
  37182. x14 = x14 + j14 | 0;
  37183. x15 = x15 + j15 | 0;
  37184. o[ 0] = x0 >>> 0 & 0xff;
  37185. o[ 1] = x0 >>> 8 & 0xff;
  37186. o[ 2] = x0 >>> 16 & 0xff;
  37187. o[ 3] = x0 >>> 24 & 0xff;
  37188. o[ 4] = x1 >>> 0 & 0xff;
  37189. o[ 5] = x1 >>> 8 & 0xff;
  37190. o[ 6] = x1 >>> 16 & 0xff;
  37191. o[ 7] = x1 >>> 24 & 0xff;
  37192. o[ 8] = x2 >>> 0 & 0xff;
  37193. o[ 9] = x2 >>> 8 & 0xff;
  37194. o[10] = x2 >>> 16 & 0xff;
  37195. o[11] = x2 >>> 24 & 0xff;
  37196. o[12] = x3 >>> 0 & 0xff;
  37197. o[13] = x3 >>> 8 & 0xff;
  37198. o[14] = x3 >>> 16 & 0xff;
  37199. o[15] = x3 >>> 24 & 0xff;
  37200. o[16] = x4 >>> 0 & 0xff;
  37201. o[17] = x4 >>> 8 & 0xff;
  37202. o[18] = x4 >>> 16 & 0xff;
  37203. o[19] = x4 >>> 24 & 0xff;
  37204. o[20] = x5 >>> 0 & 0xff;
  37205. o[21] = x5 >>> 8 & 0xff;
  37206. o[22] = x5 >>> 16 & 0xff;
  37207. o[23] = x5 >>> 24 & 0xff;
  37208. o[24] = x6 >>> 0 & 0xff;
  37209. o[25] = x6 >>> 8 & 0xff;
  37210. o[26] = x6 >>> 16 & 0xff;
  37211. o[27] = x6 >>> 24 & 0xff;
  37212. o[28] = x7 >>> 0 & 0xff;
  37213. o[29] = x7 >>> 8 & 0xff;
  37214. o[30] = x7 >>> 16 & 0xff;
  37215. o[31] = x7 >>> 24 & 0xff;
  37216. o[32] = x8 >>> 0 & 0xff;
  37217. o[33] = x8 >>> 8 & 0xff;
  37218. o[34] = x8 >>> 16 & 0xff;
  37219. o[35] = x8 >>> 24 & 0xff;
  37220. o[36] = x9 >>> 0 & 0xff;
  37221. o[37] = x9 >>> 8 & 0xff;
  37222. o[38] = x9 >>> 16 & 0xff;
  37223. o[39] = x9 >>> 24 & 0xff;
  37224. o[40] = x10 >>> 0 & 0xff;
  37225. o[41] = x10 >>> 8 & 0xff;
  37226. o[42] = x10 >>> 16 & 0xff;
  37227. o[43] = x10 >>> 24 & 0xff;
  37228. o[44] = x11 >>> 0 & 0xff;
  37229. o[45] = x11 >>> 8 & 0xff;
  37230. o[46] = x11 >>> 16 & 0xff;
  37231. o[47] = x11 >>> 24 & 0xff;
  37232. o[48] = x12 >>> 0 & 0xff;
  37233. o[49] = x12 >>> 8 & 0xff;
  37234. o[50] = x12 >>> 16 & 0xff;
  37235. o[51] = x12 >>> 24 & 0xff;
  37236. o[52] = x13 >>> 0 & 0xff;
  37237. o[53] = x13 >>> 8 & 0xff;
  37238. o[54] = x13 >>> 16 & 0xff;
  37239. o[55] = x13 >>> 24 & 0xff;
  37240. o[56] = x14 >>> 0 & 0xff;
  37241. o[57] = x14 >>> 8 & 0xff;
  37242. o[58] = x14 >>> 16 & 0xff;
  37243. o[59] = x14 >>> 24 & 0xff;
  37244. o[60] = x15 >>> 0 & 0xff;
  37245. o[61] = x15 >>> 8 & 0xff;
  37246. o[62] = x15 >>> 16 & 0xff;
  37247. o[63] = x15 >>> 24 & 0xff;
  37248. }
  37249. function core_hsalsa20(o,p,k,c) {
  37250. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  37251. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  37252. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  37253. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  37254. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  37255. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  37256. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  37257. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  37258. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  37259. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  37260. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  37261. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  37262. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  37263. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  37264. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  37265. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  37266. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  37267. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  37268. x15 = j15, u;
  37269. for (var i = 0; i < 20; i += 2) {
  37270. u = x0 + x12 | 0;
  37271. x4 ^= u<<7 | u>>>(32-7);
  37272. u = x4 + x0 | 0;
  37273. x8 ^= u<<9 | u>>>(32-9);
  37274. u = x8 + x4 | 0;
  37275. x12 ^= u<<13 | u>>>(32-13);
  37276. u = x12 + x8 | 0;
  37277. x0 ^= u<<18 | u>>>(32-18);
  37278. u = x5 + x1 | 0;
  37279. x9 ^= u<<7 | u>>>(32-7);
  37280. u = x9 + x5 | 0;
  37281. x13 ^= u<<9 | u>>>(32-9);
  37282. u = x13 + x9 | 0;
  37283. x1 ^= u<<13 | u>>>(32-13);
  37284. u = x1 + x13 | 0;
  37285. x5 ^= u<<18 | u>>>(32-18);
  37286. u = x10 + x6 | 0;
  37287. x14 ^= u<<7 | u>>>(32-7);
  37288. u = x14 + x10 | 0;
  37289. x2 ^= u<<9 | u>>>(32-9);
  37290. u = x2 + x14 | 0;
  37291. x6 ^= u<<13 | u>>>(32-13);
  37292. u = x6 + x2 | 0;
  37293. x10 ^= u<<18 | u>>>(32-18);
  37294. u = x15 + x11 | 0;
  37295. x3 ^= u<<7 | u>>>(32-7);
  37296. u = x3 + x15 | 0;
  37297. x7 ^= u<<9 | u>>>(32-9);
  37298. u = x7 + x3 | 0;
  37299. x11 ^= u<<13 | u>>>(32-13);
  37300. u = x11 + x7 | 0;
  37301. x15 ^= u<<18 | u>>>(32-18);
  37302. u = x0 + x3 | 0;
  37303. x1 ^= u<<7 | u>>>(32-7);
  37304. u = x1 + x0 | 0;
  37305. x2 ^= u<<9 | u>>>(32-9);
  37306. u = x2 + x1 | 0;
  37307. x3 ^= u<<13 | u>>>(32-13);
  37308. u = x3 + x2 | 0;
  37309. x0 ^= u<<18 | u>>>(32-18);
  37310. u = x5 + x4 | 0;
  37311. x6 ^= u<<7 | u>>>(32-7);
  37312. u = x6 + x5 | 0;
  37313. x7 ^= u<<9 | u>>>(32-9);
  37314. u = x7 + x6 | 0;
  37315. x4 ^= u<<13 | u>>>(32-13);
  37316. u = x4 + x7 | 0;
  37317. x5 ^= u<<18 | u>>>(32-18);
  37318. u = x10 + x9 | 0;
  37319. x11 ^= u<<7 | u>>>(32-7);
  37320. u = x11 + x10 | 0;
  37321. x8 ^= u<<9 | u>>>(32-9);
  37322. u = x8 + x11 | 0;
  37323. x9 ^= u<<13 | u>>>(32-13);
  37324. u = x9 + x8 | 0;
  37325. x10 ^= u<<18 | u>>>(32-18);
  37326. u = x15 + x14 | 0;
  37327. x12 ^= u<<7 | u>>>(32-7);
  37328. u = x12 + x15 | 0;
  37329. x13 ^= u<<9 | u>>>(32-9);
  37330. u = x13 + x12 | 0;
  37331. x14 ^= u<<13 | u>>>(32-13);
  37332. u = x14 + x13 | 0;
  37333. x15 ^= u<<18 | u>>>(32-18);
  37334. }
  37335. o[ 0] = x0 >>> 0 & 0xff;
  37336. o[ 1] = x0 >>> 8 & 0xff;
  37337. o[ 2] = x0 >>> 16 & 0xff;
  37338. o[ 3] = x0 >>> 24 & 0xff;
  37339. o[ 4] = x5 >>> 0 & 0xff;
  37340. o[ 5] = x5 >>> 8 & 0xff;
  37341. o[ 6] = x5 >>> 16 & 0xff;
  37342. o[ 7] = x5 >>> 24 & 0xff;
  37343. o[ 8] = x10 >>> 0 & 0xff;
  37344. o[ 9] = x10 >>> 8 & 0xff;
  37345. o[10] = x10 >>> 16 & 0xff;
  37346. o[11] = x10 >>> 24 & 0xff;
  37347. o[12] = x15 >>> 0 & 0xff;
  37348. o[13] = x15 >>> 8 & 0xff;
  37349. o[14] = x15 >>> 16 & 0xff;
  37350. o[15] = x15 >>> 24 & 0xff;
  37351. o[16] = x6 >>> 0 & 0xff;
  37352. o[17] = x6 >>> 8 & 0xff;
  37353. o[18] = x6 >>> 16 & 0xff;
  37354. o[19] = x6 >>> 24 & 0xff;
  37355. o[20] = x7 >>> 0 & 0xff;
  37356. o[21] = x7 >>> 8 & 0xff;
  37357. o[22] = x7 >>> 16 & 0xff;
  37358. o[23] = x7 >>> 24 & 0xff;
  37359. o[24] = x8 >>> 0 & 0xff;
  37360. o[25] = x8 >>> 8 & 0xff;
  37361. o[26] = x8 >>> 16 & 0xff;
  37362. o[27] = x8 >>> 24 & 0xff;
  37363. o[28] = x9 >>> 0 & 0xff;
  37364. o[29] = x9 >>> 8 & 0xff;
  37365. o[30] = x9 >>> 16 & 0xff;
  37366. o[31] = x9 >>> 24 & 0xff;
  37367. }
  37368. function crypto_core_salsa20(out,inp,k,c) {
  37369. core_salsa20(out,inp,k,c);
  37370. }
  37371. function crypto_core_hsalsa20(out,inp,k,c) {
  37372. core_hsalsa20(out,inp,k,c);
  37373. }
  37374. var sigma = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]);
  37375. // "expand 32-byte k"
  37376. function crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k) {
  37377. var z = new Uint8Array(16), x = new Uint8Array(64);
  37378. var u, i;
  37379. for (i = 0; i < 16; i++) z[i] = 0;
  37380. for (i = 0; i < 8; i++) z[i] = n[i];
  37381. while (b >= 64) {
  37382. crypto_core_salsa20(x,z,k,sigma);
  37383. for (i = 0; i < 64; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  37384. u = 1;
  37385. for (i = 8; i < 16; i++) {
  37386. u = u + (z[i] & 0xff) | 0;
  37387. z[i] = u & 0xff;
  37388. u >>>= 8;
  37389. }
  37390. b -= 64;
  37391. cpos += 64;
  37392. mpos += 64;
  37393. }
  37394. if (b > 0) {
  37395. crypto_core_salsa20(x,z,k,sigma);
  37396. for (i = 0; i < b; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  37397. }
  37398. return 0;
  37399. }
  37400. function crypto_stream_salsa20(c,cpos,b,n,k) {
  37401. var z = new Uint8Array(16), x = new Uint8Array(64);
  37402. var u, i;
  37403. for (i = 0; i < 16; i++) z[i] = 0;
  37404. for (i = 0; i < 8; i++) z[i] = n[i];
  37405. while (b >= 64) {
  37406. crypto_core_salsa20(x,z,k,sigma);
  37407. for (i = 0; i < 64; i++) c[cpos+i] = x[i];
  37408. u = 1;
  37409. for (i = 8; i < 16; i++) {
  37410. u = u + (z[i] & 0xff) | 0;
  37411. z[i] = u & 0xff;
  37412. u >>>= 8;
  37413. }
  37414. b -= 64;
  37415. cpos += 64;
  37416. }
  37417. if (b > 0) {
  37418. crypto_core_salsa20(x,z,k,sigma);
  37419. for (i = 0; i < b; i++) c[cpos+i] = x[i];
  37420. }
  37421. return 0;
  37422. }
  37423. function crypto_stream(c,cpos,d,n,k) {
  37424. var s = new Uint8Array(32);
  37425. crypto_core_hsalsa20(s,n,k,sigma);
  37426. var sn = new Uint8Array(8);
  37427. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  37428. return crypto_stream_salsa20(c,cpos,d,sn,s);
  37429. }
  37430. function crypto_stream_xor(c,cpos,m,mpos,d,n,k) {
  37431. var s = new Uint8Array(32);
  37432. crypto_core_hsalsa20(s,n,k,sigma);
  37433. var sn = new Uint8Array(8);
  37434. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  37435. return crypto_stream_salsa20_xor(c,cpos,m,mpos,d,sn,s);
  37436. }
  37437. /*
  37438. * Port of Andrew Moon's Poly1305-donna-16. Public domain.
  37439. * https://github.com/floodyberry/poly1305-donna
  37440. */
  37441. var poly1305 = function(key) {
  37442. this.buffer = new Uint8Array(16);
  37443. this.r = new Uint16Array(10);
  37444. this.h = new Uint16Array(10);
  37445. this.pad = new Uint16Array(8);
  37446. this.leftover = 0;
  37447. this.fin = 0;
  37448. var t0, t1, t2, t3, t4, t5, t6, t7;
  37449. t0 = key[ 0] & 0xff | (key[ 1] & 0xff) << 8; this.r[0] = ( t0 ) & 0x1fff;
  37450. t1 = key[ 2] & 0xff | (key[ 3] & 0xff) << 8; this.r[1] = ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  37451. t2 = key[ 4] & 0xff | (key[ 5] & 0xff) << 8; this.r[2] = ((t1 >>> 10) | (t2 << 6)) & 0x1f03;
  37452. t3 = key[ 6] & 0xff | (key[ 7] & 0xff) << 8; this.r[3] = ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  37453. t4 = key[ 8] & 0xff | (key[ 9] & 0xff) << 8; this.r[4] = ((t3 >>> 4) | (t4 << 12)) & 0x00ff;
  37454. this.r[5] = ((t4 >>> 1)) & 0x1ffe;
  37455. t5 = key[10] & 0xff | (key[11] & 0xff) << 8; this.r[6] = ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  37456. t6 = key[12] & 0xff | (key[13] & 0xff) << 8; this.r[7] = ((t5 >>> 11) | (t6 << 5)) & 0x1f81;
  37457. t7 = key[14] & 0xff | (key[15] & 0xff) << 8; this.r[8] = ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  37458. this.r[9] = ((t7 >>> 5)) & 0x007f;
  37459. this.pad[0] = key[16] & 0xff | (key[17] & 0xff) << 8;
  37460. this.pad[1] = key[18] & 0xff | (key[19] & 0xff) << 8;
  37461. this.pad[2] = key[20] & 0xff | (key[21] & 0xff) << 8;
  37462. this.pad[3] = key[22] & 0xff | (key[23] & 0xff) << 8;
  37463. this.pad[4] = key[24] & 0xff | (key[25] & 0xff) << 8;
  37464. this.pad[5] = key[26] & 0xff | (key[27] & 0xff) << 8;
  37465. this.pad[6] = key[28] & 0xff | (key[29] & 0xff) << 8;
  37466. this.pad[7] = key[30] & 0xff | (key[31] & 0xff) << 8;
  37467. };
  37468. poly1305.prototype.blocks = function(m, mpos, bytes) {
  37469. var hibit = this.fin ? 0 : (1 << 11);
  37470. var t0, t1, t2, t3, t4, t5, t6, t7, c;
  37471. var d0, d1, d2, d3, d4, d5, d6, d7, d8, d9;
  37472. var h0 = this.h[0],
  37473. h1 = this.h[1],
  37474. h2 = this.h[2],
  37475. h3 = this.h[3],
  37476. h4 = this.h[4],
  37477. h5 = this.h[5],
  37478. h6 = this.h[6],
  37479. h7 = this.h[7],
  37480. h8 = this.h[8],
  37481. h9 = this.h[9];
  37482. var r0 = this.r[0],
  37483. r1 = this.r[1],
  37484. r2 = this.r[2],
  37485. r3 = this.r[3],
  37486. r4 = this.r[4],
  37487. r5 = this.r[5],
  37488. r6 = this.r[6],
  37489. r7 = this.r[7],
  37490. r8 = this.r[8],
  37491. r9 = this.r[9];
  37492. while (bytes >= 16) {
  37493. t0 = m[mpos+ 0] & 0xff | (m[mpos+ 1] & 0xff) << 8; h0 += ( t0 ) & 0x1fff;
  37494. t1 = m[mpos+ 2] & 0xff | (m[mpos+ 3] & 0xff) << 8; h1 += ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  37495. t2 = m[mpos+ 4] & 0xff | (m[mpos+ 5] & 0xff) << 8; h2 += ((t1 >>> 10) | (t2 << 6)) & 0x1fff;
  37496. t3 = m[mpos+ 6] & 0xff | (m[mpos+ 7] & 0xff) << 8; h3 += ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  37497. t4 = m[mpos+ 8] & 0xff | (m[mpos+ 9] & 0xff) << 8; h4 += ((t3 >>> 4) | (t4 << 12)) & 0x1fff;
  37498. h5 += ((t4 >>> 1)) & 0x1fff;
  37499. t5 = m[mpos+10] & 0xff | (m[mpos+11] & 0xff) << 8; h6 += ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  37500. t6 = m[mpos+12] & 0xff | (m[mpos+13] & 0xff) << 8; h7 += ((t5 >>> 11) | (t6 << 5)) & 0x1fff;
  37501. t7 = m[mpos+14] & 0xff | (m[mpos+15] & 0xff) << 8; h8 += ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  37502. h9 += ((t7 >>> 5)) | hibit;
  37503. c = 0;
  37504. d0 = c;
  37505. d0 += h0 * r0;
  37506. d0 += h1 * (5 * r9);
  37507. d0 += h2 * (5 * r8);
  37508. d0 += h3 * (5 * r7);
  37509. d0 += h4 * (5 * r6);
  37510. c = (d0 >>> 13); d0 &= 0x1fff;
  37511. d0 += h5 * (5 * r5);
  37512. d0 += h6 * (5 * r4);
  37513. d0 += h7 * (5 * r3);
  37514. d0 += h8 * (5 * r2);
  37515. d0 += h9 * (5 * r1);
  37516. c += (d0 >>> 13); d0 &= 0x1fff;
  37517. d1 = c;
  37518. d1 += h0 * r1;
  37519. d1 += h1 * r0;
  37520. d1 += h2 * (5 * r9);
  37521. d1 += h3 * (5 * r8);
  37522. d1 += h4 * (5 * r7);
  37523. c = (d1 >>> 13); d1 &= 0x1fff;
  37524. d1 += h5 * (5 * r6);
  37525. d1 += h6 * (5 * r5);
  37526. d1 += h7 * (5 * r4);
  37527. d1 += h8 * (5 * r3);
  37528. d1 += h9 * (5 * r2);
  37529. c += (d1 >>> 13); d1 &= 0x1fff;
  37530. d2 = c;
  37531. d2 += h0 * r2;
  37532. d2 += h1 * r1;
  37533. d2 += h2 * r0;
  37534. d2 += h3 * (5 * r9);
  37535. d2 += h4 * (5 * r8);
  37536. c = (d2 >>> 13); d2 &= 0x1fff;
  37537. d2 += h5 * (5 * r7);
  37538. d2 += h6 * (5 * r6);
  37539. d2 += h7 * (5 * r5);
  37540. d2 += h8 * (5 * r4);
  37541. d2 += h9 * (5 * r3);
  37542. c += (d2 >>> 13); d2 &= 0x1fff;
  37543. d3 = c;
  37544. d3 += h0 * r3;
  37545. d3 += h1 * r2;
  37546. d3 += h2 * r1;
  37547. d3 += h3 * r0;
  37548. d3 += h4 * (5 * r9);
  37549. c = (d3 >>> 13); d3 &= 0x1fff;
  37550. d3 += h5 * (5 * r8);
  37551. d3 += h6 * (5 * r7);
  37552. d3 += h7 * (5 * r6);
  37553. d3 += h8 * (5 * r5);
  37554. d3 += h9 * (5 * r4);
  37555. c += (d3 >>> 13); d3 &= 0x1fff;
  37556. d4 = c;
  37557. d4 += h0 * r4;
  37558. d4 += h1 * r3;
  37559. d4 += h2 * r2;
  37560. d4 += h3 * r1;
  37561. d4 += h4 * r0;
  37562. c = (d4 >>> 13); d4 &= 0x1fff;
  37563. d4 += h5 * (5 * r9);
  37564. d4 += h6 * (5 * r8);
  37565. d4 += h7 * (5 * r7);
  37566. d4 += h8 * (5 * r6);
  37567. d4 += h9 * (5 * r5);
  37568. c += (d4 >>> 13); d4 &= 0x1fff;
  37569. d5 = c;
  37570. d5 += h0 * r5;
  37571. d5 += h1 * r4;
  37572. d5 += h2 * r3;
  37573. d5 += h3 * r2;
  37574. d5 += h4 * r1;
  37575. c = (d5 >>> 13); d5 &= 0x1fff;
  37576. d5 += h5 * r0;
  37577. d5 += h6 * (5 * r9);
  37578. d5 += h7 * (5 * r8);
  37579. d5 += h8 * (5 * r7);
  37580. d5 += h9 * (5 * r6);
  37581. c += (d5 >>> 13); d5 &= 0x1fff;
  37582. d6 = c;
  37583. d6 += h0 * r6;
  37584. d6 += h1 * r5;
  37585. d6 += h2 * r4;
  37586. d6 += h3 * r3;
  37587. d6 += h4 * r2;
  37588. c = (d6 >>> 13); d6 &= 0x1fff;
  37589. d6 += h5 * r1;
  37590. d6 += h6 * r0;
  37591. d6 += h7 * (5 * r9);
  37592. d6 += h8 * (5 * r8);
  37593. d6 += h9 * (5 * r7);
  37594. c += (d6 >>> 13); d6 &= 0x1fff;
  37595. d7 = c;
  37596. d7 += h0 * r7;
  37597. d7 += h1 * r6;
  37598. d7 += h2 * r5;
  37599. d7 += h3 * r4;
  37600. d7 += h4 * r3;
  37601. c = (d7 >>> 13); d7 &= 0x1fff;
  37602. d7 += h5 * r2;
  37603. d7 += h6 * r1;
  37604. d7 += h7 * r0;
  37605. d7 += h8 * (5 * r9);
  37606. d7 += h9 * (5 * r8);
  37607. c += (d7 >>> 13); d7 &= 0x1fff;
  37608. d8 = c;
  37609. d8 += h0 * r8;
  37610. d8 += h1 * r7;
  37611. d8 += h2 * r6;
  37612. d8 += h3 * r5;
  37613. d8 += h4 * r4;
  37614. c = (d8 >>> 13); d8 &= 0x1fff;
  37615. d8 += h5 * r3;
  37616. d8 += h6 * r2;
  37617. d8 += h7 * r1;
  37618. d8 += h8 * r0;
  37619. d8 += h9 * (5 * r9);
  37620. c += (d8 >>> 13); d8 &= 0x1fff;
  37621. d9 = c;
  37622. d9 += h0 * r9;
  37623. d9 += h1 * r8;
  37624. d9 += h2 * r7;
  37625. d9 += h3 * r6;
  37626. d9 += h4 * r5;
  37627. c = (d9 >>> 13); d9 &= 0x1fff;
  37628. d9 += h5 * r4;
  37629. d9 += h6 * r3;
  37630. d9 += h7 * r2;
  37631. d9 += h8 * r1;
  37632. d9 += h9 * r0;
  37633. c += (d9 >>> 13); d9 &= 0x1fff;
  37634. c = (((c << 2) + c)) | 0;
  37635. c = (c + d0) | 0;
  37636. d0 = c & 0x1fff;
  37637. c = (c >>> 13);
  37638. d1 += c;
  37639. h0 = d0;
  37640. h1 = d1;
  37641. h2 = d2;
  37642. h3 = d3;
  37643. h4 = d4;
  37644. h5 = d5;
  37645. h6 = d6;
  37646. h7 = d7;
  37647. h8 = d8;
  37648. h9 = d9;
  37649. mpos += 16;
  37650. bytes -= 16;
  37651. }
  37652. this.h[0] = h0;
  37653. this.h[1] = h1;
  37654. this.h[2] = h2;
  37655. this.h[3] = h3;
  37656. this.h[4] = h4;
  37657. this.h[5] = h5;
  37658. this.h[6] = h6;
  37659. this.h[7] = h7;
  37660. this.h[8] = h8;
  37661. this.h[9] = h9;
  37662. };
  37663. poly1305.prototype.finish = function(mac, macpos) {
  37664. var g = new Uint16Array(10);
  37665. var c, mask, f, i;
  37666. if (this.leftover) {
  37667. i = this.leftover;
  37668. this.buffer[i++] = 1;
  37669. for (; i < 16; i++) this.buffer[i] = 0;
  37670. this.fin = 1;
  37671. this.blocks(this.buffer, 0, 16);
  37672. }
  37673. c = this.h[1] >>> 13;
  37674. this.h[1] &= 0x1fff;
  37675. for (i = 2; i < 10; i++) {
  37676. this.h[i] += c;
  37677. c = this.h[i] >>> 13;
  37678. this.h[i] &= 0x1fff;
  37679. }
  37680. this.h[0] += (c * 5);
  37681. c = this.h[0] >>> 13;
  37682. this.h[0] &= 0x1fff;
  37683. this.h[1] += c;
  37684. c = this.h[1] >>> 13;
  37685. this.h[1] &= 0x1fff;
  37686. this.h[2] += c;
  37687. g[0] = this.h[0] + 5;
  37688. c = g[0] >>> 13;
  37689. g[0] &= 0x1fff;
  37690. for (i = 1; i < 10; i++) {
  37691. g[i] = this.h[i] + c;
  37692. c = g[i] >>> 13;
  37693. g[i] &= 0x1fff;
  37694. }
  37695. g[9] -= (1 << 13);
  37696. mask = (c ^ 1) - 1;
  37697. for (i = 0; i < 10; i++) g[i] &= mask;
  37698. mask = ~mask;
  37699. for (i = 0; i < 10; i++) this.h[i] = (this.h[i] & mask) | g[i];
  37700. this.h[0] = ((this.h[0] ) | (this.h[1] << 13) ) & 0xffff;
  37701. this.h[1] = ((this.h[1] >>> 3) | (this.h[2] << 10) ) & 0xffff;
  37702. this.h[2] = ((this.h[2] >>> 6) | (this.h[3] << 7) ) & 0xffff;
  37703. this.h[3] = ((this.h[3] >>> 9) | (this.h[4] << 4) ) & 0xffff;
  37704. this.h[4] = ((this.h[4] >>> 12) | (this.h[5] << 1) | (this.h[6] << 14)) & 0xffff;
  37705. this.h[5] = ((this.h[6] >>> 2) | (this.h[7] << 11) ) & 0xffff;
  37706. this.h[6] = ((this.h[7] >>> 5) | (this.h[8] << 8) ) & 0xffff;
  37707. this.h[7] = ((this.h[8] >>> 8) | (this.h[9] << 5) ) & 0xffff;
  37708. f = this.h[0] + this.pad[0];
  37709. this.h[0] = f & 0xffff;
  37710. for (i = 1; i < 8; i++) {
  37711. f = (((this.h[i] + this.pad[i]) | 0) + (f >>> 16)) | 0;
  37712. this.h[i] = f & 0xffff;
  37713. }
  37714. mac[macpos+ 0] = (this.h[0] >>> 0) & 0xff;
  37715. mac[macpos+ 1] = (this.h[0] >>> 8) & 0xff;
  37716. mac[macpos+ 2] = (this.h[1] >>> 0) & 0xff;
  37717. mac[macpos+ 3] = (this.h[1] >>> 8) & 0xff;
  37718. mac[macpos+ 4] = (this.h[2] >>> 0) & 0xff;
  37719. mac[macpos+ 5] = (this.h[2] >>> 8) & 0xff;
  37720. mac[macpos+ 6] = (this.h[3] >>> 0) & 0xff;
  37721. mac[macpos+ 7] = (this.h[3] >>> 8) & 0xff;
  37722. mac[macpos+ 8] = (this.h[4] >>> 0) & 0xff;
  37723. mac[macpos+ 9] = (this.h[4] >>> 8) & 0xff;
  37724. mac[macpos+10] = (this.h[5] >>> 0) & 0xff;
  37725. mac[macpos+11] = (this.h[5] >>> 8) & 0xff;
  37726. mac[macpos+12] = (this.h[6] >>> 0) & 0xff;
  37727. mac[macpos+13] = (this.h[6] >>> 8) & 0xff;
  37728. mac[macpos+14] = (this.h[7] >>> 0) & 0xff;
  37729. mac[macpos+15] = (this.h[7] >>> 8) & 0xff;
  37730. };
  37731. poly1305.prototype.update = function(m, mpos, bytes) {
  37732. var i, want;
  37733. if (this.leftover) {
  37734. want = (16 - this.leftover);
  37735. if (want > bytes)
  37736. want = bytes;
  37737. for (i = 0; i < want; i++)
  37738. this.buffer[this.leftover + i] = m[mpos+i];
  37739. bytes -= want;
  37740. mpos += want;
  37741. this.leftover += want;
  37742. if (this.leftover < 16)
  37743. return;
  37744. this.blocks(this.buffer, 0, 16);
  37745. this.leftover = 0;
  37746. }
  37747. if (bytes >= 16) {
  37748. want = bytes - (bytes % 16);
  37749. this.blocks(m, mpos, want);
  37750. mpos += want;
  37751. bytes -= want;
  37752. }
  37753. if (bytes) {
  37754. for (i = 0; i < bytes; i++)
  37755. this.buffer[this.leftover + i] = m[mpos+i];
  37756. this.leftover += bytes;
  37757. }
  37758. };
  37759. function crypto_onetimeauth(out, outpos, m, mpos, n, k) {
  37760. var s = new poly1305(k);
  37761. s.update(m, mpos, n);
  37762. s.finish(out, outpos);
  37763. return 0;
  37764. }
  37765. function crypto_onetimeauth_verify(h, hpos, m, mpos, n, k) {
  37766. var x = new Uint8Array(16);
  37767. crypto_onetimeauth(x,0,m,mpos,n,k);
  37768. return crypto_verify_16(h,hpos,x,0);
  37769. }
  37770. function crypto_secretbox(c,m,d,n,k) {
  37771. var i;
  37772. if (d < 32) return -1;
  37773. crypto_stream_xor(c,0,m,0,d,n,k);
  37774. crypto_onetimeauth(c, 16, c, 32, d - 32, c);
  37775. for (i = 0; i < 16; i++) c[i] = 0;
  37776. return 0;
  37777. }
  37778. function crypto_secretbox_open(m,c,d,n,k) {
  37779. var i;
  37780. var x = new Uint8Array(32);
  37781. if (d < 32) return -1;
  37782. crypto_stream(x,0,32,n,k);
  37783. if (crypto_onetimeauth_verify(c, 16,c, 32,d - 32,x) !== 0) return -1;
  37784. crypto_stream_xor(m,0,c,0,d,n,k);
  37785. for (i = 0; i < 32; i++) m[i] = 0;
  37786. return 0;
  37787. }
  37788. function set25519(r, a) {
  37789. var i;
  37790. for (i = 0; i < 16; i++) r[i] = a[i]|0;
  37791. }
  37792. function car25519(o) {
  37793. var i, v, c = 1;
  37794. for (i = 0; i < 16; i++) {
  37795. v = o[i] + c + 65535;
  37796. c = Math.floor(v / 65536);
  37797. o[i] = v - c * 65536;
  37798. }
  37799. o[0] += c-1 + 37 * (c-1);
  37800. }
  37801. function sel25519(p, q, b) {
  37802. var t, c = ~(b-1);
  37803. for (var i = 0; i < 16; i++) {
  37804. t = c & (p[i] ^ q[i]);
  37805. p[i] ^= t;
  37806. q[i] ^= t;
  37807. }
  37808. }
  37809. function pack25519(o, n) {
  37810. var i, j, b;
  37811. var m = gf(), t = gf();
  37812. for (i = 0; i < 16; i++) t[i] = n[i];
  37813. car25519(t);
  37814. car25519(t);
  37815. car25519(t);
  37816. for (j = 0; j < 2; j++) {
  37817. m[0] = t[0] - 0xffed;
  37818. for (i = 1; i < 15; i++) {
  37819. m[i] = t[i] - 0xffff - ((m[i-1]>>16) & 1);
  37820. m[i-1] &= 0xffff;
  37821. }
  37822. m[15] = t[15] - 0x7fff - ((m[14]>>16) & 1);
  37823. b = (m[15]>>16) & 1;
  37824. m[14] &= 0xffff;
  37825. sel25519(t, m, 1-b);
  37826. }
  37827. for (i = 0; i < 16; i++) {
  37828. o[2*i] = t[i] & 0xff;
  37829. o[2*i+1] = t[i]>>8;
  37830. }
  37831. }
  37832. function neq25519(a, b) {
  37833. var c = new Uint8Array(32), d = new Uint8Array(32);
  37834. pack25519(c, a);
  37835. pack25519(d, b);
  37836. return crypto_verify_32(c, 0, d, 0);
  37837. }
  37838. function par25519(a) {
  37839. var d = new Uint8Array(32);
  37840. pack25519(d, a);
  37841. return d[0] & 1;
  37842. }
  37843. function unpack25519(o, n) {
  37844. var i;
  37845. for (i = 0; i < 16; i++) o[i] = n[2*i] + (n[2*i+1] << 8);
  37846. o[15] &= 0x7fff;
  37847. }
  37848. function A(o, a, b) {
  37849. for (var i = 0; i < 16; i++) o[i] = a[i] + b[i];
  37850. }
  37851. function Z(o, a, b) {
  37852. for (var i = 0; i < 16; i++) o[i] = a[i] - b[i];
  37853. }
  37854. function M(o, a, b) {
  37855. var v, c,
  37856. t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0,
  37857. t8 = 0, t9 = 0, t10 = 0, t11 = 0, t12 = 0, t13 = 0, t14 = 0, t15 = 0,
  37858. t16 = 0, t17 = 0, t18 = 0, t19 = 0, t20 = 0, t21 = 0, t22 = 0, t23 = 0,
  37859. t24 = 0, t25 = 0, t26 = 0, t27 = 0, t28 = 0, t29 = 0, t30 = 0,
  37860. b0 = b[0],
  37861. b1 = b[1],
  37862. b2 = b[2],
  37863. b3 = b[3],
  37864. b4 = b[4],
  37865. b5 = b[5],
  37866. b6 = b[6],
  37867. b7 = b[7],
  37868. b8 = b[8],
  37869. b9 = b[9],
  37870. b10 = b[10],
  37871. b11 = b[11],
  37872. b12 = b[12],
  37873. b13 = b[13],
  37874. b14 = b[14],
  37875. b15 = b[15];
  37876. v = a[0];
  37877. t0 += v * b0;
  37878. t1 += v * b1;
  37879. t2 += v * b2;
  37880. t3 += v * b3;
  37881. t4 += v * b4;
  37882. t5 += v * b5;
  37883. t6 += v * b6;
  37884. t7 += v * b7;
  37885. t8 += v * b8;
  37886. t9 += v * b9;
  37887. t10 += v * b10;
  37888. t11 += v * b11;
  37889. t12 += v * b12;
  37890. t13 += v * b13;
  37891. t14 += v * b14;
  37892. t15 += v * b15;
  37893. v = a[1];
  37894. t1 += v * b0;
  37895. t2 += v * b1;
  37896. t3 += v * b2;
  37897. t4 += v * b3;
  37898. t5 += v * b4;
  37899. t6 += v * b5;
  37900. t7 += v * b6;
  37901. t8 += v * b7;
  37902. t9 += v * b8;
  37903. t10 += v * b9;
  37904. t11 += v * b10;
  37905. t12 += v * b11;
  37906. t13 += v * b12;
  37907. t14 += v * b13;
  37908. t15 += v * b14;
  37909. t16 += v * b15;
  37910. v = a[2];
  37911. t2 += v * b0;
  37912. t3 += v * b1;
  37913. t4 += v * b2;
  37914. t5 += v * b3;
  37915. t6 += v * b4;
  37916. t7 += v * b5;
  37917. t8 += v * b6;
  37918. t9 += v * b7;
  37919. t10 += v * b8;
  37920. t11 += v * b9;
  37921. t12 += v * b10;
  37922. t13 += v * b11;
  37923. t14 += v * b12;
  37924. t15 += v * b13;
  37925. t16 += v * b14;
  37926. t17 += v * b15;
  37927. v = a[3];
  37928. t3 += v * b0;
  37929. t4 += v * b1;
  37930. t5 += v * b2;
  37931. t6 += v * b3;
  37932. t7 += v * b4;
  37933. t8 += v * b5;
  37934. t9 += v * b6;
  37935. t10 += v * b7;
  37936. t11 += v * b8;
  37937. t12 += v * b9;
  37938. t13 += v * b10;
  37939. t14 += v * b11;
  37940. t15 += v * b12;
  37941. t16 += v * b13;
  37942. t17 += v * b14;
  37943. t18 += v * b15;
  37944. v = a[4];
  37945. t4 += v * b0;
  37946. t5 += v * b1;
  37947. t6 += v * b2;
  37948. t7 += v * b3;
  37949. t8 += v * b4;
  37950. t9 += v * b5;
  37951. t10 += v * b6;
  37952. t11 += v * b7;
  37953. t12 += v * b8;
  37954. t13 += v * b9;
  37955. t14 += v * b10;
  37956. t15 += v * b11;
  37957. t16 += v * b12;
  37958. t17 += v * b13;
  37959. t18 += v * b14;
  37960. t19 += v * b15;
  37961. v = a[5];
  37962. t5 += v * b0;
  37963. t6 += v * b1;
  37964. t7 += v * b2;
  37965. t8 += v * b3;
  37966. t9 += v * b4;
  37967. t10 += v * b5;
  37968. t11 += v * b6;
  37969. t12 += v * b7;
  37970. t13 += v * b8;
  37971. t14 += v * b9;
  37972. t15 += v * b10;
  37973. t16 += v * b11;
  37974. t17 += v * b12;
  37975. t18 += v * b13;
  37976. t19 += v * b14;
  37977. t20 += v * b15;
  37978. v = a[6];
  37979. t6 += v * b0;
  37980. t7 += v * b1;
  37981. t8 += v * b2;
  37982. t9 += v * b3;
  37983. t10 += v * b4;
  37984. t11 += v * b5;
  37985. t12 += v * b6;
  37986. t13 += v * b7;
  37987. t14 += v * b8;
  37988. t15 += v * b9;
  37989. t16 += v * b10;
  37990. t17 += v * b11;
  37991. t18 += v * b12;
  37992. t19 += v * b13;
  37993. t20 += v * b14;
  37994. t21 += v * b15;
  37995. v = a[7];
  37996. t7 += v * b0;
  37997. t8 += v * b1;
  37998. t9 += v * b2;
  37999. t10 += v * b3;
  38000. t11 += v * b4;
  38001. t12 += v * b5;
  38002. t13 += v * b6;
  38003. t14 += v * b7;
  38004. t15 += v * b8;
  38005. t16 += v * b9;
  38006. t17 += v * b10;
  38007. t18 += v * b11;
  38008. t19 += v * b12;
  38009. t20 += v * b13;
  38010. t21 += v * b14;
  38011. t22 += v * b15;
  38012. v = a[8];
  38013. t8 += v * b0;
  38014. t9 += v * b1;
  38015. t10 += v * b2;
  38016. t11 += v * b3;
  38017. t12 += v * b4;
  38018. t13 += v * b5;
  38019. t14 += v * b6;
  38020. t15 += v * b7;
  38021. t16 += v * b8;
  38022. t17 += v * b9;
  38023. t18 += v * b10;
  38024. t19 += v * b11;
  38025. t20 += v * b12;
  38026. t21 += v * b13;
  38027. t22 += v * b14;
  38028. t23 += v * b15;
  38029. v = a[9];
  38030. t9 += v * b0;
  38031. t10 += v * b1;
  38032. t11 += v * b2;
  38033. t12 += v * b3;
  38034. t13 += v * b4;
  38035. t14 += v * b5;
  38036. t15 += v * b6;
  38037. t16 += v * b7;
  38038. t17 += v * b8;
  38039. t18 += v * b9;
  38040. t19 += v * b10;
  38041. t20 += v * b11;
  38042. t21 += v * b12;
  38043. t22 += v * b13;
  38044. t23 += v * b14;
  38045. t24 += v * b15;
  38046. v = a[10];
  38047. t10 += v * b0;
  38048. t11 += v * b1;
  38049. t12 += v * b2;
  38050. t13 += v * b3;
  38051. t14 += v * b4;
  38052. t15 += v * b5;
  38053. t16 += v * b6;
  38054. t17 += v * b7;
  38055. t18 += v * b8;
  38056. t19 += v * b9;
  38057. t20 += v * b10;
  38058. t21 += v * b11;
  38059. t22 += v * b12;
  38060. t23 += v * b13;
  38061. t24 += v * b14;
  38062. t25 += v * b15;
  38063. v = a[11];
  38064. t11 += v * b0;
  38065. t12 += v * b1;
  38066. t13 += v * b2;
  38067. t14 += v * b3;
  38068. t15 += v * b4;
  38069. t16 += v * b5;
  38070. t17 += v * b6;
  38071. t18 += v * b7;
  38072. t19 += v * b8;
  38073. t20 += v * b9;
  38074. t21 += v * b10;
  38075. t22 += v * b11;
  38076. t23 += v * b12;
  38077. t24 += v * b13;
  38078. t25 += v * b14;
  38079. t26 += v * b15;
  38080. v = a[12];
  38081. t12 += v * b0;
  38082. t13 += v * b1;
  38083. t14 += v * b2;
  38084. t15 += v * b3;
  38085. t16 += v * b4;
  38086. t17 += v * b5;
  38087. t18 += v * b6;
  38088. t19 += v * b7;
  38089. t20 += v * b8;
  38090. t21 += v * b9;
  38091. t22 += v * b10;
  38092. t23 += v * b11;
  38093. t24 += v * b12;
  38094. t25 += v * b13;
  38095. t26 += v * b14;
  38096. t27 += v * b15;
  38097. v = a[13];
  38098. t13 += v * b0;
  38099. t14 += v * b1;
  38100. t15 += v * b2;
  38101. t16 += v * b3;
  38102. t17 += v * b4;
  38103. t18 += v * b5;
  38104. t19 += v * b6;
  38105. t20 += v * b7;
  38106. t21 += v * b8;
  38107. t22 += v * b9;
  38108. t23 += v * b10;
  38109. t24 += v * b11;
  38110. t25 += v * b12;
  38111. t26 += v * b13;
  38112. t27 += v * b14;
  38113. t28 += v * b15;
  38114. v = a[14];
  38115. t14 += v * b0;
  38116. t15 += v * b1;
  38117. t16 += v * b2;
  38118. t17 += v * b3;
  38119. t18 += v * b4;
  38120. t19 += v * b5;
  38121. t20 += v * b6;
  38122. t21 += v * b7;
  38123. t22 += v * b8;
  38124. t23 += v * b9;
  38125. t24 += v * b10;
  38126. t25 += v * b11;
  38127. t26 += v * b12;
  38128. t27 += v * b13;
  38129. t28 += v * b14;
  38130. t29 += v * b15;
  38131. v = a[15];
  38132. t15 += v * b0;
  38133. t16 += v * b1;
  38134. t17 += v * b2;
  38135. t18 += v * b3;
  38136. t19 += v * b4;
  38137. t20 += v * b5;
  38138. t21 += v * b6;
  38139. t22 += v * b7;
  38140. t23 += v * b8;
  38141. t24 += v * b9;
  38142. t25 += v * b10;
  38143. t26 += v * b11;
  38144. t27 += v * b12;
  38145. t28 += v * b13;
  38146. t29 += v * b14;
  38147. t30 += v * b15;
  38148. t0 += 38 * t16;
  38149. t1 += 38 * t17;
  38150. t2 += 38 * t18;
  38151. t3 += 38 * t19;
  38152. t4 += 38 * t20;
  38153. t5 += 38 * t21;
  38154. t6 += 38 * t22;
  38155. t7 += 38 * t23;
  38156. t8 += 38 * t24;
  38157. t9 += 38 * t25;
  38158. t10 += 38 * t26;
  38159. t11 += 38 * t27;
  38160. t12 += 38 * t28;
  38161. t13 += 38 * t29;
  38162. t14 += 38 * t30;
  38163. // t15 left as is
  38164. // first car
  38165. c = 1;
  38166. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  38167. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  38168. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  38169. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  38170. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  38171. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  38172. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  38173. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  38174. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  38175. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  38176. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  38177. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  38178. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  38179. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  38180. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  38181. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  38182. t0 += c-1 + 37 * (c-1);
  38183. // second car
  38184. c = 1;
  38185. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  38186. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  38187. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  38188. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  38189. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  38190. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  38191. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  38192. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  38193. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  38194. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  38195. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  38196. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  38197. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  38198. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  38199. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  38200. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  38201. t0 += c-1 + 37 * (c-1);
  38202. o[ 0] = t0;
  38203. o[ 1] = t1;
  38204. o[ 2] = t2;
  38205. o[ 3] = t3;
  38206. o[ 4] = t4;
  38207. o[ 5] = t5;
  38208. o[ 6] = t6;
  38209. o[ 7] = t7;
  38210. o[ 8] = t8;
  38211. o[ 9] = t9;
  38212. o[10] = t10;
  38213. o[11] = t11;
  38214. o[12] = t12;
  38215. o[13] = t13;
  38216. o[14] = t14;
  38217. o[15] = t15;
  38218. }
  38219. function S(o, a) {
  38220. M(o, a, a);
  38221. }
  38222. function inv25519(o, i) {
  38223. var c = gf();
  38224. var a;
  38225. for (a = 0; a < 16; a++) c[a] = i[a];
  38226. for (a = 253; a >= 0; a--) {
  38227. S(c, c);
  38228. if(a !== 2 && a !== 4) M(c, c, i);
  38229. }
  38230. for (a = 0; a < 16; a++) o[a] = c[a];
  38231. }
  38232. function pow2523(o, i) {
  38233. var c = gf();
  38234. var a;
  38235. for (a = 0; a < 16; a++) c[a] = i[a];
  38236. for (a = 250; a >= 0; a--) {
  38237. S(c, c);
  38238. if(a !== 1) M(c, c, i);
  38239. }
  38240. for (a = 0; a < 16; a++) o[a] = c[a];
  38241. }
  38242. function crypto_scalarmult(q, n, p) {
  38243. var z = new Uint8Array(32);
  38244. var x = new Float64Array(80), r, i;
  38245. var a = gf(), b = gf(), c = gf(),
  38246. d = gf(), e = gf(), f = gf();
  38247. for (i = 0; i < 31; i++) z[i] = n[i];
  38248. z[31]=(n[31]&127)|64;
  38249. z[0]&=248;
  38250. unpack25519(x,p);
  38251. for (i = 0; i < 16; i++) {
  38252. b[i]=x[i];
  38253. d[i]=a[i]=c[i]=0;
  38254. }
  38255. a[0]=d[0]=1;
  38256. for (i=254; i>=0; --i) {
  38257. r=(z[i>>>3]>>>(i&7))&1;
  38258. sel25519(a,b,r);
  38259. sel25519(c,d,r);
  38260. A(e,a,c);
  38261. Z(a,a,c);
  38262. A(c,b,d);
  38263. Z(b,b,d);
  38264. S(d,e);
  38265. S(f,a);
  38266. M(a,c,a);
  38267. M(c,b,e);
  38268. A(e,a,c);
  38269. Z(a,a,c);
  38270. S(b,a);
  38271. Z(c,d,f);
  38272. M(a,c,_121665);
  38273. A(a,a,d);
  38274. M(c,c,a);
  38275. M(a,d,f);
  38276. M(d,b,x);
  38277. S(b,e);
  38278. sel25519(a,b,r);
  38279. sel25519(c,d,r);
  38280. }
  38281. for (i = 0; i < 16; i++) {
  38282. x[i+16]=a[i];
  38283. x[i+32]=c[i];
  38284. x[i+48]=b[i];
  38285. x[i+64]=d[i];
  38286. }
  38287. var x32 = x.subarray(32);
  38288. var x16 = x.subarray(16);
  38289. inv25519(x32,x32);
  38290. M(x16,x16,x32);
  38291. pack25519(q,x16);
  38292. return 0;
  38293. }
  38294. function crypto_scalarmult_base(q, n) {
  38295. return crypto_scalarmult(q, n, _9);
  38296. }
  38297. function crypto_box_keypair(y, x) {
  38298. randombytes(x, 32);
  38299. return crypto_scalarmult_base(y, x);
  38300. }
  38301. function crypto_box_beforenm(k, y, x) {
  38302. var s = new Uint8Array(32);
  38303. crypto_scalarmult(s, x, y);
  38304. return crypto_core_hsalsa20(k, _0, s, sigma);
  38305. }
  38306. var crypto_box_afternm = crypto_secretbox;
  38307. var crypto_box_open_afternm = crypto_secretbox_open;
  38308. function crypto_box(c, m, d, n, y, x) {
  38309. var k = new Uint8Array(32);
  38310. crypto_box_beforenm(k, y, x);
  38311. return crypto_box_afternm(c, m, d, n, k);
  38312. }
  38313. function crypto_box_open(m, c, d, n, y, x) {
  38314. var k = new Uint8Array(32);
  38315. crypto_box_beforenm(k, y, x);
  38316. return crypto_box_open_afternm(m, c, d, n, k);
  38317. }
  38318. var K = [
  38319. 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
  38320. 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
  38321. 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
  38322. 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
  38323. 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
  38324. 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
  38325. 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
  38326. 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
  38327. 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
  38328. 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
  38329. 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
  38330. 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
  38331. 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
  38332. 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
  38333. 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
  38334. 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
  38335. 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
  38336. 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
  38337. 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
  38338. 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
  38339. 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
  38340. 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
  38341. 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
  38342. 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
  38343. 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
  38344. 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
  38345. 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
  38346. 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
  38347. 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
  38348. 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
  38349. 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
  38350. 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
  38351. 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
  38352. 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
  38353. 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
  38354. 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
  38355. 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
  38356. 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
  38357. 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
  38358. 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
  38359. ];
  38360. function crypto_hashblocks_hl(hh, hl, m, n) {
  38361. var wh = new Int32Array(16), wl = new Int32Array(16),
  38362. bh0, bh1, bh2, bh3, bh4, bh5, bh6, bh7,
  38363. bl0, bl1, bl2, bl3, bl4, bl5, bl6, bl7,
  38364. th, tl, i, j, h, l, a, b, c, d;
  38365. var ah0 = hh[0],
  38366. ah1 = hh[1],
  38367. ah2 = hh[2],
  38368. ah3 = hh[3],
  38369. ah4 = hh[4],
  38370. ah5 = hh[5],
  38371. ah6 = hh[6],
  38372. ah7 = hh[7],
  38373. al0 = hl[0],
  38374. al1 = hl[1],
  38375. al2 = hl[2],
  38376. al3 = hl[3],
  38377. al4 = hl[4],
  38378. al5 = hl[5],
  38379. al6 = hl[6],
  38380. al7 = hl[7];
  38381. var pos = 0;
  38382. while (n >= 128) {
  38383. for (i = 0; i < 16; i++) {
  38384. j = 8 * i + pos;
  38385. wh[i] = (m[j+0] << 24) | (m[j+1] << 16) | (m[j+2] << 8) | m[j+3];
  38386. wl[i] = (m[j+4] << 24) | (m[j+5] << 16) | (m[j+6] << 8) | m[j+7];
  38387. }
  38388. for (i = 0; i < 80; i++) {
  38389. bh0 = ah0;
  38390. bh1 = ah1;
  38391. bh2 = ah2;
  38392. bh3 = ah3;
  38393. bh4 = ah4;
  38394. bh5 = ah5;
  38395. bh6 = ah6;
  38396. bh7 = ah7;
  38397. bl0 = al0;
  38398. bl1 = al1;
  38399. bl2 = al2;
  38400. bl3 = al3;
  38401. bl4 = al4;
  38402. bl5 = al5;
  38403. bl6 = al6;
  38404. bl7 = al7;
  38405. // add
  38406. h = ah7;
  38407. l = al7;
  38408. a = l & 0xffff; b = l >>> 16;
  38409. c = h & 0xffff; d = h >>> 16;
  38410. // Sigma1
  38411. h = ((ah4 >>> 14) | (al4 << (32-14))) ^ ((ah4 >>> 18) | (al4 << (32-18))) ^ ((al4 >>> (41-32)) | (ah4 << (32-(41-32))));
  38412. l = ((al4 >>> 14) | (ah4 << (32-14))) ^ ((al4 >>> 18) | (ah4 << (32-18))) ^ ((ah4 >>> (41-32)) | (al4 << (32-(41-32))));
  38413. a += l & 0xffff; b += l >>> 16;
  38414. c += h & 0xffff; d += h >>> 16;
  38415. // Ch
  38416. h = (ah4 & ah5) ^ (~ah4 & ah6);
  38417. l = (al4 & al5) ^ (~al4 & al6);
  38418. a += l & 0xffff; b += l >>> 16;
  38419. c += h & 0xffff; d += h >>> 16;
  38420. // K
  38421. h = K[i*2];
  38422. l = K[i*2+1];
  38423. a += l & 0xffff; b += l >>> 16;
  38424. c += h & 0xffff; d += h >>> 16;
  38425. // w
  38426. h = wh[i%16];
  38427. l = wl[i%16];
  38428. a += l & 0xffff; b += l >>> 16;
  38429. c += h & 0xffff; d += h >>> 16;
  38430. b += a >>> 16;
  38431. c += b >>> 16;
  38432. d += c >>> 16;
  38433. th = c & 0xffff | d << 16;
  38434. tl = a & 0xffff | b << 16;
  38435. // add
  38436. h = th;
  38437. l = tl;
  38438. a = l & 0xffff; b = l >>> 16;
  38439. c = h & 0xffff; d = h >>> 16;
  38440. // Sigma0
  38441. h = ((ah0 >>> 28) | (al0 << (32-28))) ^ ((al0 >>> (34-32)) | (ah0 << (32-(34-32)))) ^ ((al0 >>> (39-32)) | (ah0 << (32-(39-32))));
  38442. l = ((al0 >>> 28) | (ah0 << (32-28))) ^ ((ah0 >>> (34-32)) | (al0 << (32-(34-32)))) ^ ((ah0 >>> (39-32)) | (al0 << (32-(39-32))));
  38443. a += l & 0xffff; b += l >>> 16;
  38444. c += h & 0xffff; d += h >>> 16;
  38445. // Maj
  38446. h = (ah0 & ah1) ^ (ah0 & ah2) ^ (ah1 & ah2);
  38447. l = (al0 & al1) ^ (al0 & al2) ^ (al1 & al2);
  38448. a += l & 0xffff; b += l >>> 16;
  38449. c += h & 0xffff; d += h >>> 16;
  38450. b += a >>> 16;
  38451. c += b >>> 16;
  38452. d += c >>> 16;
  38453. bh7 = (c & 0xffff) | (d << 16);
  38454. bl7 = (a & 0xffff) | (b << 16);
  38455. // add
  38456. h = bh3;
  38457. l = bl3;
  38458. a = l & 0xffff; b = l >>> 16;
  38459. c = h & 0xffff; d = h >>> 16;
  38460. h = th;
  38461. l = tl;
  38462. a += l & 0xffff; b += l >>> 16;
  38463. c += h & 0xffff; d += h >>> 16;
  38464. b += a >>> 16;
  38465. c += b >>> 16;
  38466. d += c >>> 16;
  38467. bh3 = (c & 0xffff) | (d << 16);
  38468. bl3 = (a & 0xffff) | (b << 16);
  38469. ah1 = bh0;
  38470. ah2 = bh1;
  38471. ah3 = bh2;
  38472. ah4 = bh3;
  38473. ah5 = bh4;
  38474. ah6 = bh5;
  38475. ah7 = bh6;
  38476. ah0 = bh7;
  38477. al1 = bl0;
  38478. al2 = bl1;
  38479. al3 = bl2;
  38480. al4 = bl3;
  38481. al5 = bl4;
  38482. al6 = bl5;
  38483. al7 = bl6;
  38484. al0 = bl7;
  38485. if (i%16 === 15) {
  38486. for (j = 0; j < 16; j++) {
  38487. // add
  38488. h = wh[j];
  38489. l = wl[j];
  38490. a = l & 0xffff; b = l >>> 16;
  38491. c = h & 0xffff; d = h >>> 16;
  38492. h = wh[(j+9)%16];
  38493. l = wl[(j+9)%16];
  38494. a += l & 0xffff; b += l >>> 16;
  38495. c += h & 0xffff; d += h >>> 16;
  38496. // sigma0
  38497. th = wh[(j+1)%16];
  38498. tl = wl[(j+1)%16];
  38499. h = ((th >>> 1) | (tl << (32-1))) ^ ((th >>> 8) | (tl << (32-8))) ^ (th >>> 7);
  38500. l = ((tl >>> 1) | (th << (32-1))) ^ ((tl >>> 8) | (th << (32-8))) ^ ((tl >>> 7) | (th << (32-7)));
  38501. a += l & 0xffff; b += l >>> 16;
  38502. c += h & 0xffff; d += h >>> 16;
  38503. // sigma1
  38504. th = wh[(j+14)%16];
  38505. tl = wl[(j+14)%16];
  38506. h = ((th >>> 19) | (tl << (32-19))) ^ ((tl >>> (61-32)) | (th << (32-(61-32)))) ^ (th >>> 6);
  38507. l = ((tl >>> 19) | (th << (32-19))) ^ ((th >>> (61-32)) | (tl << (32-(61-32)))) ^ ((tl >>> 6) | (th << (32-6)));
  38508. a += l & 0xffff; b += l >>> 16;
  38509. c += h & 0xffff; d += h >>> 16;
  38510. b += a >>> 16;
  38511. c += b >>> 16;
  38512. d += c >>> 16;
  38513. wh[j] = (c & 0xffff) | (d << 16);
  38514. wl[j] = (a & 0xffff) | (b << 16);
  38515. }
  38516. }
  38517. }
  38518. // add
  38519. h = ah0;
  38520. l = al0;
  38521. a = l & 0xffff; b = l >>> 16;
  38522. c = h & 0xffff; d = h >>> 16;
  38523. h = hh[0];
  38524. l = hl[0];
  38525. a += l & 0xffff; b += l >>> 16;
  38526. c += h & 0xffff; d += h >>> 16;
  38527. b += a >>> 16;
  38528. c += b >>> 16;
  38529. d += c >>> 16;
  38530. hh[0] = ah0 = (c & 0xffff) | (d << 16);
  38531. hl[0] = al0 = (a & 0xffff) | (b << 16);
  38532. h = ah1;
  38533. l = al1;
  38534. a = l & 0xffff; b = l >>> 16;
  38535. c = h & 0xffff; d = h >>> 16;
  38536. h = hh[1];
  38537. l = hl[1];
  38538. a += l & 0xffff; b += l >>> 16;
  38539. c += h & 0xffff; d += h >>> 16;
  38540. b += a >>> 16;
  38541. c += b >>> 16;
  38542. d += c >>> 16;
  38543. hh[1] = ah1 = (c & 0xffff) | (d << 16);
  38544. hl[1] = al1 = (a & 0xffff) | (b << 16);
  38545. h = ah2;
  38546. l = al2;
  38547. a = l & 0xffff; b = l >>> 16;
  38548. c = h & 0xffff; d = h >>> 16;
  38549. h = hh[2];
  38550. l = hl[2];
  38551. a += l & 0xffff; b += l >>> 16;
  38552. c += h & 0xffff; d += h >>> 16;
  38553. b += a >>> 16;
  38554. c += b >>> 16;
  38555. d += c >>> 16;
  38556. hh[2] = ah2 = (c & 0xffff) | (d << 16);
  38557. hl[2] = al2 = (a & 0xffff) | (b << 16);
  38558. h = ah3;
  38559. l = al3;
  38560. a = l & 0xffff; b = l >>> 16;
  38561. c = h & 0xffff; d = h >>> 16;
  38562. h = hh[3];
  38563. l = hl[3];
  38564. a += l & 0xffff; b += l >>> 16;
  38565. c += h & 0xffff; d += h >>> 16;
  38566. b += a >>> 16;
  38567. c += b >>> 16;
  38568. d += c >>> 16;
  38569. hh[3] = ah3 = (c & 0xffff) | (d << 16);
  38570. hl[3] = al3 = (a & 0xffff) | (b << 16);
  38571. h = ah4;
  38572. l = al4;
  38573. a = l & 0xffff; b = l >>> 16;
  38574. c = h & 0xffff; d = h >>> 16;
  38575. h = hh[4];
  38576. l = hl[4];
  38577. a += l & 0xffff; b += l >>> 16;
  38578. c += h & 0xffff; d += h >>> 16;
  38579. b += a >>> 16;
  38580. c += b >>> 16;
  38581. d += c >>> 16;
  38582. hh[4] = ah4 = (c & 0xffff) | (d << 16);
  38583. hl[4] = al4 = (a & 0xffff) | (b << 16);
  38584. h = ah5;
  38585. l = al5;
  38586. a = l & 0xffff; b = l >>> 16;
  38587. c = h & 0xffff; d = h >>> 16;
  38588. h = hh[5];
  38589. l = hl[5];
  38590. a += l & 0xffff; b += l >>> 16;
  38591. c += h & 0xffff; d += h >>> 16;
  38592. b += a >>> 16;
  38593. c += b >>> 16;
  38594. d += c >>> 16;
  38595. hh[5] = ah5 = (c & 0xffff) | (d << 16);
  38596. hl[5] = al5 = (a & 0xffff) | (b << 16);
  38597. h = ah6;
  38598. l = al6;
  38599. a = l & 0xffff; b = l >>> 16;
  38600. c = h & 0xffff; d = h >>> 16;
  38601. h = hh[6];
  38602. l = hl[6];
  38603. a += l & 0xffff; b += l >>> 16;
  38604. c += h & 0xffff; d += h >>> 16;
  38605. b += a >>> 16;
  38606. c += b >>> 16;
  38607. d += c >>> 16;
  38608. hh[6] = ah6 = (c & 0xffff) | (d << 16);
  38609. hl[6] = al6 = (a & 0xffff) | (b << 16);
  38610. h = ah7;
  38611. l = al7;
  38612. a = l & 0xffff; b = l >>> 16;
  38613. c = h & 0xffff; d = h >>> 16;
  38614. h = hh[7];
  38615. l = hl[7];
  38616. a += l & 0xffff; b += l >>> 16;
  38617. c += h & 0xffff; d += h >>> 16;
  38618. b += a >>> 16;
  38619. c += b >>> 16;
  38620. d += c >>> 16;
  38621. hh[7] = ah7 = (c & 0xffff) | (d << 16);
  38622. hl[7] = al7 = (a & 0xffff) | (b << 16);
  38623. pos += 128;
  38624. n -= 128;
  38625. }
  38626. return n;
  38627. }
  38628. function crypto_hash(out, m, n) {
  38629. var hh = new Int32Array(8),
  38630. hl = new Int32Array(8),
  38631. x = new Uint8Array(256),
  38632. i, b = n;
  38633. hh[0] = 0x6a09e667;
  38634. hh[1] = 0xbb67ae85;
  38635. hh[2] = 0x3c6ef372;
  38636. hh[3] = 0xa54ff53a;
  38637. hh[4] = 0x510e527f;
  38638. hh[5] = 0x9b05688c;
  38639. hh[6] = 0x1f83d9ab;
  38640. hh[7] = 0x5be0cd19;
  38641. hl[0] = 0xf3bcc908;
  38642. hl[1] = 0x84caa73b;
  38643. hl[2] = 0xfe94f82b;
  38644. hl[3] = 0x5f1d36f1;
  38645. hl[4] = 0xade682d1;
  38646. hl[5] = 0x2b3e6c1f;
  38647. hl[6] = 0xfb41bd6b;
  38648. hl[7] = 0x137e2179;
  38649. crypto_hashblocks_hl(hh, hl, m, n);
  38650. n %= 128;
  38651. for (i = 0; i < n; i++) x[i] = m[b-n+i];
  38652. x[n] = 128;
  38653. n = 256-128*(n<112?1:0);
  38654. x[n-9] = 0;
  38655. ts64(x, n-8, (b / 0x20000000) | 0, b << 3);
  38656. crypto_hashblocks_hl(hh, hl, x, n);
  38657. for (i = 0; i < 8; i++) ts64(out, 8*i, hh[i], hl[i]);
  38658. return 0;
  38659. }
  38660. function add(p, q) {
  38661. var a = gf(), b = gf(), c = gf(),
  38662. d = gf(), e = gf(), f = gf(),
  38663. g = gf(), h = gf(), t = gf();
  38664. Z(a, p[1], p[0]);
  38665. Z(t, q[1], q[0]);
  38666. M(a, a, t);
  38667. A(b, p[0], p[1]);
  38668. A(t, q[0], q[1]);
  38669. M(b, b, t);
  38670. M(c, p[3], q[3]);
  38671. M(c, c, D2);
  38672. M(d, p[2], q[2]);
  38673. A(d, d, d);
  38674. Z(e, b, a);
  38675. Z(f, d, c);
  38676. A(g, d, c);
  38677. A(h, b, a);
  38678. M(p[0], e, f);
  38679. M(p[1], h, g);
  38680. M(p[2], g, f);
  38681. M(p[3], e, h);
  38682. }
  38683. function cswap(p, q, b) {
  38684. var i;
  38685. for (i = 0; i < 4; i++) {
  38686. sel25519(p[i], q[i], b);
  38687. }
  38688. }
  38689. function pack(r, p) {
  38690. var tx = gf(), ty = gf(), zi = gf();
  38691. inv25519(zi, p[2]);
  38692. M(tx, p[0], zi);
  38693. M(ty, p[1], zi);
  38694. pack25519(r, ty);
  38695. r[31] ^= par25519(tx) << 7;
  38696. }
  38697. function scalarmult(p, q, s) {
  38698. var b, i;
  38699. set25519(p[0], gf0);
  38700. set25519(p[1], gf1);
  38701. set25519(p[2], gf1);
  38702. set25519(p[3], gf0);
  38703. for (i = 255; i >= 0; --i) {
  38704. b = (s[(i/8)|0] >> (i&7)) & 1;
  38705. cswap(p, q, b);
  38706. add(q, p);
  38707. add(p, p);
  38708. cswap(p, q, b);
  38709. }
  38710. }
  38711. function scalarbase(p, s) {
  38712. var q = [gf(), gf(), gf(), gf()];
  38713. set25519(q[0], X);
  38714. set25519(q[1], Y);
  38715. set25519(q[2], gf1);
  38716. M(q[3], X, Y);
  38717. scalarmult(p, q, s);
  38718. }
  38719. function crypto_sign_keypair(pk, sk, seeded) {
  38720. var d = new Uint8Array(64);
  38721. var p = [gf(), gf(), gf(), gf()];
  38722. var i;
  38723. if (!seeded) randombytes(sk, 32);
  38724. crypto_hash(d, sk, 32);
  38725. d[0] &= 248;
  38726. d[31] &= 127;
  38727. d[31] |= 64;
  38728. scalarbase(p, d);
  38729. pack(pk, p);
  38730. for (i = 0; i < 32; i++) sk[i+32] = pk[i];
  38731. return 0;
  38732. }
  38733. 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]);
  38734. function modL(r, x) {
  38735. var carry, i, j, k;
  38736. for (i = 63; i >= 32; --i) {
  38737. carry = 0;
  38738. for (j = i - 32, k = i - 12; j < k; ++j) {
  38739. x[j] += carry - 16 * x[i] * L[j - (i - 32)];
  38740. carry = (x[j] + 128) >> 8;
  38741. x[j] -= carry * 256;
  38742. }
  38743. x[j] += carry;
  38744. x[i] = 0;
  38745. }
  38746. carry = 0;
  38747. for (j = 0; j < 32; j++) {
  38748. x[j] += carry - (x[31] >> 4) * L[j];
  38749. carry = x[j] >> 8;
  38750. x[j] &= 255;
  38751. }
  38752. for (j = 0; j < 32; j++) x[j] -= carry * L[j];
  38753. for (i = 0; i < 32; i++) {
  38754. x[i+1] += x[i] >> 8;
  38755. r[i] = x[i] & 255;
  38756. }
  38757. }
  38758. function reduce(r) {
  38759. var x = new Float64Array(64), i;
  38760. for (i = 0; i < 64; i++) x[i] = r[i];
  38761. for (i = 0; i < 64; i++) r[i] = 0;
  38762. modL(r, x);
  38763. }
  38764. // Note: difference from C - smlen returned, not passed as argument.
  38765. function crypto_sign(sm, m, n, sk) {
  38766. var d = new Uint8Array(64), h = new Uint8Array(64), r = new Uint8Array(64);
  38767. var i, j, x = new Float64Array(64);
  38768. var p = [gf(), gf(), gf(), gf()];
  38769. crypto_hash(d, sk, 32);
  38770. d[0] &= 248;
  38771. d[31] &= 127;
  38772. d[31] |= 64;
  38773. var smlen = n + 64;
  38774. for (i = 0; i < n; i++) sm[64 + i] = m[i];
  38775. for (i = 0; i < 32; i++) sm[32 + i] = d[32 + i];
  38776. crypto_hash(r, sm.subarray(32), n+32);
  38777. reduce(r);
  38778. scalarbase(p, r);
  38779. pack(sm, p);
  38780. for (i = 32; i < 64; i++) sm[i] = sk[i];
  38781. crypto_hash(h, sm, n + 64);
  38782. reduce(h);
  38783. for (i = 0; i < 64; i++) x[i] = 0;
  38784. for (i = 0; i < 32; i++) x[i] = r[i];
  38785. for (i = 0; i < 32; i++) {
  38786. for (j = 0; j < 32; j++) {
  38787. x[i+j] += h[i] * d[j];
  38788. }
  38789. }
  38790. modL(sm.subarray(32), x);
  38791. return smlen;
  38792. }
  38793. function unpackneg(r, p) {
  38794. var t = gf(), chk = gf(), num = gf(),
  38795. den = gf(), den2 = gf(), den4 = gf(),
  38796. den6 = gf();
  38797. set25519(r[2], gf1);
  38798. unpack25519(r[1], p);
  38799. S(num, r[1]);
  38800. M(den, num, D);
  38801. Z(num, num, r[2]);
  38802. A(den, r[2], den);
  38803. S(den2, den);
  38804. S(den4, den2);
  38805. M(den6, den4, den2);
  38806. M(t, den6, num);
  38807. M(t, t, den);
  38808. pow2523(t, t);
  38809. M(t, t, num);
  38810. M(t, t, den);
  38811. M(t, t, den);
  38812. M(r[0], t, den);
  38813. S(chk, r[0]);
  38814. M(chk, chk, den);
  38815. if (neq25519(chk, num)) M(r[0], r[0], I);
  38816. S(chk, r[0]);
  38817. M(chk, chk, den);
  38818. if (neq25519(chk, num)) return -1;
  38819. if (par25519(r[0]) === (p[31]>>7)) Z(r[0], gf0, r[0]);
  38820. M(r[3], r[0], r[1]);
  38821. return 0;
  38822. }
  38823. function crypto_sign_open(m, sm, n, pk) {
  38824. var i, mlen;
  38825. var t = new Uint8Array(32), h = new Uint8Array(64);
  38826. var p = [gf(), gf(), gf(), gf()],
  38827. q = [gf(), gf(), gf(), gf()];
  38828. mlen = -1;
  38829. if (n < 64) return -1;
  38830. if (unpackneg(q, pk)) return -1;
  38831. for (i = 0; i < n; i++) m[i] = sm[i];
  38832. for (i = 0; i < 32; i++) m[i+32] = pk[i];
  38833. crypto_hash(h, m, n);
  38834. reduce(h);
  38835. scalarmult(p, q, h);
  38836. scalarbase(q, sm.subarray(32));
  38837. add(p, q);
  38838. pack(t, p);
  38839. n -= 64;
  38840. if (crypto_verify_32(sm, 0, t, 0)) {
  38841. for (i = 0; i < n; i++) m[i] = 0;
  38842. return -1;
  38843. }
  38844. for (i = 0; i < n; i++) m[i] = sm[i + 64];
  38845. mlen = n;
  38846. return mlen;
  38847. }
  38848. var crypto_secretbox_KEYBYTES = 32,
  38849. crypto_secretbox_NONCEBYTES = 24,
  38850. crypto_secretbox_ZEROBYTES = 32,
  38851. crypto_secretbox_BOXZEROBYTES = 16,
  38852. crypto_scalarmult_BYTES = 32,
  38853. crypto_scalarmult_SCALARBYTES = 32,
  38854. crypto_box_PUBLICKEYBYTES = 32,
  38855. crypto_box_SECRETKEYBYTES = 32,
  38856. crypto_box_BEFORENMBYTES = 32,
  38857. crypto_box_NONCEBYTES = crypto_secretbox_NONCEBYTES,
  38858. crypto_box_ZEROBYTES = crypto_secretbox_ZEROBYTES,
  38859. crypto_box_BOXZEROBYTES = crypto_secretbox_BOXZEROBYTES,
  38860. crypto_sign_BYTES = 64,
  38861. crypto_sign_PUBLICKEYBYTES = 32,
  38862. crypto_sign_SECRETKEYBYTES = 64,
  38863. crypto_sign_SEEDBYTES = 32,
  38864. crypto_hash_BYTES = 64;
  38865. nacl.lowlevel = {
  38866. crypto_core_hsalsa20: crypto_core_hsalsa20,
  38867. crypto_stream_xor: crypto_stream_xor,
  38868. crypto_stream: crypto_stream,
  38869. crypto_stream_salsa20_xor: crypto_stream_salsa20_xor,
  38870. crypto_stream_salsa20: crypto_stream_salsa20,
  38871. crypto_onetimeauth: crypto_onetimeauth,
  38872. crypto_onetimeauth_verify: crypto_onetimeauth_verify,
  38873. crypto_verify_16: crypto_verify_16,
  38874. crypto_verify_32: crypto_verify_32,
  38875. crypto_secretbox: crypto_secretbox,
  38876. crypto_secretbox_open: crypto_secretbox_open,
  38877. crypto_scalarmult: crypto_scalarmult,
  38878. crypto_scalarmult_base: crypto_scalarmult_base,
  38879. crypto_box_beforenm: crypto_box_beforenm,
  38880. crypto_box_afternm: crypto_box_afternm,
  38881. crypto_box: crypto_box,
  38882. crypto_box_open: crypto_box_open,
  38883. crypto_box_keypair: crypto_box_keypair,
  38884. crypto_hash: crypto_hash,
  38885. crypto_sign: crypto_sign,
  38886. crypto_sign_keypair: crypto_sign_keypair,
  38887. crypto_sign_open: crypto_sign_open,
  38888. crypto_secretbox_KEYBYTES: crypto_secretbox_KEYBYTES,
  38889. crypto_secretbox_NONCEBYTES: crypto_secretbox_NONCEBYTES,
  38890. crypto_secretbox_ZEROBYTES: crypto_secretbox_ZEROBYTES,
  38891. crypto_secretbox_BOXZEROBYTES: crypto_secretbox_BOXZEROBYTES,
  38892. crypto_scalarmult_BYTES: crypto_scalarmult_BYTES,
  38893. crypto_scalarmult_SCALARBYTES: crypto_scalarmult_SCALARBYTES,
  38894. crypto_box_PUBLICKEYBYTES: crypto_box_PUBLICKEYBYTES,
  38895. crypto_box_SECRETKEYBYTES: crypto_box_SECRETKEYBYTES,
  38896. crypto_box_BEFORENMBYTES: crypto_box_BEFORENMBYTES,
  38897. crypto_box_NONCEBYTES: crypto_box_NONCEBYTES,
  38898. crypto_box_ZEROBYTES: crypto_box_ZEROBYTES,
  38899. crypto_box_BOXZEROBYTES: crypto_box_BOXZEROBYTES,
  38900. crypto_sign_BYTES: crypto_sign_BYTES,
  38901. crypto_sign_PUBLICKEYBYTES: crypto_sign_PUBLICKEYBYTES,
  38902. crypto_sign_SECRETKEYBYTES: crypto_sign_SECRETKEYBYTES,
  38903. crypto_sign_SEEDBYTES: crypto_sign_SEEDBYTES,
  38904. crypto_hash_BYTES: crypto_hash_BYTES
  38905. };
  38906. /* High-level API */
  38907. function checkLengths(k, n) {
  38908. if (k.length !== crypto_secretbox_KEYBYTES) throw new Error('bad key size');
  38909. if (n.length !== crypto_secretbox_NONCEBYTES) throw new Error('bad nonce size');
  38910. }
  38911. function checkBoxLengths(pk, sk) {
  38912. if (pk.length !== crypto_box_PUBLICKEYBYTES) throw new Error('bad public key size');
  38913. if (sk.length !== crypto_box_SECRETKEYBYTES) throw new Error('bad secret key size');
  38914. }
  38915. function checkArrayTypes() {
  38916. for (var i = 0; i < arguments.length; i++) {
  38917. if (!(arguments[i] instanceof Uint8Array))
  38918. throw new TypeError('unexpected type, use Uint8Array');
  38919. }
  38920. }
  38921. function cleanup(arr) {
  38922. for (var i = 0; i < arr.length; i++) arr[i] = 0;
  38923. }
  38924. nacl.randomBytes = function(n) {
  38925. var b = new Uint8Array(n);
  38926. randombytes(b, n);
  38927. return b;
  38928. };
  38929. nacl.secretbox = function(msg, nonce, key) {
  38930. checkArrayTypes(msg, nonce, key);
  38931. checkLengths(key, nonce);
  38932. var m = new Uint8Array(crypto_secretbox_ZEROBYTES + msg.length);
  38933. var c = new Uint8Array(m.length);
  38934. for (var i = 0; i < msg.length; i++) m[i+crypto_secretbox_ZEROBYTES] = msg[i];
  38935. crypto_secretbox(c, m, m.length, nonce, key);
  38936. return c.subarray(crypto_secretbox_BOXZEROBYTES);
  38937. };
  38938. nacl.secretbox.open = function(box, nonce, key) {
  38939. checkArrayTypes(box, nonce, key);
  38940. checkLengths(key, nonce);
  38941. var c = new Uint8Array(crypto_secretbox_BOXZEROBYTES + box.length);
  38942. var m = new Uint8Array(c.length);
  38943. for (var i = 0; i < box.length; i++) c[i+crypto_secretbox_BOXZEROBYTES] = box[i];
  38944. if (c.length < 32) return null;
  38945. if (crypto_secretbox_open(m, c, c.length, nonce, key) !== 0) return null;
  38946. return m.subarray(crypto_secretbox_ZEROBYTES);
  38947. };
  38948. nacl.secretbox.keyLength = crypto_secretbox_KEYBYTES;
  38949. nacl.secretbox.nonceLength = crypto_secretbox_NONCEBYTES;
  38950. nacl.secretbox.overheadLength = crypto_secretbox_BOXZEROBYTES;
  38951. nacl.scalarMult = function(n, p) {
  38952. checkArrayTypes(n, p);
  38953. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  38954. if (p.length !== crypto_scalarmult_BYTES) throw new Error('bad p size');
  38955. var q = new Uint8Array(crypto_scalarmult_BYTES);
  38956. crypto_scalarmult(q, n, p);
  38957. return q;
  38958. };
  38959. nacl.scalarMult.base = function(n) {
  38960. checkArrayTypes(n);
  38961. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  38962. var q = new Uint8Array(crypto_scalarmult_BYTES);
  38963. crypto_scalarmult_base(q, n);
  38964. return q;
  38965. };
  38966. nacl.scalarMult.scalarLength = crypto_scalarmult_SCALARBYTES;
  38967. nacl.scalarMult.groupElementLength = crypto_scalarmult_BYTES;
  38968. nacl.box = function(msg, nonce, publicKey, secretKey) {
  38969. var k = nacl.box.before(publicKey, secretKey);
  38970. return nacl.secretbox(msg, nonce, k);
  38971. };
  38972. nacl.box.before = function(publicKey, secretKey) {
  38973. checkArrayTypes(publicKey, secretKey);
  38974. checkBoxLengths(publicKey, secretKey);
  38975. var k = new Uint8Array(crypto_box_BEFORENMBYTES);
  38976. crypto_box_beforenm(k, publicKey, secretKey);
  38977. return k;
  38978. };
  38979. nacl.box.after = nacl.secretbox;
  38980. nacl.box.open = function(msg, nonce, publicKey, secretKey) {
  38981. var k = nacl.box.before(publicKey, secretKey);
  38982. return nacl.secretbox.open(msg, nonce, k);
  38983. };
  38984. nacl.box.open.after = nacl.secretbox.open;
  38985. nacl.box.keyPair = function() {
  38986. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  38987. var sk = new Uint8Array(crypto_box_SECRETKEYBYTES);
  38988. crypto_box_keypair(pk, sk);
  38989. return {publicKey: pk, secretKey: sk};
  38990. };
  38991. nacl.box.keyPair.fromSecretKey = function(secretKey) {
  38992. checkArrayTypes(secretKey);
  38993. if (secretKey.length !== crypto_box_SECRETKEYBYTES)
  38994. throw new Error('bad secret key size');
  38995. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  38996. crypto_scalarmult_base(pk, secretKey);
  38997. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  38998. };
  38999. nacl.box.publicKeyLength = crypto_box_PUBLICKEYBYTES;
  39000. nacl.box.secretKeyLength = crypto_box_SECRETKEYBYTES;
  39001. nacl.box.sharedKeyLength = crypto_box_BEFORENMBYTES;
  39002. nacl.box.nonceLength = crypto_box_NONCEBYTES;
  39003. nacl.box.overheadLength = nacl.secretbox.overheadLength;
  39004. nacl.sign = function(msg, secretKey) {
  39005. checkArrayTypes(msg, secretKey);
  39006. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  39007. throw new Error('bad secret key size');
  39008. var signedMsg = new Uint8Array(crypto_sign_BYTES+msg.length);
  39009. crypto_sign(signedMsg, msg, msg.length, secretKey);
  39010. return signedMsg;
  39011. };
  39012. nacl.sign.open = function(signedMsg, publicKey) {
  39013. checkArrayTypes(signedMsg, publicKey);
  39014. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  39015. throw new Error('bad public key size');
  39016. var tmp = new Uint8Array(signedMsg.length);
  39017. var mlen = crypto_sign_open(tmp, signedMsg, signedMsg.length, publicKey);
  39018. if (mlen < 0) return null;
  39019. var m = new Uint8Array(mlen);
  39020. for (var i = 0; i < m.length; i++) m[i] = tmp[i];
  39021. return m;
  39022. };
  39023. nacl.sign.detached = function(msg, secretKey) {
  39024. var signedMsg = nacl.sign(msg, secretKey);
  39025. var sig = new Uint8Array(crypto_sign_BYTES);
  39026. for (var i = 0; i < sig.length; i++) sig[i] = signedMsg[i];
  39027. return sig;
  39028. };
  39029. nacl.sign.detached.verify = function(msg, sig, publicKey) {
  39030. checkArrayTypes(msg, sig, publicKey);
  39031. if (sig.length !== crypto_sign_BYTES)
  39032. throw new Error('bad signature size');
  39033. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  39034. throw new Error('bad public key size');
  39035. var sm = new Uint8Array(crypto_sign_BYTES + msg.length);
  39036. var m = new Uint8Array(crypto_sign_BYTES + msg.length);
  39037. var i;
  39038. for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i];
  39039. for (i = 0; i < msg.length; i++) sm[i+crypto_sign_BYTES] = msg[i];
  39040. return (crypto_sign_open(m, sm, sm.length, publicKey) >= 0);
  39041. };
  39042. nacl.sign.keyPair = function() {
  39043. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  39044. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  39045. crypto_sign_keypair(pk, sk);
  39046. return {publicKey: pk, secretKey: sk};
  39047. };
  39048. nacl.sign.keyPair.fromSecretKey = function(secretKey) {
  39049. checkArrayTypes(secretKey);
  39050. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  39051. throw new Error('bad secret key size');
  39052. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  39053. for (var i = 0; i < pk.length; i++) pk[i] = secretKey[32+i];
  39054. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  39055. };
  39056. nacl.sign.keyPair.fromSeed = function(seed) {
  39057. checkArrayTypes(seed);
  39058. if (seed.length !== crypto_sign_SEEDBYTES)
  39059. throw new Error('bad seed size');
  39060. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  39061. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  39062. for (var i = 0; i < 32; i++) sk[i] = seed[i];
  39063. crypto_sign_keypair(pk, sk, true);
  39064. return {publicKey: pk, secretKey: sk};
  39065. };
  39066. nacl.sign.publicKeyLength = crypto_sign_PUBLICKEYBYTES;
  39067. nacl.sign.secretKeyLength = crypto_sign_SECRETKEYBYTES;
  39068. nacl.sign.seedLength = crypto_sign_SEEDBYTES;
  39069. nacl.sign.signatureLength = crypto_sign_BYTES;
  39070. nacl.hash = function(msg) {
  39071. checkArrayTypes(msg);
  39072. var h = new Uint8Array(crypto_hash_BYTES);
  39073. crypto_hash(h, msg, msg.length);
  39074. return h;
  39075. };
  39076. nacl.hash.hashLength = crypto_hash_BYTES;
  39077. nacl.verify = function(x, y) {
  39078. checkArrayTypes(x, y);
  39079. // Zero length arguments are considered not equal.
  39080. if (x.length === 0 || y.length === 0) return false;
  39081. if (x.length !== y.length) return false;
  39082. return (vn(x, 0, y, 0, x.length) === 0) ? true : false;
  39083. };
  39084. nacl.setPRNG = function(fn) {
  39085. randombytes = fn;
  39086. };
  39087. (function() {
  39088. // Initialize PRNG if environment provides CSPRNG.
  39089. // If not, methods calling randombytes will throw.
  39090. var crypto = typeof self !== 'undefined' ? (self.crypto || self.msCrypto) : null;
  39091. if (crypto && crypto.getRandomValues) {
  39092. // Browsers.
  39093. var QUOTA = 65536;
  39094. nacl.setPRNG(function(x, n) {
  39095. var i, v = new Uint8Array(n);
  39096. for (i = 0; i < n; i += QUOTA) {
  39097. crypto.getRandomValues(v.subarray(i, i + Math.min(n - i, QUOTA)));
  39098. }
  39099. for (i = 0; i < n; i++) x[i] = v[i];
  39100. cleanup(v);
  39101. });
  39102. } else if (true) {
  39103. // Node.js.
  39104. crypto = __webpack_require__(3);
  39105. if (crypto && crypto.randomBytes) {
  39106. nacl.setPRNG(function(x, n) {
  39107. var i, v = crypto.randomBytes(n);
  39108. for (i = 0; i < n; i++) x[i] = v[i];
  39109. cleanup(v);
  39110. });
  39111. }
  39112. }
  39113. })();
  39114. })( true && module.exports ? module.exports : (self.nacl = self.nacl || {}));
  39115. /***/ }),
  39116. /* 1 */
  39117. /***/ (function(module, exports, __webpack_require__) {
  39118. // Written in 2014-2016 by Dmitry Chestnykh and Devi Mandiri.
  39119. // Public domain.
  39120. (function(root, f) {
  39121. 'use strict';
  39122. if ( true && module.exports) module.exports = f();
  39123. else if (root.nacl) root.nacl.util = f();
  39124. else {
  39125. root.nacl = {};
  39126. root.nacl.util = f();
  39127. }
  39128. }(this, function() {
  39129. 'use strict';
  39130. var util = {};
  39131. function validateBase64(s) {
  39132. if (!(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(s))) {
  39133. throw new TypeError('invalid encoding');
  39134. }
  39135. }
  39136. util.decodeUTF8 = function(s) {
  39137. if (typeof s !== 'string') throw new TypeError('expected string');
  39138. var i, d = unescape(encodeURIComponent(s)), b = new Uint8Array(d.length);
  39139. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  39140. return b;
  39141. };
  39142. util.encodeUTF8 = function(arr) {
  39143. var i, s = [];
  39144. for (i = 0; i < arr.length; i++) s.push(String.fromCharCode(arr[i]));
  39145. return decodeURIComponent(escape(s.join('')));
  39146. };
  39147. if (typeof atob === 'undefined') {
  39148. // Node.js
  39149. if (typeof Buffer.from !== 'undefined') {
  39150. // Node v6 and later
  39151. util.encodeBase64 = function (arr) { // v6 and later
  39152. return Buffer.from(arr).toString('base64');
  39153. };
  39154. util.decodeBase64 = function (s) {
  39155. validateBase64(s);
  39156. return new Uint8Array(Array.prototype.slice.call(Buffer.from(s, 'base64'), 0));
  39157. };
  39158. } else {
  39159. // Node earlier than v6
  39160. util.encodeBase64 = function (arr) { // v6 and later
  39161. return (new Buffer(arr)).toString('base64');
  39162. };
  39163. util.decodeBase64 = function(s) {
  39164. validateBase64(s);
  39165. return new Uint8Array(Array.prototype.slice.call(new Buffer(s, 'base64'), 0));
  39166. };
  39167. }
  39168. } else {
  39169. // Browsers
  39170. util.encodeBase64 = function(arr) {
  39171. var i, s = [], len = arr.length;
  39172. for (i = 0; i < len; i++) s.push(String.fromCharCode(arr[i]));
  39173. return btoa(s.join(''));
  39174. };
  39175. util.decodeBase64 = function(s) {
  39176. validateBase64(s);
  39177. var i, d = atob(s), b = new Uint8Array(d.length);
  39178. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  39179. return b;
  39180. };
  39181. }
  39182. return util;
  39183. }));
  39184. /***/ }),
  39185. /* 2 */
  39186. /***/ (function(module, exports, __webpack_require__) {
  39187. // required so we don't have to do require('pusher').default etc.
  39188. module.exports = __webpack_require__(4).default;
  39189. /***/ }),
  39190. /* 3 */
  39191. /***/ (function(module, exports) {
  39192. /* (ignored) */
  39193. /***/ }),
  39194. /* 4 */
  39195. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  39196. "use strict";
  39197. __webpack_require__.r(__webpack_exports__);
  39198. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_receiver_factory.ts
  39199. var ScriptReceiverFactory = (function () {
  39200. function ScriptReceiverFactory(prefix, name) {
  39201. this.lastId = 0;
  39202. this.prefix = prefix;
  39203. this.name = name;
  39204. }
  39205. ScriptReceiverFactory.prototype.create = function (callback) {
  39206. this.lastId++;
  39207. var number = this.lastId;
  39208. var id = this.prefix + number;
  39209. var name = this.name + "[" + number + "]";
  39210. var called = false;
  39211. var callbackWrapper = function () {
  39212. if (!called) {
  39213. callback.apply(null, arguments);
  39214. called = true;
  39215. }
  39216. };
  39217. this[number] = callbackWrapper;
  39218. return { number: number, id: id, name: name, callback: callbackWrapper };
  39219. };
  39220. ScriptReceiverFactory.prototype.remove = function (receiver) {
  39221. delete this[receiver.number];
  39222. };
  39223. return ScriptReceiverFactory;
  39224. }());
  39225. var ScriptReceivers = new ScriptReceiverFactory("_pusher_script_", "Pusher.ScriptReceivers");
  39226. // CONCATENATED MODULE: ./src/core/defaults.ts
  39227. var Defaults = {
  39228. VERSION: "5.0.3",
  39229. PROTOCOL: 7,
  39230. host: 'ws.pusherapp.com',
  39231. ws_port: 80,
  39232. wss_port: 443,
  39233. ws_path: '',
  39234. sockjs_host: 'sockjs.pusher.com',
  39235. sockjs_http_port: 80,
  39236. sockjs_https_port: 443,
  39237. sockjs_path: '/pusher',
  39238. stats_host: 'stats.pusher.com',
  39239. channel_auth_endpoint: '/pusher/auth',
  39240. channel_auth_transport: 'ajax',
  39241. activity_timeout: 120000,
  39242. pong_timeout: 30000,
  39243. unavailable_timeout: 10000,
  39244. cdn_http: "http://js.pusher.com",
  39245. cdn_https: "https://js.pusher.com",
  39246. dependency_suffix: ""
  39247. };
  39248. /* harmony default export */ var defaults = (Defaults);
  39249. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependency_loader.ts
  39250. var dependency_loader_DependencyLoader = (function () {
  39251. function DependencyLoader(options) {
  39252. this.options = options;
  39253. this.receivers = options.receivers || ScriptReceivers;
  39254. this.loading = {};
  39255. }
  39256. DependencyLoader.prototype.load = function (name, options, callback) {
  39257. var self = this;
  39258. if (self.loading[name] && self.loading[name].length > 0) {
  39259. self.loading[name].push(callback);
  39260. }
  39261. else {
  39262. self.loading[name] = [callback];
  39263. var request = runtime.createScriptRequest(self.getPath(name, options));
  39264. var receiver = self.receivers.create(function (error) {
  39265. self.receivers.remove(receiver);
  39266. if (self.loading[name]) {
  39267. var callbacks = self.loading[name];
  39268. delete self.loading[name];
  39269. var successCallback = function (wasSuccessful) {
  39270. if (!wasSuccessful) {
  39271. request.cleanup();
  39272. }
  39273. };
  39274. for (var i = 0; i < callbacks.length; i++) {
  39275. callbacks[i](error, successCallback);
  39276. }
  39277. }
  39278. });
  39279. request.send(receiver);
  39280. }
  39281. };
  39282. DependencyLoader.prototype.getRoot = function (options) {
  39283. var cdn;
  39284. var protocol = runtime.getDocument().location.protocol;
  39285. if ((options && options.useTLS) || protocol === "https:") {
  39286. cdn = this.options.cdn_https;
  39287. }
  39288. else {
  39289. cdn = this.options.cdn_http;
  39290. }
  39291. return cdn.replace(/\/*$/, "") + "/" + this.options.version;
  39292. };
  39293. DependencyLoader.prototype.getPath = function (name, options) {
  39294. return this.getRoot(options) + '/' + name + this.options.suffix + '.js';
  39295. };
  39296. ;
  39297. return DependencyLoader;
  39298. }());
  39299. /* harmony default export */ var dependency_loader = (dependency_loader_DependencyLoader);
  39300. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependencies.ts
  39301. var DependenciesReceivers = new ScriptReceiverFactory("_pusher_dependencies", "Pusher.DependenciesReceivers");
  39302. var Dependencies = new dependency_loader({
  39303. cdn_http: defaults.cdn_http,
  39304. cdn_https: defaults.cdn_https,
  39305. version: defaults.VERSION,
  39306. suffix: defaults.dependency_suffix,
  39307. receivers: DependenciesReceivers
  39308. });
  39309. // CONCATENATED MODULE: ./src/core/base64.ts
  39310. function encode(s) {
  39311. return btoa(utob(s));
  39312. }
  39313. var fromCharCode = String.fromCharCode;
  39314. var b64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
  39315. var b64tab = {};
  39316. for (var base64_i = 0, l = b64chars.length; base64_i < l; base64_i++) {
  39317. b64tab[b64chars.charAt(base64_i)] = base64_i;
  39318. }
  39319. var cb_utob = function (c) {
  39320. var cc = c.charCodeAt(0);
  39321. return cc < 0x80
  39322. ? c
  39323. : cc < 0x800
  39324. ? fromCharCode(0xc0 | (cc >>> 6)) + fromCharCode(0x80 | (cc & 0x3f))
  39325. : fromCharCode(0xe0 | ((cc >>> 12) & 0x0f)) +
  39326. fromCharCode(0x80 | ((cc >>> 6) & 0x3f)) +
  39327. fromCharCode(0x80 | (cc & 0x3f));
  39328. };
  39329. var utob = function (u) {
  39330. return u.replace(/[^\x00-\x7F]/g, cb_utob);
  39331. };
  39332. var cb_encode = function (ccc) {
  39333. var padlen = [0, 2, 1][ccc.length % 3];
  39334. var ord = (ccc.charCodeAt(0) << 16) |
  39335. ((ccc.length > 1 ? ccc.charCodeAt(1) : 0) << 8) |
  39336. (ccc.length > 2 ? ccc.charCodeAt(2) : 0);
  39337. var chars = [
  39338. b64chars.charAt(ord >>> 18),
  39339. b64chars.charAt((ord >>> 12) & 63),
  39340. padlen >= 2 ? '=' : b64chars.charAt((ord >>> 6) & 63),
  39341. padlen >= 1 ? '=' : b64chars.charAt(ord & 63)
  39342. ];
  39343. return chars.join('');
  39344. };
  39345. var btoa = window.btoa ||
  39346. function (b) {
  39347. return b.replace(/[\s\S]{1,3}/g, cb_encode);
  39348. };
  39349. // CONCATENATED MODULE: ./src/core/utils/timers/abstract_timer.ts
  39350. var Timer = (function () {
  39351. function Timer(set, clear, delay, callback) {
  39352. var _this = this;
  39353. this.clear = clear;
  39354. this.timer = set(function () {
  39355. if (_this.timer) {
  39356. _this.timer = callback(_this.timer);
  39357. }
  39358. }, delay);
  39359. }
  39360. Timer.prototype.isRunning = function () {
  39361. return this.timer !== null;
  39362. };
  39363. Timer.prototype.ensureAborted = function () {
  39364. if (this.timer) {
  39365. this.clear(this.timer);
  39366. this.timer = null;
  39367. }
  39368. };
  39369. return Timer;
  39370. }());
  39371. /* harmony default export */ var abstract_timer = (Timer);
  39372. // CONCATENATED MODULE: ./src/core/utils/timers/index.ts
  39373. var __extends = (undefined && undefined.__extends) || (function () {
  39374. var extendStatics = function (d, b) {
  39375. extendStatics = Object.setPrototypeOf ||
  39376. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  39377. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  39378. return extendStatics(d, b);
  39379. };
  39380. return function (d, b) {
  39381. extendStatics(d, b);
  39382. function __() { this.constructor = d; }
  39383. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  39384. };
  39385. })();
  39386. function timers_clearTimeout(timer) {
  39387. window.clearTimeout(timer);
  39388. }
  39389. function timers_clearInterval(timer) {
  39390. window.clearInterval(timer);
  39391. }
  39392. var OneOffTimer = (function (_super) {
  39393. __extends(OneOffTimer, _super);
  39394. function OneOffTimer(delay, callback) {
  39395. return _super.call(this, setTimeout, timers_clearTimeout, delay, function (timer) {
  39396. callback();
  39397. return null;
  39398. }) || this;
  39399. }
  39400. return OneOffTimer;
  39401. }(abstract_timer));
  39402. var PeriodicTimer = (function (_super) {
  39403. __extends(PeriodicTimer, _super);
  39404. function PeriodicTimer(delay, callback) {
  39405. return _super.call(this, setInterval, timers_clearInterval, delay, function (timer) {
  39406. callback();
  39407. return timer;
  39408. }) || this;
  39409. }
  39410. return PeriodicTimer;
  39411. }(abstract_timer));
  39412. // CONCATENATED MODULE: ./src/core/util.ts
  39413. var Util = {
  39414. now: function () {
  39415. if (Date.now) {
  39416. return Date.now();
  39417. }
  39418. else {
  39419. return new Date().valueOf();
  39420. }
  39421. },
  39422. defer: function (callback) {
  39423. return new OneOffTimer(0, callback);
  39424. },
  39425. method: function (name) {
  39426. var args = [];
  39427. for (var _i = 1; _i < arguments.length; _i++) {
  39428. args[_i - 1] = arguments[_i];
  39429. }
  39430. var boundArguments = Array.prototype.slice.call(arguments, 1);
  39431. return function (object) {
  39432. return object[name].apply(object, boundArguments.concat(arguments));
  39433. };
  39434. }
  39435. };
  39436. /* harmony default export */ var util = (Util);
  39437. // CONCATENATED MODULE: ./src/core/utils/collections.ts
  39438. function extend(target) {
  39439. var sources = [];
  39440. for (var _i = 1; _i < arguments.length; _i++) {
  39441. sources[_i - 1] = arguments[_i];
  39442. }
  39443. for (var i = 0; i < sources.length; i++) {
  39444. var extensions = sources[i];
  39445. for (var property in extensions) {
  39446. if (extensions[property] && extensions[property].constructor &&
  39447. extensions[property].constructor === Object) {
  39448. target[property] = extend(target[property] || {}, extensions[property]);
  39449. }
  39450. else {
  39451. target[property] = extensions[property];
  39452. }
  39453. }
  39454. }
  39455. return target;
  39456. }
  39457. function stringify() {
  39458. var m = ["Pusher"];
  39459. for (var i = 0; i < arguments.length; i++) {
  39460. if (typeof arguments[i] === "string") {
  39461. m.push(arguments[i]);
  39462. }
  39463. else {
  39464. m.push(safeJSONStringify(arguments[i]));
  39465. }
  39466. }
  39467. return m.join(" : ");
  39468. }
  39469. function arrayIndexOf(array, item) {
  39470. var nativeIndexOf = Array.prototype.indexOf;
  39471. if (array === null) {
  39472. return -1;
  39473. }
  39474. if (nativeIndexOf && array.indexOf === nativeIndexOf) {
  39475. return array.indexOf(item);
  39476. }
  39477. for (var i = 0, l = array.length; i < l; i++) {
  39478. if (array[i] === item) {
  39479. return i;
  39480. }
  39481. }
  39482. return -1;
  39483. }
  39484. function objectApply(object, f) {
  39485. for (var key in object) {
  39486. if (Object.prototype.hasOwnProperty.call(object, key)) {
  39487. f(object[key], key, object);
  39488. }
  39489. }
  39490. }
  39491. function keys(object) {
  39492. var keys = [];
  39493. objectApply(object, function (_, key) {
  39494. keys.push(key);
  39495. });
  39496. return keys;
  39497. }
  39498. function values(object) {
  39499. var values = [];
  39500. objectApply(object, function (value) {
  39501. values.push(value);
  39502. });
  39503. return values;
  39504. }
  39505. function apply(array, f, context) {
  39506. for (var i = 0; i < array.length; i++) {
  39507. f.call(context || window, array[i], i, array);
  39508. }
  39509. }
  39510. function map(array, f) {
  39511. var result = [];
  39512. for (var i = 0; i < array.length; i++) {
  39513. result.push(f(array[i], i, array, result));
  39514. }
  39515. return result;
  39516. }
  39517. function mapObject(object, f) {
  39518. var result = {};
  39519. objectApply(object, function (value, key) {
  39520. result[key] = f(value);
  39521. });
  39522. return result;
  39523. }
  39524. function filter(array, test) {
  39525. test = test || function (value) { return !!value; };
  39526. var result = [];
  39527. for (var i = 0; i < array.length; i++) {
  39528. if (test(array[i], i, array, result)) {
  39529. result.push(array[i]);
  39530. }
  39531. }
  39532. return result;
  39533. }
  39534. function filterObject(object, test) {
  39535. var result = {};
  39536. objectApply(object, function (value, key) {
  39537. if ((test && test(value, key, object, result)) || Boolean(value)) {
  39538. result[key] = value;
  39539. }
  39540. });
  39541. return result;
  39542. }
  39543. function flatten(object) {
  39544. var result = [];
  39545. objectApply(object, function (value, key) {
  39546. result.push([key, value]);
  39547. });
  39548. return result;
  39549. }
  39550. function any(array, test) {
  39551. for (var i = 0; i < array.length; i++) {
  39552. if (test(array[i], i, array)) {
  39553. return true;
  39554. }
  39555. }
  39556. return false;
  39557. }
  39558. function collections_all(array, test) {
  39559. for (var i = 0; i < array.length; i++) {
  39560. if (!test(array[i], i, array)) {
  39561. return false;
  39562. }
  39563. }
  39564. return true;
  39565. }
  39566. function encodeParamsObject(data) {
  39567. return mapObject(data, function (value) {
  39568. if (typeof value === "object") {
  39569. value = safeJSONStringify(value);
  39570. }
  39571. return encodeURIComponent(encode(value.toString()));
  39572. });
  39573. }
  39574. function buildQueryString(data) {
  39575. var params = filterObject(data, function (value) {
  39576. return value !== undefined;
  39577. });
  39578. var query = map(flatten(encodeParamsObject(params)), util.method("join", "=")).join("&");
  39579. return query;
  39580. }
  39581. function decycleObject(object) {
  39582. var objects = [], paths = [];
  39583. return (function derez(value, path) {
  39584. var i, name, nu;
  39585. switch (typeof value) {
  39586. case 'object':
  39587. if (!value) {
  39588. return null;
  39589. }
  39590. for (i = 0; i < objects.length; i += 1) {
  39591. if (objects[i] === value) {
  39592. return { $ref: paths[i] };
  39593. }
  39594. }
  39595. objects.push(value);
  39596. paths.push(path);
  39597. if (Object.prototype.toString.apply(value) === '[object Array]') {
  39598. nu = [];
  39599. for (i = 0; i < value.length; i += 1) {
  39600. nu[i] = derez(value[i], path + '[' + i + ']');
  39601. }
  39602. }
  39603. else {
  39604. nu = {};
  39605. for (name in value) {
  39606. if (Object.prototype.hasOwnProperty.call(value, name)) {
  39607. nu[name] = derez(value[name], path + '[' + JSON.stringify(name) + ']');
  39608. }
  39609. }
  39610. }
  39611. return nu;
  39612. case 'number':
  39613. case 'string':
  39614. case 'boolean':
  39615. return value;
  39616. }
  39617. }(object, '$'));
  39618. }
  39619. function safeJSONStringify(source) {
  39620. try {
  39621. return JSON.stringify(source);
  39622. }
  39623. catch (e) {
  39624. return JSON.stringify(decycleObject(source));
  39625. }
  39626. }
  39627. // CONCATENATED MODULE: ./src/core/logger.ts
  39628. var logger_Logger = (function () {
  39629. function Logger() {
  39630. this.globalLog = function (message) {
  39631. if (window.console && window.console.log) {
  39632. window.console.log(message);
  39633. }
  39634. };
  39635. }
  39636. Logger.prototype.debug = function () {
  39637. var args = [];
  39638. for (var _i = 0; _i < arguments.length; _i++) {
  39639. args[_i] = arguments[_i];
  39640. }
  39641. this.log(this.globalLog, args);
  39642. };
  39643. Logger.prototype.warn = function () {
  39644. var args = [];
  39645. for (var _i = 0; _i < arguments.length; _i++) {
  39646. args[_i] = arguments[_i];
  39647. }
  39648. this.log(this.globalLogWarn, args);
  39649. };
  39650. Logger.prototype.error = function () {
  39651. var args = [];
  39652. for (var _i = 0; _i < arguments.length; _i++) {
  39653. args[_i] = arguments[_i];
  39654. }
  39655. this.log(this.globalLogError, args);
  39656. };
  39657. Logger.prototype.globalLogWarn = function (message) {
  39658. if (window.console && window.console.warn) {
  39659. window.console.warn(message);
  39660. }
  39661. else {
  39662. this.globalLog(message);
  39663. }
  39664. };
  39665. Logger.prototype.globalLogError = function (message) {
  39666. if (window.console && window.console.error) {
  39667. window.console.error(message);
  39668. }
  39669. else {
  39670. this.globalLogWarn(message);
  39671. }
  39672. };
  39673. Logger.prototype.log = function (defaultLoggingFunction) {
  39674. var args = [];
  39675. for (var _i = 1; _i < arguments.length; _i++) {
  39676. args[_i - 1] = arguments[_i];
  39677. }
  39678. var message = stringify.apply(this, arguments);
  39679. if (core_pusher.log) {
  39680. core_pusher.log(message);
  39681. }
  39682. else if (core_pusher.logToConsole) {
  39683. var log = defaultLoggingFunction.bind(this);
  39684. log(message);
  39685. }
  39686. };
  39687. return Logger;
  39688. }());
  39689. /* harmony default export */ var logger = (new logger_Logger());
  39690. // CONCATENATED MODULE: ./src/core/utils/url_store.ts
  39691. var urlStore = {
  39692. baseUrl: "https://pusher.com",
  39693. urls: {
  39694. authenticationEndpoint: {
  39695. path: "/docs/authenticating_users",
  39696. },
  39697. javascriptQuickStart: {
  39698. path: "/docs/javascript_quick_start"
  39699. },
  39700. triggeringClientEvents: {
  39701. path: "/docs/client_api_guide/client_events#trigger-events"
  39702. }
  39703. }
  39704. };
  39705. var buildLogSuffix = function (key) {
  39706. var urlPrefix = "See:";
  39707. var urlObj = urlStore.urls[key];
  39708. if (!urlObj)
  39709. return "";
  39710. var url;
  39711. if (urlObj.fullUrl) {
  39712. url = urlObj.fullUrl;
  39713. }
  39714. else if (urlObj.path) {
  39715. url = urlStore.baseUrl + urlObj.path;
  39716. }
  39717. if (!url)
  39718. return "";
  39719. return urlPrefix + " " + url;
  39720. };
  39721. /* harmony default export */ var url_store = ({ buildLogSuffix: buildLogSuffix });
  39722. // CONCATENATED MODULE: ./src/runtimes/isomorphic/auth/xhr_auth.ts
  39723. var ajax = function (context, socketId, callback) {
  39724. var self = this, xhr;
  39725. xhr = runtime.createXHR();
  39726. xhr.open("POST", self.options.authEndpoint, true);
  39727. xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  39728. for (var headerName in this.authOptions.headers) {
  39729. xhr.setRequestHeader(headerName, this.authOptions.headers[headerName]);
  39730. }
  39731. xhr.onreadystatechange = function () {
  39732. if (xhr.readyState === 4) {
  39733. if (xhr.status === 200) {
  39734. var data, parsed = false;
  39735. try {
  39736. data = JSON.parse(xhr.responseText);
  39737. parsed = true;
  39738. }
  39739. catch (e) {
  39740. callback(true, 'JSON returned from auth endpoint was invalid, yet status code was 200. Data was: ' + xhr.responseText);
  39741. }
  39742. if (parsed) {
  39743. callback(false, data);
  39744. }
  39745. }
  39746. else {
  39747. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  39748. logger.error('Unable to retrieve auth string from auth endpoint - ' +
  39749. ("received status " + xhr.status + " from " + self.options.authEndpoint + ". ") +
  39750. ("Clients must be authenticated to join private or presence channels. " + suffix));
  39751. callback(true, xhr.status);
  39752. }
  39753. }
  39754. };
  39755. xhr.send(this.composeQuery(socketId));
  39756. return xhr;
  39757. };
  39758. /* harmony default export */ var xhr_auth = (ajax);
  39759. // CONCATENATED MODULE: ./src/runtimes/web/auth/jsonp_auth.ts
  39760. var jsonp = function (context, socketId, callback) {
  39761. if (this.authOptions.headers !== undefined) {
  39762. logger.warn('To send headers with the auth request, you must use AJAX, rather than JSONP.');
  39763. }
  39764. var callbackName = context.nextAuthCallbackID.toString();
  39765. context.nextAuthCallbackID++;
  39766. var document = context.getDocument();
  39767. var script = document.createElement("script");
  39768. context.auth_callbacks[callbackName] = function (data) {
  39769. callback(false, data);
  39770. };
  39771. var callback_name = "Pusher.auth_callbacks['" + callbackName + "']";
  39772. script.src = this.options.authEndpoint +
  39773. '?callback=' +
  39774. encodeURIComponent(callback_name) +
  39775. '&' +
  39776. this.composeQuery(socketId);
  39777. var head = document.getElementsByTagName("head")[0] || document.documentElement;
  39778. head.insertBefore(script, head.firstChild);
  39779. };
  39780. /* harmony default export */ var jsonp_auth = (jsonp);
  39781. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_request.ts
  39782. var ScriptRequest = (function () {
  39783. function ScriptRequest(src) {
  39784. this.src = src;
  39785. }
  39786. ScriptRequest.prototype.send = function (receiver) {
  39787. var self = this;
  39788. var errorString = "Error loading " + self.src;
  39789. self.script = document.createElement("script");
  39790. self.script.id = receiver.id;
  39791. self.script.src = self.src;
  39792. self.script.type = "text/javascript";
  39793. self.script.charset = "UTF-8";
  39794. if (self.script.addEventListener) {
  39795. self.script.onerror = function () {
  39796. receiver.callback(errorString);
  39797. };
  39798. self.script.onload = function () {
  39799. receiver.callback(null);
  39800. };
  39801. }
  39802. else {
  39803. self.script.onreadystatechange = function () {
  39804. if (self.script.readyState === 'loaded' ||
  39805. self.script.readyState === 'complete') {
  39806. receiver.callback(null);
  39807. }
  39808. };
  39809. }
  39810. if (self.script.async === undefined && document.attachEvent &&
  39811. /opera/i.test(navigator.userAgent)) {
  39812. self.errorScript = document.createElement("script");
  39813. self.errorScript.id = receiver.id + "_error";
  39814. self.errorScript.text = receiver.name + "('" + errorString + "');";
  39815. self.script.async = self.errorScript.async = false;
  39816. }
  39817. else {
  39818. self.script.async = true;
  39819. }
  39820. var head = document.getElementsByTagName('head')[0];
  39821. head.insertBefore(self.script, head.firstChild);
  39822. if (self.errorScript) {
  39823. head.insertBefore(self.errorScript, self.script.nextSibling);
  39824. }
  39825. };
  39826. ScriptRequest.prototype.cleanup = function () {
  39827. if (this.script) {
  39828. this.script.onload = this.script.onerror = null;
  39829. this.script.onreadystatechange = null;
  39830. }
  39831. if (this.script && this.script.parentNode) {
  39832. this.script.parentNode.removeChild(this.script);
  39833. }
  39834. if (this.errorScript && this.errorScript.parentNode) {
  39835. this.errorScript.parentNode.removeChild(this.errorScript);
  39836. }
  39837. this.script = null;
  39838. this.errorScript = null;
  39839. };
  39840. return ScriptRequest;
  39841. }());
  39842. /* harmony default export */ var script_request = (ScriptRequest);
  39843. // CONCATENATED MODULE: ./src/runtimes/web/dom/jsonp_request.ts
  39844. var jsonp_request_JSONPRequest = (function () {
  39845. function JSONPRequest(url, data) {
  39846. this.url = url;
  39847. this.data = data;
  39848. }
  39849. JSONPRequest.prototype.send = function (receiver) {
  39850. if (this.request) {
  39851. return;
  39852. }
  39853. var query = buildQueryString(this.data);
  39854. var url = this.url + "/" + receiver.number + "?" + query;
  39855. this.request = runtime.createScriptRequest(url);
  39856. this.request.send(receiver);
  39857. };
  39858. JSONPRequest.prototype.cleanup = function () {
  39859. if (this.request) {
  39860. this.request.cleanup();
  39861. }
  39862. };
  39863. return JSONPRequest;
  39864. }());
  39865. /* harmony default export */ var jsonp_request = (jsonp_request_JSONPRequest);
  39866. // CONCATENATED MODULE: ./src/runtimes/web/timeline/jsonp_timeline.ts
  39867. var getAgent = function (sender, useTLS) {
  39868. return function (data, callback) {
  39869. var scheme = "http" + (useTLS ? "s" : "") + "://";
  39870. var url = scheme + (sender.host || sender.options.host) + sender.options.path;
  39871. var request = runtime.createJSONPRequest(url, data);
  39872. var receiver = runtime.ScriptReceivers.create(function (error, result) {
  39873. ScriptReceivers.remove(receiver);
  39874. request.cleanup();
  39875. if (result && result.host) {
  39876. sender.host = result.host;
  39877. }
  39878. if (callback) {
  39879. callback(error, result);
  39880. }
  39881. });
  39882. request.send(receiver);
  39883. };
  39884. };
  39885. var jsonp_timeline_jsonp = {
  39886. name: 'jsonp',
  39887. getAgent: getAgent
  39888. };
  39889. /* harmony default export */ var jsonp_timeline = (jsonp_timeline_jsonp);
  39890. // CONCATENATED MODULE: ./src/core/transports/url_schemes.ts
  39891. function getGenericURL(baseScheme, params, path) {
  39892. var scheme = baseScheme + (params.useTLS ? "s" : "");
  39893. var host = params.useTLS ? params.hostTLS : params.hostNonTLS;
  39894. return scheme + "://" + host + path;
  39895. }
  39896. function getGenericPath(key, queryString) {
  39897. var path = "/app/" + key;
  39898. var query = "?protocol=" + defaults.PROTOCOL +
  39899. "&client=js" +
  39900. "&version=" + defaults.VERSION +
  39901. (queryString ? ("&" + queryString) : "");
  39902. return path + query;
  39903. }
  39904. var ws = {
  39905. getInitial: function (key, params) {
  39906. var path = (params.httpPath || "") + getGenericPath(key, "flash=false");
  39907. return getGenericURL("ws", params, path);
  39908. }
  39909. };
  39910. var http = {
  39911. getInitial: function (key, params) {
  39912. var path = (params.httpPath || "/pusher") + getGenericPath(key);
  39913. return getGenericURL("http", params, path);
  39914. }
  39915. };
  39916. var sockjs = {
  39917. getInitial: function (key, params) {
  39918. return getGenericURL("http", params, params.httpPath || "/pusher");
  39919. },
  39920. getPath: function (key, params) {
  39921. return getGenericPath(key);
  39922. }
  39923. };
  39924. // CONCATENATED MODULE: ./src/core/events/callback_registry.ts
  39925. var callback_registry_CallbackRegistry = (function () {
  39926. function CallbackRegistry() {
  39927. this._callbacks = {};
  39928. }
  39929. CallbackRegistry.prototype.get = function (name) {
  39930. return this._callbacks[prefix(name)];
  39931. };
  39932. CallbackRegistry.prototype.add = function (name, callback, context) {
  39933. var prefixedEventName = prefix(name);
  39934. this._callbacks[prefixedEventName] = this._callbacks[prefixedEventName] || [];
  39935. this._callbacks[prefixedEventName].push({
  39936. fn: callback,
  39937. context: context
  39938. });
  39939. };
  39940. CallbackRegistry.prototype.remove = function (name, callback, context) {
  39941. if (!name && !callback && !context) {
  39942. this._callbacks = {};
  39943. return;
  39944. }
  39945. var names = name ? [prefix(name)] : keys(this._callbacks);
  39946. if (callback || context) {
  39947. this.removeCallback(names, callback, context);
  39948. }
  39949. else {
  39950. this.removeAllCallbacks(names);
  39951. }
  39952. };
  39953. CallbackRegistry.prototype.removeCallback = function (names, callback, context) {
  39954. apply(names, function (name) {
  39955. this._callbacks[name] = filter(this._callbacks[name] || [], function (binding) {
  39956. return (callback && callback !== binding.fn) ||
  39957. (context && context !== binding.context);
  39958. });
  39959. if (this._callbacks[name].length === 0) {
  39960. delete this._callbacks[name];
  39961. }
  39962. }, this);
  39963. };
  39964. CallbackRegistry.prototype.removeAllCallbacks = function (names) {
  39965. apply(names, function (name) {
  39966. delete this._callbacks[name];
  39967. }, this);
  39968. };
  39969. return CallbackRegistry;
  39970. }());
  39971. /* harmony default export */ var callback_registry = (callback_registry_CallbackRegistry);
  39972. function prefix(name) {
  39973. return "_" + name;
  39974. }
  39975. // CONCATENATED MODULE: ./src/core/events/dispatcher.ts
  39976. var dispatcher_Dispatcher = (function () {
  39977. function Dispatcher(failThrough) {
  39978. this.callbacks = new callback_registry();
  39979. this.global_callbacks = [];
  39980. this.failThrough = failThrough;
  39981. }
  39982. Dispatcher.prototype.bind = function (eventName, callback, context) {
  39983. this.callbacks.add(eventName, callback, context);
  39984. return this;
  39985. };
  39986. Dispatcher.prototype.bind_global = function (callback) {
  39987. this.global_callbacks.push(callback);
  39988. return this;
  39989. };
  39990. Dispatcher.prototype.unbind = function (eventName, callback, context) {
  39991. this.callbacks.remove(eventName, callback, context);
  39992. return this;
  39993. };
  39994. Dispatcher.prototype.unbind_global = function (callback) {
  39995. if (!callback) {
  39996. this.global_callbacks = [];
  39997. return this;
  39998. }
  39999. this.global_callbacks = filter(this.global_callbacks || [], function (c) { return c !== callback; });
  40000. return this;
  40001. };
  40002. Dispatcher.prototype.unbind_all = function () {
  40003. this.unbind();
  40004. this.unbind_global();
  40005. return this;
  40006. };
  40007. Dispatcher.prototype.emit = function (eventName, data, metadata) {
  40008. for (var i = 0; i < this.global_callbacks.length; i++) {
  40009. this.global_callbacks[i](eventName, data);
  40010. }
  40011. var callbacks = this.callbacks.get(eventName);
  40012. var args = [];
  40013. if (metadata) {
  40014. args.push(data, metadata);
  40015. }
  40016. else if (data) {
  40017. args.push(data);
  40018. }
  40019. if (callbacks && callbacks.length > 0) {
  40020. for (var i = 0; i < callbacks.length; i++) {
  40021. callbacks[i].fn.apply(callbacks[i].context || window, args);
  40022. }
  40023. }
  40024. else if (this.failThrough) {
  40025. this.failThrough(eventName, data);
  40026. }
  40027. return this;
  40028. };
  40029. return Dispatcher;
  40030. }());
  40031. /* harmony default export */ var dispatcher = (dispatcher_Dispatcher);
  40032. // CONCATENATED MODULE: ./src/core/transports/transport_connection.ts
  40033. var transport_connection_extends = (undefined && undefined.__extends) || (function () {
  40034. var extendStatics = function (d, b) {
  40035. extendStatics = Object.setPrototypeOf ||
  40036. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40037. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40038. return extendStatics(d, b);
  40039. };
  40040. return function (d, b) {
  40041. extendStatics(d, b);
  40042. function __() { this.constructor = d; }
  40043. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40044. };
  40045. })();
  40046. var transport_connection_TransportConnection = (function (_super) {
  40047. transport_connection_extends(TransportConnection, _super);
  40048. function TransportConnection(hooks, name, priority, key, options) {
  40049. var _this = _super.call(this) || this;
  40050. _this.initialize = runtime.transportConnectionInitializer;
  40051. _this.hooks = hooks;
  40052. _this.name = name;
  40053. _this.priority = priority;
  40054. _this.key = key;
  40055. _this.options = options;
  40056. _this.state = "new";
  40057. _this.timeline = options.timeline;
  40058. _this.activityTimeout = options.activityTimeout;
  40059. _this.id = _this.timeline.generateUniqueID();
  40060. return _this;
  40061. }
  40062. TransportConnection.prototype.handlesActivityChecks = function () {
  40063. return Boolean(this.hooks.handlesActivityChecks);
  40064. };
  40065. TransportConnection.prototype.supportsPing = function () {
  40066. return Boolean(this.hooks.supportsPing);
  40067. };
  40068. TransportConnection.prototype.connect = function () {
  40069. var _this = this;
  40070. if (this.socket || this.state !== "initialized") {
  40071. return false;
  40072. }
  40073. var url = this.hooks.urls.getInitial(this.key, this.options);
  40074. try {
  40075. this.socket = this.hooks.getSocket(url, this.options);
  40076. }
  40077. catch (e) {
  40078. util.defer(function () {
  40079. _this.onError(e);
  40080. _this.changeState("closed");
  40081. });
  40082. return false;
  40083. }
  40084. this.bindListeners();
  40085. logger.debug("Connecting", { transport: this.name, url: url });
  40086. this.changeState("connecting");
  40087. return true;
  40088. };
  40089. TransportConnection.prototype.close = function () {
  40090. if (this.socket) {
  40091. this.socket.close();
  40092. return true;
  40093. }
  40094. else {
  40095. return false;
  40096. }
  40097. };
  40098. TransportConnection.prototype.send = function (data) {
  40099. var _this = this;
  40100. if (this.state === "open") {
  40101. util.defer(function () {
  40102. if (_this.socket) {
  40103. _this.socket.send(data);
  40104. }
  40105. });
  40106. return true;
  40107. }
  40108. else {
  40109. return false;
  40110. }
  40111. };
  40112. TransportConnection.prototype.ping = function () {
  40113. if (this.state === "open" && this.supportsPing()) {
  40114. this.socket.ping();
  40115. }
  40116. };
  40117. TransportConnection.prototype.onOpen = function () {
  40118. if (this.hooks.beforeOpen) {
  40119. this.hooks.beforeOpen(this.socket, this.hooks.urls.getPath(this.key, this.options));
  40120. }
  40121. this.changeState("open");
  40122. this.socket.onopen = undefined;
  40123. };
  40124. TransportConnection.prototype.onError = function (error) {
  40125. this.emit("error", { type: 'WebSocketError', error: error });
  40126. this.timeline.error(this.buildTimelineMessage({ error: error.toString() }));
  40127. };
  40128. TransportConnection.prototype.onClose = function (closeEvent) {
  40129. if (closeEvent) {
  40130. this.changeState("closed", {
  40131. code: closeEvent.code,
  40132. reason: closeEvent.reason,
  40133. wasClean: closeEvent.wasClean
  40134. });
  40135. }
  40136. else {
  40137. this.changeState("closed");
  40138. }
  40139. this.unbindListeners();
  40140. this.socket = undefined;
  40141. };
  40142. TransportConnection.prototype.onMessage = function (message) {
  40143. this.emit("message", message);
  40144. };
  40145. TransportConnection.prototype.onActivity = function () {
  40146. this.emit("activity");
  40147. };
  40148. TransportConnection.prototype.bindListeners = function () {
  40149. var _this = this;
  40150. this.socket.onopen = function () {
  40151. _this.onOpen();
  40152. };
  40153. this.socket.onerror = function (error) {
  40154. _this.onError(error);
  40155. };
  40156. this.socket.onclose = function (closeEvent) {
  40157. _this.onClose(closeEvent);
  40158. };
  40159. this.socket.onmessage = function (message) {
  40160. _this.onMessage(message);
  40161. };
  40162. if (this.supportsPing()) {
  40163. this.socket.onactivity = function () { _this.onActivity(); };
  40164. }
  40165. };
  40166. TransportConnection.prototype.unbindListeners = function () {
  40167. if (this.socket) {
  40168. this.socket.onopen = undefined;
  40169. this.socket.onerror = undefined;
  40170. this.socket.onclose = undefined;
  40171. this.socket.onmessage = undefined;
  40172. if (this.supportsPing()) {
  40173. this.socket.onactivity = undefined;
  40174. }
  40175. }
  40176. };
  40177. TransportConnection.prototype.changeState = function (state, params) {
  40178. this.state = state;
  40179. this.timeline.info(this.buildTimelineMessage({
  40180. state: state,
  40181. params: params
  40182. }));
  40183. this.emit(state, params);
  40184. };
  40185. TransportConnection.prototype.buildTimelineMessage = function (message) {
  40186. return extend({ cid: this.id }, message);
  40187. };
  40188. return TransportConnection;
  40189. }(dispatcher));
  40190. /* harmony default export */ var transport_connection = (transport_connection_TransportConnection);
  40191. // CONCATENATED MODULE: ./src/core/transports/transport.ts
  40192. var transport_Transport = (function () {
  40193. function Transport(hooks) {
  40194. this.hooks = hooks;
  40195. }
  40196. Transport.prototype.isSupported = function (environment) {
  40197. return this.hooks.isSupported(environment);
  40198. };
  40199. Transport.prototype.createConnection = function (name, priority, key, options) {
  40200. return new transport_connection(this.hooks, name, priority, key, options);
  40201. };
  40202. return Transport;
  40203. }());
  40204. /* harmony default export */ var transports_transport = (transport_Transport);
  40205. // CONCATENATED MODULE: ./src/runtimes/isomorphic/transports/transports.ts
  40206. var WSTransport = new transports_transport({
  40207. urls: ws,
  40208. handlesActivityChecks: false,
  40209. supportsPing: false,
  40210. isInitialized: function () {
  40211. return Boolean(runtime.getWebSocketAPI());
  40212. },
  40213. isSupported: function () {
  40214. return Boolean(runtime.getWebSocketAPI());
  40215. },
  40216. getSocket: function (url) {
  40217. return runtime.createWebSocket(url);
  40218. }
  40219. });
  40220. var httpConfiguration = {
  40221. urls: http,
  40222. handlesActivityChecks: false,
  40223. supportsPing: true,
  40224. isInitialized: function () {
  40225. return true;
  40226. }
  40227. };
  40228. var streamingConfiguration = extend({ getSocket: function (url) {
  40229. return runtime.HTTPFactory.createStreamingSocket(url);
  40230. }
  40231. }, httpConfiguration);
  40232. var pollingConfiguration = extend({ getSocket: function (url) {
  40233. return runtime.HTTPFactory.createPollingSocket(url);
  40234. }
  40235. }, httpConfiguration);
  40236. var xhrConfiguration = {
  40237. isSupported: function () {
  40238. return runtime.isXHRSupported();
  40239. }
  40240. };
  40241. var XHRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xhrConfiguration));
  40242. var XHRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xhrConfiguration));
  40243. var Transports = {
  40244. ws: WSTransport,
  40245. xhr_streaming: XHRStreamingTransport,
  40246. xhr_polling: XHRPollingTransport
  40247. };
  40248. /* harmony default export */ var transports = (Transports);
  40249. // CONCATENATED MODULE: ./src/runtimes/web/transports/transports.ts
  40250. var SockJSTransport = new transports_transport({
  40251. file: "sockjs",
  40252. urls: sockjs,
  40253. handlesActivityChecks: true,
  40254. supportsPing: false,
  40255. isSupported: function () {
  40256. return true;
  40257. },
  40258. isInitialized: function () {
  40259. return window.SockJS !== undefined;
  40260. },
  40261. getSocket: function (url, options) {
  40262. return new window.SockJS(url, null, {
  40263. js_path: Dependencies.getPath("sockjs", {
  40264. useTLS: options.useTLS
  40265. }),
  40266. ignore_null_origin: options.ignoreNullOrigin
  40267. });
  40268. },
  40269. beforeOpen: function (socket, path) {
  40270. socket.send(JSON.stringify({
  40271. path: path
  40272. }));
  40273. }
  40274. });
  40275. var xdrConfiguration = {
  40276. isSupported: function (environment) {
  40277. var yes = runtime.isXDRSupported(environment.useTLS);
  40278. return yes;
  40279. }
  40280. };
  40281. var XDRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xdrConfiguration));
  40282. var XDRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xdrConfiguration));
  40283. transports.xdr_streaming = XDRStreamingTransport;
  40284. transports.xdr_polling = XDRPollingTransport;
  40285. transports.sockjs = SockJSTransport;
  40286. /* harmony default export */ var transports_transports = (transports);
  40287. // CONCATENATED MODULE: ./src/runtimes/web/net_info.ts
  40288. var net_info_extends = (undefined && undefined.__extends) || (function () {
  40289. var extendStatics = function (d, b) {
  40290. extendStatics = Object.setPrototypeOf ||
  40291. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40292. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40293. return extendStatics(d, b);
  40294. };
  40295. return function (d, b) {
  40296. extendStatics(d, b);
  40297. function __() { this.constructor = d; }
  40298. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40299. };
  40300. })();
  40301. var NetInfo = (function (_super) {
  40302. net_info_extends(NetInfo, _super);
  40303. function NetInfo() {
  40304. var _this = _super.call(this) || this;
  40305. var self = _this;
  40306. if (window.addEventListener !== undefined) {
  40307. window.addEventListener("online", function () {
  40308. self.emit('online');
  40309. }, false);
  40310. window.addEventListener("offline", function () {
  40311. self.emit('offline');
  40312. }, false);
  40313. }
  40314. return _this;
  40315. }
  40316. NetInfo.prototype.isOnline = function () {
  40317. if (window.navigator.onLine === undefined) {
  40318. return true;
  40319. }
  40320. else {
  40321. return window.navigator.onLine;
  40322. }
  40323. };
  40324. return NetInfo;
  40325. }(dispatcher));
  40326. var net_info_Network = new NetInfo();
  40327. // CONCATENATED MODULE: ./src/core/transports/assistant_to_the_transport_manager.ts
  40328. var assistant_to_the_transport_manager_AssistantToTheTransportManager = (function () {
  40329. function AssistantToTheTransportManager(manager, transport, options) {
  40330. this.manager = manager;
  40331. this.transport = transport;
  40332. this.minPingDelay = options.minPingDelay;
  40333. this.maxPingDelay = options.maxPingDelay;
  40334. this.pingDelay = undefined;
  40335. }
  40336. AssistantToTheTransportManager.prototype.createConnection = function (name, priority, key, options) {
  40337. var _this = this;
  40338. options = extend({}, options, {
  40339. activityTimeout: this.pingDelay
  40340. });
  40341. var connection = this.transport.createConnection(name, priority, key, options);
  40342. var openTimestamp = null;
  40343. var onOpen = function () {
  40344. connection.unbind("open", onOpen);
  40345. connection.bind("closed", onClosed);
  40346. openTimestamp = util.now();
  40347. };
  40348. var onClosed = function (closeEvent) {
  40349. connection.unbind("closed", onClosed);
  40350. if (closeEvent.code === 1002 || closeEvent.code === 1003) {
  40351. _this.manager.reportDeath();
  40352. }
  40353. else if (!closeEvent.wasClean && openTimestamp) {
  40354. var lifespan = util.now() - openTimestamp;
  40355. if (lifespan < 2 * _this.maxPingDelay) {
  40356. _this.manager.reportDeath();
  40357. _this.pingDelay = Math.max(lifespan / 2, _this.minPingDelay);
  40358. }
  40359. }
  40360. };
  40361. connection.bind("open", onOpen);
  40362. return connection;
  40363. };
  40364. AssistantToTheTransportManager.prototype.isSupported = function (environment) {
  40365. return this.manager.isAlive() && this.transport.isSupported(environment);
  40366. };
  40367. return AssistantToTheTransportManager;
  40368. }());
  40369. /* harmony default export */ var assistant_to_the_transport_manager = (assistant_to_the_transport_manager_AssistantToTheTransportManager);
  40370. // CONCATENATED MODULE: ./src/core/connection/protocol/protocol.ts
  40371. var Protocol = {
  40372. decodeMessage: function (messageEvent) {
  40373. try {
  40374. var messageData = JSON.parse(messageEvent.data);
  40375. var pusherEventData = messageData.data;
  40376. if (typeof pusherEventData === 'string') {
  40377. try {
  40378. pusherEventData = JSON.parse(messageData.data);
  40379. }
  40380. catch (e) { }
  40381. }
  40382. var pusherEvent = {
  40383. event: messageData.event,
  40384. channel: messageData.channel,
  40385. data: pusherEventData,
  40386. };
  40387. if (messageData.user_id) {
  40388. pusherEvent.user_id = messageData.user_id;
  40389. }
  40390. return pusherEvent;
  40391. }
  40392. catch (e) {
  40393. throw { type: 'MessageParseError', error: e, data: messageEvent.data };
  40394. }
  40395. },
  40396. encodeMessage: function (event) {
  40397. return JSON.stringify(event);
  40398. },
  40399. processHandshake: function (messageEvent) {
  40400. var message = Protocol.decodeMessage(messageEvent);
  40401. if (message.event === "pusher:connection_established") {
  40402. if (!message.data.activity_timeout) {
  40403. throw "No activity timeout specified in handshake";
  40404. }
  40405. return {
  40406. action: "connected",
  40407. id: message.data.socket_id,
  40408. activityTimeout: message.data.activity_timeout * 1000
  40409. };
  40410. }
  40411. else if (message.event === "pusher:error") {
  40412. return {
  40413. action: this.getCloseAction(message.data),
  40414. error: this.getCloseError(message.data)
  40415. };
  40416. }
  40417. else {
  40418. throw "Invalid handshake";
  40419. }
  40420. },
  40421. getCloseAction: function (closeEvent) {
  40422. if (closeEvent.code < 4000) {
  40423. if (closeEvent.code >= 1002 && closeEvent.code <= 1004) {
  40424. return "backoff";
  40425. }
  40426. else {
  40427. return null;
  40428. }
  40429. }
  40430. else if (closeEvent.code === 4000) {
  40431. return "tls_only";
  40432. }
  40433. else if (closeEvent.code < 4100) {
  40434. return "refused";
  40435. }
  40436. else if (closeEvent.code < 4200) {
  40437. return "backoff";
  40438. }
  40439. else if (closeEvent.code < 4300) {
  40440. return "retry";
  40441. }
  40442. else {
  40443. return "refused";
  40444. }
  40445. },
  40446. getCloseError: function (closeEvent) {
  40447. if (closeEvent.code !== 1000 && closeEvent.code !== 1001) {
  40448. return {
  40449. type: 'PusherError',
  40450. data: {
  40451. code: closeEvent.code,
  40452. message: closeEvent.reason || closeEvent.message
  40453. }
  40454. };
  40455. }
  40456. else {
  40457. return null;
  40458. }
  40459. }
  40460. };
  40461. /* harmony default export */ var protocol_protocol = (Protocol);
  40462. // CONCATENATED MODULE: ./src/core/connection/connection.ts
  40463. var connection_extends = (undefined && undefined.__extends) || (function () {
  40464. var extendStatics = function (d, b) {
  40465. extendStatics = Object.setPrototypeOf ||
  40466. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40467. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40468. return extendStatics(d, b);
  40469. };
  40470. return function (d, b) {
  40471. extendStatics(d, b);
  40472. function __() { this.constructor = d; }
  40473. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40474. };
  40475. })();
  40476. var connection_Connection = (function (_super) {
  40477. connection_extends(Connection, _super);
  40478. function Connection(id, transport) {
  40479. var _this = _super.call(this) || this;
  40480. _this.id = id;
  40481. _this.transport = transport;
  40482. _this.activityTimeout = transport.activityTimeout;
  40483. _this.bindListeners();
  40484. return _this;
  40485. }
  40486. Connection.prototype.handlesActivityChecks = function () {
  40487. return this.transport.handlesActivityChecks();
  40488. };
  40489. Connection.prototype.send = function (data) {
  40490. return this.transport.send(data);
  40491. };
  40492. Connection.prototype.send_event = function (name, data, channel) {
  40493. var event = { event: name, data: data };
  40494. if (channel) {
  40495. event.channel = channel;
  40496. }
  40497. logger.debug('Event sent', event);
  40498. return this.send(protocol_protocol.encodeMessage(event));
  40499. };
  40500. Connection.prototype.ping = function () {
  40501. if (this.transport.supportsPing()) {
  40502. this.transport.ping();
  40503. }
  40504. else {
  40505. this.send_event('pusher:ping', {});
  40506. }
  40507. };
  40508. Connection.prototype.close = function () {
  40509. this.transport.close();
  40510. };
  40511. Connection.prototype.bindListeners = function () {
  40512. var _this = this;
  40513. var listeners = {
  40514. message: function (messageEvent) {
  40515. var pusherEvent;
  40516. try {
  40517. pusherEvent = protocol_protocol.decodeMessage(messageEvent);
  40518. }
  40519. catch (e) {
  40520. _this.emit('error', {
  40521. type: 'MessageParseError',
  40522. error: e,
  40523. data: messageEvent.data
  40524. });
  40525. }
  40526. if (pusherEvent !== undefined) {
  40527. logger.debug('Event recd', pusherEvent);
  40528. switch (pusherEvent.event) {
  40529. case 'pusher:error':
  40530. _this.emit('error', { type: 'PusherError', data: pusherEvent.data });
  40531. break;
  40532. case 'pusher:ping':
  40533. _this.emit("ping");
  40534. break;
  40535. case 'pusher:pong':
  40536. _this.emit("pong");
  40537. break;
  40538. }
  40539. _this.emit('message', pusherEvent);
  40540. }
  40541. },
  40542. activity: function () {
  40543. _this.emit("activity");
  40544. },
  40545. error: function (error) {
  40546. _this.emit("error", { type: "WebSocketError", error: error });
  40547. },
  40548. closed: function (closeEvent) {
  40549. unbindListeners();
  40550. if (closeEvent && closeEvent.code) {
  40551. _this.handleCloseEvent(closeEvent);
  40552. }
  40553. _this.transport = null;
  40554. _this.emit("closed");
  40555. }
  40556. };
  40557. var unbindListeners = function () {
  40558. objectApply(listeners, function (listener, event) {
  40559. _this.transport.unbind(event, listener);
  40560. });
  40561. };
  40562. objectApply(listeners, function (listener, event) {
  40563. _this.transport.bind(event, listener);
  40564. });
  40565. };
  40566. Connection.prototype.handleCloseEvent = function (closeEvent) {
  40567. var action = protocol_protocol.getCloseAction(closeEvent);
  40568. var error = protocol_protocol.getCloseError(closeEvent);
  40569. if (error) {
  40570. this.emit('error', error);
  40571. }
  40572. if (action) {
  40573. this.emit(action, { action: action, error: error });
  40574. }
  40575. };
  40576. return Connection;
  40577. }(dispatcher));
  40578. /* harmony default export */ var connection_connection = (connection_Connection);
  40579. // CONCATENATED MODULE: ./src/core/connection/handshake/index.ts
  40580. var handshake_Handshake = (function () {
  40581. function Handshake(transport, callback) {
  40582. this.transport = transport;
  40583. this.callback = callback;
  40584. this.bindListeners();
  40585. }
  40586. Handshake.prototype.close = function () {
  40587. this.unbindListeners();
  40588. this.transport.close();
  40589. };
  40590. Handshake.prototype.bindListeners = function () {
  40591. var _this = this;
  40592. this.onMessage = function (m) {
  40593. _this.unbindListeners();
  40594. var result;
  40595. try {
  40596. result = protocol_protocol.processHandshake(m);
  40597. }
  40598. catch (e) {
  40599. _this.finish("error", { error: e });
  40600. _this.transport.close();
  40601. return;
  40602. }
  40603. if (result.action === "connected") {
  40604. _this.finish("connected", {
  40605. connection: new connection_connection(result.id, _this.transport),
  40606. activityTimeout: result.activityTimeout
  40607. });
  40608. }
  40609. else {
  40610. _this.finish(result.action, { error: result.error });
  40611. _this.transport.close();
  40612. }
  40613. };
  40614. this.onClosed = function (closeEvent) {
  40615. _this.unbindListeners();
  40616. var action = protocol_protocol.getCloseAction(closeEvent) || "backoff";
  40617. var error = protocol_protocol.getCloseError(closeEvent);
  40618. _this.finish(action, { error: error });
  40619. };
  40620. this.transport.bind("message", this.onMessage);
  40621. this.transport.bind("closed", this.onClosed);
  40622. };
  40623. Handshake.prototype.unbindListeners = function () {
  40624. this.transport.unbind("message", this.onMessage);
  40625. this.transport.unbind("closed", this.onClosed);
  40626. };
  40627. Handshake.prototype.finish = function (action, params) {
  40628. this.callback(extend({ transport: this.transport, action: action }, params));
  40629. };
  40630. return Handshake;
  40631. }());
  40632. /* harmony default export */ var connection_handshake = (handshake_Handshake);
  40633. // CONCATENATED MODULE: ./src/core/auth/pusher_authorizer.ts
  40634. var pusher_authorizer_PusherAuthorizer = (function () {
  40635. function PusherAuthorizer(channel, options) {
  40636. this.channel = channel;
  40637. var authTransport = options.authTransport;
  40638. if (typeof runtime.getAuthorizers()[authTransport] === "undefined") {
  40639. throw "'" + authTransport + "' is not a recognized auth transport";
  40640. }
  40641. this.type = authTransport;
  40642. this.options = options;
  40643. this.authOptions = (options || {}).auth || {};
  40644. }
  40645. PusherAuthorizer.prototype.composeQuery = function (socketId) {
  40646. var query = 'socket_id=' + encodeURIComponent(socketId) +
  40647. '&channel_name=' + encodeURIComponent(this.channel.name);
  40648. for (var i in this.authOptions.params) {
  40649. query += "&" + encodeURIComponent(i) + "=" + encodeURIComponent(this.authOptions.params[i]);
  40650. }
  40651. return query;
  40652. };
  40653. PusherAuthorizer.prototype.authorize = function (socketId, callback) {
  40654. PusherAuthorizer.authorizers = PusherAuthorizer.authorizers || runtime.getAuthorizers();
  40655. return PusherAuthorizer.authorizers[this.type].call(this, runtime, socketId, callback);
  40656. };
  40657. return PusherAuthorizer;
  40658. }());
  40659. /* harmony default export */ var pusher_authorizer = (pusher_authorizer_PusherAuthorizer);
  40660. // CONCATENATED MODULE: ./src/core/timeline/timeline_sender.ts
  40661. var timeline_sender_TimelineSender = (function () {
  40662. function TimelineSender(timeline, options) {
  40663. this.timeline = timeline;
  40664. this.options = options || {};
  40665. }
  40666. TimelineSender.prototype.send = function (useTLS, callback) {
  40667. if (this.timeline.isEmpty()) {
  40668. return;
  40669. }
  40670. this.timeline.send(runtime.TimelineTransport.getAgent(this, useTLS), callback);
  40671. };
  40672. return TimelineSender;
  40673. }());
  40674. /* harmony default export */ var timeline_sender = (timeline_sender_TimelineSender);
  40675. // CONCATENATED MODULE: ./src/core/errors.ts
  40676. var errors_extends = (undefined && undefined.__extends) || (function () {
  40677. var extendStatics = function (d, b) {
  40678. extendStatics = Object.setPrototypeOf ||
  40679. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40680. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40681. return extendStatics(d, b);
  40682. };
  40683. return function (d, b) {
  40684. extendStatics(d, b);
  40685. function __() { this.constructor = d; }
  40686. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40687. };
  40688. })();
  40689. var BadEventName = (function (_super) {
  40690. errors_extends(BadEventName, _super);
  40691. function BadEventName(msg) {
  40692. var _newTarget = this.constructor;
  40693. var _this = _super.call(this, msg) || this;
  40694. Object.setPrototypeOf(_this, _newTarget.prototype);
  40695. return _this;
  40696. }
  40697. return BadEventName;
  40698. }(Error));
  40699. var RequestTimedOut = (function (_super) {
  40700. errors_extends(RequestTimedOut, _super);
  40701. function RequestTimedOut(msg) {
  40702. var _newTarget = this.constructor;
  40703. var _this = _super.call(this, msg) || this;
  40704. Object.setPrototypeOf(_this, _newTarget.prototype);
  40705. return _this;
  40706. }
  40707. return RequestTimedOut;
  40708. }(Error));
  40709. var TransportPriorityTooLow = (function (_super) {
  40710. errors_extends(TransportPriorityTooLow, _super);
  40711. function TransportPriorityTooLow(msg) {
  40712. var _newTarget = this.constructor;
  40713. var _this = _super.call(this, msg) || this;
  40714. Object.setPrototypeOf(_this, _newTarget.prototype);
  40715. return _this;
  40716. }
  40717. return TransportPriorityTooLow;
  40718. }(Error));
  40719. var TransportClosed = (function (_super) {
  40720. errors_extends(TransportClosed, _super);
  40721. function TransportClosed(msg) {
  40722. var _newTarget = this.constructor;
  40723. var _this = _super.call(this, msg) || this;
  40724. Object.setPrototypeOf(_this, _newTarget.prototype);
  40725. return _this;
  40726. }
  40727. return TransportClosed;
  40728. }(Error));
  40729. var UnsupportedFeature = (function (_super) {
  40730. errors_extends(UnsupportedFeature, _super);
  40731. function UnsupportedFeature(msg) {
  40732. var _newTarget = this.constructor;
  40733. var _this = _super.call(this, msg) || this;
  40734. Object.setPrototypeOf(_this, _newTarget.prototype);
  40735. return _this;
  40736. }
  40737. return UnsupportedFeature;
  40738. }(Error));
  40739. var UnsupportedTransport = (function (_super) {
  40740. errors_extends(UnsupportedTransport, _super);
  40741. function UnsupportedTransport(msg) {
  40742. var _newTarget = this.constructor;
  40743. var _this = _super.call(this, msg) || this;
  40744. Object.setPrototypeOf(_this, _newTarget.prototype);
  40745. return _this;
  40746. }
  40747. return UnsupportedTransport;
  40748. }(Error));
  40749. var UnsupportedStrategy = (function (_super) {
  40750. errors_extends(UnsupportedStrategy, _super);
  40751. function UnsupportedStrategy(msg) {
  40752. var _newTarget = this.constructor;
  40753. var _this = _super.call(this, msg) || this;
  40754. Object.setPrototypeOf(_this, _newTarget.prototype);
  40755. return _this;
  40756. }
  40757. return UnsupportedStrategy;
  40758. }(Error));
  40759. // CONCATENATED MODULE: ./src/core/channels/channel.ts
  40760. var channel_extends = (undefined && undefined.__extends) || (function () {
  40761. var extendStatics = function (d, b) {
  40762. extendStatics = Object.setPrototypeOf ||
  40763. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40764. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40765. return extendStatics(d, b);
  40766. };
  40767. return function (d, b) {
  40768. extendStatics(d, b);
  40769. function __() { this.constructor = d; }
  40770. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40771. };
  40772. })();
  40773. var channel_Channel = (function (_super) {
  40774. channel_extends(Channel, _super);
  40775. function Channel(name, pusher) {
  40776. var _this = _super.call(this, function (event, data) {
  40777. logger.debug('No callbacks on ' + name + ' for ' + event);
  40778. }) || this;
  40779. _this.name = name;
  40780. _this.pusher = pusher;
  40781. _this.subscribed = false;
  40782. _this.subscriptionPending = false;
  40783. _this.subscriptionCancelled = false;
  40784. return _this;
  40785. }
  40786. Channel.prototype.authorize = function (socketId, callback) {
  40787. return callback(false, {});
  40788. };
  40789. Channel.prototype.trigger = function (event, data) {
  40790. if (event.indexOf("client-") !== 0) {
  40791. throw new BadEventName("Event '" + event + "' does not start with 'client-'");
  40792. }
  40793. if (!this.subscribed) {
  40794. var suffix = url_store.buildLogSuffix("triggeringClientEvents");
  40795. logger.warn("Client event triggered before channel 'subscription_succeeded' event . " + suffix);
  40796. }
  40797. return this.pusher.send_event(event, data, this.name);
  40798. };
  40799. Channel.prototype.disconnect = function () {
  40800. this.subscribed = false;
  40801. this.subscriptionPending = false;
  40802. };
  40803. Channel.prototype.handleEvent = function (event) {
  40804. var eventName = event.event;
  40805. var data = event.data;
  40806. if (eventName === "pusher_internal:subscription_succeeded") {
  40807. this.handleSubscriptionSucceededEvent(event);
  40808. }
  40809. else if (eventName.indexOf("pusher_internal:") !== 0) {
  40810. var metadata = {};
  40811. this.emit(eventName, data, metadata);
  40812. }
  40813. };
  40814. Channel.prototype.handleSubscriptionSucceededEvent = function (event) {
  40815. this.subscriptionPending = false;
  40816. this.subscribed = true;
  40817. if (this.subscriptionCancelled) {
  40818. this.pusher.unsubscribe(this.name);
  40819. }
  40820. else {
  40821. this.emit("pusher:subscription_succeeded", event.data);
  40822. }
  40823. };
  40824. Channel.prototype.subscribe = function () {
  40825. var _this = this;
  40826. if (this.subscribed) {
  40827. return;
  40828. }
  40829. this.subscriptionPending = true;
  40830. this.subscriptionCancelled = false;
  40831. this.authorize(this.pusher.connection.socket_id, function (error, data) {
  40832. if (error) {
  40833. logger.error(data);
  40834. _this.emit('pusher:subscription_error', data);
  40835. }
  40836. else {
  40837. _this.pusher.send_event('pusher:subscribe', {
  40838. auth: data.auth,
  40839. channel_data: data.channel_data,
  40840. channel: _this.name
  40841. });
  40842. }
  40843. });
  40844. };
  40845. Channel.prototype.unsubscribe = function () {
  40846. this.subscribed = false;
  40847. this.pusher.send_event('pusher:unsubscribe', {
  40848. channel: this.name
  40849. });
  40850. };
  40851. Channel.prototype.cancelSubscription = function () {
  40852. this.subscriptionCancelled = true;
  40853. };
  40854. Channel.prototype.reinstateSubscription = function () {
  40855. this.subscriptionCancelled = false;
  40856. };
  40857. return Channel;
  40858. }(dispatcher));
  40859. /* harmony default export */ var channels_channel = (channel_Channel);
  40860. // CONCATENATED MODULE: ./src/core/channels/private_channel.ts
  40861. var private_channel_extends = (undefined && undefined.__extends) || (function () {
  40862. var extendStatics = function (d, b) {
  40863. extendStatics = Object.setPrototypeOf ||
  40864. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40865. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40866. return extendStatics(d, b);
  40867. };
  40868. return function (d, b) {
  40869. extendStatics(d, b);
  40870. function __() { this.constructor = d; }
  40871. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40872. };
  40873. })();
  40874. var private_channel_PrivateChannel = (function (_super) {
  40875. private_channel_extends(PrivateChannel, _super);
  40876. function PrivateChannel() {
  40877. return _super !== null && _super.apply(this, arguments) || this;
  40878. }
  40879. PrivateChannel.prototype.authorize = function (socketId, callback) {
  40880. var authorizer = factory.createAuthorizer(this, this.pusher.config);
  40881. return authorizer.authorize(socketId, callback);
  40882. };
  40883. return PrivateChannel;
  40884. }(channels_channel));
  40885. /* harmony default export */ var private_channel = (private_channel_PrivateChannel);
  40886. // CONCATENATED MODULE: ./src/core/channels/members.ts
  40887. var members_Members = (function () {
  40888. function Members() {
  40889. this.reset();
  40890. }
  40891. Members.prototype.get = function (id) {
  40892. if (Object.prototype.hasOwnProperty.call(this.members, id)) {
  40893. return {
  40894. id: id,
  40895. info: this.members[id]
  40896. };
  40897. }
  40898. else {
  40899. return null;
  40900. }
  40901. };
  40902. Members.prototype.each = function (callback) {
  40903. var _this = this;
  40904. objectApply(this.members, function (member, id) {
  40905. callback(_this.get(id));
  40906. });
  40907. };
  40908. Members.prototype.setMyID = function (id) {
  40909. this.myID = id;
  40910. };
  40911. Members.prototype.onSubscription = function (subscriptionData) {
  40912. this.members = subscriptionData.presence.hash;
  40913. this.count = subscriptionData.presence.count;
  40914. this.me = this.get(this.myID);
  40915. };
  40916. Members.prototype.addMember = function (memberData) {
  40917. if (this.get(memberData.user_id) === null) {
  40918. this.count++;
  40919. }
  40920. this.members[memberData.user_id] = memberData.user_info;
  40921. return this.get(memberData.user_id);
  40922. };
  40923. Members.prototype.removeMember = function (memberData) {
  40924. var member = this.get(memberData.user_id);
  40925. if (member) {
  40926. delete this.members[memberData.user_id];
  40927. this.count--;
  40928. }
  40929. return member;
  40930. };
  40931. Members.prototype.reset = function () {
  40932. this.members = {};
  40933. this.count = 0;
  40934. this.myID = null;
  40935. this.me = null;
  40936. };
  40937. return Members;
  40938. }());
  40939. /* harmony default export */ var members = (members_Members);
  40940. // CONCATENATED MODULE: ./src/core/channels/presence_channel.ts
  40941. var presence_channel_extends = (undefined && undefined.__extends) || (function () {
  40942. var extendStatics = function (d, b) {
  40943. extendStatics = Object.setPrototypeOf ||
  40944. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40945. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40946. return extendStatics(d, b);
  40947. };
  40948. return function (d, b) {
  40949. extendStatics(d, b);
  40950. function __() { this.constructor = d; }
  40951. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40952. };
  40953. })();
  40954. var presence_channel_PresenceChannel = (function (_super) {
  40955. presence_channel_extends(PresenceChannel, _super);
  40956. function PresenceChannel(name, pusher) {
  40957. var _this = _super.call(this, name, pusher) || this;
  40958. _this.members = new members();
  40959. return _this;
  40960. }
  40961. PresenceChannel.prototype.authorize = function (socketId, callback) {
  40962. var _this = this;
  40963. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  40964. if (!error) {
  40965. if (authData.channel_data === undefined) {
  40966. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  40967. logger.error("Invalid auth response for channel '" + _this.name + "'," +
  40968. ("expected 'channel_data' field. " + suffix));
  40969. callback("Invalid auth response");
  40970. return;
  40971. }
  40972. var channelData = JSON.parse(authData.channel_data);
  40973. _this.members.setMyID(channelData.user_id);
  40974. }
  40975. callback(error, authData);
  40976. });
  40977. };
  40978. PresenceChannel.prototype.handleEvent = function (event) {
  40979. var eventName = event.event;
  40980. if (eventName.indexOf("pusher_internal:") === 0) {
  40981. this.handleInternalEvent(event);
  40982. }
  40983. else {
  40984. var data = event.data;
  40985. var metadata = {};
  40986. if (event.user_id) {
  40987. metadata.user_id = event.user_id;
  40988. }
  40989. this.emit(eventName, data, metadata);
  40990. }
  40991. };
  40992. PresenceChannel.prototype.handleInternalEvent = function (event) {
  40993. var eventName = event.event;
  40994. var data = event.data;
  40995. switch (eventName) {
  40996. case "pusher_internal:subscription_succeeded":
  40997. this.handleSubscriptionSucceededEvent(event);
  40998. break;
  40999. case "pusher_internal:member_added":
  41000. var addedMember = this.members.addMember(data);
  41001. this.emit('pusher:member_added', addedMember);
  41002. break;
  41003. case "pusher_internal:member_removed":
  41004. var removedMember = this.members.removeMember(data);
  41005. if (removedMember) {
  41006. this.emit('pusher:member_removed', removedMember);
  41007. }
  41008. break;
  41009. }
  41010. };
  41011. PresenceChannel.prototype.handleSubscriptionSucceededEvent = function (event) {
  41012. this.subscriptionPending = false;
  41013. this.subscribed = true;
  41014. if (this.subscriptionCancelled) {
  41015. this.pusher.unsubscribe(this.name);
  41016. }
  41017. else {
  41018. this.members.onSubscription(event.data);
  41019. this.emit("pusher:subscription_succeeded", this.members);
  41020. }
  41021. };
  41022. PresenceChannel.prototype.disconnect = function () {
  41023. this.members.reset();
  41024. _super.prototype.disconnect.call(this);
  41025. };
  41026. return PresenceChannel;
  41027. }(private_channel));
  41028. /* harmony default export */ var presence_channel = (presence_channel_PresenceChannel);
  41029. // EXTERNAL MODULE: ./node_modules/tweetnacl/nacl-fast.js
  41030. var nacl_fast = __webpack_require__(0);
  41031. // EXTERNAL MODULE: ./node_modules/tweetnacl-util/nacl-util.js
  41032. var nacl_util = __webpack_require__(1);
  41033. // CONCATENATED MODULE: ./src/core/channels/encrypted_channel.ts
  41034. var encrypted_channel_extends = (undefined && undefined.__extends) || (function () {
  41035. var extendStatics = function (d, b) {
  41036. extendStatics = Object.setPrototypeOf ||
  41037. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41038. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41039. return extendStatics(d, b);
  41040. };
  41041. return function (d, b) {
  41042. extendStatics(d, b);
  41043. function __() { this.constructor = d; }
  41044. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41045. };
  41046. })();
  41047. var encrypted_channel_EncryptedChannel = (function (_super) {
  41048. encrypted_channel_extends(EncryptedChannel, _super);
  41049. function EncryptedChannel() {
  41050. var _this = _super !== null && _super.apply(this, arguments) || this;
  41051. _this.key = null;
  41052. return _this;
  41053. }
  41054. EncryptedChannel.prototype.authorize = function (socketId, callback) {
  41055. var _this = this;
  41056. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  41057. if (error) {
  41058. callback(true, authData);
  41059. return;
  41060. }
  41061. var sharedSecret = authData["shared_secret"];
  41062. if (!sharedSecret) {
  41063. var errorMsg = "No shared_secret key in auth payload for encrypted channel: " + _this.name;
  41064. callback(true, errorMsg);
  41065. return;
  41066. }
  41067. _this.key = Object(nacl_util["decodeBase64"])(sharedSecret);
  41068. delete authData["shared_secret"];
  41069. callback(false, authData);
  41070. });
  41071. };
  41072. EncryptedChannel.prototype.trigger = function (event, data) {
  41073. throw new UnsupportedFeature('Client events are not currently supported for encrypted channels');
  41074. };
  41075. EncryptedChannel.prototype.handleEvent = function (event) {
  41076. var eventName = event.event;
  41077. var data = event.data;
  41078. if (eventName.indexOf("pusher_internal:") === 0 || eventName.indexOf("pusher:") === 0) {
  41079. _super.prototype.handleEvent.call(this, event);
  41080. return;
  41081. }
  41082. this.handleEncryptedEvent(eventName, data);
  41083. };
  41084. EncryptedChannel.prototype.handleEncryptedEvent = function (event, data) {
  41085. var _this = this;
  41086. if (!this.key) {
  41087. logger.debug('Received encrypted event before key has been retrieved from the authEndpoint');
  41088. return;
  41089. }
  41090. if (!data.ciphertext || !data.nonce) {
  41091. logger.error('Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: ' + data);
  41092. return;
  41093. }
  41094. var cipherText = Object(nacl_util["decodeBase64"])(data.ciphertext);
  41095. if (cipherText.length < nacl_fast["secretbox"].overheadLength) {
  41096. logger.error("Expected encrypted event ciphertext length to be " + nacl_fast["secretbox"].overheadLength + ", got: " + cipherText.length);
  41097. return;
  41098. }
  41099. var nonce = Object(nacl_util["decodeBase64"])(data.nonce);
  41100. if (nonce.length < nacl_fast["secretbox"].nonceLength) {
  41101. logger.error("Expected encrypted event nonce length to be " + nacl_fast["secretbox"].nonceLength + ", got: " + nonce.length);
  41102. return;
  41103. }
  41104. var bytes = nacl_fast["secretbox"].open(cipherText, nonce, this.key);
  41105. if (bytes === null) {
  41106. logger.debug('Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint...');
  41107. this.authorize(this.pusher.connection.socket_id, function (error, authData) {
  41108. if (error) {
  41109. logger.error("Failed to make a request to the authEndpoint: " + authData + ". Unable to fetch new key, so dropping encrypted event");
  41110. return;
  41111. }
  41112. bytes = nacl_fast["secretbox"].open(cipherText, nonce, _this.key);
  41113. if (bytes === null) {
  41114. logger.error("Failed to decrypt event with new key. Dropping encrypted event");
  41115. return;
  41116. }
  41117. _this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  41118. return;
  41119. });
  41120. return;
  41121. }
  41122. this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  41123. };
  41124. EncryptedChannel.prototype.emitJSON = function (eventName, data) {
  41125. try {
  41126. this.emit(eventName, JSON.parse(data));
  41127. }
  41128. catch (e) {
  41129. this.emit(eventName, data);
  41130. }
  41131. return this;
  41132. };
  41133. return EncryptedChannel;
  41134. }(private_channel));
  41135. /* harmony default export */ var encrypted_channel = (encrypted_channel_EncryptedChannel);
  41136. // CONCATENATED MODULE: ./src/core/connection/connection_manager.ts
  41137. var connection_manager_extends = (undefined && undefined.__extends) || (function () {
  41138. var extendStatics = function (d, b) {
  41139. extendStatics = Object.setPrototypeOf ||
  41140. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41141. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41142. return extendStatics(d, b);
  41143. };
  41144. return function (d, b) {
  41145. extendStatics(d, b);
  41146. function __() { this.constructor = d; }
  41147. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41148. };
  41149. })();
  41150. var connection_manager_ConnectionManager = (function (_super) {
  41151. connection_manager_extends(ConnectionManager, _super);
  41152. function ConnectionManager(key, options) {
  41153. var _this = _super.call(this) || this;
  41154. _this.key = key;
  41155. _this.options = options || {};
  41156. _this.state = "initialized";
  41157. _this.connection = null;
  41158. _this.usingTLS = !!options.useTLS;
  41159. _this.timeline = _this.options.timeline;
  41160. _this.errorCallbacks = _this.buildErrorCallbacks();
  41161. _this.connectionCallbacks = _this.buildConnectionCallbacks(_this.errorCallbacks);
  41162. _this.handshakeCallbacks = _this.buildHandshakeCallbacks(_this.errorCallbacks);
  41163. var Network = runtime.getNetwork();
  41164. Network.bind("online", function () {
  41165. _this.timeline.info({ netinfo: "online" });
  41166. if (_this.state === "connecting" || _this.state === "unavailable") {
  41167. _this.retryIn(0);
  41168. }
  41169. });
  41170. Network.bind("offline", function () {
  41171. _this.timeline.info({ netinfo: "offline" });
  41172. if (_this.connection) {
  41173. _this.sendActivityCheck();
  41174. }
  41175. });
  41176. _this.updateStrategy();
  41177. return _this;
  41178. }
  41179. ConnectionManager.prototype.connect = function () {
  41180. if (this.connection || this.runner) {
  41181. return;
  41182. }
  41183. if (!this.strategy.isSupported()) {
  41184. this.updateState("failed");
  41185. return;
  41186. }
  41187. this.updateState("connecting");
  41188. this.startConnecting();
  41189. this.setUnavailableTimer();
  41190. };
  41191. ;
  41192. ConnectionManager.prototype.send = function (data) {
  41193. if (this.connection) {
  41194. return this.connection.send(data);
  41195. }
  41196. else {
  41197. return false;
  41198. }
  41199. };
  41200. ;
  41201. ConnectionManager.prototype.send_event = function (name, data, channel) {
  41202. if (this.connection) {
  41203. return this.connection.send_event(name, data, channel);
  41204. }
  41205. else {
  41206. return false;
  41207. }
  41208. };
  41209. ;
  41210. ConnectionManager.prototype.disconnect = function () {
  41211. this.disconnectInternally();
  41212. this.updateState("disconnected");
  41213. };
  41214. ;
  41215. ConnectionManager.prototype.isUsingTLS = function () {
  41216. return this.usingTLS;
  41217. };
  41218. ;
  41219. ConnectionManager.prototype.startConnecting = function () {
  41220. var _this = this;
  41221. var callback = function (error, handshake) {
  41222. if (error) {
  41223. _this.runner = _this.strategy.connect(0, callback);
  41224. }
  41225. else {
  41226. if (handshake.action === "error") {
  41227. _this.emit("error", { type: "HandshakeError", error: handshake.error });
  41228. _this.timeline.error({ handshakeError: handshake.error });
  41229. }
  41230. else {
  41231. _this.abortConnecting();
  41232. _this.handshakeCallbacks[handshake.action](handshake);
  41233. }
  41234. }
  41235. };
  41236. this.runner = this.strategy.connect(0, callback);
  41237. };
  41238. ;
  41239. ConnectionManager.prototype.abortConnecting = function () {
  41240. if (this.runner) {
  41241. this.runner.abort();
  41242. this.runner = null;
  41243. }
  41244. };
  41245. ;
  41246. ConnectionManager.prototype.disconnectInternally = function () {
  41247. this.abortConnecting();
  41248. this.clearRetryTimer();
  41249. this.clearUnavailableTimer();
  41250. if (this.connection) {
  41251. var connection = this.abandonConnection();
  41252. connection.close();
  41253. }
  41254. };
  41255. ;
  41256. ConnectionManager.prototype.updateStrategy = function () {
  41257. this.strategy = this.options.getStrategy({
  41258. key: this.key,
  41259. timeline: this.timeline,
  41260. useTLS: this.usingTLS
  41261. });
  41262. };
  41263. ;
  41264. ConnectionManager.prototype.retryIn = function (delay) {
  41265. var _this = this;
  41266. this.timeline.info({ action: "retry", delay: delay });
  41267. if (delay > 0) {
  41268. this.emit("connecting_in", Math.round(delay / 1000));
  41269. }
  41270. this.retryTimer = new OneOffTimer(delay || 0, function () {
  41271. _this.disconnectInternally();
  41272. _this.connect();
  41273. });
  41274. };
  41275. ;
  41276. ConnectionManager.prototype.clearRetryTimer = function () {
  41277. if (this.retryTimer) {
  41278. this.retryTimer.ensureAborted();
  41279. this.retryTimer = null;
  41280. }
  41281. };
  41282. ;
  41283. ConnectionManager.prototype.setUnavailableTimer = function () {
  41284. var _this = this;
  41285. this.unavailableTimer = new OneOffTimer(this.options.unavailableTimeout, function () {
  41286. _this.updateState("unavailable");
  41287. });
  41288. };
  41289. ;
  41290. ConnectionManager.prototype.clearUnavailableTimer = function () {
  41291. if (this.unavailableTimer) {
  41292. this.unavailableTimer.ensureAborted();
  41293. }
  41294. };
  41295. ;
  41296. ConnectionManager.prototype.sendActivityCheck = function () {
  41297. var _this = this;
  41298. this.stopActivityCheck();
  41299. this.connection.ping();
  41300. this.activityTimer = new OneOffTimer(this.options.pongTimeout, function () {
  41301. _this.timeline.error({ pong_timed_out: _this.options.pongTimeout });
  41302. _this.retryIn(0);
  41303. });
  41304. };
  41305. ;
  41306. ConnectionManager.prototype.resetActivityCheck = function () {
  41307. var _this = this;
  41308. this.stopActivityCheck();
  41309. if (this.connection && !this.connection.handlesActivityChecks()) {
  41310. this.activityTimer = new OneOffTimer(this.activityTimeout, function () {
  41311. _this.sendActivityCheck();
  41312. });
  41313. }
  41314. };
  41315. ;
  41316. ConnectionManager.prototype.stopActivityCheck = function () {
  41317. if (this.activityTimer) {
  41318. this.activityTimer.ensureAborted();
  41319. }
  41320. };
  41321. ;
  41322. ConnectionManager.prototype.buildConnectionCallbacks = function (errorCallbacks) {
  41323. var _this = this;
  41324. return extend({}, errorCallbacks, {
  41325. message: function (message) {
  41326. _this.resetActivityCheck();
  41327. _this.emit('message', message);
  41328. },
  41329. ping: function () {
  41330. _this.send_event('pusher:pong', {});
  41331. },
  41332. activity: function () {
  41333. _this.resetActivityCheck();
  41334. },
  41335. error: function (error) {
  41336. _this.emit("error", { type: "WebSocketError", error: error });
  41337. },
  41338. closed: function () {
  41339. _this.abandonConnection();
  41340. if (_this.shouldRetry()) {
  41341. _this.retryIn(1000);
  41342. }
  41343. }
  41344. });
  41345. };
  41346. ;
  41347. ConnectionManager.prototype.buildHandshakeCallbacks = function (errorCallbacks) {
  41348. var _this = this;
  41349. return extend({}, errorCallbacks, {
  41350. connected: function (handshake) {
  41351. _this.activityTimeout = Math.min(_this.options.activityTimeout, handshake.activityTimeout, handshake.connection.activityTimeout || Infinity);
  41352. _this.clearUnavailableTimer();
  41353. _this.setConnection(handshake.connection);
  41354. _this.socket_id = _this.connection.id;
  41355. _this.updateState("connected", { socket_id: _this.socket_id });
  41356. }
  41357. });
  41358. };
  41359. ;
  41360. ConnectionManager.prototype.buildErrorCallbacks = function () {
  41361. var _this = this;
  41362. var withErrorEmitted = function (callback) {
  41363. return function (result) {
  41364. if (result.error) {
  41365. _this.emit("error", { type: "WebSocketError", error: result.error });
  41366. }
  41367. callback(result);
  41368. };
  41369. };
  41370. return {
  41371. tls_only: withErrorEmitted(function () {
  41372. _this.usingTLS = true;
  41373. _this.updateStrategy();
  41374. _this.retryIn(0);
  41375. }),
  41376. refused: withErrorEmitted(function () {
  41377. _this.disconnect();
  41378. }),
  41379. backoff: withErrorEmitted(function () {
  41380. _this.retryIn(1000);
  41381. }),
  41382. retry: withErrorEmitted(function () {
  41383. _this.retryIn(0);
  41384. })
  41385. };
  41386. };
  41387. ;
  41388. ConnectionManager.prototype.setConnection = function (connection) {
  41389. this.connection = connection;
  41390. for (var event in this.connectionCallbacks) {
  41391. this.connection.bind(event, this.connectionCallbacks[event]);
  41392. }
  41393. this.resetActivityCheck();
  41394. };
  41395. ;
  41396. ConnectionManager.prototype.abandonConnection = function () {
  41397. if (!this.connection) {
  41398. return;
  41399. }
  41400. this.stopActivityCheck();
  41401. for (var event in this.connectionCallbacks) {
  41402. this.connection.unbind(event, this.connectionCallbacks[event]);
  41403. }
  41404. var connection = this.connection;
  41405. this.connection = null;
  41406. return connection;
  41407. };
  41408. ConnectionManager.prototype.updateState = function (newState, data) {
  41409. var previousState = this.state;
  41410. this.state = newState;
  41411. if (previousState !== newState) {
  41412. var newStateDescription = newState;
  41413. if (newStateDescription === "connected") {
  41414. newStateDescription += " with new socket ID " + data.socket_id;
  41415. }
  41416. logger.debug('State changed', previousState + ' -> ' + newStateDescription);
  41417. this.timeline.info({ state: newState, params: data });
  41418. this.emit('state_change', { previous: previousState, current: newState });
  41419. this.emit(newState, data);
  41420. }
  41421. };
  41422. ConnectionManager.prototype.shouldRetry = function () {
  41423. return this.state === "connecting" || this.state === "connected";
  41424. };
  41425. return ConnectionManager;
  41426. }(dispatcher));
  41427. /* harmony default export */ var connection_manager = (connection_manager_ConnectionManager);
  41428. // CONCATENATED MODULE: ./src/core/channels/channels.ts
  41429. var channels_Channels = (function () {
  41430. function Channels() {
  41431. this.channels = {};
  41432. }
  41433. Channels.prototype.add = function (name, pusher) {
  41434. if (!this.channels[name]) {
  41435. this.channels[name] = createChannel(name, pusher);
  41436. }
  41437. return this.channels[name];
  41438. };
  41439. Channels.prototype.all = function () {
  41440. return values(this.channels);
  41441. };
  41442. Channels.prototype.find = function (name) {
  41443. return this.channels[name];
  41444. };
  41445. Channels.prototype.remove = function (name) {
  41446. var channel = this.channels[name];
  41447. delete this.channels[name];
  41448. return channel;
  41449. };
  41450. Channels.prototype.disconnect = function () {
  41451. objectApply(this.channels, function (channel) {
  41452. channel.disconnect();
  41453. });
  41454. };
  41455. return Channels;
  41456. }());
  41457. /* harmony default export */ var channels = (channels_Channels);
  41458. function createChannel(name, pusher) {
  41459. if (name.indexOf('private-encrypted-') === 0) {
  41460. if (false) { var errorMsg; }
  41461. return factory.createEncryptedChannel(name, pusher);
  41462. }
  41463. else if (name.indexOf('private-') === 0) {
  41464. return factory.createPrivateChannel(name, pusher);
  41465. }
  41466. else if (name.indexOf('presence-') === 0) {
  41467. return factory.createPresenceChannel(name, pusher);
  41468. }
  41469. else {
  41470. return factory.createChannel(name, pusher);
  41471. }
  41472. }
  41473. // CONCATENATED MODULE: ./src/core/utils/factory.ts
  41474. var Factory = {
  41475. createChannels: function () {
  41476. return new channels();
  41477. },
  41478. createConnectionManager: function (key, options) {
  41479. return new connection_manager(key, options);
  41480. },
  41481. createChannel: function (name, pusher) {
  41482. return new channels_channel(name, pusher);
  41483. },
  41484. createPrivateChannel: function (name, pusher) {
  41485. return new private_channel(name, pusher);
  41486. },
  41487. createPresenceChannel: function (name, pusher) {
  41488. return new presence_channel(name, pusher);
  41489. },
  41490. createEncryptedChannel: function (name, pusher) {
  41491. return new encrypted_channel(name, pusher);
  41492. },
  41493. createTimelineSender: function (timeline, options) {
  41494. return new timeline_sender(timeline, options);
  41495. },
  41496. createAuthorizer: function (channel, options) {
  41497. if (options.authorizer) {
  41498. return options.authorizer(channel, options);
  41499. }
  41500. return new pusher_authorizer(channel, options);
  41501. },
  41502. createHandshake: function (transport, callback) {
  41503. return new connection_handshake(transport, callback);
  41504. },
  41505. createAssistantToTheTransportManager: function (manager, transport, options) {
  41506. return new assistant_to_the_transport_manager(manager, transport, options);
  41507. }
  41508. };
  41509. /* harmony default export */ var factory = (Factory);
  41510. // CONCATENATED MODULE: ./src/core/transports/transport_manager.ts
  41511. var transport_manager_TransportManager = (function () {
  41512. function TransportManager(options) {
  41513. this.options = options || {};
  41514. this.livesLeft = this.options.lives || Infinity;
  41515. }
  41516. TransportManager.prototype.getAssistant = function (transport) {
  41517. return factory.createAssistantToTheTransportManager(this, transport, {
  41518. minPingDelay: this.options.minPingDelay,
  41519. maxPingDelay: this.options.maxPingDelay
  41520. });
  41521. };
  41522. TransportManager.prototype.isAlive = function () {
  41523. return this.livesLeft > 0;
  41524. };
  41525. TransportManager.prototype.reportDeath = function () {
  41526. this.livesLeft -= 1;
  41527. };
  41528. return TransportManager;
  41529. }());
  41530. /* harmony default export */ var transport_manager = (transport_manager_TransportManager);
  41531. // CONCATENATED MODULE: ./src/core/strategies/sequential_strategy.ts
  41532. var sequential_strategy_SequentialStrategy = (function () {
  41533. function SequentialStrategy(strategies, options) {
  41534. this.strategies = strategies;
  41535. this.loop = Boolean(options.loop);
  41536. this.failFast = Boolean(options.failFast);
  41537. this.timeout = options.timeout;
  41538. this.timeoutLimit = options.timeoutLimit;
  41539. }
  41540. SequentialStrategy.prototype.isSupported = function () {
  41541. return any(this.strategies, util.method("isSupported"));
  41542. };
  41543. SequentialStrategy.prototype.connect = function (minPriority, callback) {
  41544. var _this = this;
  41545. var strategies = this.strategies;
  41546. var current = 0;
  41547. var timeout = this.timeout;
  41548. var runner = null;
  41549. var tryNextStrategy = function (error, handshake) {
  41550. if (handshake) {
  41551. callback(null, handshake);
  41552. }
  41553. else {
  41554. current = current + 1;
  41555. if (_this.loop) {
  41556. current = current % strategies.length;
  41557. }
  41558. if (current < strategies.length) {
  41559. if (timeout) {
  41560. timeout = timeout * 2;
  41561. if (_this.timeoutLimit) {
  41562. timeout = Math.min(timeout, _this.timeoutLimit);
  41563. }
  41564. }
  41565. runner = _this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: _this.failFast }, tryNextStrategy);
  41566. }
  41567. else {
  41568. callback(true);
  41569. }
  41570. }
  41571. };
  41572. runner = this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: this.failFast }, tryNextStrategy);
  41573. return {
  41574. abort: function () {
  41575. runner.abort();
  41576. },
  41577. forceMinPriority: function (p) {
  41578. minPriority = p;
  41579. if (runner) {
  41580. runner.forceMinPriority(p);
  41581. }
  41582. }
  41583. };
  41584. };
  41585. SequentialStrategy.prototype.tryStrategy = function (strategy, minPriority, options, callback) {
  41586. var timer = null;
  41587. var runner = null;
  41588. if (options.timeout > 0) {
  41589. timer = new OneOffTimer(options.timeout, function () {
  41590. runner.abort();
  41591. callback(true);
  41592. });
  41593. }
  41594. runner = strategy.connect(minPriority, function (error, handshake) {
  41595. if (error && timer && timer.isRunning() && !options.failFast) {
  41596. return;
  41597. }
  41598. if (timer) {
  41599. timer.ensureAborted();
  41600. }
  41601. callback(error, handshake);
  41602. });
  41603. return {
  41604. abort: function () {
  41605. if (timer) {
  41606. timer.ensureAborted();
  41607. }
  41608. runner.abort();
  41609. },
  41610. forceMinPriority: function (p) {
  41611. runner.forceMinPriority(p);
  41612. }
  41613. };
  41614. };
  41615. return SequentialStrategy;
  41616. }());
  41617. /* harmony default export */ var sequential_strategy = (sequential_strategy_SequentialStrategy);
  41618. // CONCATENATED MODULE: ./src/core/strategies/best_connected_ever_strategy.ts
  41619. var best_connected_ever_strategy_BestConnectedEverStrategy = (function () {
  41620. function BestConnectedEverStrategy(strategies) {
  41621. this.strategies = strategies;
  41622. }
  41623. BestConnectedEverStrategy.prototype.isSupported = function () {
  41624. return any(this.strategies, util.method("isSupported"));
  41625. };
  41626. BestConnectedEverStrategy.prototype.connect = function (minPriority, callback) {
  41627. return connect(this.strategies, minPriority, function (i, runners) {
  41628. return function (error, handshake) {
  41629. runners[i].error = error;
  41630. if (error) {
  41631. if (allRunnersFailed(runners)) {
  41632. callback(true);
  41633. }
  41634. return;
  41635. }
  41636. apply(runners, function (runner) {
  41637. runner.forceMinPriority(handshake.transport.priority);
  41638. });
  41639. callback(null, handshake);
  41640. };
  41641. });
  41642. };
  41643. return BestConnectedEverStrategy;
  41644. }());
  41645. /* harmony default export */ var best_connected_ever_strategy = (best_connected_ever_strategy_BestConnectedEverStrategy);
  41646. function connect(strategies, minPriority, callbackBuilder) {
  41647. var runners = map(strategies, function (strategy, i, _, rs) {
  41648. return strategy.connect(minPriority, callbackBuilder(i, rs));
  41649. });
  41650. return {
  41651. abort: function () {
  41652. apply(runners, abortRunner);
  41653. },
  41654. forceMinPriority: function (p) {
  41655. apply(runners, function (runner) {
  41656. runner.forceMinPriority(p);
  41657. });
  41658. }
  41659. };
  41660. }
  41661. function allRunnersFailed(runners) {
  41662. return collections_all(runners, function (runner) {
  41663. return Boolean(runner.error);
  41664. });
  41665. }
  41666. function abortRunner(runner) {
  41667. if (!runner.error && !runner.aborted) {
  41668. runner.abort();
  41669. runner.aborted = true;
  41670. }
  41671. }
  41672. // CONCATENATED MODULE: ./src/core/strategies/cached_strategy.ts
  41673. var cached_strategy_CachedStrategy = (function () {
  41674. function CachedStrategy(strategy, transports, options) {
  41675. this.strategy = strategy;
  41676. this.transports = transports;
  41677. this.ttl = options.ttl || 1800 * 1000;
  41678. this.usingTLS = options.useTLS;
  41679. this.timeline = options.timeline;
  41680. }
  41681. CachedStrategy.prototype.isSupported = function () {
  41682. return this.strategy.isSupported();
  41683. };
  41684. CachedStrategy.prototype.connect = function (minPriority, callback) {
  41685. var usingTLS = this.usingTLS;
  41686. var info = fetchTransportCache(usingTLS);
  41687. var strategies = [this.strategy];
  41688. if (info && info.timestamp + this.ttl >= util.now()) {
  41689. var transport = this.transports[info.transport];
  41690. if (transport) {
  41691. this.timeline.info({
  41692. cached: true,
  41693. transport: info.transport,
  41694. latency: info.latency
  41695. });
  41696. strategies.push(new sequential_strategy([transport], {
  41697. timeout: info.latency * 2 + 1000,
  41698. failFast: true
  41699. }));
  41700. }
  41701. }
  41702. var startTimestamp = util.now();
  41703. var runner = strategies.pop().connect(minPriority, function cb(error, handshake) {
  41704. if (error) {
  41705. flushTransportCache(usingTLS);
  41706. if (strategies.length > 0) {
  41707. startTimestamp = util.now();
  41708. runner = strategies.pop().connect(minPriority, cb);
  41709. }
  41710. else {
  41711. callback(error);
  41712. }
  41713. }
  41714. else {
  41715. storeTransportCache(usingTLS, handshake.transport.name, util.now() - startTimestamp);
  41716. callback(null, handshake);
  41717. }
  41718. });
  41719. return {
  41720. abort: function () {
  41721. runner.abort();
  41722. },
  41723. forceMinPriority: function (p) {
  41724. minPriority = p;
  41725. if (runner) {
  41726. runner.forceMinPriority(p);
  41727. }
  41728. }
  41729. };
  41730. };
  41731. return CachedStrategy;
  41732. }());
  41733. /* harmony default export */ var cached_strategy = (cached_strategy_CachedStrategy);
  41734. function getTransportCacheKey(usingTLS) {
  41735. return "pusherTransport" + (usingTLS ? "TLS" : "NonTLS");
  41736. }
  41737. function fetchTransportCache(usingTLS) {
  41738. var storage = runtime.getLocalStorage();
  41739. if (storage) {
  41740. try {
  41741. var serializedCache = storage[getTransportCacheKey(usingTLS)];
  41742. if (serializedCache) {
  41743. return JSON.parse(serializedCache);
  41744. }
  41745. }
  41746. catch (e) {
  41747. flushTransportCache(usingTLS);
  41748. }
  41749. }
  41750. return null;
  41751. }
  41752. function storeTransportCache(usingTLS, transport, latency) {
  41753. var storage = runtime.getLocalStorage();
  41754. if (storage) {
  41755. try {
  41756. storage[getTransportCacheKey(usingTLS)] = safeJSONStringify({
  41757. timestamp: util.now(),
  41758. transport: transport,
  41759. latency: latency
  41760. });
  41761. }
  41762. catch (e) {
  41763. }
  41764. }
  41765. }
  41766. function flushTransportCache(usingTLS) {
  41767. var storage = runtime.getLocalStorage();
  41768. if (storage) {
  41769. try {
  41770. delete storage[getTransportCacheKey(usingTLS)];
  41771. }
  41772. catch (e) {
  41773. }
  41774. }
  41775. }
  41776. // CONCATENATED MODULE: ./src/core/strategies/delayed_strategy.ts
  41777. var delayed_strategy_DelayedStrategy = (function () {
  41778. function DelayedStrategy(strategy, _a) {
  41779. var number = _a.delay;
  41780. this.strategy = strategy;
  41781. this.options = { delay: number };
  41782. }
  41783. DelayedStrategy.prototype.isSupported = function () {
  41784. return this.strategy.isSupported();
  41785. };
  41786. DelayedStrategy.prototype.connect = function (minPriority, callback) {
  41787. var strategy = this.strategy;
  41788. var runner;
  41789. var timer = new OneOffTimer(this.options.delay, function () {
  41790. runner = strategy.connect(minPriority, callback);
  41791. });
  41792. return {
  41793. abort: function () {
  41794. timer.ensureAborted();
  41795. if (runner) {
  41796. runner.abort();
  41797. }
  41798. },
  41799. forceMinPriority: function (p) {
  41800. minPriority = p;
  41801. if (runner) {
  41802. runner.forceMinPriority(p);
  41803. }
  41804. }
  41805. };
  41806. };
  41807. return DelayedStrategy;
  41808. }());
  41809. /* harmony default export */ var delayed_strategy = (delayed_strategy_DelayedStrategy);
  41810. // CONCATENATED MODULE: ./src/core/strategies/if_strategy.ts
  41811. var IfStrategy = (function () {
  41812. function IfStrategy(test, trueBranch, falseBranch) {
  41813. this.test = test;
  41814. this.trueBranch = trueBranch;
  41815. this.falseBranch = falseBranch;
  41816. }
  41817. IfStrategy.prototype.isSupported = function () {
  41818. var branch = this.test() ? this.trueBranch : this.falseBranch;
  41819. return branch.isSupported();
  41820. };
  41821. IfStrategy.prototype.connect = function (minPriority, callback) {
  41822. var branch = this.test() ? this.trueBranch : this.falseBranch;
  41823. return branch.connect(minPriority, callback);
  41824. };
  41825. return IfStrategy;
  41826. }());
  41827. /* harmony default export */ var if_strategy = (IfStrategy);
  41828. // CONCATENATED MODULE: ./src/core/strategies/first_connected_strategy.ts
  41829. var FirstConnectedStrategy = (function () {
  41830. function FirstConnectedStrategy(strategy) {
  41831. this.strategy = strategy;
  41832. }
  41833. FirstConnectedStrategy.prototype.isSupported = function () {
  41834. return this.strategy.isSupported();
  41835. };
  41836. FirstConnectedStrategy.prototype.connect = function (minPriority, callback) {
  41837. var runner = this.strategy.connect(minPriority, function (error, handshake) {
  41838. if (handshake) {
  41839. runner.abort();
  41840. }
  41841. callback(error, handshake);
  41842. });
  41843. return runner;
  41844. };
  41845. return FirstConnectedStrategy;
  41846. }());
  41847. /* harmony default export */ var first_connected_strategy = (FirstConnectedStrategy);
  41848. // CONCATENATED MODULE: ./src/runtimes/web/default_strategy.ts
  41849. function testSupportsStrategy(strategy) {
  41850. return function () {
  41851. return strategy.isSupported();
  41852. };
  41853. }
  41854. var getDefaultStrategy = function (config, defineTransport) {
  41855. var definedTransports = {};
  41856. function defineTransportStrategy(name, type, priority, options, manager) {
  41857. var transport = defineTransport(config, name, type, priority, options, manager);
  41858. definedTransports[name] = transport;
  41859. return transport;
  41860. }
  41861. var ws_options = {
  41862. hostNonTLS: config.wsHost + ":" + config.wsPort,
  41863. hostTLS: config.wsHost + ":" + config.wssPort,
  41864. httpPath: config.wsPath
  41865. };
  41866. var wss_options = extend({}, ws_options, {
  41867. useTLS: true
  41868. });
  41869. var sockjs_options = {
  41870. hostNonTLS: config.httpHost + ":" + config.httpPort,
  41871. hostTLS: config.httpHost + ":" + config.httpsPort,
  41872. httpPath: config.httpPath
  41873. };
  41874. var timeouts = {
  41875. loop: true,
  41876. timeout: 15000,
  41877. timeoutLimit: 60000
  41878. };
  41879. var ws_manager = new transport_manager({
  41880. lives: 2,
  41881. minPingDelay: 10000,
  41882. maxPingDelay: config.activity_timeout
  41883. });
  41884. var streaming_manager = new transport_manager({
  41885. lives: 2,
  41886. minPingDelay: 10000,
  41887. maxPingDelay: config.activity_timeout
  41888. });
  41889. var ws_transport = defineTransportStrategy("ws", "ws", 3, ws_options, ws_manager);
  41890. var wss_transport = defineTransportStrategy("wss", "ws", 3, wss_options, ws_manager);
  41891. var sockjs_transport = defineTransportStrategy("sockjs", "sockjs", 1, sockjs_options);
  41892. var xhr_streaming_transport = defineTransportStrategy("xhr_streaming", "xhr_streaming", 1, sockjs_options, streaming_manager);
  41893. var xdr_streaming_transport = defineTransportStrategy("xdr_streaming", "xdr_streaming", 1, sockjs_options, streaming_manager);
  41894. var xhr_polling_transport = defineTransportStrategy("xhr_polling", "xhr_polling", 1, sockjs_options);
  41895. var xdr_polling_transport = defineTransportStrategy("xdr_polling", "xdr_polling", 1, sockjs_options);
  41896. var ws_loop = new sequential_strategy([ws_transport], timeouts);
  41897. var wss_loop = new sequential_strategy([wss_transport], timeouts);
  41898. var sockjs_loop = new sequential_strategy([sockjs_transport], timeouts);
  41899. var streaming_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_streaming_transport), xhr_streaming_transport, xdr_streaming_transport)], timeouts);
  41900. var polling_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_polling_transport), xhr_polling_transport, xdr_polling_transport)], timeouts);
  41901. 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);
  41902. var http_fallback_loop = new if_strategy(testSupportsStrategy(http_loop), http_loop, sockjs_loop);
  41903. var wsStrategy;
  41904. if (config.useTLS) {
  41905. wsStrategy = new best_connected_ever_strategy([ws_loop, new delayed_strategy(http_fallback_loop, { delay: 2000 })]);
  41906. }
  41907. else {
  41908. wsStrategy = new best_connected_ever_strategy([
  41909. ws_loop,
  41910. new delayed_strategy(wss_loop, { delay: 2000 }),
  41911. new delayed_strategy(http_fallback_loop, { delay: 5000 })
  41912. ]);
  41913. }
  41914. return new cached_strategy(new first_connected_strategy(new if_strategy(testSupportsStrategy(ws_transport), wsStrategy, http_fallback_loop)), definedTransports, {
  41915. ttl: 1800000,
  41916. timeline: config.timeline,
  41917. useTLS: config.useTLS
  41918. });
  41919. };
  41920. /* harmony default export */ var default_strategy = (getDefaultStrategy);
  41921. // CONCATENATED MODULE: ./src/runtimes/web/transports/transport_connection_initializer.ts
  41922. /* harmony default export */ var transport_connection_initializer = (function () {
  41923. var self = this;
  41924. self.timeline.info(self.buildTimelineMessage({
  41925. transport: self.name + (self.options.useTLS ? "s" : "")
  41926. }));
  41927. if (self.hooks.isInitialized()) {
  41928. self.changeState("initialized");
  41929. }
  41930. else if (self.hooks.file) {
  41931. self.changeState("initializing");
  41932. Dependencies.load(self.hooks.file, { useTLS: self.options.useTLS }, function (error, callback) {
  41933. if (self.hooks.isInitialized()) {
  41934. self.changeState("initialized");
  41935. callback(true);
  41936. }
  41937. else {
  41938. if (error) {
  41939. self.onError(error);
  41940. }
  41941. self.onClose();
  41942. callback(false);
  41943. }
  41944. });
  41945. }
  41946. else {
  41947. self.onClose();
  41948. }
  41949. });
  41950. // CONCATENATED MODULE: ./src/runtimes/web/http/http_xdomain_request.ts
  41951. var http_xdomain_request_hooks = {
  41952. getRequest: function (socket) {
  41953. var xdr = new window.XDomainRequest();
  41954. xdr.ontimeout = function () {
  41955. socket.emit("error", new RequestTimedOut());
  41956. socket.close();
  41957. };
  41958. xdr.onerror = function (e) {
  41959. socket.emit("error", e);
  41960. socket.close();
  41961. };
  41962. xdr.onprogress = function () {
  41963. if (xdr.responseText && xdr.responseText.length > 0) {
  41964. socket.onChunk(200, xdr.responseText);
  41965. }
  41966. };
  41967. xdr.onload = function () {
  41968. if (xdr.responseText && xdr.responseText.length > 0) {
  41969. socket.onChunk(200, xdr.responseText);
  41970. }
  41971. socket.emit("finished", 200);
  41972. socket.close();
  41973. };
  41974. return xdr;
  41975. },
  41976. abortRequest: function (xdr) {
  41977. xdr.ontimeout = xdr.onerror = xdr.onprogress = xdr.onload = null;
  41978. xdr.abort();
  41979. }
  41980. };
  41981. /* harmony default export */ var http_xdomain_request = (http_xdomain_request_hooks);
  41982. // CONCATENATED MODULE: ./src/core/http/http_request.ts
  41983. var http_request_extends = (undefined && undefined.__extends) || (function () {
  41984. var extendStatics = function (d, b) {
  41985. extendStatics = Object.setPrototypeOf ||
  41986. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41987. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41988. return extendStatics(d, b);
  41989. };
  41990. return function (d, b) {
  41991. extendStatics(d, b);
  41992. function __() { this.constructor = d; }
  41993. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41994. };
  41995. })();
  41996. var MAX_BUFFER_LENGTH = 256 * 1024;
  41997. var http_request_HTTPRequest = (function (_super) {
  41998. http_request_extends(HTTPRequest, _super);
  41999. function HTTPRequest(hooks, method, url) {
  42000. var _this = _super.call(this) || this;
  42001. _this.hooks = hooks;
  42002. _this.method = method;
  42003. _this.url = url;
  42004. return _this;
  42005. }
  42006. HTTPRequest.prototype.start = function (payload) {
  42007. var _this = this;
  42008. this.position = 0;
  42009. this.xhr = this.hooks.getRequest(this);
  42010. this.unloader = function () {
  42011. _this.close();
  42012. };
  42013. runtime.addUnloadListener(this.unloader);
  42014. this.xhr.open(this.method, this.url, true);
  42015. if (this.xhr.setRequestHeader) {
  42016. this.xhr.setRequestHeader("Content-Type", "application/json");
  42017. }
  42018. this.xhr.send(payload);
  42019. };
  42020. HTTPRequest.prototype.close = function () {
  42021. if (this.unloader) {
  42022. runtime.removeUnloadListener(this.unloader);
  42023. this.unloader = null;
  42024. }
  42025. if (this.xhr) {
  42026. this.hooks.abortRequest(this.xhr);
  42027. this.xhr = null;
  42028. }
  42029. };
  42030. HTTPRequest.prototype.onChunk = function (status, data) {
  42031. while (true) {
  42032. var chunk = this.advanceBuffer(data);
  42033. if (chunk) {
  42034. this.emit("chunk", { status: status, data: chunk });
  42035. }
  42036. else {
  42037. break;
  42038. }
  42039. }
  42040. if (this.isBufferTooLong(data)) {
  42041. this.emit("buffer_too_long");
  42042. }
  42043. };
  42044. HTTPRequest.prototype.advanceBuffer = function (buffer) {
  42045. var unreadData = buffer.slice(this.position);
  42046. var endOfLinePosition = unreadData.indexOf("\n");
  42047. if (endOfLinePosition !== -1) {
  42048. this.position += endOfLinePosition + 1;
  42049. return unreadData.slice(0, endOfLinePosition);
  42050. }
  42051. else {
  42052. return null;
  42053. }
  42054. };
  42055. HTTPRequest.prototype.isBufferTooLong = function (buffer) {
  42056. return this.position === buffer.length && buffer.length > MAX_BUFFER_LENGTH;
  42057. };
  42058. return HTTPRequest;
  42059. }(dispatcher));
  42060. /* harmony default export */ var http_request = (http_request_HTTPRequest);
  42061. // CONCATENATED MODULE: ./src/core/http/state.ts
  42062. var State;
  42063. (function (State) {
  42064. State[State["CONNECTING"] = 0] = "CONNECTING";
  42065. State[State["OPEN"] = 1] = "OPEN";
  42066. State[State["CLOSED"] = 3] = "CLOSED";
  42067. })(State || (State = {}));
  42068. /* harmony default export */ var state = (State);
  42069. // CONCATENATED MODULE: ./src/core/http/http_socket.ts
  42070. var autoIncrement = 1;
  42071. var http_socket_HTTPSocket = (function () {
  42072. function HTTPSocket(hooks, url) {
  42073. this.hooks = hooks;
  42074. this.session = randomNumber(1000) + "/" + randomString(8);
  42075. this.location = getLocation(url);
  42076. this.readyState = state.CONNECTING;
  42077. this.openStream();
  42078. }
  42079. HTTPSocket.prototype.send = function (payload) {
  42080. return this.sendRaw(JSON.stringify([payload]));
  42081. };
  42082. HTTPSocket.prototype.ping = function () {
  42083. this.hooks.sendHeartbeat(this);
  42084. };
  42085. HTTPSocket.prototype.close = function (code, reason) {
  42086. this.onClose(code, reason, true);
  42087. };
  42088. HTTPSocket.prototype.sendRaw = function (payload) {
  42089. if (this.readyState === state.OPEN) {
  42090. try {
  42091. runtime.createSocketRequest("POST", getUniqueURL(getSendURL(this.location, this.session))).start(payload);
  42092. return true;
  42093. }
  42094. catch (e) {
  42095. return false;
  42096. }
  42097. }
  42098. else {
  42099. return false;
  42100. }
  42101. };
  42102. HTTPSocket.prototype.reconnect = function () {
  42103. this.closeStream();
  42104. this.openStream();
  42105. };
  42106. ;
  42107. HTTPSocket.prototype.onClose = function (code, reason, wasClean) {
  42108. this.closeStream();
  42109. this.readyState = state.CLOSED;
  42110. if (this.onclose) {
  42111. this.onclose({
  42112. code: code,
  42113. reason: reason,
  42114. wasClean: wasClean
  42115. });
  42116. }
  42117. };
  42118. HTTPSocket.prototype.onChunk = function (chunk) {
  42119. if (chunk.status !== 200) {
  42120. return;
  42121. }
  42122. if (this.readyState === state.OPEN) {
  42123. this.onActivity();
  42124. }
  42125. var payload;
  42126. var type = chunk.data.slice(0, 1);
  42127. switch (type) {
  42128. case 'o':
  42129. payload = JSON.parse(chunk.data.slice(1) || '{}');
  42130. this.onOpen(payload);
  42131. break;
  42132. case 'a':
  42133. payload = JSON.parse(chunk.data.slice(1) || '[]');
  42134. for (var i = 0; i < payload.length; i++) {
  42135. this.onEvent(payload[i]);
  42136. }
  42137. break;
  42138. case 'm':
  42139. payload = JSON.parse(chunk.data.slice(1) || 'null');
  42140. this.onEvent(payload);
  42141. break;
  42142. case 'h':
  42143. this.hooks.onHeartbeat(this);
  42144. break;
  42145. case 'c':
  42146. payload = JSON.parse(chunk.data.slice(1) || '[]');
  42147. this.onClose(payload[0], payload[1], true);
  42148. break;
  42149. }
  42150. };
  42151. HTTPSocket.prototype.onOpen = function (options) {
  42152. if (this.readyState === state.CONNECTING) {
  42153. if (options && options.hostname) {
  42154. this.location.base = replaceHost(this.location.base, options.hostname);
  42155. }
  42156. this.readyState = state.OPEN;
  42157. if (this.onopen) {
  42158. this.onopen();
  42159. }
  42160. }
  42161. else {
  42162. this.onClose(1006, "Server lost session", true);
  42163. }
  42164. };
  42165. HTTPSocket.prototype.onEvent = function (event) {
  42166. if (this.readyState === state.OPEN && this.onmessage) {
  42167. this.onmessage({ data: event });
  42168. }
  42169. };
  42170. HTTPSocket.prototype.onActivity = function () {
  42171. if (this.onactivity) {
  42172. this.onactivity();
  42173. }
  42174. };
  42175. HTTPSocket.prototype.onError = function (error) {
  42176. if (this.onerror) {
  42177. this.onerror(error);
  42178. }
  42179. };
  42180. HTTPSocket.prototype.openStream = function () {
  42181. var _this = this;
  42182. this.stream = runtime.createSocketRequest("POST", getUniqueURL(this.hooks.getReceiveURL(this.location, this.session)));
  42183. this.stream.bind("chunk", function (chunk) {
  42184. _this.onChunk(chunk);
  42185. });
  42186. this.stream.bind("finished", function (status) {
  42187. _this.hooks.onFinished(_this, status);
  42188. });
  42189. this.stream.bind("buffer_too_long", function () {
  42190. _this.reconnect();
  42191. });
  42192. try {
  42193. this.stream.start();
  42194. }
  42195. catch (error) {
  42196. util.defer(function () {
  42197. _this.onError(error);
  42198. _this.onClose(1006, "Could not start streaming", false);
  42199. });
  42200. }
  42201. };
  42202. HTTPSocket.prototype.closeStream = function () {
  42203. if (this.stream) {
  42204. this.stream.unbind_all();
  42205. this.stream.close();
  42206. this.stream = null;
  42207. }
  42208. };
  42209. return HTTPSocket;
  42210. }());
  42211. function getLocation(url) {
  42212. var parts = /([^\?]*)\/*(\??.*)/.exec(url);
  42213. return {
  42214. base: parts[1],
  42215. queryString: parts[2]
  42216. };
  42217. }
  42218. function getSendURL(url, session) {
  42219. return url.base + "/" + session + "/xhr_send";
  42220. }
  42221. function getUniqueURL(url) {
  42222. var separator = (url.indexOf('?') === -1) ? "?" : "&";
  42223. return url + separator + "t=" + (+new Date()) + "&n=" + autoIncrement++;
  42224. }
  42225. function replaceHost(url, hostname) {
  42226. var urlParts = /(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(url);
  42227. return urlParts[1] + hostname + urlParts[3];
  42228. }
  42229. function randomNumber(max) {
  42230. return Math.floor(Math.random() * max);
  42231. }
  42232. function randomString(length) {
  42233. var result = [];
  42234. for (var i = 0; i < length; i++) {
  42235. result.push(randomNumber(32).toString(32));
  42236. }
  42237. return result.join('');
  42238. }
  42239. /* harmony default export */ var http_socket = (http_socket_HTTPSocket);
  42240. // CONCATENATED MODULE: ./src/core/http/http_streaming_socket.ts
  42241. var http_streaming_socket_hooks = {
  42242. getReceiveURL: function (url, session) {
  42243. return url.base + "/" + session + "/xhr_streaming" + url.queryString;
  42244. },
  42245. onHeartbeat: function (socket) {
  42246. socket.sendRaw("[]");
  42247. },
  42248. sendHeartbeat: function (socket) {
  42249. socket.sendRaw("[]");
  42250. },
  42251. onFinished: function (socket, status) {
  42252. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  42253. }
  42254. };
  42255. /* harmony default export */ var http_streaming_socket = (http_streaming_socket_hooks);
  42256. // CONCATENATED MODULE: ./src/core/http/http_polling_socket.ts
  42257. var http_polling_socket_hooks = {
  42258. getReceiveURL: function (url, session) {
  42259. return url.base + "/" + session + "/xhr" + url.queryString;
  42260. },
  42261. onHeartbeat: function () {
  42262. },
  42263. sendHeartbeat: function (socket) {
  42264. socket.sendRaw("[]");
  42265. },
  42266. onFinished: function (socket, status) {
  42267. if (status === 200) {
  42268. socket.reconnect();
  42269. }
  42270. else {
  42271. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  42272. }
  42273. }
  42274. };
  42275. /* harmony default export */ var http_polling_socket = (http_polling_socket_hooks);
  42276. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http_xhr_request.ts
  42277. var http_xhr_request_hooks = {
  42278. getRequest: function (socket) {
  42279. var Constructor = runtime.getXHRAPI();
  42280. var xhr = new Constructor();
  42281. xhr.onreadystatechange = xhr.onprogress = function () {
  42282. switch (xhr.readyState) {
  42283. case 3:
  42284. if (xhr.responseText && xhr.responseText.length > 0) {
  42285. socket.onChunk(xhr.status, xhr.responseText);
  42286. }
  42287. break;
  42288. case 4:
  42289. if (xhr.responseText && xhr.responseText.length > 0) {
  42290. socket.onChunk(xhr.status, xhr.responseText);
  42291. }
  42292. socket.emit("finished", xhr.status);
  42293. socket.close();
  42294. break;
  42295. }
  42296. };
  42297. return xhr;
  42298. },
  42299. abortRequest: function (xhr) {
  42300. xhr.onreadystatechange = null;
  42301. xhr.abort();
  42302. }
  42303. };
  42304. /* harmony default export */ var http_xhr_request = (http_xhr_request_hooks);
  42305. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http.ts
  42306. var HTTP = {
  42307. createStreamingSocket: function (url) {
  42308. return this.createSocket(http_streaming_socket, url);
  42309. },
  42310. createPollingSocket: function (url) {
  42311. return this.createSocket(http_polling_socket, url);
  42312. },
  42313. createSocket: function (hooks, url) {
  42314. return new http_socket(hooks, url);
  42315. },
  42316. createXHR: function (method, url) {
  42317. return this.createRequest(http_xhr_request, method, url);
  42318. },
  42319. createRequest: function (hooks, method, url) {
  42320. return new http_request(hooks, method, url);
  42321. }
  42322. };
  42323. /* harmony default export */ var http_http = (HTTP);
  42324. // CONCATENATED MODULE: ./src/runtimes/web/http/http.ts
  42325. http_http.createXDR = function (method, url) {
  42326. return this.createRequest(http_xdomain_request, method, url);
  42327. };
  42328. /* harmony default export */ var web_http_http = (http_http);
  42329. // CONCATENATED MODULE: ./src/runtimes/web/runtime.ts
  42330. var Runtime = {
  42331. nextAuthCallbackID: 1,
  42332. auth_callbacks: {},
  42333. ScriptReceivers: ScriptReceivers,
  42334. DependenciesReceivers: DependenciesReceivers,
  42335. getDefaultStrategy: default_strategy,
  42336. Transports: transports_transports,
  42337. transportConnectionInitializer: transport_connection_initializer,
  42338. HTTPFactory: web_http_http,
  42339. TimelineTransport: jsonp_timeline,
  42340. getXHRAPI: function () {
  42341. return window.XMLHttpRequest;
  42342. },
  42343. getWebSocketAPI: function () {
  42344. return window.WebSocket || window.MozWebSocket;
  42345. },
  42346. setup: function (PusherClass) {
  42347. var _this = this;
  42348. window.Pusher = PusherClass;
  42349. var initializeOnDocumentBody = function () {
  42350. _this.onDocumentBody(PusherClass.ready);
  42351. };
  42352. if (!window.JSON) {
  42353. Dependencies.load("json2", {}, initializeOnDocumentBody);
  42354. }
  42355. else {
  42356. initializeOnDocumentBody();
  42357. }
  42358. },
  42359. getDocument: function () {
  42360. return document;
  42361. },
  42362. getProtocol: function () {
  42363. return this.getDocument().location.protocol;
  42364. },
  42365. getAuthorizers: function () {
  42366. return { ajax: xhr_auth, jsonp: jsonp_auth };
  42367. },
  42368. onDocumentBody: function (callback) {
  42369. var _this = this;
  42370. if (document.body) {
  42371. callback();
  42372. }
  42373. else {
  42374. setTimeout(function () {
  42375. _this.onDocumentBody(callback);
  42376. }, 0);
  42377. }
  42378. },
  42379. createJSONPRequest: function (url, data) {
  42380. return new jsonp_request(url, data);
  42381. },
  42382. createScriptRequest: function (src) {
  42383. return new script_request(src);
  42384. },
  42385. getLocalStorage: function () {
  42386. try {
  42387. return window.localStorage;
  42388. }
  42389. catch (e) {
  42390. return undefined;
  42391. }
  42392. },
  42393. createXHR: function () {
  42394. if (this.getXHRAPI()) {
  42395. return this.createXMLHttpRequest();
  42396. }
  42397. else {
  42398. return this.createMicrosoftXHR();
  42399. }
  42400. },
  42401. createXMLHttpRequest: function () {
  42402. var Constructor = this.getXHRAPI();
  42403. return new Constructor();
  42404. },
  42405. createMicrosoftXHR: function () {
  42406. return new ActiveXObject("Microsoft.XMLHTTP");
  42407. },
  42408. getNetwork: function () {
  42409. return net_info_Network;
  42410. },
  42411. createWebSocket: function (url) {
  42412. var Constructor = this.getWebSocketAPI();
  42413. return new Constructor(url);
  42414. },
  42415. createSocketRequest: function (method, url) {
  42416. if (this.isXHRSupported()) {
  42417. return this.HTTPFactory.createXHR(method, url);
  42418. }
  42419. else if (this.isXDRSupported(url.indexOf("https:") === 0)) {
  42420. return this.HTTPFactory.createXDR(method, url);
  42421. }
  42422. else {
  42423. throw "Cross-origin HTTP requests are not supported";
  42424. }
  42425. },
  42426. isXHRSupported: function () {
  42427. var Constructor = this.getXHRAPI();
  42428. return Boolean(Constructor) && (new Constructor()).withCredentials !== undefined;
  42429. },
  42430. isXDRSupported: function (useTLS) {
  42431. var protocol = useTLS ? "https:" : "http:";
  42432. var documentProtocol = this.getProtocol();
  42433. return Boolean((window['XDomainRequest'])) && documentProtocol === protocol;
  42434. },
  42435. addUnloadListener: function (listener) {
  42436. if (window.addEventListener !== undefined) {
  42437. window.addEventListener("unload", listener, false);
  42438. }
  42439. else if (window.attachEvent !== undefined) {
  42440. window.attachEvent("onunload", listener);
  42441. }
  42442. },
  42443. removeUnloadListener: function (listener) {
  42444. if (window.addEventListener !== undefined) {
  42445. window.removeEventListener("unload", listener, false);
  42446. }
  42447. else if (window.detachEvent !== undefined) {
  42448. window.detachEvent("onunload", listener);
  42449. }
  42450. }
  42451. };
  42452. /* harmony default export */ var runtime = (Runtime);
  42453. // CONCATENATED MODULE: ./src/core/timeline/level.ts
  42454. var TimelineLevel;
  42455. (function (TimelineLevel) {
  42456. TimelineLevel[TimelineLevel["ERROR"] = 3] = "ERROR";
  42457. TimelineLevel[TimelineLevel["INFO"] = 6] = "INFO";
  42458. TimelineLevel[TimelineLevel["DEBUG"] = 7] = "DEBUG";
  42459. })(TimelineLevel || (TimelineLevel = {}));
  42460. /* harmony default export */ var timeline_level = (TimelineLevel);
  42461. // CONCATENATED MODULE: ./src/core/timeline/timeline.ts
  42462. var timeline_Timeline = (function () {
  42463. function Timeline(key, session, options) {
  42464. this.key = key;
  42465. this.session = session;
  42466. this.events = [];
  42467. this.options = options || {};
  42468. this.sent = 0;
  42469. this.uniqueID = 0;
  42470. }
  42471. Timeline.prototype.log = function (level, event) {
  42472. if (level <= this.options.level) {
  42473. this.events.push(extend({}, event, { timestamp: util.now() }));
  42474. if (this.options.limit && this.events.length > this.options.limit) {
  42475. this.events.shift();
  42476. }
  42477. }
  42478. };
  42479. Timeline.prototype.error = function (event) {
  42480. this.log(timeline_level.ERROR, event);
  42481. };
  42482. Timeline.prototype.info = function (event) {
  42483. this.log(timeline_level.INFO, event);
  42484. };
  42485. Timeline.prototype.debug = function (event) {
  42486. this.log(timeline_level.DEBUG, event);
  42487. };
  42488. Timeline.prototype.isEmpty = function () {
  42489. return this.events.length === 0;
  42490. };
  42491. Timeline.prototype.send = function (sendfn, callback) {
  42492. var _this = this;
  42493. var data = extend({
  42494. session: this.session,
  42495. bundle: this.sent + 1,
  42496. key: this.key,
  42497. lib: "js",
  42498. version: this.options.version,
  42499. cluster: this.options.cluster,
  42500. features: this.options.features,
  42501. timeline: this.events
  42502. }, this.options.params);
  42503. this.events = [];
  42504. sendfn(data, function (error, result) {
  42505. if (!error) {
  42506. _this.sent++;
  42507. }
  42508. if (callback) {
  42509. callback(error, result);
  42510. }
  42511. });
  42512. return true;
  42513. };
  42514. Timeline.prototype.generateUniqueID = function () {
  42515. this.uniqueID++;
  42516. return this.uniqueID;
  42517. };
  42518. return Timeline;
  42519. }());
  42520. /* harmony default export */ var timeline_timeline = (timeline_Timeline);
  42521. // CONCATENATED MODULE: ./src/core/strategies/transport_strategy.ts
  42522. var transport_strategy_TransportStrategy = (function () {
  42523. function TransportStrategy(name, priority, transport, options) {
  42524. this.name = name;
  42525. this.priority = priority;
  42526. this.transport = transport;
  42527. this.options = options || {};
  42528. }
  42529. TransportStrategy.prototype.isSupported = function () {
  42530. return this.transport.isSupported({
  42531. useTLS: this.options.useTLS
  42532. });
  42533. };
  42534. TransportStrategy.prototype.connect = function (minPriority, callback) {
  42535. var _this = this;
  42536. if (!this.isSupported()) {
  42537. return failAttempt(new UnsupportedStrategy(), callback);
  42538. }
  42539. else if (this.priority < minPriority) {
  42540. return failAttempt(new TransportPriorityTooLow(), callback);
  42541. }
  42542. var connected = false;
  42543. var transport = this.transport.createConnection(this.name, this.priority, this.options.key, this.options);
  42544. var handshake = null;
  42545. var onInitialized = function () {
  42546. transport.unbind("initialized", onInitialized);
  42547. transport.connect();
  42548. };
  42549. var onOpen = function () {
  42550. handshake = factory.createHandshake(transport, function (result) {
  42551. connected = true;
  42552. unbindListeners();
  42553. callback(null, result);
  42554. });
  42555. };
  42556. var onError = function (error) {
  42557. unbindListeners();
  42558. callback(error);
  42559. };
  42560. var onClosed = function () {
  42561. unbindListeners();
  42562. var serializedTransport;
  42563. serializedTransport = safeJSONStringify(transport);
  42564. callback(new TransportClosed(serializedTransport));
  42565. };
  42566. var unbindListeners = function () {
  42567. transport.unbind("initialized", onInitialized);
  42568. transport.unbind("open", onOpen);
  42569. transport.unbind("error", onError);
  42570. transport.unbind("closed", onClosed);
  42571. };
  42572. transport.bind("initialized", onInitialized);
  42573. transport.bind("open", onOpen);
  42574. transport.bind("error", onError);
  42575. transport.bind("closed", onClosed);
  42576. transport.initialize();
  42577. return {
  42578. abort: function () {
  42579. if (connected) {
  42580. return;
  42581. }
  42582. unbindListeners();
  42583. if (handshake) {
  42584. handshake.close();
  42585. }
  42586. else {
  42587. transport.close();
  42588. }
  42589. },
  42590. forceMinPriority: function (p) {
  42591. if (connected) {
  42592. return;
  42593. }
  42594. if (_this.priority < p) {
  42595. if (handshake) {
  42596. handshake.close();
  42597. }
  42598. else {
  42599. transport.close();
  42600. }
  42601. }
  42602. }
  42603. };
  42604. };
  42605. return TransportStrategy;
  42606. }());
  42607. /* harmony default export */ var transport_strategy = (transport_strategy_TransportStrategy);
  42608. function failAttempt(error, callback) {
  42609. util.defer(function () {
  42610. callback(error);
  42611. });
  42612. return {
  42613. abort: function () { },
  42614. forceMinPriority: function () { }
  42615. };
  42616. }
  42617. // CONCATENATED MODULE: ./src/core/strategies/strategy_builder.ts
  42618. var strategy_builder_Transports = runtime.Transports;
  42619. var strategy_builder_defineTransport = function (config, name, type, priority, options, manager) {
  42620. var transportClass = strategy_builder_Transports[type];
  42621. if (!transportClass) {
  42622. throw new UnsupportedTransport(type);
  42623. }
  42624. var enabled = (!config.enabledTransports ||
  42625. arrayIndexOf(config.enabledTransports, name) !== -1) &&
  42626. (!config.disabledTransports ||
  42627. arrayIndexOf(config.disabledTransports, name) === -1);
  42628. var transport;
  42629. if (enabled) {
  42630. transport = new transport_strategy(name, priority, manager ? manager.getAssistant(transportClass) : transportClass, extend({
  42631. key: config.key,
  42632. useTLS: config.useTLS,
  42633. timeline: config.timeline,
  42634. ignoreNullOrigin: config.ignoreNullOrigin
  42635. }, options));
  42636. }
  42637. else {
  42638. transport = strategy_builder_UnsupportedStrategy;
  42639. }
  42640. return transport;
  42641. };
  42642. var strategy_builder_UnsupportedStrategy = {
  42643. isSupported: function () {
  42644. return false;
  42645. },
  42646. connect: function (_, callback) {
  42647. var deferred = util.defer(function () {
  42648. callback(new UnsupportedStrategy());
  42649. });
  42650. return {
  42651. abort: function () {
  42652. deferred.ensureAborted();
  42653. },
  42654. forceMinPriority: function () { }
  42655. };
  42656. }
  42657. };
  42658. // CONCATENATED MODULE: ./src/core/config.ts
  42659. var getGlobalConfig = function () {
  42660. return {
  42661. wsHost: defaults.host,
  42662. wsPort: defaults.ws_port,
  42663. wssPort: defaults.wss_port,
  42664. wsPath: defaults.ws_path,
  42665. httpHost: defaults.sockjs_host,
  42666. httpPort: defaults.sockjs_http_port,
  42667. httpsPort: defaults.sockjs_https_port,
  42668. httpPath: defaults.sockjs_path,
  42669. statsHost: defaults.stats_host,
  42670. authEndpoint: defaults.channel_auth_endpoint,
  42671. authTransport: defaults.channel_auth_transport,
  42672. activity_timeout: defaults.activity_timeout,
  42673. pong_timeout: defaults.pong_timeout,
  42674. unavailable_timeout: defaults.unavailable_timeout
  42675. };
  42676. };
  42677. var getClusterConfig = function (clusterName) {
  42678. return {
  42679. wsHost: 'ws-' + clusterName + '.pusher.com',
  42680. httpHost: 'sockjs-' + clusterName + '.pusher.com'
  42681. };
  42682. };
  42683. // CONCATENATED MODULE: ./src/core/pusher.ts
  42684. var pusher_Pusher = (function () {
  42685. function Pusher(app_key, options) {
  42686. var _this = this;
  42687. checkAppKey(app_key);
  42688. options = options || {};
  42689. if (!options.cluster && !(options.wsHost || options.httpHost)) {
  42690. var suffix = url_store.buildLogSuffix('javascriptQuickStart');
  42691. logger.warn("You should always specify a cluster when connecting. " + suffix);
  42692. }
  42693. this.key = app_key;
  42694. this.config = extend(getGlobalConfig(), options.cluster ? getClusterConfig(options.cluster) : {}, options);
  42695. this.channels = factory.createChannels();
  42696. this.global_emitter = new dispatcher();
  42697. this.sessionID = Math.floor(Math.random() * 1000000000);
  42698. this.timeline = new timeline_timeline(this.key, this.sessionID, {
  42699. cluster: this.config.cluster,
  42700. features: Pusher.getClientFeatures(),
  42701. params: this.config.timelineParams || {},
  42702. limit: 50,
  42703. level: timeline_level.INFO,
  42704. version: defaults.VERSION
  42705. });
  42706. if (!this.config.disableStats) {
  42707. this.timelineSender = factory.createTimelineSender(this.timeline, {
  42708. host: this.config.statsHost,
  42709. path: '/timeline/v2/' + runtime.TimelineTransport.name
  42710. });
  42711. }
  42712. var getStrategy = function (options) {
  42713. var config = extend({}, _this.config, options);
  42714. return runtime.getDefaultStrategy(config, strategy_builder_defineTransport);
  42715. };
  42716. this.connection = factory.createConnectionManager(this.key, extend({
  42717. getStrategy: getStrategy,
  42718. timeline: this.timeline,
  42719. activityTimeout: this.config.activity_timeout,
  42720. pongTimeout: this.config.pong_timeout,
  42721. unavailableTimeout: this.config.unavailable_timeout
  42722. }, this.config, { useTLS: this.shouldUseTLS() }));
  42723. this.connection.bind('connected', function () {
  42724. _this.subscribeAll();
  42725. if (_this.timelineSender) {
  42726. _this.timelineSender.send(_this.connection.isUsingTLS());
  42727. }
  42728. });
  42729. this.connection.bind('message', function (event) {
  42730. var eventName = event.event;
  42731. var internal = eventName.indexOf('pusher_internal:') === 0;
  42732. if (event.channel) {
  42733. var channel = _this.channel(event.channel);
  42734. if (channel) {
  42735. channel.handleEvent(event);
  42736. }
  42737. }
  42738. if (!internal) {
  42739. _this.global_emitter.emit(event.event, event.data);
  42740. }
  42741. });
  42742. this.connection.bind('connecting', function () {
  42743. _this.channels.disconnect();
  42744. });
  42745. this.connection.bind('disconnected', function () {
  42746. _this.channels.disconnect();
  42747. });
  42748. this.connection.bind('error', function (err) {
  42749. logger.warn(err);
  42750. });
  42751. Pusher.instances.push(this);
  42752. this.timeline.info({ instances: Pusher.instances.length });
  42753. if (Pusher.isReady) {
  42754. this.connect();
  42755. }
  42756. }
  42757. Pusher.ready = function () {
  42758. Pusher.isReady = true;
  42759. for (var i = 0, l = Pusher.instances.length; i < l; i++) {
  42760. Pusher.instances[i].connect();
  42761. }
  42762. };
  42763. Pusher.getClientFeatures = function () {
  42764. return keys(filterObject({ ws: runtime.Transports.ws }, function (t) {
  42765. return t.isSupported({});
  42766. }));
  42767. };
  42768. Pusher.prototype.channel = function (name) {
  42769. return this.channels.find(name);
  42770. };
  42771. Pusher.prototype.allChannels = function () {
  42772. return this.channels.all();
  42773. };
  42774. Pusher.prototype.connect = function () {
  42775. this.connection.connect();
  42776. if (this.timelineSender) {
  42777. if (!this.timelineSenderTimer) {
  42778. var usingTLS = this.connection.isUsingTLS();
  42779. var timelineSender = this.timelineSender;
  42780. this.timelineSenderTimer = new PeriodicTimer(60000, function () {
  42781. timelineSender.send(usingTLS);
  42782. });
  42783. }
  42784. }
  42785. };
  42786. Pusher.prototype.disconnect = function () {
  42787. this.connection.disconnect();
  42788. if (this.timelineSenderTimer) {
  42789. this.timelineSenderTimer.ensureAborted();
  42790. this.timelineSenderTimer = null;
  42791. }
  42792. };
  42793. Pusher.prototype.bind = function (event_name, callback, context) {
  42794. this.global_emitter.bind(event_name, callback, context);
  42795. return this;
  42796. };
  42797. Pusher.prototype.unbind = function (event_name, callback, context) {
  42798. this.global_emitter.unbind(event_name, callback, context);
  42799. return this;
  42800. };
  42801. Pusher.prototype.bind_global = function (callback) {
  42802. this.global_emitter.bind_global(callback);
  42803. return this;
  42804. };
  42805. Pusher.prototype.unbind_global = function (callback) {
  42806. this.global_emitter.unbind_global(callback);
  42807. return this;
  42808. };
  42809. Pusher.prototype.unbind_all = function (callback) {
  42810. this.global_emitter.unbind_all();
  42811. return this;
  42812. };
  42813. Pusher.prototype.subscribeAll = function () {
  42814. var channelName;
  42815. for (channelName in this.channels.channels) {
  42816. if (this.channels.channels.hasOwnProperty(channelName)) {
  42817. this.subscribe(channelName);
  42818. }
  42819. }
  42820. };
  42821. Pusher.prototype.subscribe = function (channel_name) {
  42822. var channel = this.channels.add(channel_name, this);
  42823. if (channel.subscriptionPending && channel.subscriptionCancelled) {
  42824. channel.reinstateSubscription();
  42825. }
  42826. else if (!channel.subscriptionPending &&
  42827. this.connection.state === 'connected') {
  42828. channel.subscribe();
  42829. }
  42830. return channel;
  42831. };
  42832. Pusher.prototype.unsubscribe = function (channel_name) {
  42833. var channel = this.channels.find(channel_name);
  42834. if (channel && channel.subscriptionPending) {
  42835. channel.cancelSubscription();
  42836. }
  42837. else {
  42838. channel = this.channels.remove(channel_name);
  42839. if (channel && this.connection.state === 'connected') {
  42840. channel.unsubscribe();
  42841. }
  42842. }
  42843. };
  42844. Pusher.prototype.send_event = function (event_name, data, channel) {
  42845. return this.connection.send_event(event_name, data, channel);
  42846. };
  42847. Pusher.prototype.shouldUseTLS = function () {
  42848. if (runtime.getProtocol() === 'https:') {
  42849. return true;
  42850. }
  42851. else if (this.config.forceTLS === true) {
  42852. return true;
  42853. }
  42854. else {
  42855. return Boolean(this.config.encrypted);
  42856. }
  42857. };
  42858. Pusher.instances = [];
  42859. Pusher.isReady = false;
  42860. Pusher.logToConsole = false;
  42861. Pusher.Runtime = runtime;
  42862. Pusher.ScriptReceivers = runtime.ScriptReceivers;
  42863. Pusher.DependenciesReceivers = runtime.DependenciesReceivers;
  42864. Pusher.auth_callbacks = runtime.auth_callbacks;
  42865. return Pusher;
  42866. }());
  42867. /* harmony default export */ var core_pusher = __webpack_exports__["default"] = (pusher_Pusher);
  42868. function checkAppKey(key) {
  42869. if (key === null || key === undefined) {
  42870. throw 'You must pass your app key when you instantiate Pusher.';
  42871. }
  42872. }
  42873. runtime.setup(pusher_Pusher);
  42874. /***/ })
  42875. /******/ ]);
  42876. });
  42877. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../buffer/index.js */ "./node_modules/buffer/index.js").Buffer))
  42878. /***/ }),
  42879. /***/ "./node_modules/setimmediate/setImmediate.js":
  42880. /*!***************************************************!*\
  42881. !*** ./node_modules/setimmediate/setImmediate.js ***!
  42882. \***************************************************/
  42883. /*! no static exports found */
  42884. /***/ (function(module, exports, __webpack_require__) {
  42885. /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
  42886. "use strict";
  42887. if (global.setImmediate) {
  42888. return;
  42889. }
  42890. var nextHandle = 1; // Spec says greater than zero
  42891. var tasksByHandle = {};
  42892. var currentlyRunningATask = false;
  42893. var doc = global.document;
  42894. var registerImmediate;
  42895. function setImmediate(callback) {
  42896. // Callback can either be a function or a string
  42897. if (typeof callback !== "function") {
  42898. callback = new Function("" + callback);
  42899. }
  42900. // Copy function arguments
  42901. var args = new Array(arguments.length - 1);
  42902. for (var i = 0; i < args.length; i++) {
  42903. args[i] = arguments[i + 1];
  42904. }
  42905. // Store and register the task
  42906. var task = { callback: callback, args: args };
  42907. tasksByHandle[nextHandle] = task;
  42908. registerImmediate(nextHandle);
  42909. return nextHandle++;
  42910. }
  42911. function clearImmediate(handle) {
  42912. delete tasksByHandle[handle];
  42913. }
  42914. function run(task) {
  42915. var callback = task.callback;
  42916. var args = task.args;
  42917. switch (args.length) {
  42918. case 0:
  42919. callback();
  42920. break;
  42921. case 1:
  42922. callback(args[0]);
  42923. break;
  42924. case 2:
  42925. callback(args[0], args[1]);
  42926. break;
  42927. case 3:
  42928. callback(args[0], args[1], args[2]);
  42929. break;
  42930. default:
  42931. callback.apply(undefined, args);
  42932. break;
  42933. }
  42934. }
  42935. function runIfPresent(handle) {
  42936. // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
  42937. // So if we're currently running a task, we'll need to delay this invocation.
  42938. if (currentlyRunningATask) {
  42939. // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
  42940. // "too much recursion" error.
  42941. setTimeout(runIfPresent, 0, handle);
  42942. } else {
  42943. var task = tasksByHandle[handle];
  42944. if (task) {
  42945. currentlyRunningATask = true;
  42946. try {
  42947. run(task);
  42948. } finally {
  42949. clearImmediate(handle);
  42950. currentlyRunningATask = false;
  42951. }
  42952. }
  42953. }
  42954. }
  42955. function installNextTickImplementation() {
  42956. registerImmediate = function(handle) {
  42957. process.nextTick(function () { runIfPresent(handle); });
  42958. };
  42959. }
  42960. function canUsePostMessage() {
  42961. // The test against `importScripts` prevents this implementation from being installed inside a web worker,
  42962. // where `global.postMessage` means something completely different and can't be used for this purpose.
  42963. if (global.postMessage && !global.importScripts) {
  42964. var postMessageIsAsynchronous = true;
  42965. var oldOnMessage = global.onmessage;
  42966. global.onmessage = function() {
  42967. postMessageIsAsynchronous = false;
  42968. };
  42969. global.postMessage("", "*");
  42970. global.onmessage = oldOnMessage;
  42971. return postMessageIsAsynchronous;
  42972. }
  42973. }
  42974. function installPostMessageImplementation() {
  42975. // Installs an event handler on `global` for the `message` event: see
  42976. // * https://developer.mozilla.org/en/DOM/window.postMessage
  42977. // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
  42978. var messagePrefix = "setImmediate$" + Math.random() + "$";
  42979. var onGlobalMessage = function(event) {
  42980. if (event.source === global &&
  42981. typeof event.data === "string" &&
  42982. event.data.indexOf(messagePrefix) === 0) {
  42983. runIfPresent(+event.data.slice(messagePrefix.length));
  42984. }
  42985. };
  42986. if (global.addEventListener) {
  42987. global.addEventListener("message", onGlobalMessage, false);
  42988. } else {
  42989. global.attachEvent("onmessage", onGlobalMessage);
  42990. }
  42991. registerImmediate = function(handle) {
  42992. global.postMessage(messagePrefix + handle, "*");
  42993. };
  42994. }
  42995. function installMessageChannelImplementation() {
  42996. var channel = new MessageChannel();
  42997. channel.port1.onmessage = function(event) {
  42998. var handle = event.data;
  42999. runIfPresent(handle);
  43000. };
  43001. registerImmediate = function(handle) {
  43002. channel.port2.postMessage(handle);
  43003. };
  43004. }
  43005. function installReadyStateChangeImplementation() {
  43006. var html = doc.documentElement;
  43007. registerImmediate = function(handle) {
  43008. // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
  43009. // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
  43010. var script = doc.createElement("script");
  43011. script.onreadystatechange = function () {
  43012. runIfPresent(handle);
  43013. script.onreadystatechange = null;
  43014. html.removeChild(script);
  43015. script = null;
  43016. };
  43017. html.appendChild(script);
  43018. };
  43019. }
  43020. function installSetTimeoutImplementation() {
  43021. registerImmediate = function(handle) {
  43022. setTimeout(runIfPresent, 0, handle);
  43023. };
  43024. }
  43025. // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
  43026. var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
  43027. attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
  43028. // Don't get fooled by e.g. browserify environments.
  43029. if ({}.toString.call(global.process) === "[object process]") {
  43030. // For Node.js before 0.9
  43031. installNextTickImplementation();
  43032. } else if (canUsePostMessage()) {
  43033. // For non-IE10 modern browsers
  43034. installPostMessageImplementation();
  43035. } else if (global.MessageChannel) {
  43036. // For web workers, where supported
  43037. installMessageChannelImplementation();
  43038. } else if (doc && "onreadystatechange" in doc.createElement("script")) {
  43039. // For IE 6–8
  43040. installReadyStateChangeImplementation();
  43041. } else {
  43042. // For older browsers
  43043. installSetTimeoutImplementation();
  43044. }
  43045. attachTo.setImmediate = setImmediate;
  43046. attachTo.clearImmediate = clearImmediate;
  43047. }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
  43048. /* 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")))
  43049. /***/ }),
  43050. /***/ "./node_modules/timers-browserify/main.js":
  43051. /*!************************************************!*\
  43052. !*** ./node_modules/timers-browserify/main.js ***!
  43053. \************************************************/
  43054. /*! no static exports found */
  43055. /***/ (function(module, exports, __webpack_require__) {
  43056. /* WEBPACK VAR INJECTION */(function(global) {var scope = (typeof global !== "undefined" && global) ||
  43057. (typeof self !== "undefined" && self) ||
  43058. window;
  43059. var apply = Function.prototype.apply;
  43060. // DOM APIs, for completeness
  43061. exports.setTimeout = function() {
  43062. return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);
  43063. };
  43064. exports.setInterval = function() {
  43065. return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);
  43066. };
  43067. exports.clearTimeout =
  43068. exports.clearInterval = function(timeout) {
  43069. if (timeout) {
  43070. timeout.close();
  43071. }
  43072. };
  43073. function Timeout(id, clearFn) {
  43074. this._id = id;
  43075. this._clearFn = clearFn;
  43076. }
  43077. Timeout.prototype.unref = Timeout.prototype.ref = function() {};
  43078. Timeout.prototype.close = function() {
  43079. this._clearFn.call(scope, this._id);
  43080. };
  43081. // Does not start the time, just sets up the members needed.
  43082. exports.enroll = function(item, msecs) {
  43083. clearTimeout(item._idleTimeoutId);
  43084. item._idleTimeout = msecs;
  43085. };
  43086. exports.unenroll = function(item) {
  43087. clearTimeout(item._idleTimeoutId);
  43088. item._idleTimeout = -1;
  43089. };
  43090. exports._unrefActive = exports.active = function(item) {
  43091. clearTimeout(item._idleTimeoutId);
  43092. var msecs = item._idleTimeout;
  43093. if (msecs >= 0) {
  43094. item._idleTimeoutId = setTimeout(function onTimeout() {
  43095. if (item._onTimeout)
  43096. item._onTimeout();
  43097. }, msecs);
  43098. }
  43099. };
  43100. // setimmediate attaches itself to the global object
  43101. __webpack_require__(/*! setimmediate */ "./node_modules/setimmediate/setImmediate.js");
  43102. // On some exotic environments, it's not clear which object `setimmediate` was
  43103. // able to install onto. Search each possibility in the same order as the
  43104. // `setimmediate` library.
  43105. exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) ||
  43106. (typeof global !== "undefined" && global.setImmediate) ||
  43107. (this && this.setImmediate);
  43108. exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||
  43109. (typeof global !== "undefined" && global.clearImmediate) ||
  43110. (this && this.clearImmediate);
  43111. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  43112. /***/ }),
  43113. /***/ "./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&":
  43114. /*!*******************************************************************************************************************************************************************************************************************!*\
  43115. !*** ./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& ***!
  43116. \*******************************************************************************************************************************************************************************************************************/
  43117. /*! exports provided: render, staticRenderFns */
  43118. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43119. "use strict";
  43120. __webpack_require__.r(__webpack_exports__);
  43121. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43122. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43123. var render = function() {
  43124. var _vm = this
  43125. var _h = _vm.$createElement
  43126. var _c = _vm._self._c || _h
  43127. return _vm._m(0)
  43128. }
  43129. var staticRenderFns = [
  43130. function() {
  43131. var _vm = this
  43132. var _h = _vm.$createElement
  43133. var _c = _vm._self._c || _h
  43134. return _c("div", { staticClass: "container" }, [
  43135. _c("div", { staticClass: "row justify-content-center" }, [
  43136. _c("div", { staticClass: "col-md-8" }, [
  43137. _c("div", { staticClass: "card" }, [
  43138. _c("div", { staticClass: "card-header" }, [
  43139. _vm._v("Example Component")
  43140. ]),
  43141. _vm._v(" "),
  43142. _c("div", { staticClass: "card-body" }, [
  43143. _vm._v(
  43144. "\n I'm an example component.\n "
  43145. )
  43146. ])
  43147. ])
  43148. ])
  43149. ])
  43150. ])
  43151. }
  43152. ]
  43153. render._withStripped = true
  43154. /***/ }),
  43155. /***/ "./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&":
  43156. /*!************************************************************************************************************************************************************************************************************!*\
  43157. !*** ./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& ***!
  43158. \************************************************************************************************************************************************************************************************************/
  43159. /*! exports provided: render, staticRenderFns */
  43160. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43161. "use strict";
  43162. __webpack_require__.r(__webpack_exports__);
  43163. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43164. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43165. var render = function() {
  43166. var _vm = this
  43167. var _h = _vm.$createElement
  43168. var _c = _vm._self._c || _h
  43169. return _c(
  43170. "div",
  43171. [
  43172. _c(
  43173. "modal",
  43174. {
  43175. attrs: {
  43176. id: "asseteditModal",
  43177. tabindex: "-1",
  43178. role: "dialog",
  43179. "aria-labelledby": "asseteditModalLabel"
  43180. }
  43181. },
  43182. [
  43183. _c(
  43184. "h5",
  43185. {
  43186. staticClass: "modal-title",
  43187. attrs: { slot: "header", id: "asseteditModalLabel" },
  43188. slot: "header"
  43189. },
  43190. [_vm._v("\n Edit Work Order Information\n ")]
  43191. ),
  43192. _vm._v(" "),
  43193. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43194. _c("div", { staticClass: "form-group" }, [
  43195. _c("label", { attrs: { for: "manufacturer" } }, [
  43196. _vm._v("Manufacturer")
  43197. ]),
  43198. _vm._v(" "),
  43199. _c("input", {
  43200. directives: [
  43201. {
  43202. name: "model",
  43203. rawName: "v-model.lazy",
  43204. value: _vm.data.pcmanu,
  43205. expression: "data.pcmanu",
  43206. modifiers: { lazy: true }
  43207. }
  43208. ],
  43209. staticClass: "form-control",
  43210. attrs: {
  43211. type: "text",
  43212. name: "manufacturer",
  43213. id: "manufacturer"
  43214. },
  43215. domProps: { value: _vm.data.pcmanu },
  43216. on: {
  43217. change: function($event) {
  43218. return _vm.$set(_vm.data, "pcmanu", $event.target.value)
  43219. }
  43220. }
  43221. })
  43222. ]),
  43223. _vm._v(" "),
  43224. _c("div", { staticClass: "form-group" }, [
  43225. _c("label", { attrs: { for: "make" } }, [_vm._v("Make")]),
  43226. _vm._v(" "),
  43227. _c("input", {
  43228. directives: [
  43229. {
  43230. name: "model",
  43231. rawName: "v-model.lazy",
  43232. value: _vm.data.pcmake,
  43233. expression: "data.pcmake",
  43234. modifiers: { lazy: true }
  43235. }
  43236. ],
  43237. staticClass: "form-control",
  43238. attrs: { type: "text", name: "make", id: "make" },
  43239. domProps: { value: _vm.data.pcmake },
  43240. on: {
  43241. change: function($event) {
  43242. return _vm.$set(_vm.data, "pcmake", $event.target.value)
  43243. }
  43244. }
  43245. })
  43246. ]),
  43247. _vm._v(" "),
  43248. _c("div", { staticClass: "form-group" }, [
  43249. _c("label", { attrs: { for: "nickname" } }, [_vm._v("Nickname")]),
  43250. _vm._v(" "),
  43251. _c("input", {
  43252. directives: [
  43253. {
  43254. name: "model",
  43255. rawName: "v-model.lazy",
  43256. value: _vm.data.pcnickname,
  43257. expression: "data.pcnickname",
  43258. modifiers: { lazy: true }
  43259. }
  43260. ],
  43261. staticClass: "form-control",
  43262. attrs: { type: "text", name: "nickname", id: "nickname" },
  43263. domProps: { value: _vm.data.pcnickname },
  43264. on: {
  43265. change: function($event) {
  43266. return _vm.$set(_vm.data, "pcnickname", $event.target.value)
  43267. }
  43268. }
  43269. })
  43270. ]),
  43271. _vm._v(" "),
  43272. _c("div", { staticClass: "form-group" }, [
  43273. _c("label", { attrs: { for: "os" } }, [_vm._v("OS")]),
  43274. _vm._v(" "),
  43275. _c("input", {
  43276. directives: [
  43277. {
  43278. name: "model",
  43279. rawName: "v-model.lazy",
  43280. value: _vm.pcextra[2],
  43281. expression: "pcextra[2]",
  43282. modifiers: { lazy: true }
  43283. }
  43284. ],
  43285. staticClass: "form-control",
  43286. attrs: { type: "text", name: "os", id: "os" },
  43287. domProps: { value: _vm.pcextra[2] },
  43288. on: {
  43289. change: function($event) {
  43290. return _vm.$set(_vm.pcextra, 2, $event.target.value)
  43291. }
  43292. }
  43293. })
  43294. ]),
  43295. _vm._v(" "),
  43296. _c("div", { staticClass: "form-group" }, [
  43297. _c("label", { attrs: { for: "serial" } }, [
  43298. _vm._v("Serial Number")
  43299. ]),
  43300. _vm._v(" "),
  43301. _c("input", {
  43302. directives: [
  43303. {
  43304. name: "model",
  43305. rawName: "v-model.lazy",
  43306. value: _vm.pcextra[104],
  43307. expression: "pcextra[104]",
  43308. modifiers: { lazy: true }
  43309. }
  43310. ],
  43311. staticClass: "form-control",
  43312. attrs: { type: "text", id: "serial", name: "serial" },
  43313. domProps: { value: _vm.pcextra[104] },
  43314. on: {
  43315. change: function($event) {
  43316. return _vm.$set(_vm.pcextra, 104, $event.target.value)
  43317. }
  43318. }
  43319. })
  43320. ]),
  43321. _vm._v(" "),
  43322. _c("div", { staticClass: "form-group" }, [
  43323. _c("label", { attrs: { for: "cpu" } }, [_vm._v("CPU")]),
  43324. _vm._v(" "),
  43325. _c("input", {
  43326. directives: [
  43327. {
  43328. name: "model",
  43329. rawName: "v-model.lazy",
  43330. value: _vm.pcextra[101],
  43331. expression: "pcextra[101]",
  43332. modifiers: { lazy: true }
  43333. }
  43334. ],
  43335. staticClass: "form-control",
  43336. attrs: { type: "text", id: "cpu", name: "cpu" },
  43337. domProps: { value: _vm.pcextra[101] },
  43338. on: {
  43339. change: function($event) {
  43340. return _vm.$set(_vm.pcextra, 101, $event.target.value)
  43341. }
  43342. }
  43343. })
  43344. ]),
  43345. _vm._v(" "),
  43346. _c("div", { staticClass: "form-group" }, [
  43347. _c("label", { attrs: { for: "ram" } }, [_vm._v("RAM")]),
  43348. _vm._v(" "),
  43349. _c("input", {
  43350. directives: [
  43351. {
  43352. name: "model",
  43353. rawName: "v-model.lazy",
  43354. value: _vm.pcextra[100],
  43355. expression: "pcextra[100]",
  43356. modifiers: { lazy: true }
  43357. }
  43358. ],
  43359. staticClass: "form-control",
  43360. attrs: { type: "text", name: "ram", id: "ram" },
  43361. domProps: { value: _vm.pcextra[100] },
  43362. on: {
  43363. change: function($event) {
  43364. return _vm.$set(_vm.pcextra, 100, $event.target.value)
  43365. }
  43366. }
  43367. })
  43368. ]),
  43369. _vm._v(" "),
  43370. _c("div", { staticClass: "form-group" }, [
  43371. _c("label", { attrs: { for: "graphics" } }, [_vm._v("Graphics")]),
  43372. _vm._v(" "),
  43373. _c("input", {
  43374. directives: [
  43375. {
  43376. name: "model",
  43377. rawName: "v-model.lazy",
  43378. value: _vm.pcextra[4],
  43379. expression: "pcextra[4]",
  43380. modifiers: { lazy: true }
  43381. }
  43382. ],
  43383. staticClass: "form-control",
  43384. attrs: { type: "text", name: "graphics", id: "grapics" },
  43385. domProps: { value: _vm.pcextra[4] },
  43386. on: {
  43387. change: function($event) {
  43388. return _vm.$set(_vm.pcextra, 4, $event.target.value)
  43389. }
  43390. }
  43391. })
  43392. ])
  43393. ]),
  43394. _vm._v(" "),
  43395. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43396. _c(
  43397. "button",
  43398. {
  43399. staticClass: "btn btn-secondary",
  43400. attrs: { type: "button", "data-dismiss": "modal" }
  43401. },
  43402. [_vm._v("Close")]
  43403. ),
  43404. _vm._v(" "),
  43405. _c(
  43406. "button",
  43407. {
  43408. staticClass: "btn btn-primary",
  43409. attrs: { type: "button" },
  43410. on: {
  43411. click: function($event) {
  43412. return _vm.updateAsset()
  43413. }
  43414. }
  43415. },
  43416. [_vm._v("Save")]
  43417. )
  43418. ])
  43419. ]
  43420. ),
  43421. _vm._v(" "),
  43422. _c("h4", { staticClass: "text-center" }, [
  43423. _vm._v(
  43424. _vm._s(this.data.pcmanu) + " " + _vm._s(this.data.pcmake) + " - "
  43425. ),
  43426. _c("small", { staticClass: "text-muted" }, [
  43427. _vm._v(_vm._s(this.data.pcnickname))
  43428. ])
  43429. ]),
  43430. _vm._v(" "),
  43431. _c("p", [_vm._v("OS: " + _vm._s(this.pcextra[2]))]),
  43432. _vm._v(" "),
  43433. _c("p", [_vm._v("S/N: " + _vm._s(this.pcextra[104]))]),
  43434. _vm._v(" "),
  43435. _c("p", [_vm._v("CPU: " + _vm._s(this.pcextra[101]))]),
  43436. _vm._v(" "),
  43437. _c("p", [_vm._v("RAM: " + _vm._s(this.pcextra[100]))]),
  43438. _vm._v(" "),
  43439. _c("p", [_vm._v("Graphics: " + _vm._s(this.pcextra[4]))]),
  43440. _vm._v(" "),
  43441. _c(
  43442. "button",
  43443. {
  43444. staticClass: "btn btn-primary",
  43445. attrs: {
  43446. type: "button",
  43447. "data-toggle": "modal",
  43448. "data-target": "#asseteditModal"
  43449. }
  43450. },
  43451. [_vm._v("Edit")]
  43452. )
  43453. ],
  43454. 1
  43455. )
  43456. }
  43457. var staticRenderFns = []
  43458. render._withStripped = true
  43459. /***/ }),
  43460. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=template&id=18875e5a&":
  43461. /*!*******************************************************************************************************************************************************************************************************************************!*\
  43462. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=template&id=18875e5a& ***!
  43463. \*******************************************************************************************************************************************************************************************************************************/
  43464. /*! exports provided: render, staticRenderFns */
  43465. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43466. "use strict";
  43467. __webpack_require__.r(__webpack_exports__);
  43468. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43469. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43470. var render = function() {
  43471. var _vm = this
  43472. var _h = _vm.$createElement
  43473. var _c = _vm._self._c || _h
  43474. return _c("div", { staticClass: "dropdown", class: { open: _vm.open } }, [
  43475. _c("div", { staticClass: "input-group" }, [
  43476. _c("input", {
  43477. directives: [
  43478. {
  43479. name: "model",
  43480. rawName: "v-model",
  43481. value: _vm.searchText,
  43482. expression: "searchText"
  43483. }
  43484. ],
  43485. staticClass: "form-control",
  43486. attrs: { type: "text" },
  43487. domProps: { value: _vm.searchText },
  43488. on: {
  43489. input: [
  43490. function($event) {
  43491. if ($event.target.composing) {
  43492. return
  43493. }
  43494. _vm.searchText = $event.target.value
  43495. },
  43496. _vm.searchChanged
  43497. ]
  43498. }
  43499. }),
  43500. _vm._v(" "),
  43501. _c("div", { staticClass: "form-group-append" }, [
  43502. _c(
  43503. "a",
  43504. {
  43505. staticClass: "toggle input-group-text bg-primary text-light",
  43506. on: {
  43507. mousedown: function($event) {
  43508. $event.preventDefault()
  43509. },
  43510. click: function($event) {
  43511. return _vm.setOpen(!_vm.open)
  43512. }
  43513. }
  43514. },
  43515. [
  43516. _c("span", { staticClass: "arrow-up" }, [_vm._v("▲")]),
  43517. _vm._v(" "),
  43518. _c("span", { staticClass: "arrow-down" }, [_vm._v("▼")])
  43519. ]
  43520. )
  43521. ])
  43522. ]),
  43523. _vm._v(" "),
  43524. _c(
  43525. "ul",
  43526. { staticClass: "suggestion-list list-unstyled" },
  43527. _vm._l(_vm.matches, function(suggestion, index) {
  43528. return _c(
  43529. "li",
  43530. {
  43531. key: index,
  43532. on: {
  43533. mousedown: function($event) {
  43534. $event.preventDefault()
  43535. },
  43536. click: function($event) {
  43537. return _vm.suggestionSelected(suggestion)
  43538. }
  43539. }
  43540. },
  43541. [_vm._v("\n " + _vm._s(suggestion[1]) + "\n ")]
  43542. )
  43543. }),
  43544. 0
  43545. )
  43546. ])
  43547. }
  43548. var staticRenderFns = []
  43549. render._withStripped = true
  43550. /***/ }),
  43551. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential-form-modal.vue?vue&type=template&id=5ba19d42&":
  43552. /*!************************************************************************************************************************************************************************************************************************!*\
  43553. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/credential-form-modal.vue?vue&type=template&id=5ba19d42& ***!
  43554. \************************************************************************************************************************************************************************************************************************/
  43555. /*! exports provided: render, staticRenderFns */
  43556. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43557. "use strict";
  43558. __webpack_require__.r(__webpack_exports__);
  43559. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43560. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43561. var render = function() {
  43562. var _vm = this
  43563. var _h = _vm.$createElement
  43564. var _c = _vm._self._c || _h
  43565. return _c(
  43566. "modal",
  43567. {
  43568. attrs: {
  43569. id: _vm.id,
  43570. tabindex: "-1",
  43571. role: "dialog",
  43572. "aria-labelledby": _vm.id + "Label"
  43573. }
  43574. },
  43575. [
  43576. _c(
  43577. "h5",
  43578. {
  43579. staticClass: "modal-title",
  43580. attrs: { slot: "header", id: _vm.id + "Label" },
  43581. slot: "header"
  43582. },
  43583. [_vm._v("\n Edit Credential\n ")]
  43584. ),
  43585. _vm._v(" "),
  43586. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43587. _c(
  43588. "div",
  43589. { staticClass: "form" },
  43590. [
  43591. _c("autocomplete-custom-dropdown", {
  43592. attrs: {
  43593. options: _vm.descriptions,
  43594. value: _vm.creddesc,
  43595. "allow-custom": true
  43596. },
  43597. model: {
  43598. value: _vm.creddesc,
  43599. callback: function($$v) {
  43600. _vm.creddesc = $$v
  43601. },
  43602. expression: "creddesc"
  43603. }
  43604. })
  43605. ],
  43606. 1
  43607. ),
  43608. _vm._v(" "),
  43609. _c("div", { staticClass: "form-group" }, [
  43610. _c("label", { attrs: { for: "newusername" } }, [_vm._v("Username")]),
  43611. _vm._v(" "),
  43612. _c("input", {
  43613. directives: [
  43614. {
  43615. name: "model",
  43616. rawName: "v-model",
  43617. value: _vm.data.creduser,
  43618. expression: "data.creduser"
  43619. }
  43620. ],
  43621. staticClass: "form-control credential",
  43622. attrs: {
  43623. type: "text",
  43624. name: "newusername" + _vm.data.credid,
  43625. id: "newusername" + _vm.data.credid
  43626. },
  43627. domProps: { value: _vm.data.creduser },
  43628. on: {
  43629. input: function($event) {
  43630. if ($event.target.composing) {
  43631. return
  43632. }
  43633. _vm.$set(_vm.data, "creduser", $event.target.value)
  43634. }
  43635. }
  43636. })
  43637. ]),
  43638. _vm._v(" "),
  43639. _c("div", { staticClass: "form-group" }, [
  43640. _c("label", { attrs: { for: "newpassword" } }, [_vm._v("Password")]),
  43641. _vm._v(" "),
  43642. _c("input", {
  43643. directives: [
  43644. {
  43645. name: "model",
  43646. rawName: "v-model",
  43647. value: _vm.data.credpass,
  43648. expression: "data.credpass"
  43649. }
  43650. ],
  43651. staticClass: "form-control credential",
  43652. attrs: {
  43653. type: "text",
  43654. name: "newpassword" + _vm.data.credid,
  43655. id: "newpassword" + _vm.data.credid
  43656. },
  43657. domProps: { value: _vm.data.credpass },
  43658. on: {
  43659. input: function($event) {
  43660. if ($event.target.composing) {
  43661. return
  43662. }
  43663. _vm.$set(_vm.data, "credpass", $event.target.value)
  43664. }
  43665. }
  43666. }),
  43667. _vm._v(" "),
  43668. _c(
  43669. "button",
  43670. {
  43671. staticClass: "btn btn-secondary",
  43672. attrs: { type: "button" },
  43673. on: {
  43674. click: function($event) {
  43675. return _vm.getRandomPassword(_vm.data.credid)
  43676. }
  43677. }
  43678. },
  43679. [_vm._v("Generate Random")]
  43680. )
  43681. ]),
  43682. _vm._v(" "),
  43683. _c("div", { staticClass: "form-group" })
  43684. ]),
  43685. _vm._v(" "),
  43686. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43687. _c(
  43688. "button",
  43689. {
  43690. staticClass: "btn btn-secondary",
  43691. attrs: { type: "button", "data-dismiss": "modal" }
  43692. },
  43693. [_vm._v("Close")]
  43694. ),
  43695. _vm._v(" "),
  43696. _c(
  43697. "button",
  43698. {
  43699. staticClass: "btn btn-primary",
  43700. attrs: { type: "button" },
  43701. on: {
  43702. click: function($event) {
  43703. return _vm.updateCredential()
  43704. }
  43705. }
  43706. },
  43707. [_vm._v("Save")]
  43708. )
  43709. ])
  43710. ]
  43711. )
  43712. }
  43713. var staticRenderFns = []
  43714. render._withStripped = true
  43715. /***/ }),
  43716. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential-list.vue?vue&type=template&id=06d8fa4e&":
  43717. /*!******************************************************************************************************************************************************************************************************************!*\
  43718. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/credential-list.vue?vue&type=template&id=06d8fa4e& ***!
  43719. \******************************************************************************************************************************************************************************************************************/
  43720. /*! exports provided: render, staticRenderFns */
  43721. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43722. "use strict";
  43723. __webpack_require__.r(__webpack_exports__);
  43724. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43725. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43726. var render = function() {
  43727. var _vm = this
  43728. var _h = _vm.$createElement
  43729. var _c = _vm._self._c || _h
  43730. return _c(
  43731. "div",
  43732. [
  43733. _c("credential-form-modal", {
  43734. attrs: {
  43735. "modal-id": "newCredentialModal",
  43736. descriptions: _vm.creddescList,
  43737. create: true,
  43738. pcid: _vm.pcid
  43739. }
  43740. }),
  43741. _vm._v(" "),
  43742. _c(
  43743. "button",
  43744. {
  43745. staticClass: "btn btn-primary",
  43746. attrs: {
  43747. type: "button",
  43748. "data-toggle": "modal",
  43749. "data-target": "#newCredentialModal"
  43750. }
  43751. },
  43752. [_vm._v("New Credential")]
  43753. ),
  43754. _vm._v(" "),
  43755. _vm._l(_vm.credentials, function(credential) {
  43756. return _c(
  43757. "div",
  43758. { key: credential.credid },
  43759. [
  43760. _c("credential", {
  43761. attrs: { credential: credential, descriptions: _vm.creddescList }
  43762. })
  43763. ],
  43764. 1
  43765. )
  43766. })
  43767. ],
  43768. 2
  43769. )
  43770. }
  43771. var staticRenderFns = []
  43772. render._withStripped = true
  43773. /***/ }),
  43774. /***/ "./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&":
  43775. /*!*************************************************************************************************************************************************************************************************************!*\
  43776. !*** ./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& ***!
  43777. \*************************************************************************************************************************************************************************************************************/
  43778. /*! exports provided: render, staticRenderFns */
  43779. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43780. "use strict";
  43781. __webpack_require__.r(__webpack_exports__);
  43782. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43783. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43784. var render = function() {
  43785. var _vm = this
  43786. var _h = _vm.$createElement
  43787. var _c = _vm._self._c || _h
  43788. return _c(
  43789. "div",
  43790. { staticClass: "bg-lightgray m-1 p-2 border rounded container-fluid" },
  43791. [
  43792. _c("credential-form-modal", {
  43793. attrs: {
  43794. descriptions: _vm.creddescList,
  43795. "modal-id": "credential" + this.data.credid + "editModal",
  43796. populateWith: this.data
  43797. }
  43798. }),
  43799. _vm._v(" "),
  43800. _c(
  43801. "modal",
  43802. {
  43803. attrs: {
  43804. id: "credential" + this.data.credid + "deleteModal",
  43805. tabindex: "-1"
  43806. }
  43807. },
  43808. [
  43809. _c(
  43810. "h5",
  43811. {
  43812. staticClass: "modal-title",
  43813. attrs: {
  43814. slot: "header",
  43815. id: "credential" + this.data.credid + "deleteModalLabel"
  43816. },
  43817. slot: "header"
  43818. },
  43819. [_vm._v("\r\n Delete Credential\r\n ")]
  43820. ),
  43821. _vm._v(" "),
  43822. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43823. _vm._v("\r\n Are you sure?\r\n ")
  43824. ]),
  43825. _vm._v(" "),
  43826. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43827. _c(
  43828. "button",
  43829. {
  43830. staticClass: "btn btn-secondary",
  43831. attrs: { type: "button", "data-dismiss": "modal" }
  43832. },
  43833. [_vm._v("Cancel")]
  43834. ),
  43835. _vm._v(" "),
  43836. _c(
  43837. "button",
  43838. {
  43839. staticClass: "btn btn-danger",
  43840. attrs: { type: "button" },
  43841. on: {
  43842. click: function($event) {
  43843. return _vm.deleteCredential()
  43844. }
  43845. }
  43846. },
  43847. [_vm._v("Confirm")]
  43848. )
  43849. ])
  43850. ]
  43851. ),
  43852. _vm._v(" "),
  43853. _c("div", { staticClass: "row no-gutters" }, [
  43854. _c("div", { staticClass: "h5 col-3 text-left" }, [
  43855. _vm._v(_vm._s(this.data.creddesc))
  43856. ]),
  43857. _vm._v(" "),
  43858. _c("div", { staticClass: "col-9 text-right" }, [
  43859. _vm._v(_vm._s(this.data.creddate))
  43860. ])
  43861. ]),
  43862. _vm._v(" "),
  43863. _c("div", { staticClass: "row" }, [
  43864. _c("div", { staticClass: "col-lg-9" }, [
  43865. _c("div", [
  43866. _vm._m(0),
  43867. _vm._v(" "),
  43868. _c("input", {
  43869. staticClass: "border-0 credential",
  43870. attrs: {
  43871. type: "text",
  43872. id: "username" + this.data.credid,
  43873. readonly: ""
  43874. },
  43875. domProps: { value: this.data.creduser }
  43876. }),
  43877. _vm._v(" "),
  43878. _c(
  43879. "button",
  43880. {
  43881. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  43882. attrs: {
  43883. id: "btn-username" + this.data.credid,
  43884. "data-clipboard-target": "#username" + this.data.credid
  43885. }
  43886. },
  43887. [_c("i", { staticClass: "far fa-clone" })]
  43888. )
  43889. ]),
  43890. _vm._v(" "),
  43891. _c("div", [
  43892. _vm._m(1),
  43893. _vm._v(" "),
  43894. _c("input", {
  43895. staticClass: "border-0 credential",
  43896. attrs: {
  43897. type: "text",
  43898. id: "password" + this.data.credid,
  43899. readonly: ""
  43900. },
  43901. domProps: { value: this.data.credpass }
  43902. }),
  43903. _vm._v(" "),
  43904. _c(
  43905. "button",
  43906. {
  43907. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  43908. attrs: {
  43909. id: "btn-password" + this.data.credid,
  43910. "data-clipboard-target": "#password" + this.data.credid
  43911. }
  43912. },
  43913. [_c("i", { staticClass: "far fa-clone" })]
  43914. )
  43915. ])
  43916. ]),
  43917. _vm._v(" "),
  43918. _c(
  43919. "div",
  43920. {
  43921. staticClass: "btn-group col-lg-2 align-self-end w-25 w-lg-auto",
  43922. attrs: { role: "group", "aria-label": "Edit and Delete" }
  43923. },
  43924. [
  43925. _c(
  43926. "button",
  43927. {
  43928. staticClass: "btn btn-sm btn-secondary p-lg-1",
  43929. attrs: {
  43930. type: "button",
  43931. "data-toggle": "modal",
  43932. "data-target": "#credential" + this.data.credid + "editModal"
  43933. }
  43934. },
  43935. [_c("i", { staticClass: "fas fa-fw fa-edit" })]
  43936. ),
  43937. _vm._v(" "),
  43938. _c(
  43939. "button",
  43940. {
  43941. staticClass: "btn btn-sm btn-danger p-lg-1",
  43942. attrs: {
  43943. type: "button",
  43944. "data-toggle": "modal",
  43945. "data-target":
  43946. "#credential" + this.data.credid + "deleteModal"
  43947. }
  43948. },
  43949. [_c("i", { staticClass: "fas fa-fw fa-trash-alt" })]
  43950. )
  43951. ]
  43952. )
  43953. ])
  43954. ],
  43955. 1
  43956. )
  43957. }
  43958. var staticRenderFns = [
  43959. function() {
  43960. var _vm = this
  43961. var _h = _vm.$createElement
  43962. var _c = _vm._self._c || _h
  43963. return _c("label", { attrs: { for: "username" } }, [
  43964. _c("i", { staticClass: "fas fa-fw fa-user" })
  43965. ])
  43966. },
  43967. function() {
  43968. var _vm = this
  43969. var _h = _vm.$createElement
  43970. var _c = _vm._self._c || _h
  43971. return _c("label", { attrs: { for: "password" } }, [
  43972. _c("i", { staticClass: "fas fa-fw fa-key" })
  43973. ])
  43974. }
  43975. ]
  43976. render._withStripped = true
  43977. /***/ }),
  43978. /***/ "./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&":
  43979. /*!************************************************************************************************************************************************************************************************************!*\
  43980. !*** ./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& ***!
  43981. \************************************************************************************************************************************************************************************************************/
  43982. /*! exports provided: render, staticRenderFns */
  43983. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43984. "use strict";
  43985. __webpack_require__.r(__webpack_exports__);
  43986. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43987. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43988. var render = function() {
  43989. var _vm = this
  43990. var _h = _vm.$createElement
  43991. var _c = _vm._self._c || _h
  43992. return _c(
  43993. "ul",
  43994. { staticClass: "list-unstyled" },
  43995. _vm._l(_vm.errorList, function(error) {
  43996. return _c("li", { key: error, staticClass: "text-danger" }, [
  43997. _vm._v(" " + _vm._s(error) + " ")
  43998. ])
  43999. }),
  44000. 0
  44001. )
  44002. }
  44003. var staticRenderFns = []
  44004. render._withStripped = true
  44005. /***/ }),
  44006. /***/ "./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&":
  44007. /*!********************************************************************************************************************************************************************************************************!*\
  44008. !*** ./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& ***!
  44009. \********************************************************************************************************************************************************************************************************/
  44010. /*! exports provided: render, staticRenderFns */
  44011. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44012. "use strict";
  44013. __webpack_require__.r(__webpack_exports__);
  44014. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44015. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44016. var render = function() {
  44017. var _vm = this
  44018. var _h = _vm.$createElement
  44019. var _c = _vm._self._c || _h
  44020. return _c("div", { staticClass: "modal fade" }, [
  44021. _c(
  44022. "div",
  44023. { staticClass: "modal-dialog modal-lg", attrs: { role: "document" } },
  44024. [
  44025. _c("div", { staticClass: "modal-content" }, [
  44026. _c(
  44027. "div",
  44028. { staticClass: "modal-header" },
  44029. [_vm._m(0), _vm._v(" "), _vm._t("header")],
  44030. 2
  44031. ),
  44032. _vm._v(" "),
  44033. _c("div", { staticClass: "modal-body" }, [_vm._t("body")], 2),
  44034. _vm._v(" "),
  44035. _c("div", { staticClass: "modal-footer" }, [_vm._t("footer")], 2)
  44036. ])
  44037. ]
  44038. )
  44039. ])
  44040. }
  44041. var staticRenderFns = [
  44042. function() {
  44043. var _vm = this
  44044. var _h = _vm.$createElement
  44045. var _c = _vm._self._c || _h
  44046. return _c(
  44047. "button",
  44048. {
  44049. staticClass: "close",
  44050. attrs: {
  44051. type: "button",
  44052. "data-dismiss": "modal",
  44053. "aria-label": "Close"
  44054. }
  44055. },
  44056. [_c("span", { attrs: { "aria-hidden": "true" } }, [_vm._v("×")])]
  44057. )
  44058. }
  44059. ]
  44060. render._withStripped = true
  44061. /***/ }),
  44062. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/note-form-modal.vue?vue&type=template&id=0435c624&":
  44063. /*!******************************************************************************************************************************************************************************************************************!*\
  44064. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/note-form-modal.vue?vue&type=template&id=0435c624& ***!
  44065. \******************************************************************************************************************************************************************************************************************/
  44066. /*! exports provided: render, staticRenderFns */
  44067. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44068. "use strict";
  44069. __webpack_require__.r(__webpack_exports__);
  44070. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44071. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44072. var render = function() {
  44073. var _vm = this
  44074. var _h = _vm.$createElement
  44075. var _c = _vm._self._c || _h
  44076. return _c(
  44077. "modal",
  44078. {
  44079. attrs: {
  44080. id: _vm.modalId,
  44081. tabindex: "-1",
  44082. role: "dialog",
  44083. "aria-labelledby": _vm.modalId + "Label"
  44084. }
  44085. },
  44086. [
  44087. _c(
  44088. "h5",
  44089. {
  44090. staticClass: "modal-title",
  44091. attrs: { slot: "header", id: _vm.modalId + "Label" },
  44092. slot: "header"
  44093. },
  44094. [_vm._v("\n Edit Note\n ")]
  44095. ),
  44096. _vm._v(" "),
  44097. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  44098. _c("div", { staticClass: "form-group" }, [
  44099. _c("label", { attrs: { for: "content" } }, [_vm._v("Content")]),
  44100. _vm._v(" "),
  44101. _c("textarea", {
  44102. directives: [
  44103. {
  44104. name: "model",
  44105. rawName: "v-model",
  44106. value: _vm.note.thenote,
  44107. expression: "note.thenote"
  44108. }
  44109. ],
  44110. staticClass: "form-control",
  44111. attrs: {
  44112. name: "content" + _vm.note.noteid,
  44113. id: "content" + _vm.note.noteid
  44114. },
  44115. domProps: { value: _vm.note.thenote },
  44116. on: {
  44117. input: function($event) {
  44118. if ($event.target.composing) {
  44119. return
  44120. }
  44121. _vm.$set(_vm.note, "thenote", $event.target.value)
  44122. }
  44123. }
  44124. })
  44125. ])
  44126. ]),
  44127. _vm._v(" "),
  44128. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  44129. _c(
  44130. "button",
  44131. {
  44132. staticClass: "btn btn-secondary",
  44133. attrs: { type: "button", "data-dismiss": "modal" }
  44134. },
  44135. [_vm._v("Close")]
  44136. ),
  44137. _vm._v(" "),
  44138. _c(
  44139. "button",
  44140. {
  44141. staticClass: "btn btn-primary",
  44142. attrs: { type: "button" },
  44143. on: {
  44144. click: function($event) {
  44145. return _vm.updateNote(_vm.note)
  44146. }
  44147. }
  44148. },
  44149. [_vm._v("Save")]
  44150. )
  44151. ])
  44152. ]
  44153. )
  44154. }
  44155. var staticRenderFns = []
  44156. render._withStripped = true
  44157. /***/ }),
  44158. /***/ "./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&":
  44159. /*!********************************************************************************************************************************************************************************************************!*\
  44160. !*** ./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& ***!
  44161. \********************************************************************************************************************************************************************************************************/
  44162. /*! exports provided: render, staticRenderFns */
  44163. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44164. "use strict";
  44165. __webpack_require__.r(__webpack_exports__);
  44166. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44167. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44168. var render = function() {
  44169. var _vm = this
  44170. var _h = _vm.$createElement
  44171. var _c = _vm._self._c || _h
  44172. return _c(
  44173. "ul",
  44174. { staticClass: "list-unstyled" },
  44175. [
  44176. _c("div", { staticClass: "row" }, [
  44177. _c(
  44178. "div",
  44179. {
  44180. staticClass:
  44181. "col-md-2 d-flex justify-content-center justify-content-md-start"
  44182. },
  44183. [
  44184. _c(
  44185. "button",
  44186. {
  44187. staticClass: "btn btn-primary m-2",
  44188. attrs: {
  44189. type: "button",
  44190. "data-toggle": "collapse",
  44191. "data-target": "#note" + _vm.noteType + "add"
  44192. }
  44193. },
  44194. [
  44195. _c("i", { staticClass: "fas fa-fw fa-plus" }),
  44196. _vm._v(" Add New Note")
  44197. ]
  44198. )
  44199. ]
  44200. ),
  44201. _vm._v(" "),
  44202. _c("div", { staticClass: "col-md-10" }, [
  44203. _c(
  44204. "div",
  44205. {
  44206. staticClass: "collapse",
  44207. attrs: { id: "note" + _vm.noteType + "add" }
  44208. },
  44209. [
  44210. _c(
  44211. "div",
  44212. {
  44213. staticClass:
  44214. "d-flex flex-wrap flex-md-nowrap justify-content-center"
  44215. },
  44216. [
  44217. _c("textarea", {
  44218. directives: [
  44219. {
  44220. name: "model",
  44221. rawName: "v-model",
  44222. value: _vm.newNote.thenote,
  44223. expression: "newNote.thenote"
  44224. }
  44225. ],
  44226. staticClass: "form-control",
  44227. attrs: {
  44228. name: "newnote" + _vm.noteType,
  44229. id: "newnote" + _vm.noteType
  44230. },
  44231. domProps: { value: _vm.newNote.thenote },
  44232. on: {
  44233. input: function($event) {
  44234. if ($event.target.composing) {
  44235. return
  44236. }
  44237. _vm.$set(_vm.newNote, "thenote", $event.target.value)
  44238. }
  44239. }
  44240. }),
  44241. _vm._v(" "),
  44242. _c(
  44243. "button",
  44244. {
  44245. staticClass: "btn btn-secondary m-2",
  44246. attrs: { type: "button" },
  44247. on: {
  44248. click: function($event) {
  44249. return _vm.createNote()
  44250. }
  44251. }
  44252. },
  44253. [_vm._v("Save")]
  44254. )
  44255. ]
  44256. )
  44257. ]
  44258. )
  44259. ])
  44260. ]),
  44261. _vm._v(" "),
  44262. _vm._l(this.notes, function(note, index) {
  44263. return _c(
  44264. "li",
  44265. { key: index, staticClass: "row no-gutters mb-2" },
  44266. [
  44267. _c("note-form-modal", {
  44268. attrs: {
  44269. "modal-id": "note" + note.noteid + "editModal",
  44270. "populate-with": note
  44271. }
  44272. }),
  44273. _vm._v(" "),
  44274. _c(
  44275. "div",
  44276. {
  44277. staticClass: "col-md-1 d-flex flex-column mx-md-3",
  44278. class: _vm.setOrder(index)
  44279. },
  44280. [
  44281. _c("div", { staticClass: "text-center p-0 m-0" }, [
  44282. _vm._v(_vm._s(note.noteuser))
  44283. ]),
  44284. _vm._v(" "),
  44285. _c(
  44286. "div",
  44287. { staticClass: "text-muted text-small text-center p-0 m-0" },
  44288. [_vm._v(_vm._s(_vm.getHRDate(note.notetime)))]
  44289. ),
  44290. _vm._v(" "),
  44291. _c(
  44292. "div",
  44293. { staticClass: "btn-group justify-content-center p-0 m-0" },
  44294. [
  44295. _vm.authusername === note.noteuser ||
  44296. _vm.authusername === "admin"
  44297. ? [
  44298. _c(
  44299. "button",
  44300. {
  44301. staticClass: "btn btn-sm btn-primary m-1",
  44302. attrs: {
  44303. "data-toggle": "modal",
  44304. "data-target":
  44305. "#note" + note.noteid + "editModal"
  44306. }
  44307. },
  44308. [_c("i", { staticClass: "fas fa-fw fa-edit" })]
  44309. ),
  44310. _vm._v(" "),
  44311. _vm._m(0, true),
  44312. _vm._v(" "),
  44313. _vm._m(1, true)
  44314. ]
  44315. : _vm._e()
  44316. ],
  44317. 2
  44318. )
  44319. ]
  44320. ),
  44321. _vm._v(" "),
  44322. _c("div", { staticClass: "col-md-10" }, [
  44323. _c("div", { staticClass: "card m-2" }, [
  44324. _c("div", { staticClass: "card-body p-2" }, [
  44325. _vm._v(
  44326. "\n " +
  44327. _vm._s(note.thenote) +
  44328. "\n "
  44329. )
  44330. ])
  44331. ])
  44332. ])
  44333. ],
  44334. 1
  44335. )
  44336. })
  44337. ],
  44338. 2
  44339. )
  44340. }
  44341. var staticRenderFns = [
  44342. function() {
  44343. var _vm = this
  44344. var _h = _vm.$createElement
  44345. var _c = _vm._self._c || _h
  44346. return _c("button", { staticClass: "btn btn-sm btn-danger m-1" }, [
  44347. _c("i", { staticClass: "fas fa-fw fa-trash-alt" })
  44348. ])
  44349. },
  44350. function() {
  44351. var _vm = this
  44352. var _h = _vm.$createElement
  44353. var _c = _vm._self._c || _h
  44354. return _c("button", { staticClass: "btn btn-sm btn-primary m-1" }, [
  44355. _c("i", { staticClass: "fa fa-fw fa-random" })
  44356. ])
  44357. }
  44358. ]
  44359. render._withStripped = true
  44360. /***/ }),
  44361. /***/ "./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&":
  44362. /*!********************************************************************************************************************************************************************************************************************!*\
  44363. !*** ./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& ***!
  44364. \********************************************************************************************************************************************************************************************************************/
  44365. /*! exports provided: render, staticRenderFns */
  44366. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44367. "use strict";
  44368. __webpack_require__.r(__webpack_exports__);
  44369. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44370. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44371. var render = function() {
  44372. var _vm = this
  44373. var _h = _vm.$createElement
  44374. var _c = _vm._self._c || _h
  44375. return _c(
  44376. "modal",
  44377. {
  44378. attrs: {
  44379. id: _vm.id,
  44380. tabindex: "-1",
  44381. role: "dialog",
  44382. "aria-labelledby": _vm.id + "Label"
  44383. }
  44384. },
  44385. [
  44386. _c(
  44387. "h5",
  44388. {
  44389. staticClass: "modal-title",
  44390. attrs: { slot: "header", id: _vm.id + "Label" },
  44391. slot: "header"
  44392. },
  44393. [_vm._v("\r\n Edit Work Order Information\r\n ")]
  44394. ),
  44395. _vm._v(" "),
  44396. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  44397. _c(
  44398. "div",
  44399. { staticClass: "form-group" },
  44400. [
  44401. _c("label", { attrs: { for: "probdesc" } }, [
  44402. _vm._v("Problem Description")
  44403. ]),
  44404. _vm._v(" "),
  44405. _c("textarea", {
  44406. directives: [
  44407. {
  44408. name: "model",
  44409. rawName: "v-model",
  44410. value: _vm.data.probdesc,
  44411. expression: "data.probdesc"
  44412. }
  44413. ],
  44414. class: {
  44415. "form-control": true,
  44416. "is-invalid": _vm.errors.probdesc
  44417. },
  44418. attrs: { id: "probdesc", name: "probdesc" },
  44419. domProps: { value: _vm.data.probdesc },
  44420. on: {
  44421. input: function($event) {
  44422. if ($event.target.composing) {
  44423. return
  44424. }
  44425. _vm.$set(_vm.data, "probdesc", $event.target.value)
  44426. }
  44427. }
  44428. }),
  44429. _vm._v(" "),
  44430. _c("errorlist", { attrs: { errors: _vm.errors.probdesc } })
  44431. ],
  44432. 1
  44433. ),
  44434. _vm._v(" "),
  44435. _c(
  44436. "div",
  44437. { staticClass: "form-group" },
  44438. [
  44439. _c("label", { attrs: { for: "suggested" } }, [
  44440. _vm._v("Suggested Solution")
  44441. ]),
  44442. _vm._v(" "),
  44443. _c("textarea", {
  44444. directives: [
  44445. {
  44446. name: "model",
  44447. rawName: "v-model",
  44448. value: _vm.data.suggested,
  44449. expression: "data.suggested"
  44450. }
  44451. ],
  44452. class: {
  44453. "form-control": true,
  44454. "is-invalid": _vm.errors.suggested
  44455. },
  44456. attrs: { id: "suggested", name: "suggested" },
  44457. domProps: { value: _vm.data.suggested },
  44458. on: {
  44459. input: function($event) {
  44460. if ($event.target.composing) {
  44461. return
  44462. }
  44463. _vm.$set(_vm.data, "suggested", $event.target.value)
  44464. }
  44465. }
  44466. }),
  44467. _vm._v(" "),
  44468. _c("errorlist", { attrs: { errors: _vm.errors.suggested } })
  44469. ],
  44470. 1
  44471. ),
  44472. _vm._v(" "),
  44473. _c(
  44474. "div",
  44475. { staticClass: "form-group" },
  44476. [
  44477. _c("label", { attrs: { for: "storelist" } }, [_vm._v("Store")]),
  44478. _vm._v(" "),
  44479. _c("autocomplete-custom-dropdown", {
  44480. attrs: { options: _vm.storeList, value: this.store },
  44481. model: {
  44482. value: _vm.store,
  44483. callback: function($$v) {
  44484. _vm.store = $$v
  44485. },
  44486. expression: "store"
  44487. }
  44488. })
  44489. ],
  44490. 1
  44491. )
  44492. ]),
  44493. _vm._v(" "),
  44494. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  44495. _c(
  44496. "button",
  44497. {
  44498. staticClass: "btn btn-secondary",
  44499. attrs: { type: "button", "data-dismiss": "modal" }
  44500. },
  44501. [_vm._v("Close")]
  44502. ),
  44503. _vm._v(" "),
  44504. _c(
  44505. "button",
  44506. {
  44507. staticClass: "btn btn-primary",
  44508. attrs: { type: "button" },
  44509. on: {
  44510. click: function($event) {
  44511. return _vm.updateWorkOrder()
  44512. }
  44513. }
  44514. },
  44515. [_vm._v("Save")]
  44516. )
  44517. ])
  44518. ]
  44519. )
  44520. }
  44521. var staticRenderFns = []
  44522. render._withStripped = true
  44523. /***/ }),
  44524. /***/ "./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&":
  44525. /*!*********************************************************************************************************************************************************************************************************!*\
  44526. !*** ./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& ***!
  44527. \*********************************************************************************************************************************************************************************************************/
  44528. /*! exports provided: render, staticRenderFns */
  44529. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44530. "use strict";
  44531. __webpack_require__.r(__webpack_exports__);
  44532. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44533. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44534. var render = function() {
  44535. var _vm = this
  44536. var _h = _vm.$createElement
  44537. var _c = _vm._self._c || _h
  44538. return _c(
  44539. "div",
  44540. [
  44541. _c("woinfo-edit-modal", {
  44542. attrs: {
  44543. "modal-id": "workordereditModal",
  44544. "populate-with": this.data,
  44545. "store-list": this.storeList
  44546. }
  44547. }),
  44548. _vm._v(" "),
  44549. _c("p", [
  44550. _c("i", { staticClass: "fas fa-fw fa-info-circle" }),
  44551. _vm._v(" "),
  44552. _c("span", { domProps: { textContent: _vm._s(this.data.probdesc) } })
  44553. ]),
  44554. _vm._v(" "),
  44555. _c("p", [
  44556. _c("i", { staticClass: "far fa-fw fa-lightbulb" }),
  44557. _vm._v(" "),
  44558. _c("span", { domProps: { textContent: _vm._s(this.data.suggested) } })
  44559. ]),
  44560. _vm._v(" "),
  44561. _c("p", [
  44562. _c("i", { staticClass: "fas fa-fw fa-paste" }),
  44563. _vm._v(" "),
  44564. _c("span", { domProps: { textContent: _vm._s(this.data.woid) } })
  44565. ]),
  44566. _vm._v(" "),
  44567. _c("p", [
  44568. _c("i", { staticClass: "fas fa-fw fa-building" }),
  44569. _vm._v(" "),
  44570. _c("span", [_vm._v(_vm._s(_vm.storeList[_vm.data.storeid]))])
  44571. ]),
  44572. _vm._v(" "),
  44573. _c("p", [
  44574. _c("i", { staticClass: "fas fa-fw fa-sign-in-alt" }),
  44575. _vm._v(" "),
  44576. _c(
  44577. "span",
  44578. {
  44579. staticClass: "dashed-underline",
  44580. attrs: {
  44581. "data-toggle": "tooltip",
  44582. "data-placement": "bottom",
  44583. title: this.getHRDate(this.data.dropdate)
  44584. }
  44585. },
  44586. [
  44587. _vm._v(
  44588. "\n " +
  44589. _vm._s(Math.floor(this.daysSinceToday(this.data.dropdate))) +
  44590. " days ago\n "
  44591. )
  44592. ]
  44593. )
  44594. ]),
  44595. _vm._v(" "),
  44596. _c("p", [
  44597. _c("i", { staticClass: "fas fa-sign-out-alt" }),
  44598. _vm._v(" "),
  44599. !this.isZero(this.data.pickupdate)
  44600. ? _c(
  44601. "span",
  44602. {
  44603. staticClass: "dashed-underline",
  44604. attrs: {
  44605. "data-toggle": "tooltip",
  44606. "data-placement": "bottom",
  44607. title: this.getHRDate(this.data.pickupdate)
  44608. }
  44609. },
  44610. [
  44611. _vm._v(
  44612. "\n " +
  44613. _vm._s(
  44614. Math.floor(this.daysSinceToday(this.data.pickupdate))
  44615. ) +
  44616. " days ago\n "
  44617. )
  44618. ]
  44619. )
  44620. : _vm._e()
  44621. ]),
  44622. _vm._v(" "),
  44623. _c(
  44624. "button",
  44625. {
  44626. staticClass: "btn btn-primary",
  44627. attrs: {
  44628. type: "button",
  44629. "data-toggle": "modal",
  44630. "data-target": "#workordereditModal"
  44631. }
  44632. },
  44633. [_vm._v("Edit")]
  44634. )
  44635. ],
  44636. 1
  44637. )
  44638. }
  44639. var staticRenderFns = []
  44640. render._withStripped = true
  44641. /***/ }),
  44642. /***/ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js":
  44643. /*!********************************************************************!*\
  44644. !*** ./node_modules/vue-loader/lib/runtime/componentNormalizer.js ***!
  44645. \********************************************************************/
  44646. /*! exports provided: default */
  44647. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44648. "use strict";
  44649. __webpack_require__.r(__webpack_exports__);
  44650. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeComponent; });
  44651. /* globals __VUE_SSR_CONTEXT__ */
  44652. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  44653. // This module is a runtime utility for cleaner component module output and will
  44654. // be included in the final webpack user bundle.
  44655. function normalizeComponent (
  44656. scriptExports,
  44657. render,
  44658. staticRenderFns,
  44659. functionalTemplate,
  44660. injectStyles,
  44661. scopeId,
  44662. moduleIdentifier, /* server only */
  44663. shadowMode /* vue-cli only */
  44664. ) {
  44665. // Vue.extend constructor export interop
  44666. var options = typeof scriptExports === 'function'
  44667. ? scriptExports.options
  44668. : scriptExports
  44669. // render functions
  44670. if (render) {
  44671. options.render = render
  44672. options.staticRenderFns = staticRenderFns
  44673. options._compiled = true
  44674. }
  44675. // functional template
  44676. if (functionalTemplate) {
  44677. options.functional = true
  44678. }
  44679. // scopedId
  44680. if (scopeId) {
  44681. options._scopeId = 'data-v-' + scopeId
  44682. }
  44683. var hook
  44684. if (moduleIdentifier) { // server build
  44685. hook = function (context) {
  44686. // 2.3 injection
  44687. context =
  44688. context || // cached call
  44689. (this.$vnode && this.$vnode.ssrContext) || // stateful
  44690. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  44691. // 2.2 with runInNewContext: true
  44692. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  44693. context = __VUE_SSR_CONTEXT__
  44694. }
  44695. // inject component styles
  44696. if (injectStyles) {
  44697. injectStyles.call(this, context)
  44698. }
  44699. // register component module identifier for async chunk inferrence
  44700. if (context && context._registeredComponents) {
  44701. context._registeredComponents.add(moduleIdentifier)
  44702. }
  44703. }
  44704. // used by ssr in case component is cached and beforeCreate
  44705. // never gets called
  44706. options._ssrRegister = hook
  44707. } else if (injectStyles) {
  44708. hook = shadowMode
  44709. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  44710. : injectStyles
  44711. }
  44712. if (hook) {
  44713. if (options.functional) {
  44714. // for template-only hot-reload because in that case the render fn doesn't
  44715. // go through the normalizer
  44716. options._injectStyles = hook
  44717. // register for functioal component in vue file
  44718. var originalRender = options.render
  44719. options.render = function renderWithStyleInjection (h, context) {
  44720. hook.call(context)
  44721. return originalRender(h, context)
  44722. }
  44723. } else {
  44724. // inject component registration as beforeCreate hook
  44725. var existing = options.beforeCreate
  44726. options.beforeCreate = existing
  44727. ? [].concat(existing, hook)
  44728. : [hook]
  44729. }
  44730. }
  44731. return {
  44732. exports: scriptExports,
  44733. options: options
  44734. }
  44735. }
  44736. /***/ }),
  44737. /***/ "./node_modules/vue/dist/vue.common.dev.js":
  44738. /*!*************************************************!*\
  44739. !*** ./node_modules/vue/dist/vue.common.dev.js ***!
  44740. \*************************************************/
  44741. /*! no static exports found */
  44742. /***/ (function(module, exports, __webpack_require__) {
  44743. "use strict";
  44744. /* WEBPACK VAR INJECTION */(function(global, setImmediate) {/*!
  44745. * Vue.js v2.6.11
  44746. * (c) 2014-2019 Evan You
  44747. * Released under the MIT License.
  44748. */
  44749. /* */
  44750. var emptyObject = Object.freeze({});
  44751. // These helpers produce better VM code in JS engines due to their
  44752. // explicitness and function inlining.
  44753. function isUndef (v) {
  44754. return v === undefined || v === null
  44755. }
  44756. function isDef (v) {
  44757. return v !== undefined && v !== null
  44758. }
  44759. function isTrue (v) {
  44760. return v === true
  44761. }
  44762. function isFalse (v) {
  44763. return v === false
  44764. }
  44765. /**
  44766. * Check if value is primitive.
  44767. */
  44768. function isPrimitive (value) {
  44769. return (
  44770. typeof value === 'string' ||
  44771. typeof value === 'number' ||
  44772. // $flow-disable-line
  44773. typeof value === 'symbol' ||
  44774. typeof value === 'boolean'
  44775. )
  44776. }
  44777. /**
  44778. * Quick object check - this is primarily used to tell
  44779. * Objects from primitive values when we know the value
  44780. * is a JSON-compliant type.
  44781. */
  44782. function isObject (obj) {
  44783. return obj !== null && typeof obj === 'object'
  44784. }
  44785. /**
  44786. * Get the raw type string of a value, e.g., [object Object].
  44787. */
  44788. var _toString = Object.prototype.toString;
  44789. function toRawType (value) {
  44790. return _toString.call(value).slice(8, -1)
  44791. }
  44792. /**
  44793. * Strict object type check. Only returns true
  44794. * for plain JavaScript objects.
  44795. */
  44796. function isPlainObject (obj) {
  44797. return _toString.call(obj) === '[object Object]'
  44798. }
  44799. function isRegExp (v) {
  44800. return _toString.call(v) === '[object RegExp]'
  44801. }
  44802. /**
  44803. * Check if val is a valid array index.
  44804. */
  44805. function isValidArrayIndex (val) {
  44806. var n = parseFloat(String(val));
  44807. return n >= 0 && Math.floor(n) === n && isFinite(val)
  44808. }
  44809. function isPromise (val) {
  44810. return (
  44811. isDef(val) &&
  44812. typeof val.then === 'function' &&
  44813. typeof val.catch === 'function'
  44814. )
  44815. }
  44816. /**
  44817. * Convert a value to a string that is actually rendered.
  44818. */
  44819. function toString (val) {
  44820. return val == null
  44821. ? ''
  44822. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  44823. ? JSON.stringify(val, null, 2)
  44824. : String(val)
  44825. }
  44826. /**
  44827. * Convert an input value to a number for persistence.
  44828. * If the conversion fails, return original string.
  44829. */
  44830. function toNumber (val) {
  44831. var n = parseFloat(val);
  44832. return isNaN(n) ? val : n
  44833. }
  44834. /**
  44835. * Make a map and return a function for checking if a key
  44836. * is in that map.
  44837. */
  44838. function makeMap (
  44839. str,
  44840. expectsLowerCase
  44841. ) {
  44842. var map = Object.create(null);
  44843. var list = str.split(',');
  44844. for (var i = 0; i < list.length; i++) {
  44845. map[list[i]] = true;
  44846. }
  44847. return expectsLowerCase
  44848. ? function (val) { return map[val.toLowerCase()]; }
  44849. : function (val) { return map[val]; }
  44850. }
  44851. /**
  44852. * Check if a tag is a built-in tag.
  44853. */
  44854. var isBuiltInTag = makeMap('slot,component', true);
  44855. /**
  44856. * Check if an attribute is a reserved attribute.
  44857. */
  44858. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  44859. /**
  44860. * Remove an item from an array.
  44861. */
  44862. function remove (arr, item) {
  44863. if (arr.length) {
  44864. var index = arr.indexOf(item);
  44865. if (index > -1) {
  44866. return arr.splice(index, 1)
  44867. }
  44868. }
  44869. }
  44870. /**
  44871. * Check whether an object has the property.
  44872. */
  44873. var hasOwnProperty = Object.prototype.hasOwnProperty;
  44874. function hasOwn (obj, key) {
  44875. return hasOwnProperty.call(obj, key)
  44876. }
  44877. /**
  44878. * Create a cached version of a pure function.
  44879. */
  44880. function cached (fn) {
  44881. var cache = Object.create(null);
  44882. return (function cachedFn (str) {
  44883. var hit = cache[str];
  44884. return hit || (cache[str] = fn(str))
  44885. })
  44886. }
  44887. /**
  44888. * Camelize a hyphen-delimited string.
  44889. */
  44890. var camelizeRE = /-(\w)/g;
  44891. var camelize = cached(function (str) {
  44892. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  44893. });
  44894. /**
  44895. * Capitalize a string.
  44896. */
  44897. var capitalize = cached(function (str) {
  44898. return str.charAt(0).toUpperCase() + str.slice(1)
  44899. });
  44900. /**
  44901. * Hyphenate a camelCase string.
  44902. */
  44903. var hyphenateRE = /\B([A-Z])/g;
  44904. var hyphenate = cached(function (str) {
  44905. return str.replace(hyphenateRE, '-$1').toLowerCase()
  44906. });
  44907. /**
  44908. * Simple bind polyfill for environments that do not support it,
  44909. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  44910. * since native bind is now performant enough in most browsers.
  44911. * But removing it would mean breaking code that was able to run in
  44912. * PhantomJS 1.x, so this must be kept for backward compatibility.
  44913. */
  44914. /* istanbul ignore next */
  44915. function polyfillBind (fn, ctx) {
  44916. function boundFn (a) {
  44917. var l = arguments.length;
  44918. return l
  44919. ? l > 1
  44920. ? fn.apply(ctx, arguments)
  44921. : fn.call(ctx, a)
  44922. : fn.call(ctx)
  44923. }
  44924. boundFn._length = fn.length;
  44925. return boundFn
  44926. }
  44927. function nativeBind (fn, ctx) {
  44928. return fn.bind(ctx)
  44929. }
  44930. var bind = Function.prototype.bind
  44931. ? nativeBind
  44932. : polyfillBind;
  44933. /**
  44934. * Convert an Array-like object to a real Array.
  44935. */
  44936. function toArray (list, start) {
  44937. start = start || 0;
  44938. var i = list.length - start;
  44939. var ret = new Array(i);
  44940. while (i--) {
  44941. ret[i] = list[i + start];
  44942. }
  44943. return ret
  44944. }
  44945. /**
  44946. * Mix properties into target object.
  44947. */
  44948. function extend (to, _from) {
  44949. for (var key in _from) {
  44950. to[key] = _from[key];
  44951. }
  44952. return to
  44953. }
  44954. /**
  44955. * Merge an Array of Objects into a single Object.
  44956. */
  44957. function toObject (arr) {
  44958. var res = {};
  44959. for (var i = 0; i < arr.length; i++) {
  44960. if (arr[i]) {
  44961. extend(res, arr[i]);
  44962. }
  44963. }
  44964. return res
  44965. }
  44966. /* eslint-disable no-unused-vars */
  44967. /**
  44968. * Perform no operation.
  44969. * Stubbing args to make Flow happy without leaving useless transpiled code
  44970. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  44971. */
  44972. function noop (a, b, c) {}
  44973. /**
  44974. * Always return false.
  44975. */
  44976. var no = function (a, b, c) { return false; };
  44977. /* eslint-enable no-unused-vars */
  44978. /**
  44979. * Return the same value.
  44980. */
  44981. var identity = function (_) { return _; };
  44982. /**
  44983. * Generate a string containing static keys from compiler modules.
  44984. */
  44985. function genStaticKeys (modules) {
  44986. return modules.reduce(function (keys, m) {
  44987. return keys.concat(m.staticKeys || [])
  44988. }, []).join(',')
  44989. }
  44990. /**
  44991. * Check if two values are loosely equal - that is,
  44992. * if they are plain objects, do they have the same shape?
  44993. */
  44994. function looseEqual (a, b) {
  44995. if (a === b) { return true }
  44996. var isObjectA = isObject(a);
  44997. var isObjectB = isObject(b);
  44998. if (isObjectA && isObjectB) {
  44999. try {
  45000. var isArrayA = Array.isArray(a);
  45001. var isArrayB = Array.isArray(b);
  45002. if (isArrayA && isArrayB) {
  45003. return a.length === b.length && a.every(function (e, i) {
  45004. return looseEqual(e, b[i])
  45005. })
  45006. } else if (a instanceof Date && b instanceof Date) {
  45007. return a.getTime() === b.getTime()
  45008. } else if (!isArrayA && !isArrayB) {
  45009. var keysA = Object.keys(a);
  45010. var keysB = Object.keys(b);
  45011. return keysA.length === keysB.length && keysA.every(function (key) {
  45012. return looseEqual(a[key], b[key])
  45013. })
  45014. } else {
  45015. /* istanbul ignore next */
  45016. return false
  45017. }
  45018. } catch (e) {
  45019. /* istanbul ignore next */
  45020. return false
  45021. }
  45022. } else if (!isObjectA && !isObjectB) {
  45023. return String(a) === String(b)
  45024. } else {
  45025. return false
  45026. }
  45027. }
  45028. /**
  45029. * Return the first index at which a loosely equal value can be
  45030. * found in the array (if value is a plain object, the array must
  45031. * contain an object of the same shape), or -1 if it is not present.
  45032. */
  45033. function looseIndexOf (arr, val) {
  45034. for (var i = 0; i < arr.length; i++) {
  45035. if (looseEqual(arr[i], val)) { return i }
  45036. }
  45037. return -1
  45038. }
  45039. /**
  45040. * Ensure a function is called only once.
  45041. */
  45042. function once (fn) {
  45043. var called = false;
  45044. return function () {
  45045. if (!called) {
  45046. called = true;
  45047. fn.apply(this, arguments);
  45048. }
  45049. }
  45050. }
  45051. var SSR_ATTR = 'data-server-rendered';
  45052. var ASSET_TYPES = [
  45053. 'component',
  45054. 'directive',
  45055. 'filter'
  45056. ];
  45057. var LIFECYCLE_HOOKS = [
  45058. 'beforeCreate',
  45059. 'created',
  45060. 'beforeMount',
  45061. 'mounted',
  45062. 'beforeUpdate',
  45063. 'updated',
  45064. 'beforeDestroy',
  45065. 'destroyed',
  45066. 'activated',
  45067. 'deactivated',
  45068. 'errorCaptured',
  45069. 'serverPrefetch'
  45070. ];
  45071. /* */
  45072. var config = ({
  45073. /**
  45074. * Option merge strategies (used in core/util/options)
  45075. */
  45076. // $flow-disable-line
  45077. optionMergeStrategies: Object.create(null),
  45078. /**
  45079. * Whether to suppress warnings.
  45080. */
  45081. silent: false,
  45082. /**
  45083. * Show production mode tip message on boot?
  45084. */
  45085. productionTip: "development" !== 'production',
  45086. /**
  45087. * Whether to enable devtools
  45088. */
  45089. devtools: "development" !== 'production',
  45090. /**
  45091. * Whether to record perf
  45092. */
  45093. performance: false,
  45094. /**
  45095. * Error handler for watcher errors
  45096. */
  45097. errorHandler: null,
  45098. /**
  45099. * Warn handler for watcher warns
  45100. */
  45101. warnHandler: null,
  45102. /**
  45103. * Ignore certain custom elements
  45104. */
  45105. ignoredElements: [],
  45106. /**
  45107. * Custom user key aliases for v-on
  45108. */
  45109. // $flow-disable-line
  45110. keyCodes: Object.create(null),
  45111. /**
  45112. * Check if a tag is reserved so that it cannot be registered as a
  45113. * component. This is platform-dependent and may be overwritten.
  45114. */
  45115. isReservedTag: no,
  45116. /**
  45117. * Check if an attribute is reserved so that it cannot be used as a component
  45118. * prop. This is platform-dependent and may be overwritten.
  45119. */
  45120. isReservedAttr: no,
  45121. /**
  45122. * Check if a tag is an unknown element.
  45123. * Platform-dependent.
  45124. */
  45125. isUnknownElement: no,
  45126. /**
  45127. * Get the namespace of an element
  45128. */
  45129. getTagNamespace: noop,
  45130. /**
  45131. * Parse the real tag name for the specific platform.
  45132. */
  45133. parsePlatformTagName: identity,
  45134. /**
  45135. * Check if an attribute must be bound using property, e.g. value
  45136. * Platform-dependent.
  45137. */
  45138. mustUseProp: no,
  45139. /**
  45140. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  45141. * This will significantly reduce performance if set to false.
  45142. */
  45143. async: true,
  45144. /**
  45145. * Exposed for legacy reasons
  45146. */
  45147. _lifecycleHooks: LIFECYCLE_HOOKS
  45148. });
  45149. /* */
  45150. /**
  45151. * unicode letters used for parsing html tags, component names and property paths.
  45152. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  45153. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  45154. */
  45155. 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/;
  45156. /**
  45157. * Check if a string starts with $ or _
  45158. */
  45159. function isReserved (str) {
  45160. var c = (str + '').charCodeAt(0);
  45161. return c === 0x24 || c === 0x5F
  45162. }
  45163. /**
  45164. * Define a property.
  45165. */
  45166. function def (obj, key, val, enumerable) {
  45167. Object.defineProperty(obj, key, {
  45168. value: val,
  45169. enumerable: !!enumerable,
  45170. writable: true,
  45171. configurable: true
  45172. });
  45173. }
  45174. /**
  45175. * Parse simple path.
  45176. */
  45177. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  45178. function parsePath (path) {
  45179. if (bailRE.test(path)) {
  45180. return
  45181. }
  45182. var segments = path.split('.');
  45183. return function (obj) {
  45184. for (var i = 0; i < segments.length; i++) {
  45185. if (!obj) { return }
  45186. obj = obj[segments[i]];
  45187. }
  45188. return obj
  45189. }
  45190. }
  45191. /* */
  45192. // can we use __proto__?
  45193. var hasProto = '__proto__' in {};
  45194. // Browser environment sniffing
  45195. var inBrowser = typeof window !== 'undefined';
  45196. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  45197. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  45198. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  45199. var isIE = UA && /msie|trident/.test(UA);
  45200. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  45201. var isEdge = UA && UA.indexOf('edge/') > 0;
  45202. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  45203. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  45204. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  45205. var isPhantomJS = UA && /phantomjs/.test(UA);
  45206. var isFF = UA && UA.match(/firefox\/(\d+)/);
  45207. // Firefox has a "watch" function on Object.prototype...
  45208. var nativeWatch = ({}).watch;
  45209. var supportsPassive = false;
  45210. if (inBrowser) {
  45211. try {
  45212. var opts = {};
  45213. Object.defineProperty(opts, 'passive', ({
  45214. get: function get () {
  45215. /* istanbul ignore next */
  45216. supportsPassive = true;
  45217. }
  45218. })); // https://github.com/facebook/flow/issues/285
  45219. window.addEventListener('test-passive', null, opts);
  45220. } catch (e) {}
  45221. }
  45222. // this needs to be lazy-evaled because vue may be required before
  45223. // vue-server-renderer can set VUE_ENV
  45224. var _isServer;
  45225. var isServerRendering = function () {
  45226. if (_isServer === undefined) {
  45227. /* istanbul ignore if */
  45228. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  45229. // detect presence of vue-server-renderer and avoid
  45230. // Webpack shimming the process
  45231. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  45232. } else {
  45233. _isServer = false;
  45234. }
  45235. }
  45236. return _isServer
  45237. };
  45238. // detect devtools
  45239. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  45240. /* istanbul ignore next */
  45241. function isNative (Ctor) {
  45242. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  45243. }
  45244. var hasSymbol =
  45245. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  45246. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  45247. var _Set;
  45248. /* istanbul ignore if */ // $flow-disable-line
  45249. if (typeof Set !== 'undefined' && isNative(Set)) {
  45250. // use native Set when available.
  45251. _Set = Set;
  45252. } else {
  45253. // a non-standard Set polyfill that only works with primitive keys.
  45254. _Set = /*@__PURE__*/(function () {
  45255. function Set () {
  45256. this.set = Object.create(null);
  45257. }
  45258. Set.prototype.has = function has (key) {
  45259. return this.set[key] === true
  45260. };
  45261. Set.prototype.add = function add (key) {
  45262. this.set[key] = true;
  45263. };
  45264. Set.prototype.clear = function clear () {
  45265. this.set = Object.create(null);
  45266. };
  45267. return Set;
  45268. }());
  45269. }
  45270. /* */
  45271. var warn = noop;
  45272. var tip = noop;
  45273. var generateComponentTrace = (noop); // work around flow check
  45274. var formatComponentName = (noop);
  45275. {
  45276. var hasConsole = typeof console !== 'undefined';
  45277. var classifyRE = /(?:^|[-_])(\w)/g;
  45278. var classify = function (str) { return str
  45279. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  45280. .replace(/[-_]/g, ''); };
  45281. warn = function (msg, vm) {
  45282. var trace = vm ? generateComponentTrace(vm) : '';
  45283. if (config.warnHandler) {
  45284. config.warnHandler.call(null, msg, vm, trace);
  45285. } else if (hasConsole && (!config.silent)) {
  45286. console.error(("[Vue warn]: " + msg + trace));
  45287. }
  45288. };
  45289. tip = function (msg, vm) {
  45290. if (hasConsole && (!config.silent)) {
  45291. console.warn("[Vue tip]: " + msg + (
  45292. vm ? generateComponentTrace(vm) : ''
  45293. ));
  45294. }
  45295. };
  45296. formatComponentName = function (vm, includeFile) {
  45297. if (vm.$root === vm) {
  45298. return '<Root>'
  45299. }
  45300. var options = typeof vm === 'function' && vm.cid != null
  45301. ? vm.options
  45302. : vm._isVue
  45303. ? vm.$options || vm.constructor.options
  45304. : vm;
  45305. var name = options.name || options._componentTag;
  45306. var file = options.__file;
  45307. if (!name && file) {
  45308. var match = file.match(/([^/\\]+)\.vue$/);
  45309. name = match && match[1];
  45310. }
  45311. return (
  45312. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  45313. (file && includeFile !== false ? (" at " + file) : '')
  45314. )
  45315. };
  45316. var repeat = function (str, n) {
  45317. var res = '';
  45318. while (n) {
  45319. if (n % 2 === 1) { res += str; }
  45320. if (n > 1) { str += str; }
  45321. n >>= 1;
  45322. }
  45323. return res
  45324. };
  45325. generateComponentTrace = function (vm) {
  45326. if (vm._isVue && vm.$parent) {
  45327. var tree = [];
  45328. var currentRecursiveSequence = 0;
  45329. while (vm) {
  45330. if (tree.length > 0) {
  45331. var last = tree[tree.length - 1];
  45332. if (last.constructor === vm.constructor) {
  45333. currentRecursiveSequence++;
  45334. vm = vm.$parent;
  45335. continue
  45336. } else if (currentRecursiveSequence > 0) {
  45337. tree[tree.length - 1] = [last, currentRecursiveSequence];
  45338. currentRecursiveSequence = 0;
  45339. }
  45340. }
  45341. tree.push(vm);
  45342. vm = vm.$parent;
  45343. }
  45344. return '\n\nfound in\n\n' + tree
  45345. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  45346. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  45347. : formatComponentName(vm))); })
  45348. .join('\n')
  45349. } else {
  45350. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  45351. }
  45352. };
  45353. }
  45354. /* */
  45355. var uid = 0;
  45356. /**
  45357. * A dep is an observable that can have multiple
  45358. * directives subscribing to it.
  45359. */
  45360. var Dep = function Dep () {
  45361. this.id = uid++;
  45362. this.subs = [];
  45363. };
  45364. Dep.prototype.addSub = function addSub (sub) {
  45365. this.subs.push(sub);
  45366. };
  45367. Dep.prototype.removeSub = function removeSub (sub) {
  45368. remove(this.subs, sub);
  45369. };
  45370. Dep.prototype.depend = function depend () {
  45371. if (Dep.target) {
  45372. Dep.target.addDep(this);
  45373. }
  45374. };
  45375. Dep.prototype.notify = function notify () {
  45376. // stabilize the subscriber list first
  45377. var subs = this.subs.slice();
  45378. if (!config.async) {
  45379. // subs aren't sorted in scheduler if not running async
  45380. // we need to sort them now to make sure they fire in correct
  45381. // order
  45382. subs.sort(function (a, b) { return a.id - b.id; });
  45383. }
  45384. for (var i = 0, l = subs.length; i < l; i++) {
  45385. subs[i].update();
  45386. }
  45387. };
  45388. // The current target watcher being evaluated.
  45389. // This is globally unique because only one watcher
  45390. // can be evaluated at a time.
  45391. Dep.target = null;
  45392. var targetStack = [];
  45393. function pushTarget (target) {
  45394. targetStack.push(target);
  45395. Dep.target = target;
  45396. }
  45397. function popTarget () {
  45398. targetStack.pop();
  45399. Dep.target = targetStack[targetStack.length - 1];
  45400. }
  45401. /* */
  45402. var VNode = function VNode (
  45403. tag,
  45404. data,
  45405. children,
  45406. text,
  45407. elm,
  45408. context,
  45409. componentOptions,
  45410. asyncFactory
  45411. ) {
  45412. this.tag = tag;
  45413. this.data = data;
  45414. this.children = children;
  45415. this.text = text;
  45416. this.elm = elm;
  45417. this.ns = undefined;
  45418. this.context = context;
  45419. this.fnContext = undefined;
  45420. this.fnOptions = undefined;
  45421. this.fnScopeId = undefined;
  45422. this.key = data && data.key;
  45423. this.componentOptions = componentOptions;
  45424. this.componentInstance = undefined;
  45425. this.parent = undefined;
  45426. this.raw = false;
  45427. this.isStatic = false;
  45428. this.isRootInsert = true;
  45429. this.isComment = false;
  45430. this.isCloned = false;
  45431. this.isOnce = false;
  45432. this.asyncFactory = asyncFactory;
  45433. this.asyncMeta = undefined;
  45434. this.isAsyncPlaceholder = false;
  45435. };
  45436. var prototypeAccessors = { child: { configurable: true } };
  45437. // DEPRECATED: alias for componentInstance for backwards compat.
  45438. /* istanbul ignore next */
  45439. prototypeAccessors.child.get = function () {
  45440. return this.componentInstance
  45441. };
  45442. Object.defineProperties( VNode.prototype, prototypeAccessors );
  45443. var createEmptyVNode = function (text) {
  45444. if ( text === void 0 ) text = '';
  45445. var node = new VNode();
  45446. node.text = text;
  45447. node.isComment = true;
  45448. return node
  45449. };
  45450. function createTextVNode (val) {
  45451. return new VNode(undefined, undefined, undefined, String(val))
  45452. }
  45453. // optimized shallow clone
  45454. // used for static nodes and slot nodes because they may be reused across
  45455. // multiple renders, cloning them avoids errors when DOM manipulations rely
  45456. // on their elm reference.
  45457. function cloneVNode (vnode) {
  45458. var cloned = new VNode(
  45459. vnode.tag,
  45460. vnode.data,
  45461. // #7975
  45462. // clone children array to avoid mutating original in case of cloning
  45463. // a child.
  45464. vnode.children && vnode.children.slice(),
  45465. vnode.text,
  45466. vnode.elm,
  45467. vnode.context,
  45468. vnode.componentOptions,
  45469. vnode.asyncFactory
  45470. );
  45471. cloned.ns = vnode.ns;
  45472. cloned.isStatic = vnode.isStatic;
  45473. cloned.key = vnode.key;
  45474. cloned.isComment = vnode.isComment;
  45475. cloned.fnContext = vnode.fnContext;
  45476. cloned.fnOptions = vnode.fnOptions;
  45477. cloned.fnScopeId = vnode.fnScopeId;
  45478. cloned.asyncMeta = vnode.asyncMeta;
  45479. cloned.isCloned = true;
  45480. return cloned
  45481. }
  45482. /*
  45483. * not type checking this file because flow doesn't play well with
  45484. * dynamically accessing methods on Array prototype
  45485. */
  45486. var arrayProto = Array.prototype;
  45487. var arrayMethods = Object.create(arrayProto);
  45488. var methodsToPatch = [
  45489. 'push',
  45490. 'pop',
  45491. 'shift',
  45492. 'unshift',
  45493. 'splice',
  45494. 'sort',
  45495. 'reverse'
  45496. ];
  45497. /**
  45498. * Intercept mutating methods and emit events
  45499. */
  45500. methodsToPatch.forEach(function (method) {
  45501. // cache original method
  45502. var original = arrayProto[method];
  45503. def(arrayMethods, method, function mutator () {
  45504. var args = [], len = arguments.length;
  45505. while ( len-- ) args[ len ] = arguments[ len ];
  45506. var result = original.apply(this, args);
  45507. var ob = this.__ob__;
  45508. var inserted;
  45509. switch (method) {
  45510. case 'push':
  45511. case 'unshift':
  45512. inserted = args;
  45513. break
  45514. case 'splice':
  45515. inserted = args.slice(2);
  45516. break
  45517. }
  45518. if (inserted) { ob.observeArray(inserted); }
  45519. // notify change
  45520. ob.dep.notify();
  45521. return result
  45522. });
  45523. });
  45524. /* */
  45525. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  45526. /**
  45527. * In some cases we may want to disable observation inside a component's
  45528. * update computation.
  45529. */
  45530. var shouldObserve = true;
  45531. function toggleObserving (value) {
  45532. shouldObserve = value;
  45533. }
  45534. /**
  45535. * Observer class that is attached to each observed
  45536. * object. Once attached, the observer converts the target
  45537. * object's property keys into getter/setters that
  45538. * collect dependencies and dispatch updates.
  45539. */
  45540. var Observer = function Observer (value) {
  45541. this.value = value;
  45542. this.dep = new Dep();
  45543. this.vmCount = 0;
  45544. def(value, '__ob__', this);
  45545. if (Array.isArray(value)) {
  45546. if (hasProto) {
  45547. protoAugment(value, arrayMethods);
  45548. } else {
  45549. copyAugment(value, arrayMethods, arrayKeys);
  45550. }
  45551. this.observeArray(value);
  45552. } else {
  45553. this.walk(value);
  45554. }
  45555. };
  45556. /**
  45557. * Walk through all properties and convert them into
  45558. * getter/setters. This method should only be called when
  45559. * value type is Object.
  45560. */
  45561. Observer.prototype.walk = function walk (obj) {
  45562. var keys = Object.keys(obj);
  45563. for (var i = 0; i < keys.length; i++) {
  45564. defineReactive$$1(obj, keys[i]);
  45565. }
  45566. };
  45567. /**
  45568. * Observe a list of Array items.
  45569. */
  45570. Observer.prototype.observeArray = function observeArray (items) {
  45571. for (var i = 0, l = items.length; i < l; i++) {
  45572. observe(items[i]);
  45573. }
  45574. };
  45575. // helpers
  45576. /**
  45577. * Augment a target Object or Array by intercepting
  45578. * the prototype chain using __proto__
  45579. */
  45580. function protoAugment (target, src) {
  45581. /* eslint-disable no-proto */
  45582. target.__proto__ = src;
  45583. /* eslint-enable no-proto */
  45584. }
  45585. /**
  45586. * Augment a target Object or Array by defining
  45587. * hidden properties.
  45588. */
  45589. /* istanbul ignore next */
  45590. function copyAugment (target, src, keys) {
  45591. for (var i = 0, l = keys.length; i < l; i++) {
  45592. var key = keys[i];
  45593. def(target, key, src[key]);
  45594. }
  45595. }
  45596. /**
  45597. * Attempt to create an observer instance for a value,
  45598. * returns the new observer if successfully observed,
  45599. * or the existing observer if the value already has one.
  45600. */
  45601. function observe (value, asRootData) {
  45602. if (!isObject(value) || value instanceof VNode) {
  45603. return
  45604. }
  45605. var ob;
  45606. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  45607. ob = value.__ob__;
  45608. } else if (
  45609. shouldObserve &&
  45610. !isServerRendering() &&
  45611. (Array.isArray(value) || isPlainObject(value)) &&
  45612. Object.isExtensible(value) &&
  45613. !value._isVue
  45614. ) {
  45615. ob = new Observer(value);
  45616. }
  45617. if (asRootData && ob) {
  45618. ob.vmCount++;
  45619. }
  45620. return ob
  45621. }
  45622. /**
  45623. * Define a reactive property on an Object.
  45624. */
  45625. function defineReactive$$1 (
  45626. obj,
  45627. key,
  45628. val,
  45629. customSetter,
  45630. shallow
  45631. ) {
  45632. var dep = new Dep();
  45633. var property = Object.getOwnPropertyDescriptor(obj, key);
  45634. if (property && property.configurable === false) {
  45635. return
  45636. }
  45637. // cater for pre-defined getter/setters
  45638. var getter = property && property.get;
  45639. var setter = property && property.set;
  45640. if ((!getter || setter) && arguments.length === 2) {
  45641. val = obj[key];
  45642. }
  45643. var childOb = !shallow && observe(val);
  45644. Object.defineProperty(obj, key, {
  45645. enumerable: true,
  45646. configurable: true,
  45647. get: function reactiveGetter () {
  45648. var value = getter ? getter.call(obj) : val;
  45649. if (Dep.target) {
  45650. dep.depend();
  45651. if (childOb) {
  45652. childOb.dep.depend();
  45653. if (Array.isArray(value)) {
  45654. dependArray(value);
  45655. }
  45656. }
  45657. }
  45658. return value
  45659. },
  45660. set: function reactiveSetter (newVal) {
  45661. var value = getter ? getter.call(obj) : val;
  45662. /* eslint-disable no-self-compare */
  45663. if (newVal === value || (newVal !== newVal && value !== value)) {
  45664. return
  45665. }
  45666. /* eslint-enable no-self-compare */
  45667. if (customSetter) {
  45668. customSetter();
  45669. }
  45670. // #7981: for accessor properties without setter
  45671. if (getter && !setter) { return }
  45672. if (setter) {
  45673. setter.call(obj, newVal);
  45674. } else {
  45675. val = newVal;
  45676. }
  45677. childOb = !shallow && observe(newVal);
  45678. dep.notify();
  45679. }
  45680. });
  45681. }
  45682. /**
  45683. * Set a property on an object. Adds the new property and
  45684. * triggers change notification if the property doesn't
  45685. * already exist.
  45686. */
  45687. function set (target, key, val) {
  45688. if (isUndef(target) || isPrimitive(target)
  45689. ) {
  45690. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  45691. }
  45692. if (Array.isArray(target) && isValidArrayIndex(key)) {
  45693. target.length = Math.max(target.length, key);
  45694. target.splice(key, 1, val);
  45695. return val
  45696. }
  45697. if (key in target && !(key in Object.prototype)) {
  45698. target[key] = val;
  45699. return val
  45700. }
  45701. var ob = (target).__ob__;
  45702. if (target._isVue || (ob && ob.vmCount)) {
  45703. warn(
  45704. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  45705. 'at runtime - declare it upfront in the data option.'
  45706. );
  45707. return val
  45708. }
  45709. if (!ob) {
  45710. target[key] = val;
  45711. return val
  45712. }
  45713. defineReactive$$1(ob.value, key, val);
  45714. ob.dep.notify();
  45715. return val
  45716. }
  45717. /**
  45718. * Delete a property and trigger change if necessary.
  45719. */
  45720. function del (target, key) {
  45721. if (isUndef(target) || isPrimitive(target)
  45722. ) {
  45723. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  45724. }
  45725. if (Array.isArray(target) && isValidArrayIndex(key)) {
  45726. target.splice(key, 1);
  45727. return
  45728. }
  45729. var ob = (target).__ob__;
  45730. if (target._isVue || (ob && ob.vmCount)) {
  45731. warn(
  45732. 'Avoid deleting properties on a Vue instance or its root $data ' +
  45733. '- just set it to null.'
  45734. );
  45735. return
  45736. }
  45737. if (!hasOwn(target, key)) {
  45738. return
  45739. }
  45740. delete target[key];
  45741. if (!ob) {
  45742. return
  45743. }
  45744. ob.dep.notify();
  45745. }
  45746. /**
  45747. * Collect dependencies on array elements when the array is touched, since
  45748. * we cannot intercept array element access like property getters.
  45749. */
  45750. function dependArray (value) {
  45751. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  45752. e = value[i];
  45753. e && e.__ob__ && e.__ob__.dep.depend();
  45754. if (Array.isArray(e)) {
  45755. dependArray(e);
  45756. }
  45757. }
  45758. }
  45759. /* */
  45760. /**
  45761. * Option overwriting strategies are functions that handle
  45762. * how to merge a parent option value and a child option
  45763. * value into the final value.
  45764. */
  45765. var strats = config.optionMergeStrategies;
  45766. /**
  45767. * Options with restrictions
  45768. */
  45769. {
  45770. strats.el = strats.propsData = function (parent, child, vm, key) {
  45771. if (!vm) {
  45772. warn(
  45773. "option \"" + key + "\" can only be used during instance " +
  45774. 'creation with the `new` keyword.'
  45775. );
  45776. }
  45777. return defaultStrat(parent, child)
  45778. };
  45779. }
  45780. /**
  45781. * Helper that recursively merges two data objects together.
  45782. */
  45783. function mergeData (to, from) {
  45784. if (!from) { return to }
  45785. var key, toVal, fromVal;
  45786. var keys = hasSymbol
  45787. ? Reflect.ownKeys(from)
  45788. : Object.keys(from);
  45789. for (var i = 0; i < keys.length; i++) {
  45790. key = keys[i];
  45791. // in case the object is already observed...
  45792. if (key === '__ob__') { continue }
  45793. toVal = to[key];
  45794. fromVal = from[key];
  45795. if (!hasOwn(to, key)) {
  45796. set(to, key, fromVal);
  45797. } else if (
  45798. toVal !== fromVal &&
  45799. isPlainObject(toVal) &&
  45800. isPlainObject(fromVal)
  45801. ) {
  45802. mergeData(toVal, fromVal);
  45803. }
  45804. }
  45805. return to
  45806. }
  45807. /**
  45808. * Data
  45809. */
  45810. function mergeDataOrFn (
  45811. parentVal,
  45812. childVal,
  45813. vm
  45814. ) {
  45815. if (!vm) {
  45816. // in a Vue.extend merge, both should be functions
  45817. if (!childVal) {
  45818. return parentVal
  45819. }
  45820. if (!parentVal) {
  45821. return childVal
  45822. }
  45823. // when parentVal & childVal are both present,
  45824. // we need to return a function that returns the
  45825. // merged result of both functions... no need to
  45826. // check if parentVal is a function here because
  45827. // it has to be a function to pass previous merges.
  45828. return function mergedDataFn () {
  45829. return mergeData(
  45830. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  45831. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  45832. )
  45833. }
  45834. } else {
  45835. return function mergedInstanceDataFn () {
  45836. // instance merge
  45837. var instanceData = typeof childVal === 'function'
  45838. ? childVal.call(vm, vm)
  45839. : childVal;
  45840. var defaultData = typeof parentVal === 'function'
  45841. ? parentVal.call(vm, vm)
  45842. : parentVal;
  45843. if (instanceData) {
  45844. return mergeData(instanceData, defaultData)
  45845. } else {
  45846. return defaultData
  45847. }
  45848. }
  45849. }
  45850. }
  45851. strats.data = function (
  45852. parentVal,
  45853. childVal,
  45854. vm
  45855. ) {
  45856. if (!vm) {
  45857. if (childVal && typeof childVal !== 'function') {
  45858. warn(
  45859. 'The "data" option should be a function ' +
  45860. 'that returns a per-instance value in component ' +
  45861. 'definitions.',
  45862. vm
  45863. );
  45864. return parentVal
  45865. }
  45866. return mergeDataOrFn(parentVal, childVal)
  45867. }
  45868. return mergeDataOrFn(parentVal, childVal, vm)
  45869. };
  45870. /**
  45871. * Hooks and props are merged as arrays.
  45872. */
  45873. function mergeHook (
  45874. parentVal,
  45875. childVal
  45876. ) {
  45877. var res = childVal
  45878. ? parentVal
  45879. ? parentVal.concat(childVal)
  45880. : Array.isArray(childVal)
  45881. ? childVal
  45882. : [childVal]
  45883. : parentVal;
  45884. return res
  45885. ? dedupeHooks(res)
  45886. : res
  45887. }
  45888. function dedupeHooks (hooks) {
  45889. var res = [];
  45890. for (var i = 0; i < hooks.length; i++) {
  45891. if (res.indexOf(hooks[i]) === -1) {
  45892. res.push(hooks[i]);
  45893. }
  45894. }
  45895. return res
  45896. }
  45897. LIFECYCLE_HOOKS.forEach(function (hook) {
  45898. strats[hook] = mergeHook;
  45899. });
  45900. /**
  45901. * Assets
  45902. *
  45903. * When a vm is present (instance creation), we need to do
  45904. * a three-way merge between constructor options, instance
  45905. * options and parent options.
  45906. */
  45907. function mergeAssets (
  45908. parentVal,
  45909. childVal,
  45910. vm,
  45911. key
  45912. ) {
  45913. var res = Object.create(parentVal || null);
  45914. if (childVal) {
  45915. assertObjectType(key, childVal, vm);
  45916. return extend(res, childVal)
  45917. } else {
  45918. return res
  45919. }
  45920. }
  45921. ASSET_TYPES.forEach(function (type) {
  45922. strats[type + 's'] = mergeAssets;
  45923. });
  45924. /**
  45925. * Watchers.
  45926. *
  45927. * Watchers hashes should not overwrite one
  45928. * another, so we merge them as arrays.
  45929. */
  45930. strats.watch = function (
  45931. parentVal,
  45932. childVal,
  45933. vm,
  45934. key
  45935. ) {
  45936. // work around Firefox's Object.prototype.watch...
  45937. if (parentVal === nativeWatch) { parentVal = undefined; }
  45938. if (childVal === nativeWatch) { childVal = undefined; }
  45939. /* istanbul ignore if */
  45940. if (!childVal) { return Object.create(parentVal || null) }
  45941. {
  45942. assertObjectType(key, childVal, vm);
  45943. }
  45944. if (!parentVal) { return childVal }
  45945. var ret = {};
  45946. extend(ret, parentVal);
  45947. for (var key$1 in childVal) {
  45948. var parent = ret[key$1];
  45949. var child = childVal[key$1];
  45950. if (parent && !Array.isArray(parent)) {
  45951. parent = [parent];
  45952. }
  45953. ret[key$1] = parent
  45954. ? parent.concat(child)
  45955. : Array.isArray(child) ? child : [child];
  45956. }
  45957. return ret
  45958. };
  45959. /**
  45960. * Other object hashes.
  45961. */
  45962. strats.props =
  45963. strats.methods =
  45964. strats.inject =
  45965. strats.computed = function (
  45966. parentVal,
  45967. childVal,
  45968. vm,
  45969. key
  45970. ) {
  45971. if (childVal && "development" !== 'production') {
  45972. assertObjectType(key, childVal, vm);
  45973. }
  45974. if (!parentVal) { return childVal }
  45975. var ret = Object.create(null);
  45976. extend(ret, parentVal);
  45977. if (childVal) { extend(ret, childVal); }
  45978. return ret
  45979. };
  45980. strats.provide = mergeDataOrFn;
  45981. /**
  45982. * Default strategy.
  45983. */
  45984. var defaultStrat = function (parentVal, childVal) {
  45985. return childVal === undefined
  45986. ? parentVal
  45987. : childVal
  45988. };
  45989. /**
  45990. * Validate component names
  45991. */
  45992. function checkComponents (options) {
  45993. for (var key in options.components) {
  45994. validateComponentName(key);
  45995. }
  45996. }
  45997. function validateComponentName (name) {
  45998. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  45999. warn(
  46000. 'Invalid component name: "' + name + '". Component names ' +
  46001. 'should conform to valid custom element name in html5 specification.'
  46002. );
  46003. }
  46004. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  46005. warn(
  46006. 'Do not use built-in or reserved HTML elements as component ' +
  46007. 'id: ' + name
  46008. );
  46009. }
  46010. }
  46011. /**
  46012. * Ensure all props option syntax are normalized into the
  46013. * Object-based format.
  46014. */
  46015. function normalizeProps (options, vm) {
  46016. var props = options.props;
  46017. if (!props) { return }
  46018. var res = {};
  46019. var i, val, name;
  46020. if (Array.isArray(props)) {
  46021. i = props.length;
  46022. while (i--) {
  46023. val = props[i];
  46024. if (typeof val === 'string') {
  46025. name = camelize(val);
  46026. res[name] = { type: null };
  46027. } else {
  46028. warn('props must be strings when using array syntax.');
  46029. }
  46030. }
  46031. } else if (isPlainObject(props)) {
  46032. for (var key in props) {
  46033. val = props[key];
  46034. name = camelize(key);
  46035. res[name] = isPlainObject(val)
  46036. ? val
  46037. : { type: val };
  46038. }
  46039. } else {
  46040. warn(
  46041. "Invalid value for option \"props\": expected an Array or an Object, " +
  46042. "but got " + (toRawType(props)) + ".",
  46043. vm
  46044. );
  46045. }
  46046. options.props = res;
  46047. }
  46048. /**
  46049. * Normalize all injections into Object-based format
  46050. */
  46051. function normalizeInject (options, vm) {
  46052. var inject = options.inject;
  46053. if (!inject) { return }
  46054. var normalized = options.inject = {};
  46055. if (Array.isArray(inject)) {
  46056. for (var i = 0; i < inject.length; i++) {
  46057. normalized[inject[i]] = { from: inject[i] };
  46058. }
  46059. } else if (isPlainObject(inject)) {
  46060. for (var key in inject) {
  46061. var val = inject[key];
  46062. normalized[key] = isPlainObject(val)
  46063. ? extend({ from: key }, val)
  46064. : { from: val };
  46065. }
  46066. } else {
  46067. warn(
  46068. "Invalid value for option \"inject\": expected an Array or an Object, " +
  46069. "but got " + (toRawType(inject)) + ".",
  46070. vm
  46071. );
  46072. }
  46073. }
  46074. /**
  46075. * Normalize raw function directives into object format.
  46076. */
  46077. function normalizeDirectives (options) {
  46078. var dirs = options.directives;
  46079. if (dirs) {
  46080. for (var key in dirs) {
  46081. var def$$1 = dirs[key];
  46082. if (typeof def$$1 === 'function') {
  46083. dirs[key] = { bind: def$$1, update: def$$1 };
  46084. }
  46085. }
  46086. }
  46087. }
  46088. function assertObjectType (name, value, vm) {
  46089. if (!isPlainObject(value)) {
  46090. warn(
  46091. "Invalid value for option \"" + name + "\": expected an Object, " +
  46092. "but got " + (toRawType(value)) + ".",
  46093. vm
  46094. );
  46095. }
  46096. }
  46097. /**
  46098. * Merge two option objects into a new one.
  46099. * Core utility used in both instantiation and inheritance.
  46100. */
  46101. function mergeOptions (
  46102. parent,
  46103. child,
  46104. vm
  46105. ) {
  46106. {
  46107. checkComponents(child);
  46108. }
  46109. if (typeof child === 'function') {
  46110. child = child.options;
  46111. }
  46112. normalizeProps(child, vm);
  46113. normalizeInject(child, vm);
  46114. normalizeDirectives(child);
  46115. // Apply extends and mixins on the child options,
  46116. // but only if it is a raw options object that isn't
  46117. // the result of another mergeOptions call.
  46118. // Only merged options has the _base property.
  46119. if (!child._base) {
  46120. if (child.extends) {
  46121. parent = mergeOptions(parent, child.extends, vm);
  46122. }
  46123. if (child.mixins) {
  46124. for (var i = 0, l = child.mixins.length; i < l; i++) {
  46125. parent = mergeOptions(parent, child.mixins[i], vm);
  46126. }
  46127. }
  46128. }
  46129. var options = {};
  46130. var key;
  46131. for (key in parent) {
  46132. mergeField(key);
  46133. }
  46134. for (key in child) {
  46135. if (!hasOwn(parent, key)) {
  46136. mergeField(key);
  46137. }
  46138. }
  46139. function mergeField (key) {
  46140. var strat = strats[key] || defaultStrat;
  46141. options[key] = strat(parent[key], child[key], vm, key);
  46142. }
  46143. return options
  46144. }
  46145. /**
  46146. * Resolve an asset.
  46147. * This function is used because child instances need access
  46148. * to assets defined in its ancestor chain.
  46149. */
  46150. function resolveAsset (
  46151. options,
  46152. type,
  46153. id,
  46154. warnMissing
  46155. ) {
  46156. /* istanbul ignore if */
  46157. if (typeof id !== 'string') {
  46158. return
  46159. }
  46160. var assets = options[type];
  46161. // check local registration variations first
  46162. if (hasOwn(assets, id)) { return assets[id] }
  46163. var camelizedId = camelize(id);
  46164. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  46165. var PascalCaseId = capitalize(camelizedId);
  46166. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  46167. // fallback to prototype chain
  46168. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  46169. if (warnMissing && !res) {
  46170. warn(
  46171. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  46172. options
  46173. );
  46174. }
  46175. return res
  46176. }
  46177. /* */
  46178. function validateProp (
  46179. key,
  46180. propOptions,
  46181. propsData,
  46182. vm
  46183. ) {
  46184. var prop = propOptions[key];
  46185. var absent = !hasOwn(propsData, key);
  46186. var value = propsData[key];
  46187. // boolean casting
  46188. var booleanIndex = getTypeIndex(Boolean, prop.type);
  46189. if (booleanIndex > -1) {
  46190. if (absent && !hasOwn(prop, 'default')) {
  46191. value = false;
  46192. } else if (value === '' || value === hyphenate(key)) {
  46193. // only cast empty string / same name to boolean if
  46194. // boolean has higher priority
  46195. var stringIndex = getTypeIndex(String, prop.type);
  46196. if (stringIndex < 0 || booleanIndex < stringIndex) {
  46197. value = true;
  46198. }
  46199. }
  46200. }
  46201. // check default value
  46202. if (value === undefined) {
  46203. value = getPropDefaultValue(vm, prop, key);
  46204. // since the default value is a fresh copy,
  46205. // make sure to observe it.
  46206. var prevShouldObserve = shouldObserve;
  46207. toggleObserving(true);
  46208. observe(value);
  46209. toggleObserving(prevShouldObserve);
  46210. }
  46211. {
  46212. assertProp(prop, key, value, vm, absent);
  46213. }
  46214. return value
  46215. }
  46216. /**
  46217. * Get the default value of a prop.
  46218. */
  46219. function getPropDefaultValue (vm, prop, key) {
  46220. // no default, return undefined
  46221. if (!hasOwn(prop, 'default')) {
  46222. return undefined
  46223. }
  46224. var def = prop.default;
  46225. // warn against non-factory defaults for Object & Array
  46226. if (isObject(def)) {
  46227. warn(
  46228. 'Invalid default value for prop "' + key + '": ' +
  46229. 'Props with type Object/Array must use a factory function ' +
  46230. 'to return the default value.',
  46231. vm
  46232. );
  46233. }
  46234. // the raw prop value was also undefined from previous render,
  46235. // return previous default value to avoid unnecessary watcher trigger
  46236. if (vm && vm.$options.propsData &&
  46237. vm.$options.propsData[key] === undefined &&
  46238. vm._props[key] !== undefined
  46239. ) {
  46240. return vm._props[key]
  46241. }
  46242. // call factory function for non-Function types
  46243. // a value is Function if its prototype is function even across different execution context
  46244. return typeof def === 'function' && getType(prop.type) !== 'Function'
  46245. ? def.call(vm)
  46246. : def
  46247. }
  46248. /**
  46249. * Assert whether a prop is valid.
  46250. */
  46251. function assertProp (
  46252. prop,
  46253. name,
  46254. value,
  46255. vm,
  46256. absent
  46257. ) {
  46258. if (prop.required && absent) {
  46259. warn(
  46260. 'Missing required prop: "' + name + '"',
  46261. vm
  46262. );
  46263. return
  46264. }
  46265. if (value == null && !prop.required) {
  46266. return
  46267. }
  46268. var type = prop.type;
  46269. var valid = !type || type === true;
  46270. var expectedTypes = [];
  46271. if (type) {
  46272. if (!Array.isArray(type)) {
  46273. type = [type];
  46274. }
  46275. for (var i = 0; i < type.length && !valid; i++) {
  46276. var assertedType = assertType(value, type[i]);
  46277. expectedTypes.push(assertedType.expectedType || '');
  46278. valid = assertedType.valid;
  46279. }
  46280. }
  46281. if (!valid) {
  46282. warn(
  46283. getInvalidTypeMessage(name, value, expectedTypes),
  46284. vm
  46285. );
  46286. return
  46287. }
  46288. var validator = prop.validator;
  46289. if (validator) {
  46290. if (!validator(value)) {
  46291. warn(
  46292. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  46293. vm
  46294. );
  46295. }
  46296. }
  46297. }
  46298. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  46299. function assertType (value, type) {
  46300. var valid;
  46301. var expectedType = getType(type);
  46302. if (simpleCheckRE.test(expectedType)) {
  46303. var t = typeof value;
  46304. valid = t === expectedType.toLowerCase();
  46305. // for primitive wrapper objects
  46306. if (!valid && t === 'object') {
  46307. valid = value instanceof type;
  46308. }
  46309. } else if (expectedType === 'Object') {
  46310. valid = isPlainObject(value);
  46311. } else if (expectedType === 'Array') {
  46312. valid = Array.isArray(value);
  46313. } else {
  46314. valid = value instanceof type;
  46315. }
  46316. return {
  46317. valid: valid,
  46318. expectedType: expectedType
  46319. }
  46320. }
  46321. /**
  46322. * Use function string name to check built-in types,
  46323. * because a simple equality check will fail when running
  46324. * across different vms / iframes.
  46325. */
  46326. function getType (fn) {
  46327. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  46328. return match ? match[1] : ''
  46329. }
  46330. function isSameType (a, b) {
  46331. return getType(a) === getType(b)
  46332. }
  46333. function getTypeIndex (type, expectedTypes) {
  46334. if (!Array.isArray(expectedTypes)) {
  46335. return isSameType(expectedTypes, type) ? 0 : -1
  46336. }
  46337. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  46338. if (isSameType(expectedTypes[i], type)) {
  46339. return i
  46340. }
  46341. }
  46342. return -1
  46343. }
  46344. function getInvalidTypeMessage (name, value, expectedTypes) {
  46345. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  46346. " Expected " + (expectedTypes.map(capitalize).join(', '));
  46347. var expectedType = expectedTypes[0];
  46348. var receivedType = toRawType(value);
  46349. var expectedValue = styleValue(value, expectedType);
  46350. var receivedValue = styleValue(value, receivedType);
  46351. // check if we need to specify expected value
  46352. if (expectedTypes.length === 1 &&
  46353. isExplicable(expectedType) &&
  46354. !isBoolean(expectedType, receivedType)) {
  46355. message += " with value " + expectedValue;
  46356. }
  46357. message += ", got " + receivedType + " ";
  46358. // check if we need to specify received value
  46359. if (isExplicable(receivedType)) {
  46360. message += "with value " + receivedValue + ".";
  46361. }
  46362. return message
  46363. }
  46364. function styleValue (value, type) {
  46365. if (type === 'String') {
  46366. return ("\"" + value + "\"")
  46367. } else if (type === 'Number') {
  46368. return ("" + (Number(value)))
  46369. } else {
  46370. return ("" + value)
  46371. }
  46372. }
  46373. function isExplicable (value) {
  46374. var explicitTypes = ['string', 'number', 'boolean'];
  46375. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  46376. }
  46377. function isBoolean () {
  46378. var args = [], len = arguments.length;
  46379. while ( len-- ) args[ len ] = arguments[ len ];
  46380. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  46381. }
  46382. /* */
  46383. function handleError (err, vm, info) {
  46384. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  46385. // See: https://github.com/vuejs/vuex/issues/1505
  46386. pushTarget();
  46387. try {
  46388. if (vm) {
  46389. var cur = vm;
  46390. while ((cur = cur.$parent)) {
  46391. var hooks = cur.$options.errorCaptured;
  46392. if (hooks) {
  46393. for (var i = 0; i < hooks.length; i++) {
  46394. try {
  46395. var capture = hooks[i].call(cur, err, vm, info) === false;
  46396. if (capture) { return }
  46397. } catch (e) {
  46398. globalHandleError(e, cur, 'errorCaptured hook');
  46399. }
  46400. }
  46401. }
  46402. }
  46403. }
  46404. globalHandleError(err, vm, info);
  46405. } finally {
  46406. popTarget();
  46407. }
  46408. }
  46409. function invokeWithErrorHandling (
  46410. handler,
  46411. context,
  46412. args,
  46413. vm,
  46414. info
  46415. ) {
  46416. var res;
  46417. try {
  46418. res = args ? handler.apply(context, args) : handler.call(context);
  46419. if (res && !res._isVue && isPromise(res) && !res._handled) {
  46420. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  46421. // issue #9511
  46422. // avoid catch triggering multiple times when nested calls
  46423. res._handled = true;
  46424. }
  46425. } catch (e) {
  46426. handleError(e, vm, info);
  46427. }
  46428. return res
  46429. }
  46430. function globalHandleError (err, vm, info) {
  46431. if (config.errorHandler) {
  46432. try {
  46433. return config.errorHandler.call(null, err, vm, info)
  46434. } catch (e) {
  46435. // if the user intentionally throws the original error in the handler,
  46436. // do not log it twice
  46437. if (e !== err) {
  46438. logError(e, null, 'config.errorHandler');
  46439. }
  46440. }
  46441. }
  46442. logError(err, vm, info);
  46443. }
  46444. function logError (err, vm, info) {
  46445. {
  46446. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  46447. }
  46448. /* istanbul ignore else */
  46449. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  46450. console.error(err);
  46451. } else {
  46452. throw err
  46453. }
  46454. }
  46455. /* */
  46456. var isUsingMicroTask = false;
  46457. var callbacks = [];
  46458. var pending = false;
  46459. function flushCallbacks () {
  46460. pending = false;
  46461. var copies = callbacks.slice(0);
  46462. callbacks.length = 0;
  46463. for (var i = 0; i < copies.length; i++) {
  46464. copies[i]();
  46465. }
  46466. }
  46467. // Here we have async deferring wrappers using microtasks.
  46468. // In 2.5 we used (macro) tasks (in combination with microtasks).
  46469. // However, it has subtle problems when state is changed right before repaint
  46470. // (e.g. #6813, out-in transitions).
  46471. // Also, using (macro) tasks in event handler would cause some weird behaviors
  46472. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  46473. // So we now use microtasks everywhere, again.
  46474. // A major drawback of this tradeoff is that there are some scenarios
  46475. // where microtasks have too high a priority and fire in between supposedly
  46476. // sequential events (e.g. #4521, #6690, which have workarounds)
  46477. // or even between bubbling of the same event (#6566).
  46478. var timerFunc;
  46479. // The nextTick behavior leverages the microtask queue, which can be accessed
  46480. // via either native Promise.then or MutationObserver.
  46481. // MutationObserver has wider support, however it is seriously bugged in
  46482. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  46483. // completely stops working after triggering a few times... so, if native
  46484. // Promise is available, we will use it:
  46485. /* istanbul ignore next, $flow-disable-line */
  46486. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  46487. var p = Promise.resolve();
  46488. timerFunc = function () {
  46489. p.then(flushCallbacks);
  46490. // In problematic UIWebViews, Promise.then doesn't completely break, but
  46491. // it can get stuck in a weird state where callbacks are pushed into the
  46492. // microtask queue but the queue isn't being flushed, until the browser
  46493. // needs to do some other work, e.g. handle a timer. Therefore we can
  46494. // "force" the microtask queue to be flushed by adding an empty timer.
  46495. if (isIOS) { setTimeout(noop); }
  46496. };
  46497. isUsingMicroTask = true;
  46498. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  46499. isNative(MutationObserver) ||
  46500. // PhantomJS and iOS 7.x
  46501. MutationObserver.toString() === '[object MutationObserverConstructor]'
  46502. )) {
  46503. // Use MutationObserver where native Promise is not available,
  46504. // e.g. PhantomJS, iOS7, Android 4.4
  46505. // (#6466 MutationObserver is unreliable in IE11)
  46506. var counter = 1;
  46507. var observer = new MutationObserver(flushCallbacks);
  46508. var textNode = document.createTextNode(String(counter));
  46509. observer.observe(textNode, {
  46510. characterData: true
  46511. });
  46512. timerFunc = function () {
  46513. counter = (counter + 1) % 2;
  46514. textNode.data = String(counter);
  46515. };
  46516. isUsingMicroTask = true;
  46517. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  46518. // Fallback to setImmediate.
  46519. // Technically it leverages the (macro) task queue,
  46520. // but it is still a better choice than setTimeout.
  46521. timerFunc = function () {
  46522. setImmediate(flushCallbacks);
  46523. };
  46524. } else {
  46525. // Fallback to setTimeout.
  46526. timerFunc = function () {
  46527. setTimeout(flushCallbacks, 0);
  46528. };
  46529. }
  46530. function nextTick (cb, ctx) {
  46531. var _resolve;
  46532. callbacks.push(function () {
  46533. if (cb) {
  46534. try {
  46535. cb.call(ctx);
  46536. } catch (e) {
  46537. handleError(e, ctx, 'nextTick');
  46538. }
  46539. } else if (_resolve) {
  46540. _resolve(ctx);
  46541. }
  46542. });
  46543. if (!pending) {
  46544. pending = true;
  46545. timerFunc();
  46546. }
  46547. // $flow-disable-line
  46548. if (!cb && typeof Promise !== 'undefined') {
  46549. return new Promise(function (resolve) {
  46550. _resolve = resolve;
  46551. })
  46552. }
  46553. }
  46554. /* */
  46555. var mark;
  46556. var measure;
  46557. {
  46558. var perf = inBrowser && window.performance;
  46559. /* istanbul ignore if */
  46560. if (
  46561. perf &&
  46562. perf.mark &&
  46563. perf.measure &&
  46564. perf.clearMarks &&
  46565. perf.clearMeasures
  46566. ) {
  46567. mark = function (tag) { return perf.mark(tag); };
  46568. measure = function (name, startTag, endTag) {
  46569. perf.measure(name, startTag, endTag);
  46570. perf.clearMarks(startTag);
  46571. perf.clearMarks(endTag);
  46572. // perf.clearMeasures(name)
  46573. };
  46574. }
  46575. }
  46576. /* not type checking this file because flow doesn't play well with Proxy */
  46577. var initProxy;
  46578. {
  46579. var allowedGlobals = makeMap(
  46580. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  46581. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  46582. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  46583. 'require' // for Webpack/Browserify
  46584. );
  46585. var warnNonPresent = function (target, key) {
  46586. warn(
  46587. "Property or method \"" + key + "\" is not defined on the instance but " +
  46588. 'referenced during render. Make sure that this property is reactive, ' +
  46589. 'either in the data option, or for class-based components, by ' +
  46590. 'initializing the property. ' +
  46591. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  46592. target
  46593. );
  46594. };
  46595. var warnReservedPrefix = function (target, key) {
  46596. warn(
  46597. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  46598. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  46599. 'prevent conflicts with Vue internals. ' +
  46600. 'See: https://vuejs.org/v2/api/#data',
  46601. target
  46602. );
  46603. };
  46604. var hasProxy =
  46605. typeof Proxy !== 'undefined' && isNative(Proxy);
  46606. if (hasProxy) {
  46607. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  46608. config.keyCodes = new Proxy(config.keyCodes, {
  46609. set: function set (target, key, value) {
  46610. if (isBuiltInModifier(key)) {
  46611. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  46612. return false
  46613. } else {
  46614. target[key] = value;
  46615. return true
  46616. }
  46617. }
  46618. });
  46619. }
  46620. var hasHandler = {
  46621. has: function has (target, key) {
  46622. var has = key in target;
  46623. var isAllowed = allowedGlobals(key) ||
  46624. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  46625. if (!has && !isAllowed) {
  46626. if (key in target.$data) { warnReservedPrefix(target, key); }
  46627. else { warnNonPresent(target, key); }
  46628. }
  46629. return has || !isAllowed
  46630. }
  46631. };
  46632. var getHandler = {
  46633. get: function get (target, key) {
  46634. if (typeof key === 'string' && !(key in target)) {
  46635. if (key in target.$data) { warnReservedPrefix(target, key); }
  46636. else { warnNonPresent(target, key); }
  46637. }
  46638. return target[key]
  46639. }
  46640. };
  46641. initProxy = function initProxy (vm) {
  46642. if (hasProxy) {
  46643. // determine which proxy handler to use
  46644. var options = vm.$options;
  46645. var handlers = options.render && options.render._withStripped
  46646. ? getHandler
  46647. : hasHandler;
  46648. vm._renderProxy = new Proxy(vm, handlers);
  46649. } else {
  46650. vm._renderProxy = vm;
  46651. }
  46652. };
  46653. }
  46654. /* */
  46655. var seenObjects = new _Set();
  46656. /**
  46657. * Recursively traverse an object to evoke all converted
  46658. * getters, so that every nested property inside the object
  46659. * is collected as a "deep" dependency.
  46660. */
  46661. function traverse (val) {
  46662. _traverse(val, seenObjects);
  46663. seenObjects.clear();
  46664. }
  46665. function _traverse (val, seen) {
  46666. var i, keys;
  46667. var isA = Array.isArray(val);
  46668. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  46669. return
  46670. }
  46671. if (val.__ob__) {
  46672. var depId = val.__ob__.dep.id;
  46673. if (seen.has(depId)) {
  46674. return
  46675. }
  46676. seen.add(depId);
  46677. }
  46678. if (isA) {
  46679. i = val.length;
  46680. while (i--) { _traverse(val[i], seen); }
  46681. } else {
  46682. keys = Object.keys(val);
  46683. i = keys.length;
  46684. while (i--) { _traverse(val[keys[i]], seen); }
  46685. }
  46686. }
  46687. /* */
  46688. var normalizeEvent = cached(function (name) {
  46689. var passive = name.charAt(0) === '&';
  46690. name = passive ? name.slice(1) : name;
  46691. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  46692. name = once$$1 ? name.slice(1) : name;
  46693. var capture = name.charAt(0) === '!';
  46694. name = capture ? name.slice(1) : name;
  46695. return {
  46696. name: name,
  46697. once: once$$1,
  46698. capture: capture,
  46699. passive: passive
  46700. }
  46701. });
  46702. function createFnInvoker (fns, vm) {
  46703. function invoker () {
  46704. var arguments$1 = arguments;
  46705. var fns = invoker.fns;
  46706. if (Array.isArray(fns)) {
  46707. var cloned = fns.slice();
  46708. for (var i = 0; i < cloned.length; i++) {
  46709. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  46710. }
  46711. } else {
  46712. // return handler return value for single handlers
  46713. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  46714. }
  46715. }
  46716. invoker.fns = fns;
  46717. return invoker
  46718. }
  46719. function updateListeners (
  46720. on,
  46721. oldOn,
  46722. add,
  46723. remove$$1,
  46724. createOnceHandler,
  46725. vm
  46726. ) {
  46727. var name, def$$1, cur, old, event;
  46728. for (name in on) {
  46729. def$$1 = cur = on[name];
  46730. old = oldOn[name];
  46731. event = normalizeEvent(name);
  46732. if (isUndef(cur)) {
  46733. warn(
  46734. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  46735. vm
  46736. );
  46737. } else if (isUndef(old)) {
  46738. if (isUndef(cur.fns)) {
  46739. cur = on[name] = createFnInvoker(cur, vm);
  46740. }
  46741. if (isTrue(event.once)) {
  46742. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  46743. }
  46744. add(event.name, cur, event.capture, event.passive, event.params);
  46745. } else if (cur !== old) {
  46746. old.fns = cur;
  46747. on[name] = old;
  46748. }
  46749. }
  46750. for (name in oldOn) {
  46751. if (isUndef(on[name])) {
  46752. event = normalizeEvent(name);
  46753. remove$$1(event.name, oldOn[name], event.capture);
  46754. }
  46755. }
  46756. }
  46757. /* */
  46758. function mergeVNodeHook (def, hookKey, hook) {
  46759. if (def instanceof VNode) {
  46760. def = def.data.hook || (def.data.hook = {});
  46761. }
  46762. var invoker;
  46763. var oldHook = def[hookKey];
  46764. function wrappedHook () {
  46765. hook.apply(this, arguments);
  46766. // important: remove merged hook to ensure it's called only once
  46767. // and prevent memory leak
  46768. remove(invoker.fns, wrappedHook);
  46769. }
  46770. if (isUndef(oldHook)) {
  46771. // no existing hook
  46772. invoker = createFnInvoker([wrappedHook]);
  46773. } else {
  46774. /* istanbul ignore if */
  46775. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  46776. // already a merged invoker
  46777. invoker = oldHook;
  46778. invoker.fns.push(wrappedHook);
  46779. } else {
  46780. // existing plain hook
  46781. invoker = createFnInvoker([oldHook, wrappedHook]);
  46782. }
  46783. }
  46784. invoker.merged = true;
  46785. def[hookKey] = invoker;
  46786. }
  46787. /* */
  46788. function extractPropsFromVNodeData (
  46789. data,
  46790. Ctor,
  46791. tag
  46792. ) {
  46793. // we are only extracting raw values here.
  46794. // validation and default values are handled in the child
  46795. // component itself.
  46796. var propOptions = Ctor.options.props;
  46797. if (isUndef(propOptions)) {
  46798. return
  46799. }
  46800. var res = {};
  46801. var attrs = data.attrs;
  46802. var props = data.props;
  46803. if (isDef(attrs) || isDef(props)) {
  46804. for (var key in propOptions) {
  46805. var altKey = hyphenate(key);
  46806. {
  46807. var keyInLowerCase = key.toLowerCase();
  46808. if (
  46809. key !== keyInLowerCase &&
  46810. attrs && hasOwn(attrs, keyInLowerCase)
  46811. ) {
  46812. tip(
  46813. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  46814. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  46815. " \"" + key + "\". " +
  46816. "Note that HTML attributes are case-insensitive and camelCased " +
  46817. "props need to use their kebab-case equivalents when using in-DOM " +
  46818. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  46819. );
  46820. }
  46821. }
  46822. checkProp(res, props, key, altKey, true) ||
  46823. checkProp(res, attrs, key, altKey, false);
  46824. }
  46825. }
  46826. return res
  46827. }
  46828. function checkProp (
  46829. res,
  46830. hash,
  46831. key,
  46832. altKey,
  46833. preserve
  46834. ) {
  46835. if (isDef(hash)) {
  46836. if (hasOwn(hash, key)) {
  46837. res[key] = hash[key];
  46838. if (!preserve) {
  46839. delete hash[key];
  46840. }
  46841. return true
  46842. } else if (hasOwn(hash, altKey)) {
  46843. res[key] = hash[altKey];
  46844. if (!preserve) {
  46845. delete hash[altKey];
  46846. }
  46847. return true
  46848. }
  46849. }
  46850. return false
  46851. }
  46852. /* */
  46853. // The template compiler attempts to minimize the need for normalization by
  46854. // statically analyzing the template at compile time.
  46855. //
  46856. // For plain HTML markup, normalization can be completely skipped because the
  46857. // generated render function is guaranteed to return Array<VNode>. There are
  46858. // two cases where extra normalization is needed:
  46859. // 1. When the children contains components - because a functional component
  46860. // may return an Array instead of a single root. In this case, just a simple
  46861. // normalization is needed - if any child is an Array, we flatten the whole
  46862. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  46863. // because functional components already normalize their own children.
  46864. function simpleNormalizeChildren (children) {
  46865. for (var i = 0; i < children.length; i++) {
  46866. if (Array.isArray(children[i])) {
  46867. return Array.prototype.concat.apply([], children)
  46868. }
  46869. }
  46870. return children
  46871. }
  46872. // 2. When the children contains constructs that always generated nested Arrays,
  46873. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  46874. // with hand-written render functions / JSX. In such cases a full normalization
  46875. // is needed to cater to all possible types of children values.
  46876. function normalizeChildren (children) {
  46877. return isPrimitive(children)
  46878. ? [createTextVNode(children)]
  46879. : Array.isArray(children)
  46880. ? normalizeArrayChildren(children)
  46881. : undefined
  46882. }
  46883. function isTextNode (node) {
  46884. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  46885. }
  46886. function normalizeArrayChildren (children, nestedIndex) {
  46887. var res = [];
  46888. var i, c, lastIndex, last;
  46889. for (i = 0; i < children.length; i++) {
  46890. c = children[i];
  46891. if (isUndef(c) || typeof c === 'boolean') { continue }
  46892. lastIndex = res.length - 1;
  46893. last = res[lastIndex];
  46894. // nested
  46895. if (Array.isArray(c)) {
  46896. if (c.length > 0) {
  46897. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  46898. // merge adjacent text nodes
  46899. if (isTextNode(c[0]) && isTextNode(last)) {
  46900. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  46901. c.shift();
  46902. }
  46903. res.push.apply(res, c);
  46904. }
  46905. } else if (isPrimitive(c)) {
  46906. if (isTextNode(last)) {
  46907. // merge adjacent text nodes
  46908. // this is necessary for SSR hydration because text nodes are
  46909. // essentially merged when rendered to HTML strings
  46910. res[lastIndex] = createTextVNode(last.text + c);
  46911. } else if (c !== '') {
  46912. // convert primitive to vnode
  46913. res.push(createTextVNode(c));
  46914. }
  46915. } else {
  46916. if (isTextNode(c) && isTextNode(last)) {
  46917. // merge adjacent text nodes
  46918. res[lastIndex] = createTextVNode(last.text + c.text);
  46919. } else {
  46920. // default key for nested array children (likely generated by v-for)
  46921. if (isTrue(children._isVList) &&
  46922. isDef(c.tag) &&
  46923. isUndef(c.key) &&
  46924. isDef(nestedIndex)) {
  46925. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  46926. }
  46927. res.push(c);
  46928. }
  46929. }
  46930. }
  46931. return res
  46932. }
  46933. /* */
  46934. function initProvide (vm) {
  46935. var provide = vm.$options.provide;
  46936. if (provide) {
  46937. vm._provided = typeof provide === 'function'
  46938. ? provide.call(vm)
  46939. : provide;
  46940. }
  46941. }
  46942. function initInjections (vm) {
  46943. var result = resolveInject(vm.$options.inject, vm);
  46944. if (result) {
  46945. toggleObserving(false);
  46946. Object.keys(result).forEach(function (key) {
  46947. /* istanbul ignore else */
  46948. {
  46949. defineReactive$$1(vm, key, result[key], function () {
  46950. warn(
  46951. "Avoid mutating an injected value directly since the changes will be " +
  46952. "overwritten whenever the provided component re-renders. " +
  46953. "injection being mutated: \"" + key + "\"",
  46954. vm
  46955. );
  46956. });
  46957. }
  46958. });
  46959. toggleObserving(true);
  46960. }
  46961. }
  46962. function resolveInject (inject, vm) {
  46963. if (inject) {
  46964. // inject is :any because flow is not smart enough to figure out cached
  46965. var result = Object.create(null);
  46966. var keys = hasSymbol
  46967. ? Reflect.ownKeys(inject)
  46968. : Object.keys(inject);
  46969. for (var i = 0; i < keys.length; i++) {
  46970. var key = keys[i];
  46971. // #6574 in case the inject object is observed...
  46972. if (key === '__ob__') { continue }
  46973. var provideKey = inject[key].from;
  46974. var source = vm;
  46975. while (source) {
  46976. if (source._provided && hasOwn(source._provided, provideKey)) {
  46977. result[key] = source._provided[provideKey];
  46978. break
  46979. }
  46980. source = source.$parent;
  46981. }
  46982. if (!source) {
  46983. if ('default' in inject[key]) {
  46984. var provideDefault = inject[key].default;
  46985. result[key] = typeof provideDefault === 'function'
  46986. ? provideDefault.call(vm)
  46987. : provideDefault;
  46988. } else {
  46989. warn(("Injection \"" + key + "\" not found"), vm);
  46990. }
  46991. }
  46992. }
  46993. return result
  46994. }
  46995. }
  46996. /* */
  46997. /**
  46998. * Runtime helper for resolving raw children VNodes into a slot object.
  46999. */
  47000. function resolveSlots (
  47001. children,
  47002. context
  47003. ) {
  47004. if (!children || !children.length) {
  47005. return {}
  47006. }
  47007. var slots = {};
  47008. for (var i = 0, l = children.length; i < l; i++) {
  47009. var child = children[i];
  47010. var data = child.data;
  47011. // remove slot attribute if the node is resolved as a Vue slot node
  47012. if (data && data.attrs && data.attrs.slot) {
  47013. delete data.attrs.slot;
  47014. }
  47015. // named slots should only be respected if the vnode was rendered in the
  47016. // same context.
  47017. if ((child.context === context || child.fnContext === context) &&
  47018. data && data.slot != null
  47019. ) {
  47020. var name = data.slot;
  47021. var slot = (slots[name] || (slots[name] = []));
  47022. if (child.tag === 'template') {
  47023. slot.push.apply(slot, child.children || []);
  47024. } else {
  47025. slot.push(child);
  47026. }
  47027. } else {
  47028. (slots.default || (slots.default = [])).push(child);
  47029. }
  47030. }
  47031. // ignore slots that contains only whitespace
  47032. for (var name$1 in slots) {
  47033. if (slots[name$1].every(isWhitespace)) {
  47034. delete slots[name$1];
  47035. }
  47036. }
  47037. return slots
  47038. }
  47039. function isWhitespace (node) {
  47040. return (node.isComment && !node.asyncFactory) || node.text === ' '
  47041. }
  47042. /* */
  47043. function normalizeScopedSlots (
  47044. slots,
  47045. normalSlots,
  47046. prevSlots
  47047. ) {
  47048. var res;
  47049. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  47050. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  47051. var key = slots && slots.$key;
  47052. if (!slots) {
  47053. res = {};
  47054. } else if (slots._normalized) {
  47055. // fast path 1: child component re-render only, parent did not change
  47056. return slots._normalized
  47057. } else if (
  47058. isStable &&
  47059. prevSlots &&
  47060. prevSlots !== emptyObject &&
  47061. key === prevSlots.$key &&
  47062. !hasNormalSlots &&
  47063. !prevSlots.$hasNormal
  47064. ) {
  47065. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  47066. // only need to normalize once
  47067. return prevSlots
  47068. } else {
  47069. res = {};
  47070. for (var key$1 in slots) {
  47071. if (slots[key$1] && key$1[0] !== '$') {
  47072. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  47073. }
  47074. }
  47075. }
  47076. // expose normal slots on scopedSlots
  47077. for (var key$2 in normalSlots) {
  47078. if (!(key$2 in res)) {
  47079. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  47080. }
  47081. }
  47082. // avoriaz seems to mock a non-extensible $scopedSlots object
  47083. // and when that is passed down this would cause an error
  47084. if (slots && Object.isExtensible(slots)) {
  47085. (slots)._normalized = res;
  47086. }
  47087. def(res, '$stable', isStable);
  47088. def(res, '$key', key);
  47089. def(res, '$hasNormal', hasNormalSlots);
  47090. return res
  47091. }
  47092. function normalizeScopedSlot(normalSlots, key, fn) {
  47093. var normalized = function () {
  47094. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  47095. res = res && typeof res === 'object' && !Array.isArray(res)
  47096. ? [res] // single vnode
  47097. : normalizeChildren(res);
  47098. return res && (
  47099. res.length === 0 ||
  47100. (res.length === 1 && res[0].isComment) // #9658
  47101. ) ? undefined
  47102. : res
  47103. };
  47104. // this is a slot using the new v-slot syntax without scope. although it is
  47105. // compiled as a scoped slot, render fn users would expect it to be present
  47106. // on this.$slots because the usage is semantically a normal slot.
  47107. if (fn.proxy) {
  47108. Object.defineProperty(normalSlots, key, {
  47109. get: normalized,
  47110. enumerable: true,
  47111. configurable: true
  47112. });
  47113. }
  47114. return normalized
  47115. }
  47116. function proxyNormalSlot(slots, key) {
  47117. return function () { return slots[key]; }
  47118. }
  47119. /* */
  47120. /**
  47121. * Runtime helper for rendering v-for lists.
  47122. */
  47123. function renderList (
  47124. val,
  47125. render
  47126. ) {
  47127. var ret, i, l, keys, key;
  47128. if (Array.isArray(val) || typeof val === 'string') {
  47129. ret = new Array(val.length);
  47130. for (i = 0, l = val.length; i < l; i++) {
  47131. ret[i] = render(val[i], i);
  47132. }
  47133. } else if (typeof val === 'number') {
  47134. ret = new Array(val);
  47135. for (i = 0; i < val; i++) {
  47136. ret[i] = render(i + 1, i);
  47137. }
  47138. } else if (isObject(val)) {
  47139. if (hasSymbol && val[Symbol.iterator]) {
  47140. ret = [];
  47141. var iterator = val[Symbol.iterator]();
  47142. var result = iterator.next();
  47143. while (!result.done) {
  47144. ret.push(render(result.value, ret.length));
  47145. result = iterator.next();
  47146. }
  47147. } else {
  47148. keys = Object.keys(val);
  47149. ret = new Array(keys.length);
  47150. for (i = 0, l = keys.length; i < l; i++) {
  47151. key = keys[i];
  47152. ret[i] = render(val[key], key, i);
  47153. }
  47154. }
  47155. }
  47156. if (!isDef(ret)) {
  47157. ret = [];
  47158. }
  47159. (ret)._isVList = true;
  47160. return ret
  47161. }
  47162. /* */
  47163. /**
  47164. * Runtime helper for rendering <slot>
  47165. */
  47166. function renderSlot (
  47167. name,
  47168. fallback,
  47169. props,
  47170. bindObject
  47171. ) {
  47172. var scopedSlotFn = this.$scopedSlots[name];
  47173. var nodes;
  47174. if (scopedSlotFn) { // scoped slot
  47175. props = props || {};
  47176. if (bindObject) {
  47177. if (!isObject(bindObject)) {
  47178. warn(
  47179. 'slot v-bind without argument expects an Object',
  47180. this
  47181. );
  47182. }
  47183. props = extend(extend({}, bindObject), props);
  47184. }
  47185. nodes = scopedSlotFn(props) || fallback;
  47186. } else {
  47187. nodes = this.$slots[name] || fallback;
  47188. }
  47189. var target = props && props.slot;
  47190. if (target) {
  47191. return this.$createElement('template', { slot: target }, nodes)
  47192. } else {
  47193. return nodes
  47194. }
  47195. }
  47196. /* */
  47197. /**
  47198. * Runtime helper for resolving filters
  47199. */
  47200. function resolveFilter (id) {
  47201. return resolveAsset(this.$options, 'filters', id, true) || identity
  47202. }
  47203. /* */
  47204. function isKeyNotMatch (expect, actual) {
  47205. if (Array.isArray(expect)) {
  47206. return expect.indexOf(actual) === -1
  47207. } else {
  47208. return expect !== actual
  47209. }
  47210. }
  47211. /**
  47212. * Runtime helper for checking keyCodes from config.
  47213. * exposed as Vue.prototype._k
  47214. * passing in eventKeyName as last argument separately for backwards compat
  47215. */
  47216. function checkKeyCodes (
  47217. eventKeyCode,
  47218. key,
  47219. builtInKeyCode,
  47220. eventKeyName,
  47221. builtInKeyName
  47222. ) {
  47223. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  47224. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  47225. return isKeyNotMatch(builtInKeyName, eventKeyName)
  47226. } else if (mappedKeyCode) {
  47227. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  47228. } else if (eventKeyName) {
  47229. return hyphenate(eventKeyName) !== key
  47230. }
  47231. }
  47232. /* */
  47233. /**
  47234. * Runtime helper for merging v-bind="object" into a VNode's data.
  47235. */
  47236. function bindObjectProps (
  47237. data,
  47238. tag,
  47239. value,
  47240. asProp,
  47241. isSync
  47242. ) {
  47243. if (value) {
  47244. if (!isObject(value)) {
  47245. warn(
  47246. 'v-bind without argument expects an Object or Array value',
  47247. this
  47248. );
  47249. } else {
  47250. if (Array.isArray(value)) {
  47251. value = toObject(value);
  47252. }
  47253. var hash;
  47254. var loop = function ( key ) {
  47255. if (
  47256. key === 'class' ||
  47257. key === 'style' ||
  47258. isReservedAttribute(key)
  47259. ) {
  47260. hash = data;
  47261. } else {
  47262. var type = data.attrs && data.attrs.type;
  47263. hash = asProp || config.mustUseProp(tag, type, key)
  47264. ? data.domProps || (data.domProps = {})
  47265. : data.attrs || (data.attrs = {});
  47266. }
  47267. var camelizedKey = camelize(key);
  47268. var hyphenatedKey = hyphenate(key);
  47269. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  47270. hash[key] = value[key];
  47271. if (isSync) {
  47272. var on = data.on || (data.on = {});
  47273. on[("update:" + key)] = function ($event) {
  47274. value[key] = $event;
  47275. };
  47276. }
  47277. }
  47278. };
  47279. for (var key in value) loop( key );
  47280. }
  47281. }
  47282. return data
  47283. }
  47284. /* */
  47285. /**
  47286. * Runtime helper for rendering static trees.
  47287. */
  47288. function renderStatic (
  47289. index,
  47290. isInFor
  47291. ) {
  47292. var cached = this._staticTrees || (this._staticTrees = []);
  47293. var tree = cached[index];
  47294. // if has already-rendered static tree and not inside v-for,
  47295. // we can reuse the same tree.
  47296. if (tree && !isInFor) {
  47297. return tree
  47298. }
  47299. // otherwise, render a fresh tree.
  47300. tree = cached[index] = this.$options.staticRenderFns[index].call(
  47301. this._renderProxy,
  47302. null,
  47303. this // for render fns generated for functional component templates
  47304. );
  47305. markStatic(tree, ("__static__" + index), false);
  47306. return tree
  47307. }
  47308. /**
  47309. * Runtime helper for v-once.
  47310. * Effectively it means marking the node as static with a unique key.
  47311. */
  47312. function markOnce (
  47313. tree,
  47314. index,
  47315. key
  47316. ) {
  47317. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  47318. return tree
  47319. }
  47320. function markStatic (
  47321. tree,
  47322. key,
  47323. isOnce
  47324. ) {
  47325. if (Array.isArray(tree)) {
  47326. for (var i = 0; i < tree.length; i++) {
  47327. if (tree[i] && typeof tree[i] !== 'string') {
  47328. markStaticNode(tree[i], (key + "_" + i), isOnce);
  47329. }
  47330. }
  47331. } else {
  47332. markStaticNode(tree, key, isOnce);
  47333. }
  47334. }
  47335. function markStaticNode (node, key, isOnce) {
  47336. node.isStatic = true;
  47337. node.key = key;
  47338. node.isOnce = isOnce;
  47339. }
  47340. /* */
  47341. function bindObjectListeners (data, value) {
  47342. if (value) {
  47343. if (!isPlainObject(value)) {
  47344. warn(
  47345. 'v-on without argument expects an Object value',
  47346. this
  47347. );
  47348. } else {
  47349. var on = data.on = data.on ? extend({}, data.on) : {};
  47350. for (var key in value) {
  47351. var existing = on[key];
  47352. var ours = value[key];
  47353. on[key] = existing ? [].concat(existing, ours) : ours;
  47354. }
  47355. }
  47356. }
  47357. return data
  47358. }
  47359. /* */
  47360. function resolveScopedSlots (
  47361. fns, // see flow/vnode
  47362. res,
  47363. // the following are added in 2.6
  47364. hasDynamicKeys,
  47365. contentHashKey
  47366. ) {
  47367. res = res || { $stable: !hasDynamicKeys };
  47368. for (var i = 0; i < fns.length; i++) {
  47369. var slot = fns[i];
  47370. if (Array.isArray(slot)) {
  47371. resolveScopedSlots(slot, res, hasDynamicKeys);
  47372. } else if (slot) {
  47373. // marker for reverse proxying v-slot without scope on this.$slots
  47374. if (slot.proxy) {
  47375. slot.fn.proxy = true;
  47376. }
  47377. res[slot.key] = slot.fn;
  47378. }
  47379. }
  47380. if (contentHashKey) {
  47381. (res).$key = contentHashKey;
  47382. }
  47383. return res
  47384. }
  47385. /* */
  47386. function bindDynamicKeys (baseObj, values) {
  47387. for (var i = 0; i < values.length; i += 2) {
  47388. var key = values[i];
  47389. if (typeof key === 'string' && key) {
  47390. baseObj[values[i]] = values[i + 1];
  47391. } else if (key !== '' && key !== null) {
  47392. // null is a special value for explicitly removing a binding
  47393. warn(
  47394. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  47395. this
  47396. );
  47397. }
  47398. }
  47399. return baseObj
  47400. }
  47401. // helper to dynamically append modifier runtime markers to event names.
  47402. // ensure only append when value is already string, otherwise it will be cast
  47403. // to string and cause the type check to miss.
  47404. function prependModifier (value, symbol) {
  47405. return typeof value === 'string' ? symbol + value : value
  47406. }
  47407. /* */
  47408. function installRenderHelpers (target) {
  47409. target._o = markOnce;
  47410. target._n = toNumber;
  47411. target._s = toString;
  47412. target._l = renderList;
  47413. target._t = renderSlot;
  47414. target._q = looseEqual;
  47415. target._i = looseIndexOf;
  47416. target._m = renderStatic;
  47417. target._f = resolveFilter;
  47418. target._k = checkKeyCodes;
  47419. target._b = bindObjectProps;
  47420. target._v = createTextVNode;
  47421. target._e = createEmptyVNode;
  47422. target._u = resolveScopedSlots;
  47423. target._g = bindObjectListeners;
  47424. target._d = bindDynamicKeys;
  47425. target._p = prependModifier;
  47426. }
  47427. /* */
  47428. function FunctionalRenderContext (
  47429. data,
  47430. props,
  47431. children,
  47432. parent,
  47433. Ctor
  47434. ) {
  47435. var this$1 = this;
  47436. var options = Ctor.options;
  47437. // ensure the createElement function in functional components
  47438. // gets a unique context - this is necessary for correct named slot check
  47439. var contextVm;
  47440. if (hasOwn(parent, '_uid')) {
  47441. contextVm = Object.create(parent);
  47442. // $flow-disable-line
  47443. contextVm._original = parent;
  47444. } else {
  47445. // the context vm passed in is a functional context as well.
  47446. // in this case we want to make sure we are able to get a hold to the
  47447. // real context instance.
  47448. contextVm = parent;
  47449. // $flow-disable-line
  47450. parent = parent._original;
  47451. }
  47452. var isCompiled = isTrue(options._compiled);
  47453. var needNormalization = !isCompiled;
  47454. this.data = data;
  47455. this.props = props;
  47456. this.children = children;
  47457. this.parent = parent;
  47458. this.listeners = data.on || emptyObject;
  47459. this.injections = resolveInject(options.inject, parent);
  47460. this.slots = function () {
  47461. if (!this$1.$slots) {
  47462. normalizeScopedSlots(
  47463. data.scopedSlots,
  47464. this$1.$slots = resolveSlots(children, parent)
  47465. );
  47466. }
  47467. return this$1.$slots
  47468. };
  47469. Object.defineProperty(this, 'scopedSlots', ({
  47470. enumerable: true,
  47471. get: function get () {
  47472. return normalizeScopedSlots(data.scopedSlots, this.slots())
  47473. }
  47474. }));
  47475. // support for compiled functional template
  47476. if (isCompiled) {
  47477. // exposing $options for renderStatic()
  47478. this.$options = options;
  47479. // pre-resolve slots for renderSlot()
  47480. this.$slots = this.slots();
  47481. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  47482. }
  47483. if (options._scopeId) {
  47484. this._c = function (a, b, c, d) {
  47485. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  47486. if (vnode && !Array.isArray(vnode)) {
  47487. vnode.fnScopeId = options._scopeId;
  47488. vnode.fnContext = parent;
  47489. }
  47490. return vnode
  47491. };
  47492. } else {
  47493. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  47494. }
  47495. }
  47496. installRenderHelpers(FunctionalRenderContext.prototype);
  47497. function createFunctionalComponent (
  47498. Ctor,
  47499. propsData,
  47500. data,
  47501. contextVm,
  47502. children
  47503. ) {
  47504. var options = Ctor.options;
  47505. var props = {};
  47506. var propOptions = options.props;
  47507. if (isDef(propOptions)) {
  47508. for (var key in propOptions) {
  47509. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  47510. }
  47511. } else {
  47512. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  47513. if (isDef(data.props)) { mergeProps(props, data.props); }
  47514. }
  47515. var renderContext = new FunctionalRenderContext(
  47516. data,
  47517. props,
  47518. children,
  47519. contextVm,
  47520. Ctor
  47521. );
  47522. var vnode = options.render.call(null, renderContext._c, renderContext);
  47523. if (vnode instanceof VNode) {
  47524. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  47525. } else if (Array.isArray(vnode)) {
  47526. var vnodes = normalizeChildren(vnode) || [];
  47527. var res = new Array(vnodes.length);
  47528. for (var i = 0; i < vnodes.length; i++) {
  47529. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  47530. }
  47531. return res
  47532. }
  47533. }
  47534. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  47535. // #7817 clone node before setting fnContext, otherwise if the node is reused
  47536. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  47537. // that should not be matched to match.
  47538. var clone = cloneVNode(vnode);
  47539. clone.fnContext = contextVm;
  47540. clone.fnOptions = options;
  47541. {
  47542. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  47543. }
  47544. if (data.slot) {
  47545. (clone.data || (clone.data = {})).slot = data.slot;
  47546. }
  47547. return clone
  47548. }
  47549. function mergeProps (to, from) {
  47550. for (var key in from) {
  47551. to[camelize(key)] = from[key];
  47552. }
  47553. }
  47554. /* */
  47555. /* */
  47556. /* */
  47557. /* */
  47558. // inline hooks to be invoked on component VNodes during patch
  47559. var componentVNodeHooks = {
  47560. init: function init (vnode, hydrating) {
  47561. if (
  47562. vnode.componentInstance &&
  47563. !vnode.componentInstance._isDestroyed &&
  47564. vnode.data.keepAlive
  47565. ) {
  47566. // kept-alive components, treat as a patch
  47567. var mountedNode = vnode; // work around flow
  47568. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  47569. } else {
  47570. var child = vnode.componentInstance = createComponentInstanceForVnode(
  47571. vnode,
  47572. activeInstance
  47573. );
  47574. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  47575. }
  47576. },
  47577. prepatch: function prepatch (oldVnode, vnode) {
  47578. var options = vnode.componentOptions;
  47579. var child = vnode.componentInstance = oldVnode.componentInstance;
  47580. updateChildComponent(
  47581. child,
  47582. options.propsData, // updated props
  47583. options.listeners, // updated listeners
  47584. vnode, // new parent vnode
  47585. options.children // new children
  47586. );
  47587. },
  47588. insert: function insert (vnode) {
  47589. var context = vnode.context;
  47590. var componentInstance = vnode.componentInstance;
  47591. if (!componentInstance._isMounted) {
  47592. componentInstance._isMounted = true;
  47593. callHook(componentInstance, 'mounted');
  47594. }
  47595. if (vnode.data.keepAlive) {
  47596. if (context._isMounted) {
  47597. // vue-router#1212
  47598. // During updates, a kept-alive component's child components may
  47599. // change, so directly walking the tree here may call activated hooks
  47600. // on incorrect children. Instead we push them into a queue which will
  47601. // be processed after the whole patch process ended.
  47602. queueActivatedComponent(componentInstance);
  47603. } else {
  47604. activateChildComponent(componentInstance, true /* direct */);
  47605. }
  47606. }
  47607. },
  47608. destroy: function destroy (vnode) {
  47609. var componentInstance = vnode.componentInstance;
  47610. if (!componentInstance._isDestroyed) {
  47611. if (!vnode.data.keepAlive) {
  47612. componentInstance.$destroy();
  47613. } else {
  47614. deactivateChildComponent(componentInstance, true /* direct */);
  47615. }
  47616. }
  47617. }
  47618. };
  47619. var hooksToMerge = Object.keys(componentVNodeHooks);
  47620. function createComponent (
  47621. Ctor,
  47622. data,
  47623. context,
  47624. children,
  47625. tag
  47626. ) {
  47627. if (isUndef(Ctor)) {
  47628. return
  47629. }
  47630. var baseCtor = context.$options._base;
  47631. // plain options object: turn it into a constructor
  47632. if (isObject(Ctor)) {
  47633. Ctor = baseCtor.extend(Ctor);
  47634. }
  47635. // if at this stage it's not a constructor or an async component factory,
  47636. // reject.
  47637. if (typeof Ctor !== 'function') {
  47638. {
  47639. warn(("Invalid Component definition: " + (String(Ctor))), context);
  47640. }
  47641. return
  47642. }
  47643. // async component
  47644. var asyncFactory;
  47645. if (isUndef(Ctor.cid)) {
  47646. asyncFactory = Ctor;
  47647. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  47648. if (Ctor === undefined) {
  47649. // return a placeholder node for async component, which is rendered
  47650. // as a comment node but preserves all the raw information for the node.
  47651. // the information will be used for async server-rendering and hydration.
  47652. return createAsyncPlaceholder(
  47653. asyncFactory,
  47654. data,
  47655. context,
  47656. children,
  47657. tag
  47658. )
  47659. }
  47660. }
  47661. data = data || {};
  47662. // resolve constructor options in case global mixins are applied after
  47663. // component constructor creation
  47664. resolveConstructorOptions(Ctor);
  47665. // transform component v-model data into props & events
  47666. if (isDef(data.model)) {
  47667. transformModel(Ctor.options, data);
  47668. }
  47669. // extract props
  47670. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  47671. // functional component
  47672. if (isTrue(Ctor.options.functional)) {
  47673. return createFunctionalComponent(Ctor, propsData, data, context, children)
  47674. }
  47675. // extract listeners, since these needs to be treated as
  47676. // child component listeners instead of DOM listeners
  47677. var listeners = data.on;
  47678. // replace with listeners with .native modifier
  47679. // so it gets processed during parent component patch.
  47680. data.on = data.nativeOn;
  47681. if (isTrue(Ctor.options.abstract)) {
  47682. // abstract components do not keep anything
  47683. // other than props & listeners & slot
  47684. // work around flow
  47685. var slot = data.slot;
  47686. data = {};
  47687. if (slot) {
  47688. data.slot = slot;
  47689. }
  47690. }
  47691. // install component management hooks onto the placeholder node
  47692. installComponentHooks(data);
  47693. // return a placeholder vnode
  47694. var name = Ctor.options.name || tag;
  47695. var vnode = new VNode(
  47696. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  47697. data, undefined, undefined, undefined, context,
  47698. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  47699. asyncFactory
  47700. );
  47701. return vnode
  47702. }
  47703. function createComponentInstanceForVnode (
  47704. vnode, // we know it's MountedComponentVNode but flow doesn't
  47705. parent // activeInstance in lifecycle state
  47706. ) {
  47707. var options = {
  47708. _isComponent: true,
  47709. _parentVnode: vnode,
  47710. parent: parent
  47711. };
  47712. // check inline-template render functions
  47713. var inlineTemplate = vnode.data.inlineTemplate;
  47714. if (isDef(inlineTemplate)) {
  47715. options.render = inlineTemplate.render;
  47716. options.staticRenderFns = inlineTemplate.staticRenderFns;
  47717. }
  47718. return new vnode.componentOptions.Ctor(options)
  47719. }
  47720. function installComponentHooks (data) {
  47721. var hooks = data.hook || (data.hook = {});
  47722. for (var i = 0; i < hooksToMerge.length; i++) {
  47723. var key = hooksToMerge[i];
  47724. var existing = hooks[key];
  47725. var toMerge = componentVNodeHooks[key];
  47726. if (existing !== toMerge && !(existing && existing._merged)) {
  47727. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  47728. }
  47729. }
  47730. }
  47731. function mergeHook$1 (f1, f2) {
  47732. var merged = function (a, b) {
  47733. // flow complains about extra args which is why we use any
  47734. f1(a, b);
  47735. f2(a, b);
  47736. };
  47737. merged._merged = true;
  47738. return merged
  47739. }
  47740. // transform component v-model info (value and callback) into
  47741. // prop and event handler respectively.
  47742. function transformModel (options, data) {
  47743. var prop = (options.model && options.model.prop) || 'value';
  47744. var event = (options.model && options.model.event) || 'input'
  47745. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  47746. var on = data.on || (data.on = {});
  47747. var existing = on[event];
  47748. var callback = data.model.callback;
  47749. if (isDef(existing)) {
  47750. if (
  47751. Array.isArray(existing)
  47752. ? existing.indexOf(callback) === -1
  47753. : existing !== callback
  47754. ) {
  47755. on[event] = [callback].concat(existing);
  47756. }
  47757. } else {
  47758. on[event] = callback;
  47759. }
  47760. }
  47761. /* */
  47762. var SIMPLE_NORMALIZE = 1;
  47763. var ALWAYS_NORMALIZE = 2;
  47764. // wrapper function for providing a more flexible interface
  47765. // without getting yelled at by flow
  47766. function createElement (
  47767. context,
  47768. tag,
  47769. data,
  47770. children,
  47771. normalizationType,
  47772. alwaysNormalize
  47773. ) {
  47774. if (Array.isArray(data) || isPrimitive(data)) {
  47775. normalizationType = children;
  47776. children = data;
  47777. data = undefined;
  47778. }
  47779. if (isTrue(alwaysNormalize)) {
  47780. normalizationType = ALWAYS_NORMALIZE;
  47781. }
  47782. return _createElement(context, tag, data, children, normalizationType)
  47783. }
  47784. function _createElement (
  47785. context,
  47786. tag,
  47787. data,
  47788. children,
  47789. normalizationType
  47790. ) {
  47791. if (isDef(data) && isDef((data).__ob__)) {
  47792. warn(
  47793. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  47794. 'Always create fresh vnode data objects in each render!',
  47795. context
  47796. );
  47797. return createEmptyVNode()
  47798. }
  47799. // object syntax in v-bind
  47800. if (isDef(data) && isDef(data.is)) {
  47801. tag = data.is;
  47802. }
  47803. if (!tag) {
  47804. // in case of component :is set to falsy value
  47805. return createEmptyVNode()
  47806. }
  47807. // warn against non-primitive key
  47808. if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  47809. ) {
  47810. {
  47811. warn(
  47812. 'Avoid using non-primitive value as key, ' +
  47813. 'use string/number value instead.',
  47814. context
  47815. );
  47816. }
  47817. }
  47818. // support single function children as default scoped slot
  47819. if (Array.isArray(children) &&
  47820. typeof children[0] === 'function'
  47821. ) {
  47822. data = data || {};
  47823. data.scopedSlots = { default: children[0] };
  47824. children.length = 0;
  47825. }
  47826. if (normalizationType === ALWAYS_NORMALIZE) {
  47827. children = normalizeChildren(children);
  47828. } else if (normalizationType === SIMPLE_NORMALIZE) {
  47829. children = simpleNormalizeChildren(children);
  47830. }
  47831. var vnode, ns;
  47832. if (typeof tag === 'string') {
  47833. var Ctor;
  47834. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  47835. if (config.isReservedTag(tag)) {
  47836. // platform built-in elements
  47837. if (isDef(data) && isDef(data.nativeOn)) {
  47838. warn(
  47839. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  47840. context
  47841. );
  47842. }
  47843. vnode = new VNode(
  47844. config.parsePlatformTagName(tag), data, children,
  47845. undefined, undefined, context
  47846. );
  47847. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  47848. // component
  47849. vnode = createComponent(Ctor, data, context, children, tag);
  47850. } else {
  47851. // unknown or unlisted namespaced elements
  47852. // check at runtime because it may get assigned a namespace when its
  47853. // parent normalizes children
  47854. vnode = new VNode(
  47855. tag, data, children,
  47856. undefined, undefined, context
  47857. );
  47858. }
  47859. } else {
  47860. // direct component options / constructor
  47861. vnode = createComponent(tag, data, context, children);
  47862. }
  47863. if (Array.isArray(vnode)) {
  47864. return vnode
  47865. } else if (isDef(vnode)) {
  47866. if (isDef(ns)) { applyNS(vnode, ns); }
  47867. if (isDef(data)) { registerDeepBindings(data); }
  47868. return vnode
  47869. } else {
  47870. return createEmptyVNode()
  47871. }
  47872. }
  47873. function applyNS (vnode, ns, force) {
  47874. vnode.ns = ns;
  47875. if (vnode.tag === 'foreignObject') {
  47876. // use default namespace inside foreignObject
  47877. ns = undefined;
  47878. force = true;
  47879. }
  47880. if (isDef(vnode.children)) {
  47881. for (var i = 0, l = vnode.children.length; i < l; i++) {
  47882. var child = vnode.children[i];
  47883. if (isDef(child.tag) && (
  47884. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  47885. applyNS(child, ns, force);
  47886. }
  47887. }
  47888. }
  47889. }
  47890. // ref #5318
  47891. // necessary to ensure parent re-render when deep bindings like :style and
  47892. // :class are used on slot nodes
  47893. function registerDeepBindings (data) {
  47894. if (isObject(data.style)) {
  47895. traverse(data.style);
  47896. }
  47897. if (isObject(data.class)) {
  47898. traverse(data.class);
  47899. }
  47900. }
  47901. /* */
  47902. function initRender (vm) {
  47903. vm._vnode = null; // the root of the child tree
  47904. vm._staticTrees = null; // v-once cached trees
  47905. var options = vm.$options;
  47906. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  47907. var renderContext = parentVnode && parentVnode.context;
  47908. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  47909. vm.$scopedSlots = emptyObject;
  47910. // bind the createElement fn to this instance
  47911. // so that we get proper render context inside it.
  47912. // args order: tag, data, children, normalizationType, alwaysNormalize
  47913. // internal version is used by render functions compiled from templates
  47914. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  47915. // normalization is always applied for the public version, used in
  47916. // user-written render functions.
  47917. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  47918. // $attrs & $listeners are exposed for easier HOC creation.
  47919. // they need to be reactive so that HOCs using them are always updated
  47920. var parentData = parentVnode && parentVnode.data;
  47921. /* istanbul ignore else */
  47922. {
  47923. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  47924. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  47925. }, true);
  47926. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  47927. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  47928. }, true);
  47929. }
  47930. }
  47931. var currentRenderingInstance = null;
  47932. function renderMixin (Vue) {
  47933. // install runtime convenience helpers
  47934. installRenderHelpers(Vue.prototype);
  47935. Vue.prototype.$nextTick = function (fn) {
  47936. return nextTick(fn, this)
  47937. };
  47938. Vue.prototype._render = function () {
  47939. var vm = this;
  47940. var ref = vm.$options;
  47941. var render = ref.render;
  47942. var _parentVnode = ref._parentVnode;
  47943. if (_parentVnode) {
  47944. vm.$scopedSlots = normalizeScopedSlots(
  47945. _parentVnode.data.scopedSlots,
  47946. vm.$slots,
  47947. vm.$scopedSlots
  47948. );
  47949. }
  47950. // set parent vnode. this allows render functions to have access
  47951. // to the data on the placeholder node.
  47952. vm.$vnode = _parentVnode;
  47953. // render self
  47954. var vnode;
  47955. try {
  47956. // There's no need to maintain a stack because all render fns are called
  47957. // separately from one another. Nested component's render fns are called
  47958. // when parent component is patched.
  47959. currentRenderingInstance = vm;
  47960. vnode = render.call(vm._renderProxy, vm.$createElement);
  47961. } catch (e) {
  47962. handleError(e, vm, "render");
  47963. // return error render result,
  47964. // or previous vnode to prevent render error causing blank component
  47965. /* istanbul ignore else */
  47966. if (vm.$options.renderError) {
  47967. try {
  47968. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  47969. } catch (e) {
  47970. handleError(e, vm, "renderError");
  47971. vnode = vm._vnode;
  47972. }
  47973. } else {
  47974. vnode = vm._vnode;
  47975. }
  47976. } finally {
  47977. currentRenderingInstance = null;
  47978. }
  47979. // if the returned array contains only a single node, allow it
  47980. if (Array.isArray(vnode) && vnode.length === 1) {
  47981. vnode = vnode[0];
  47982. }
  47983. // return empty vnode in case the render function errored out
  47984. if (!(vnode instanceof VNode)) {
  47985. if (Array.isArray(vnode)) {
  47986. warn(
  47987. 'Multiple root nodes returned from render function. Render function ' +
  47988. 'should return a single root node.',
  47989. vm
  47990. );
  47991. }
  47992. vnode = createEmptyVNode();
  47993. }
  47994. // set parent
  47995. vnode.parent = _parentVnode;
  47996. return vnode
  47997. };
  47998. }
  47999. /* */
  48000. function ensureCtor (comp, base) {
  48001. if (
  48002. comp.__esModule ||
  48003. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  48004. ) {
  48005. comp = comp.default;
  48006. }
  48007. return isObject(comp)
  48008. ? base.extend(comp)
  48009. : comp
  48010. }
  48011. function createAsyncPlaceholder (
  48012. factory,
  48013. data,
  48014. context,
  48015. children,
  48016. tag
  48017. ) {
  48018. var node = createEmptyVNode();
  48019. node.asyncFactory = factory;
  48020. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  48021. return node
  48022. }
  48023. function resolveAsyncComponent (
  48024. factory,
  48025. baseCtor
  48026. ) {
  48027. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  48028. return factory.errorComp
  48029. }
  48030. if (isDef(factory.resolved)) {
  48031. return factory.resolved
  48032. }
  48033. var owner = currentRenderingInstance;
  48034. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  48035. // already pending
  48036. factory.owners.push(owner);
  48037. }
  48038. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  48039. return factory.loadingComp
  48040. }
  48041. if (owner && !isDef(factory.owners)) {
  48042. var owners = factory.owners = [owner];
  48043. var sync = true;
  48044. var timerLoading = null;
  48045. var timerTimeout = null
  48046. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  48047. var forceRender = function (renderCompleted) {
  48048. for (var i = 0, l = owners.length; i < l; i++) {
  48049. (owners[i]).$forceUpdate();
  48050. }
  48051. if (renderCompleted) {
  48052. owners.length = 0;
  48053. if (timerLoading !== null) {
  48054. clearTimeout(timerLoading);
  48055. timerLoading = null;
  48056. }
  48057. if (timerTimeout !== null) {
  48058. clearTimeout(timerTimeout);
  48059. timerTimeout = null;
  48060. }
  48061. }
  48062. };
  48063. var resolve = once(function (res) {
  48064. // cache resolved
  48065. factory.resolved = ensureCtor(res, baseCtor);
  48066. // invoke callbacks only if this is not a synchronous resolve
  48067. // (async resolves are shimmed as synchronous during SSR)
  48068. if (!sync) {
  48069. forceRender(true);
  48070. } else {
  48071. owners.length = 0;
  48072. }
  48073. });
  48074. var reject = once(function (reason) {
  48075. warn(
  48076. "Failed to resolve async component: " + (String(factory)) +
  48077. (reason ? ("\nReason: " + reason) : '')
  48078. );
  48079. if (isDef(factory.errorComp)) {
  48080. factory.error = true;
  48081. forceRender(true);
  48082. }
  48083. });
  48084. var res = factory(resolve, reject);
  48085. if (isObject(res)) {
  48086. if (isPromise(res)) {
  48087. // () => Promise
  48088. if (isUndef(factory.resolved)) {
  48089. res.then(resolve, reject);
  48090. }
  48091. } else if (isPromise(res.component)) {
  48092. res.component.then(resolve, reject);
  48093. if (isDef(res.error)) {
  48094. factory.errorComp = ensureCtor(res.error, baseCtor);
  48095. }
  48096. if (isDef(res.loading)) {
  48097. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  48098. if (res.delay === 0) {
  48099. factory.loading = true;
  48100. } else {
  48101. timerLoading = setTimeout(function () {
  48102. timerLoading = null;
  48103. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  48104. factory.loading = true;
  48105. forceRender(false);
  48106. }
  48107. }, res.delay || 200);
  48108. }
  48109. }
  48110. if (isDef(res.timeout)) {
  48111. timerTimeout = setTimeout(function () {
  48112. timerTimeout = null;
  48113. if (isUndef(factory.resolved)) {
  48114. reject(
  48115. "timeout (" + (res.timeout) + "ms)"
  48116. );
  48117. }
  48118. }, res.timeout);
  48119. }
  48120. }
  48121. }
  48122. sync = false;
  48123. // return in case resolved synchronously
  48124. return factory.loading
  48125. ? factory.loadingComp
  48126. : factory.resolved
  48127. }
  48128. }
  48129. /* */
  48130. function isAsyncPlaceholder (node) {
  48131. return node.isComment && node.asyncFactory
  48132. }
  48133. /* */
  48134. function getFirstComponentChild (children) {
  48135. if (Array.isArray(children)) {
  48136. for (var i = 0; i < children.length; i++) {
  48137. var c = children[i];
  48138. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  48139. return c
  48140. }
  48141. }
  48142. }
  48143. }
  48144. /* */
  48145. /* */
  48146. function initEvents (vm) {
  48147. vm._events = Object.create(null);
  48148. vm._hasHookEvent = false;
  48149. // init parent attached events
  48150. var listeners = vm.$options._parentListeners;
  48151. if (listeners) {
  48152. updateComponentListeners(vm, listeners);
  48153. }
  48154. }
  48155. var target;
  48156. function add (event, fn) {
  48157. target.$on(event, fn);
  48158. }
  48159. function remove$1 (event, fn) {
  48160. target.$off(event, fn);
  48161. }
  48162. function createOnceHandler (event, fn) {
  48163. var _target = target;
  48164. return function onceHandler () {
  48165. var res = fn.apply(null, arguments);
  48166. if (res !== null) {
  48167. _target.$off(event, onceHandler);
  48168. }
  48169. }
  48170. }
  48171. function updateComponentListeners (
  48172. vm,
  48173. listeners,
  48174. oldListeners
  48175. ) {
  48176. target = vm;
  48177. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  48178. target = undefined;
  48179. }
  48180. function eventsMixin (Vue) {
  48181. var hookRE = /^hook:/;
  48182. Vue.prototype.$on = function (event, fn) {
  48183. var vm = this;
  48184. if (Array.isArray(event)) {
  48185. for (var i = 0, l = event.length; i < l; i++) {
  48186. vm.$on(event[i], fn);
  48187. }
  48188. } else {
  48189. (vm._events[event] || (vm._events[event] = [])).push(fn);
  48190. // optimize hook:event cost by using a boolean flag marked at registration
  48191. // instead of a hash lookup
  48192. if (hookRE.test(event)) {
  48193. vm._hasHookEvent = true;
  48194. }
  48195. }
  48196. return vm
  48197. };
  48198. Vue.prototype.$once = function (event, fn) {
  48199. var vm = this;
  48200. function on () {
  48201. vm.$off(event, on);
  48202. fn.apply(vm, arguments);
  48203. }
  48204. on.fn = fn;
  48205. vm.$on(event, on);
  48206. return vm
  48207. };
  48208. Vue.prototype.$off = function (event, fn) {
  48209. var vm = this;
  48210. // all
  48211. if (!arguments.length) {
  48212. vm._events = Object.create(null);
  48213. return vm
  48214. }
  48215. // array of events
  48216. if (Array.isArray(event)) {
  48217. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  48218. vm.$off(event[i$1], fn);
  48219. }
  48220. return vm
  48221. }
  48222. // specific event
  48223. var cbs = vm._events[event];
  48224. if (!cbs) {
  48225. return vm
  48226. }
  48227. if (!fn) {
  48228. vm._events[event] = null;
  48229. return vm
  48230. }
  48231. // specific handler
  48232. var cb;
  48233. var i = cbs.length;
  48234. while (i--) {
  48235. cb = cbs[i];
  48236. if (cb === fn || cb.fn === fn) {
  48237. cbs.splice(i, 1);
  48238. break
  48239. }
  48240. }
  48241. return vm
  48242. };
  48243. Vue.prototype.$emit = function (event) {
  48244. var vm = this;
  48245. {
  48246. var lowerCaseEvent = event.toLowerCase();
  48247. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  48248. tip(
  48249. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  48250. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  48251. "Note that HTML attributes are case-insensitive and you cannot use " +
  48252. "v-on to listen to camelCase events when using in-DOM templates. " +
  48253. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  48254. );
  48255. }
  48256. }
  48257. var cbs = vm._events[event];
  48258. if (cbs) {
  48259. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  48260. var args = toArray(arguments, 1);
  48261. var info = "event handler for \"" + event + "\"";
  48262. for (var i = 0, l = cbs.length; i < l; i++) {
  48263. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  48264. }
  48265. }
  48266. return vm
  48267. };
  48268. }
  48269. /* */
  48270. var activeInstance = null;
  48271. var isUpdatingChildComponent = false;
  48272. function setActiveInstance(vm) {
  48273. var prevActiveInstance = activeInstance;
  48274. activeInstance = vm;
  48275. return function () {
  48276. activeInstance = prevActiveInstance;
  48277. }
  48278. }
  48279. function initLifecycle (vm) {
  48280. var options = vm.$options;
  48281. // locate first non-abstract parent
  48282. var parent = options.parent;
  48283. if (parent && !options.abstract) {
  48284. while (parent.$options.abstract && parent.$parent) {
  48285. parent = parent.$parent;
  48286. }
  48287. parent.$children.push(vm);
  48288. }
  48289. vm.$parent = parent;
  48290. vm.$root = parent ? parent.$root : vm;
  48291. vm.$children = [];
  48292. vm.$refs = {};
  48293. vm._watcher = null;
  48294. vm._inactive = null;
  48295. vm._directInactive = false;
  48296. vm._isMounted = false;
  48297. vm._isDestroyed = false;
  48298. vm._isBeingDestroyed = false;
  48299. }
  48300. function lifecycleMixin (Vue) {
  48301. Vue.prototype._update = function (vnode, hydrating) {
  48302. var vm = this;
  48303. var prevEl = vm.$el;
  48304. var prevVnode = vm._vnode;
  48305. var restoreActiveInstance = setActiveInstance(vm);
  48306. vm._vnode = vnode;
  48307. // Vue.prototype.__patch__ is injected in entry points
  48308. // based on the rendering backend used.
  48309. if (!prevVnode) {
  48310. // initial render
  48311. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  48312. } else {
  48313. // updates
  48314. vm.$el = vm.__patch__(prevVnode, vnode);
  48315. }
  48316. restoreActiveInstance();
  48317. // update __vue__ reference
  48318. if (prevEl) {
  48319. prevEl.__vue__ = null;
  48320. }
  48321. if (vm.$el) {
  48322. vm.$el.__vue__ = vm;
  48323. }
  48324. // if parent is an HOC, update its $el as well
  48325. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  48326. vm.$parent.$el = vm.$el;
  48327. }
  48328. // updated hook is called by the scheduler to ensure that children are
  48329. // updated in a parent's updated hook.
  48330. };
  48331. Vue.prototype.$forceUpdate = function () {
  48332. var vm = this;
  48333. if (vm._watcher) {
  48334. vm._watcher.update();
  48335. }
  48336. };
  48337. Vue.prototype.$destroy = function () {
  48338. var vm = this;
  48339. if (vm._isBeingDestroyed) {
  48340. return
  48341. }
  48342. callHook(vm, 'beforeDestroy');
  48343. vm._isBeingDestroyed = true;
  48344. // remove self from parent
  48345. var parent = vm.$parent;
  48346. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  48347. remove(parent.$children, vm);
  48348. }
  48349. // teardown watchers
  48350. if (vm._watcher) {
  48351. vm._watcher.teardown();
  48352. }
  48353. var i = vm._watchers.length;
  48354. while (i--) {
  48355. vm._watchers[i].teardown();
  48356. }
  48357. // remove reference from data ob
  48358. // frozen object may not have observer.
  48359. if (vm._data.__ob__) {
  48360. vm._data.__ob__.vmCount--;
  48361. }
  48362. // call the last hook...
  48363. vm._isDestroyed = true;
  48364. // invoke destroy hooks on current rendered tree
  48365. vm.__patch__(vm._vnode, null);
  48366. // fire destroyed hook
  48367. callHook(vm, 'destroyed');
  48368. // turn off all instance listeners.
  48369. vm.$off();
  48370. // remove __vue__ reference
  48371. if (vm.$el) {
  48372. vm.$el.__vue__ = null;
  48373. }
  48374. // release circular reference (#6759)
  48375. if (vm.$vnode) {
  48376. vm.$vnode.parent = null;
  48377. }
  48378. };
  48379. }
  48380. function mountComponent (
  48381. vm,
  48382. el,
  48383. hydrating
  48384. ) {
  48385. vm.$el = el;
  48386. if (!vm.$options.render) {
  48387. vm.$options.render = createEmptyVNode;
  48388. {
  48389. /* istanbul ignore if */
  48390. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  48391. vm.$options.el || el) {
  48392. warn(
  48393. 'You are using the runtime-only build of Vue where the template ' +
  48394. 'compiler is not available. Either pre-compile the templates into ' +
  48395. 'render functions, or use the compiler-included build.',
  48396. vm
  48397. );
  48398. } else {
  48399. warn(
  48400. 'Failed to mount component: template or render function not defined.',
  48401. vm
  48402. );
  48403. }
  48404. }
  48405. }
  48406. callHook(vm, 'beforeMount');
  48407. var updateComponent;
  48408. /* istanbul ignore if */
  48409. if (config.performance && mark) {
  48410. updateComponent = function () {
  48411. var name = vm._name;
  48412. var id = vm._uid;
  48413. var startTag = "vue-perf-start:" + id;
  48414. var endTag = "vue-perf-end:" + id;
  48415. mark(startTag);
  48416. var vnode = vm._render();
  48417. mark(endTag);
  48418. measure(("vue " + name + " render"), startTag, endTag);
  48419. mark(startTag);
  48420. vm._update(vnode, hydrating);
  48421. mark(endTag);
  48422. measure(("vue " + name + " patch"), startTag, endTag);
  48423. };
  48424. } else {
  48425. updateComponent = function () {
  48426. vm._update(vm._render(), hydrating);
  48427. };
  48428. }
  48429. // we set this to vm._watcher inside the watcher's constructor
  48430. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  48431. // component's mounted hook), which relies on vm._watcher being already defined
  48432. new Watcher(vm, updateComponent, noop, {
  48433. before: function before () {
  48434. if (vm._isMounted && !vm._isDestroyed) {
  48435. callHook(vm, 'beforeUpdate');
  48436. }
  48437. }
  48438. }, true /* isRenderWatcher */);
  48439. hydrating = false;
  48440. // manually mounted instance, call mounted on self
  48441. // mounted is called for render-created child components in its inserted hook
  48442. if (vm.$vnode == null) {
  48443. vm._isMounted = true;
  48444. callHook(vm, 'mounted');
  48445. }
  48446. return vm
  48447. }
  48448. function updateChildComponent (
  48449. vm,
  48450. propsData,
  48451. listeners,
  48452. parentVnode,
  48453. renderChildren
  48454. ) {
  48455. {
  48456. isUpdatingChildComponent = true;
  48457. }
  48458. // determine whether component has slot children
  48459. // we need to do this before overwriting $options._renderChildren.
  48460. // check if there are dynamic scopedSlots (hand-written or compiled but with
  48461. // dynamic slot names). Static scoped slots compiled from template has the
  48462. // "$stable" marker.
  48463. var newScopedSlots = parentVnode.data.scopedSlots;
  48464. var oldScopedSlots = vm.$scopedSlots;
  48465. var hasDynamicScopedSlot = !!(
  48466. (newScopedSlots && !newScopedSlots.$stable) ||
  48467. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  48468. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  48469. );
  48470. // Any static slot children from the parent may have changed during parent's
  48471. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  48472. // update is necessary to ensure correctness.
  48473. var needsForceUpdate = !!(
  48474. renderChildren || // has new static slots
  48475. vm.$options._renderChildren || // has old static slots
  48476. hasDynamicScopedSlot
  48477. );
  48478. vm.$options._parentVnode = parentVnode;
  48479. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  48480. if (vm._vnode) { // update child tree's parent
  48481. vm._vnode.parent = parentVnode;
  48482. }
  48483. vm.$options._renderChildren = renderChildren;
  48484. // update $attrs and $listeners hash
  48485. // these are also reactive so they may trigger child update if the child
  48486. // used them during render
  48487. vm.$attrs = parentVnode.data.attrs || emptyObject;
  48488. vm.$listeners = listeners || emptyObject;
  48489. // update props
  48490. if (propsData && vm.$options.props) {
  48491. toggleObserving(false);
  48492. var props = vm._props;
  48493. var propKeys = vm.$options._propKeys || [];
  48494. for (var i = 0; i < propKeys.length; i++) {
  48495. var key = propKeys[i];
  48496. var propOptions = vm.$options.props; // wtf flow?
  48497. props[key] = validateProp(key, propOptions, propsData, vm);
  48498. }
  48499. toggleObserving(true);
  48500. // keep a copy of raw propsData
  48501. vm.$options.propsData = propsData;
  48502. }
  48503. // update listeners
  48504. listeners = listeners || emptyObject;
  48505. var oldListeners = vm.$options._parentListeners;
  48506. vm.$options._parentListeners = listeners;
  48507. updateComponentListeners(vm, listeners, oldListeners);
  48508. // resolve slots + force update if has children
  48509. if (needsForceUpdate) {
  48510. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  48511. vm.$forceUpdate();
  48512. }
  48513. {
  48514. isUpdatingChildComponent = false;
  48515. }
  48516. }
  48517. function isInInactiveTree (vm) {
  48518. while (vm && (vm = vm.$parent)) {
  48519. if (vm._inactive) { return true }
  48520. }
  48521. return false
  48522. }
  48523. function activateChildComponent (vm, direct) {
  48524. if (direct) {
  48525. vm._directInactive = false;
  48526. if (isInInactiveTree(vm)) {
  48527. return
  48528. }
  48529. } else if (vm._directInactive) {
  48530. return
  48531. }
  48532. if (vm._inactive || vm._inactive === null) {
  48533. vm._inactive = false;
  48534. for (var i = 0; i < vm.$children.length; i++) {
  48535. activateChildComponent(vm.$children[i]);
  48536. }
  48537. callHook(vm, 'activated');
  48538. }
  48539. }
  48540. function deactivateChildComponent (vm, direct) {
  48541. if (direct) {
  48542. vm._directInactive = true;
  48543. if (isInInactiveTree(vm)) {
  48544. return
  48545. }
  48546. }
  48547. if (!vm._inactive) {
  48548. vm._inactive = true;
  48549. for (var i = 0; i < vm.$children.length; i++) {
  48550. deactivateChildComponent(vm.$children[i]);
  48551. }
  48552. callHook(vm, 'deactivated');
  48553. }
  48554. }
  48555. function callHook (vm, hook) {
  48556. // #7573 disable dep collection when invoking lifecycle hooks
  48557. pushTarget();
  48558. var handlers = vm.$options[hook];
  48559. var info = hook + " hook";
  48560. if (handlers) {
  48561. for (var i = 0, j = handlers.length; i < j; i++) {
  48562. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  48563. }
  48564. }
  48565. if (vm._hasHookEvent) {
  48566. vm.$emit('hook:' + hook);
  48567. }
  48568. popTarget();
  48569. }
  48570. /* */
  48571. var MAX_UPDATE_COUNT = 100;
  48572. var queue = [];
  48573. var activatedChildren = [];
  48574. var has = {};
  48575. var circular = {};
  48576. var waiting = false;
  48577. var flushing = false;
  48578. var index = 0;
  48579. /**
  48580. * Reset the scheduler's state.
  48581. */
  48582. function resetSchedulerState () {
  48583. index = queue.length = activatedChildren.length = 0;
  48584. has = {};
  48585. {
  48586. circular = {};
  48587. }
  48588. waiting = flushing = false;
  48589. }
  48590. // Async edge case #6566 requires saving the timestamp when event listeners are
  48591. // attached. However, calling performance.now() has a perf overhead especially
  48592. // if the page has thousands of event listeners. Instead, we take a timestamp
  48593. // every time the scheduler flushes and use that for all event listeners
  48594. // attached during that flush.
  48595. var currentFlushTimestamp = 0;
  48596. // Async edge case fix requires storing an event listener's attach timestamp.
  48597. var getNow = Date.now;
  48598. // Determine what event timestamp the browser is using. Annoyingly, the
  48599. // timestamp can either be hi-res (relative to page load) or low-res
  48600. // (relative to UNIX epoch), so in order to compare time we have to use the
  48601. // same timestamp type when saving the flush timestamp.
  48602. // All IE versions use low-res event timestamps, and have problematic clock
  48603. // implementations (#9632)
  48604. if (inBrowser && !isIE) {
  48605. var performance = window.performance;
  48606. if (
  48607. performance &&
  48608. typeof performance.now === 'function' &&
  48609. getNow() > document.createEvent('Event').timeStamp
  48610. ) {
  48611. // if the event timestamp, although evaluated AFTER the Date.now(), is
  48612. // smaller than it, it means the event is using a hi-res timestamp,
  48613. // and we need to use the hi-res version for event listener timestamps as
  48614. // well.
  48615. getNow = function () { return performance.now(); };
  48616. }
  48617. }
  48618. /**
  48619. * Flush both queues and run the watchers.
  48620. */
  48621. function flushSchedulerQueue () {
  48622. currentFlushTimestamp = getNow();
  48623. flushing = true;
  48624. var watcher, id;
  48625. // Sort queue before flush.
  48626. // This ensures that:
  48627. // 1. Components are updated from parent to child. (because parent is always
  48628. // created before the child)
  48629. // 2. A component's user watchers are run before its render watcher (because
  48630. // user watchers are created before the render watcher)
  48631. // 3. If a component is destroyed during a parent component's watcher run,
  48632. // its watchers can be skipped.
  48633. queue.sort(function (a, b) { return a.id - b.id; });
  48634. // do not cache length because more watchers might be pushed
  48635. // as we run existing watchers
  48636. for (index = 0; index < queue.length; index++) {
  48637. watcher = queue[index];
  48638. if (watcher.before) {
  48639. watcher.before();
  48640. }
  48641. id = watcher.id;
  48642. has[id] = null;
  48643. watcher.run();
  48644. // in dev build, check and stop circular updates.
  48645. if (has[id] != null) {
  48646. circular[id] = (circular[id] || 0) + 1;
  48647. if (circular[id] > MAX_UPDATE_COUNT) {
  48648. warn(
  48649. 'You may have an infinite update loop ' + (
  48650. watcher.user
  48651. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  48652. : "in a component render function."
  48653. ),
  48654. watcher.vm
  48655. );
  48656. break
  48657. }
  48658. }
  48659. }
  48660. // keep copies of post queues before resetting state
  48661. var activatedQueue = activatedChildren.slice();
  48662. var updatedQueue = queue.slice();
  48663. resetSchedulerState();
  48664. // call component updated and activated hooks
  48665. callActivatedHooks(activatedQueue);
  48666. callUpdatedHooks(updatedQueue);
  48667. // devtool hook
  48668. /* istanbul ignore if */
  48669. if (devtools && config.devtools) {
  48670. devtools.emit('flush');
  48671. }
  48672. }
  48673. function callUpdatedHooks (queue) {
  48674. var i = queue.length;
  48675. while (i--) {
  48676. var watcher = queue[i];
  48677. var vm = watcher.vm;
  48678. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  48679. callHook(vm, 'updated');
  48680. }
  48681. }
  48682. }
  48683. /**
  48684. * Queue a kept-alive component that was activated during patch.
  48685. * The queue will be processed after the entire tree has been patched.
  48686. */
  48687. function queueActivatedComponent (vm) {
  48688. // setting _inactive to false here so that a render function can
  48689. // rely on checking whether it's in an inactive tree (e.g. router-view)
  48690. vm._inactive = false;
  48691. activatedChildren.push(vm);
  48692. }
  48693. function callActivatedHooks (queue) {
  48694. for (var i = 0; i < queue.length; i++) {
  48695. queue[i]._inactive = true;
  48696. activateChildComponent(queue[i], true /* true */);
  48697. }
  48698. }
  48699. /**
  48700. * Push a watcher into the watcher queue.
  48701. * Jobs with duplicate IDs will be skipped unless it's
  48702. * pushed when the queue is being flushed.
  48703. */
  48704. function queueWatcher (watcher) {
  48705. var id = watcher.id;
  48706. if (has[id] == null) {
  48707. has[id] = true;
  48708. if (!flushing) {
  48709. queue.push(watcher);
  48710. } else {
  48711. // if already flushing, splice the watcher based on its id
  48712. // if already past its id, it will be run next immediately.
  48713. var i = queue.length - 1;
  48714. while (i > index && queue[i].id > watcher.id) {
  48715. i--;
  48716. }
  48717. queue.splice(i + 1, 0, watcher);
  48718. }
  48719. // queue the flush
  48720. if (!waiting) {
  48721. waiting = true;
  48722. if (!config.async) {
  48723. flushSchedulerQueue();
  48724. return
  48725. }
  48726. nextTick(flushSchedulerQueue);
  48727. }
  48728. }
  48729. }
  48730. /* */
  48731. var uid$2 = 0;
  48732. /**
  48733. * A watcher parses an expression, collects dependencies,
  48734. * and fires callback when the expression value changes.
  48735. * This is used for both the $watch() api and directives.
  48736. */
  48737. var Watcher = function Watcher (
  48738. vm,
  48739. expOrFn,
  48740. cb,
  48741. options,
  48742. isRenderWatcher
  48743. ) {
  48744. this.vm = vm;
  48745. if (isRenderWatcher) {
  48746. vm._watcher = this;
  48747. }
  48748. vm._watchers.push(this);
  48749. // options
  48750. if (options) {
  48751. this.deep = !!options.deep;
  48752. this.user = !!options.user;
  48753. this.lazy = !!options.lazy;
  48754. this.sync = !!options.sync;
  48755. this.before = options.before;
  48756. } else {
  48757. this.deep = this.user = this.lazy = this.sync = false;
  48758. }
  48759. this.cb = cb;
  48760. this.id = ++uid$2; // uid for batching
  48761. this.active = true;
  48762. this.dirty = this.lazy; // for lazy watchers
  48763. this.deps = [];
  48764. this.newDeps = [];
  48765. this.depIds = new _Set();
  48766. this.newDepIds = new _Set();
  48767. this.expression = expOrFn.toString();
  48768. // parse expression for getter
  48769. if (typeof expOrFn === 'function') {
  48770. this.getter = expOrFn;
  48771. } else {
  48772. this.getter = parsePath(expOrFn);
  48773. if (!this.getter) {
  48774. this.getter = noop;
  48775. warn(
  48776. "Failed watching path: \"" + expOrFn + "\" " +
  48777. 'Watcher only accepts simple dot-delimited paths. ' +
  48778. 'For full control, use a function instead.',
  48779. vm
  48780. );
  48781. }
  48782. }
  48783. this.value = this.lazy
  48784. ? undefined
  48785. : this.get();
  48786. };
  48787. /**
  48788. * Evaluate the getter, and re-collect dependencies.
  48789. */
  48790. Watcher.prototype.get = function get () {
  48791. pushTarget(this);
  48792. var value;
  48793. var vm = this.vm;
  48794. try {
  48795. value = this.getter.call(vm, vm);
  48796. } catch (e) {
  48797. if (this.user) {
  48798. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  48799. } else {
  48800. throw e
  48801. }
  48802. } finally {
  48803. // "touch" every property so they are all tracked as
  48804. // dependencies for deep watching
  48805. if (this.deep) {
  48806. traverse(value);
  48807. }
  48808. popTarget();
  48809. this.cleanupDeps();
  48810. }
  48811. return value
  48812. };
  48813. /**
  48814. * Add a dependency to this directive.
  48815. */
  48816. Watcher.prototype.addDep = function addDep (dep) {
  48817. var id = dep.id;
  48818. if (!this.newDepIds.has(id)) {
  48819. this.newDepIds.add(id);
  48820. this.newDeps.push(dep);
  48821. if (!this.depIds.has(id)) {
  48822. dep.addSub(this);
  48823. }
  48824. }
  48825. };
  48826. /**
  48827. * Clean up for dependency collection.
  48828. */
  48829. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  48830. var i = this.deps.length;
  48831. while (i--) {
  48832. var dep = this.deps[i];
  48833. if (!this.newDepIds.has(dep.id)) {
  48834. dep.removeSub(this);
  48835. }
  48836. }
  48837. var tmp = this.depIds;
  48838. this.depIds = this.newDepIds;
  48839. this.newDepIds = tmp;
  48840. this.newDepIds.clear();
  48841. tmp = this.deps;
  48842. this.deps = this.newDeps;
  48843. this.newDeps = tmp;
  48844. this.newDeps.length = 0;
  48845. };
  48846. /**
  48847. * Subscriber interface.
  48848. * Will be called when a dependency changes.
  48849. */
  48850. Watcher.prototype.update = function update () {
  48851. /* istanbul ignore else */
  48852. if (this.lazy) {
  48853. this.dirty = true;
  48854. } else if (this.sync) {
  48855. this.run();
  48856. } else {
  48857. queueWatcher(this);
  48858. }
  48859. };
  48860. /**
  48861. * Scheduler job interface.
  48862. * Will be called by the scheduler.
  48863. */
  48864. Watcher.prototype.run = function run () {
  48865. if (this.active) {
  48866. var value = this.get();
  48867. if (
  48868. value !== this.value ||
  48869. // Deep watchers and watchers on Object/Arrays should fire even
  48870. // when the value is the same, because the value may
  48871. // have mutated.
  48872. isObject(value) ||
  48873. this.deep
  48874. ) {
  48875. // set new value
  48876. var oldValue = this.value;
  48877. this.value = value;
  48878. if (this.user) {
  48879. try {
  48880. this.cb.call(this.vm, value, oldValue);
  48881. } catch (e) {
  48882. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  48883. }
  48884. } else {
  48885. this.cb.call(this.vm, value, oldValue);
  48886. }
  48887. }
  48888. }
  48889. };
  48890. /**
  48891. * Evaluate the value of the watcher.
  48892. * This only gets called for lazy watchers.
  48893. */
  48894. Watcher.prototype.evaluate = function evaluate () {
  48895. this.value = this.get();
  48896. this.dirty = false;
  48897. };
  48898. /**
  48899. * Depend on all deps collected by this watcher.
  48900. */
  48901. Watcher.prototype.depend = function depend () {
  48902. var i = this.deps.length;
  48903. while (i--) {
  48904. this.deps[i].depend();
  48905. }
  48906. };
  48907. /**
  48908. * Remove self from all dependencies' subscriber list.
  48909. */
  48910. Watcher.prototype.teardown = function teardown () {
  48911. if (this.active) {
  48912. // remove self from vm's watcher list
  48913. // this is a somewhat expensive operation so we skip it
  48914. // if the vm is being destroyed.
  48915. if (!this.vm._isBeingDestroyed) {
  48916. remove(this.vm._watchers, this);
  48917. }
  48918. var i = this.deps.length;
  48919. while (i--) {
  48920. this.deps[i].removeSub(this);
  48921. }
  48922. this.active = false;
  48923. }
  48924. };
  48925. /* */
  48926. var sharedPropertyDefinition = {
  48927. enumerable: true,
  48928. configurable: true,
  48929. get: noop,
  48930. set: noop
  48931. };
  48932. function proxy (target, sourceKey, key) {
  48933. sharedPropertyDefinition.get = function proxyGetter () {
  48934. return this[sourceKey][key]
  48935. };
  48936. sharedPropertyDefinition.set = function proxySetter (val) {
  48937. this[sourceKey][key] = val;
  48938. };
  48939. Object.defineProperty(target, key, sharedPropertyDefinition);
  48940. }
  48941. function initState (vm) {
  48942. vm._watchers = [];
  48943. var opts = vm.$options;
  48944. if (opts.props) { initProps(vm, opts.props); }
  48945. if (opts.methods) { initMethods(vm, opts.methods); }
  48946. if (opts.data) {
  48947. initData(vm);
  48948. } else {
  48949. observe(vm._data = {}, true /* asRootData */);
  48950. }
  48951. if (opts.computed) { initComputed(vm, opts.computed); }
  48952. if (opts.watch && opts.watch !== nativeWatch) {
  48953. initWatch(vm, opts.watch);
  48954. }
  48955. }
  48956. function initProps (vm, propsOptions) {
  48957. var propsData = vm.$options.propsData || {};
  48958. var props = vm._props = {};
  48959. // cache prop keys so that future props updates can iterate using Array
  48960. // instead of dynamic object key enumeration.
  48961. var keys = vm.$options._propKeys = [];
  48962. var isRoot = !vm.$parent;
  48963. // root instance props should be converted
  48964. if (!isRoot) {
  48965. toggleObserving(false);
  48966. }
  48967. var loop = function ( key ) {
  48968. keys.push(key);
  48969. var value = validateProp(key, propsOptions, propsData, vm);
  48970. /* istanbul ignore else */
  48971. {
  48972. var hyphenatedKey = hyphenate(key);
  48973. if (isReservedAttribute(hyphenatedKey) ||
  48974. config.isReservedAttr(hyphenatedKey)) {
  48975. warn(
  48976. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  48977. vm
  48978. );
  48979. }
  48980. defineReactive$$1(props, key, value, function () {
  48981. if (!isRoot && !isUpdatingChildComponent) {
  48982. warn(
  48983. "Avoid mutating a prop directly since the value will be " +
  48984. "overwritten whenever the parent component re-renders. " +
  48985. "Instead, use a data or computed property based on the prop's " +
  48986. "value. Prop being mutated: \"" + key + "\"",
  48987. vm
  48988. );
  48989. }
  48990. });
  48991. }
  48992. // static props are already proxied on the component's prototype
  48993. // during Vue.extend(). We only need to proxy props defined at
  48994. // instantiation here.
  48995. if (!(key in vm)) {
  48996. proxy(vm, "_props", key);
  48997. }
  48998. };
  48999. for (var key in propsOptions) loop( key );
  49000. toggleObserving(true);
  49001. }
  49002. function initData (vm) {
  49003. var data = vm.$options.data;
  49004. data = vm._data = typeof data === 'function'
  49005. ? getData(data, vm)
  49006. : data || {};
  49007. if (!isPlainObject(data)) {
  49008. data = {};
  49009. warn(
  49010. 'data functions should return an object:\n' +
  49011. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  49012. vm
  49013. );
  49014. }
  49015. // proxy data on instance
  49016. var keys = Object.keys(data);
  49017. var props = vm.$options.props;
  49018. var methods = vm.$options.methods;
  49019. var i = keys.length;
  49020. while (i--) {
  49021. var key = keys[i];
  49022. {
  49023. if (methods && hasOwn(methods, key)) {
  49024. warn(
  49025. ("Method \"" + key + "\" has already been defined as a data property."),
  49026. vm
  49027. );
  49028. }
  49029. }
  49030. if (props && hasOwn(props, key)) {
  49031. warn(
  49032. "The data property \"" + key + "\" is already declared as a prop. " +
  49033. "Use prop default value instead.",
  49034. vm
  49035. );
  49036. } else if (!isReserved(key)) {
  49037. proxy(vm, "_data", key);
  49038. }
  49039. }
  49040. // observe data
  49041. observe(data, true /* asRootData */);
  49042. }
  49043. function getData (data, vm) {
  49044. // #7573 disable dep collection when invoking data getters
  49045. pushTarget();
  49046. try {
  49047. return data.call(vm, vm)
  49048. } catch (e) {
  49049. handleError(e, vm, "data()");
  49050. return {}
  49051. } finally {
  49052. popTarget();
  49053. }
  49054. }
  49055. var computedWatcherOptions = { lazy: true };
  49056. function initComputed (vm, computed) {
  49057. // $flow-disable-line
  49058. var watchers = vm._computedWatchers = Object.create(null);
  49059. // computed properties are just getters during SSR
  49060. var isSSR = isServerRendering();
  49061. for (var key in computed) {
  49062. var userDef = computed[key];
  49063. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  49064. if (getter == null) {
  49065. warn(
  49066. ("Getter is missing for computed property \"" + key + "\"."),
  49067. vm
  49068. );
  49069. }
  49070. if (!isSSR) {
  49071. // create internal watcher for the computed property.
  49072. watchers[key] = new Watcher(
  49073. vm,
  49074. getter || noop,
  49075. noop,
  49076. computedWatcherOptions
  49077. );
  49078. }
  49079. // component-defined computed properties are already defined on the
  49080. // component prototype. We only need to define computed properties defined
  49081. // at instantiation here.
  49082. if (!(key in vm)) {
  49083. defineComputed(vm, key, userDef);
  49084. } else {
  49085. if (key in vm.$data) {
  49086. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  49087. } else if (vm.$options.props && key in vm.$options.props) {
  49088. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  49089. }
  49090. }
  49091. }
  49092. }
  49093. function defineComputed (
  49094. target,
  49095. key,
  49096. userDef
  49097. ) {
  49098. var shouldCache = !isServerRendering();
  49099. if (typeof userDef === 'function') {
  49100. sharedPropertyDefinition.get = shouldCache
  49101. ? createComputedGetter(key)
  49102. : createGetterInvoker(userDef);
  49103. sharedPropertyDefinition.set = noop;
  49104. } else {
  49105. sharedPropertyDefinition.get = userDef.get
  49106. ? shouldCache && userDef.cache !== false
  49107. ? createComputedGetter(key)
  49108. : createGetterInvoker(userDef.get)
  49109. : noop;
  49110. sharedPropertyDefinition.set = userDef.set || noop;
  49111. }
  49112. if (sharedPropertyDefinition.set === noop) {
  49113. sharedPropertyDefinition.set = function () {
  49114. warn(
  49115. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  49116. this
  49117. );
  49118. };
  49119. }
  49120. Object.defineProperty(target, key, sharedPropertyDefinition);
  49121. }
  49122. function createComputedGetter (key) {
  49123. return function computedGetter () {
  49124. var watcher = this._computedWatchers && this._computedWatchers[key];
  49125. if (watcher) {
  49126. if (watcher.dirty) {
  49127. watcher.evaluate();
  49128. }
  49129. if (Dep.target) {
  49130. watcher.depend();
  49131. }
  49132. return watcher.value
  49133. }
  49134. }
  49135. }
  49136. function createGetterInvoker(fn) {
  49137. return function computedGetter () {
  49138. return fn.call(this, this)
  49139. }
  49140. }
  49141. function initMethods (vm, methods) {
  49142. var props = vm.$options.props;
  49143. for (var key in methods) {
  49144. {
  49145. if (typeof methods[key] !== 'function') {
  49146. warn(
  49147. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  49148. "Did you reference the function correctly?",
  49149. vm
  49150. );
  49151. }
  49152. if (props && hasOwn(props, key)) {
  49153. warn(
  49154. ("Method \"" + key + "\" has already been defined as a prop."),
  49155. vm
  49156. );
  49157. }
  49158. if ((key in vm) && isReserved(key)) {
  49159. warn(
  49160. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  49161. "Avoid defining component methods that start with _ or $."
  49162. );
  49163. }
  49164. }
  49165. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  49166. }
  49167. }
  49168. function initWatch (vm, watch) {
  49169. for (var key in watch) {
  49170. var handler = watch[key];
  49171. if (Array.isArray(handler)) {
  49172. for (var i = 0; i < handler.length; i++) {
  49173. createWatcher(vm, key, handler[i]);
  49174. }
  49175. } else {
  49176. createWatcher(vm, key, handler);
  49177. }
  49178. }
  49179. }
  49180. function createWatcher (
  49181. vm,
  49182. expOrFn,
  49183. handler,
  49184. options
  49185. ) {
  49186. if (isPlainObject(handler)) {
  49187. options = handler;
  49188. handler = handler.handler;
  49189. }
  49190. if (typeof handler === 'string') {
  49191. handler = vm[handler];
  49192. }
  49193. return vm.$watch(expOrFn, handler, options)
  49194. }
  49195. function stateMixin (Vue) {
  49196. // flow somehow has problems with directly declared definition object
  49197. // when using Object.defineProperty, so we have to procedurally build up
  49198. // the object here.
  49199. var dataDef = {};
  49200. dataDef.get = function () { return this._data };
  49201. var propsDef = {};
  49202. propsDef.get = function () { return this._props };
  49203. {
  49204. dataDef.set = function () {
  49205. warn(
  49206. 'Avoid replacing instance root $data. ' +
  49207. 'Use nested data properties instead.',
  49208. this
  49209. );
  49210. };
  49211. propsDef.set = function () {
  49212. warn("$props is readonly.", this);
  49213. };
  49214. }
  49215. Object.defineProperty(Vue.prototype, '$data', dataDef);
  49216. Object.defineProperty(Vue.prototype, '$props', propsDef);
  49217. Vue.prototype.$set = set;
  49218. Vue.prototype.$delete = del;
  49219. Vue.prototype.$watch = function (
  49220. expOrFn,
  49221. cb,
  49222. options
  49223. ) {
  49224. var vm = this;
  49225. if (isPlainObject(cb)) {
  49226. return createWatcher(vm, expOrFn, cb, options)
  49227. }
  49228. options = options || {};
  49229. options.user = true;
  49230. var watcher = new Watcher(vm, expOrFn, cb, options);
  49231. if (options.immediate) {
  49232. try {
  49233. cb.call(vm, watcher.value);
  49234. } catch (error) {
  49235. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  49236. }
  49237. }
  49238. return function unwatchFn () {
  49239. watcher.teardown();
  49240. }
  49241. };
  49242. }
  49243. /* */
  49244. var uid$3 = 0;
  49245. function initMixin (Vue) {
  49246. Vue.prototype._init = function (options) {
  49247. var vm = this;
  49248. // a uid
  49249. vm._uid = uid$3++;
  49250. var startTag, endTag;
  49251. /* istanbul ignore if */
  49252. if (config.performance && mark) {
  49253. startTag = "vue-perf-start:" + (vm._uid);
  49254. endTag = "vue-perf-end:" + (vm._uid);
  49255. mark(startTag);
  49256. }
  49257. // a flag to avoid this being observed
  49258. vm._isVue = true;
  49259. // merge options
  49260. if (options && options._isComponent) {
  49261. // optimize internal component instantiation
  49262. // since dynamic options merging is pretty slow, and none of the
  49263. // internal component options needs special treatment.
  49264. initInternalComponent(vm, options);
  49265. } else {
  49266. vm.$options = mergeOptions(
  49267. resolveConstructorOptions(vm.constructor),
  49268. options || {},
  49269. vm
  49270. );
  49271. }
  49272. /* istanbul ignore else */
  49273. {
  49274. initProxy(vm);
  49275. }
  49276. // expose real self
  49277. vm._self = vm;
  49278. initLifecycle(vm);
  49279. initEvents(vm);
  49280. initRender(vm);
  49281. callHook(vm, 'beforeCreate');
  49282. initInjections(vm); // resolve injections before data/props
  49283. initState(vm);
  49284. initProvide(vm); // resolve provide after data/props
  49285. callHook(vm, 'created');
  49286. /* istanbul ignore if */
  49287. if (config.performance && mark) {
  49288. vm._name = formatComponentName(vm, false);
  49289. mark(endTag);
  49290. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  49291. }
  49292. if (vm.$options.el) {
  49293. vm.$mount(vm.$options.el);
  49294. }
  49295. };
  49296. }
  49297. function initInternalComponent (vm, options) {
  49298. var opts = vm.$options = Object.create(vm.constructor.options);
  49299. // doing this because it's faster than dynamic enumeration.
  49300. var parentVnode = options._parentVnode;
  49301. opts.parent = options.parent;
  49302. opts._parentVnode = parentVnode;
  49303. var vnodeComponentOptions = parentVnode.componentOptions;
  49304. opts.propsData = vnodeComponentOptions.propsData;
  49305. opts._parentListeners = vnodeComponentOptions.listeners;
  49306. opts._renderChildren = vnodeComponentOptions.children;
  49307. opts._componentTag = vnodeComponentOptions.tag;
  49308. if (options.render) {
  49309. opts.render = options.render;
  49310. opts.staticRenderFns = options.staticRenderFns;
  49311. }
  49312. }
  49313. function resolveConstructorOptions (Ctor) {
  49314. var options = Ctor.options;
  49315. if (Ctor.super) {
  49316. var superOptions = resolveConstructorOptions(Ctor.super);
  49317. var cachedSuperOptions = Ctor.superOptions;
  49318. if (superOptions !== cachedSuperOptions) {
  49319. // super option changed,
  49320. // need to resolve new options.
  49321. Ctor.superOptions = superOptions;
  49322. // check if there are any late-modified/attached options (#4976)
  49323. var modifiedOptions = resolveModifiedOptions(Ctor);
  49324. // update base extend options
  49325. if (modifiedOptions) {
  49326. extend(Ctor.extendOptions, modifiedOptions);
  49327. }
  49328. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  49329. if (options.name) {
  49330. options.components[options.name] = Ctor;
  49331. }
  49332. }
  49333. }
  49334. return options
  49335. }
  49336. function resolveModifiedOptions (Ctor) {
  49337. var modified;
  49338. var latest = Ctor.options;
  49339. var sealed = Ctor.sealedOptions;
  49340. for (var key in latest) {
  49341. if (latest[key] !== sealed[key]) {
  49342. if (!modified) { modified = {}; }
  49343. modified[key] = latest[key];
  49344. }
  49345. }
  49346. return modified
  49347. }
  49348. function Vue (options) {
  49349. if (!(this instanceof Vue)
  49350. ) {
  49351. warn('Vue is a constructor and should be called with the `new` keyword');
  49352. }
  49353. this._init(options);
  49354. }
  49355. initMixin(Vue);
  49356. stateMixin(Vue);
  49357. eventsMixin(Vue);
  49358. lifecycleMixin(Vue);
  49359. renderMixin(Vue);
  49360. /* */
  49361. function initUse (Vue) {
  49362. Vue.use = function (plugin) {
  49363. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  49364. if (installedPlugins.indexOf(plugin) > -1) {
  49365. return this
  49366. }
  49367. // additional parameters
  49368. var args = toArray(arguments, 1);
  49369. args.unshift(this);
  49370. if (typeof plugin.install === 'function') {
  49371. plugin.install.apply(plugin, args);
  49372. } else if (typeof plugin === 'function') {
  49373. plugin.apply(null, args);
  49374. }
  49375. installedPlugins.push(plugin);
  49376. return this
  49377. };
  49378. }
  49379. /* */
  49380. function initMixin$1 (Vue) {
  49381. Vue.mixin = function (mixin) {
  49382. this.options = mergeOptions(this.options, mixin);
  49383. return this
  49384. };
  49385. }
  49386. /* */
  49387. function initExtend (Vue) {
  49388. /**
  49389. * Each instance constructor, including Vue, has a unique
  49390. * cid. This enables us to create wrapped "child
  49391. * constructors" for prototypal inheritance and cache them.
  49392. */
  49393. Vue.cid = 0;
  49394. var cid = 1;
  49395. /**
  49396. * Class inheritance
  49397. */
  49398. Vue.extend = function (extendOptions) {
  49399. extendOptions = extendOptions || {};
  49400. var Super = this;
  49401. var SuperId = Super.cid;
  49402. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  49403. if (cachedCtors[SuperId]) {
  49404. return cachedCtors[SuperId]
  49405. }
  49406. var name = extendOptions.name || Super.options.name;
  49407. if (name) {
  49408. validateComponentName(name);
  49409. }
  49410. var Sub = function VueComponent (options) {
  49411. this._init(options);
  49412. };
  49413. Sub.prototype = Object.create(Super.prototype);
  49414. Sub.prototype.constructor = Sub;
  49415. Sub.cid = cid++;
  49416. Sub.options = mergeOptions(
  49417. Super.options,
  49418. extendOptions
  49419. );
  49420. Sub['super'] = Super;
  49421. // For props and computed properties, we define the proxy getters on
  49422. // the Vue instances at extension time, on the extended prototype. This
  49423. // avoids Object.defineProperty calls for each instance created.
  49424. if (Sub.options.props) {
  49425. initProps$1(Sub);
  49426. }
  49427. if (Sub.options.computed) {
  49428. initComputed$1(Sub);
  49429. }
  49430. // allow further extension/mixin/plugin usage
  49431. Sub.extend = Super.extend;
  49432. Sub.mixin = Super.mixin;
  49433. Sub.use = Super.use;
  49434. // create asset registers, so extended classes
  49435. // can have their private assets too.
  49436. ASSET_TYPES.forEach(function (type) {
  49437. Sub[type] = Super[type];
  49438. });
  49439. // enable recursive self-lookup
  49440. if (name) {
  49441. Sub.options.components[name] = Sub;
  49442. }
  49443. // keep a reference to the super options at extension time.
  49444. // later at instantiation we can check if Super's options have
  49445. // been updated.
  49446. Sub.superOptions = Super.options;
  49447. Sub.extendOptions = extendOptions;
  49448. Sub.sealedOptions = extend({}, Sub.options);
  49449. // cache constructor
  49450. cachedCtors[SuperId] = Sub;
  49451. return Sub
  49452. };
  49453. }
  49454. function initProps$1 (Comp) {
  49455. var props = Comp.options.props;
  49456. for (var key in props) {
  49457. proxy(Comp.prototype, "_props", key);
  49458. }
  49459. }
  49460. function initComputed$1 (Comp) {
  49461. var computed = Comp.options.computed;
  49462. for (var key in computed) {
  49463. defineComputed(Comp.prototype, key, computed[key]);
  49464. }
  49465. }
  49466. /* */
  49467. function initAssetRegisters (Vue) {
  49468. /**
  49469. * Create asset registration methods.
  49470. */
  49471. ASSET_TYPES.forEach(function (type) {
  49472. Vue[type] = function (
  49473. id,
  49474. definition
  49475. ) {
  49476. if (!definition) {
  49477. return this.options[type + 's'][id]
  49478. } else {
  49479. /* istanbul ignore if */
  49480. if (type === 'component') {
  49481. validateComponentName(id);
  49482. }
  49483. if (type === 'component' && isPlainObject(definition)) {
  49484. definition.name = definition.name || id;
  49485. definition = this.options._base.extend(definition);
  49486. }
  49487. if (type === 'directive' && typeof definition === 'function') {
  49488. definition = { bind: definition, update: definition };
  49489. }
  49490. this.options[type + 's'][id] = definition;
  49491. return definition
  49492. }
  49493. };
  49494. });
  49495. }
  49496. /* */
  49497. function getComponentName (opts) {
  49498. return opts && (opts.Ctor.options.name || opts.tag)
  49499. }
  49500. function matches (pattern, name) {
  49501. if (Array.isArray(pattern)) {
  49502. return pattern.indexOf(name) > -1
  49503. } else if (typeof pattern === 'string') {
  49504. return pattern.split(',').indexOf(name) > -1
  49505. } else if (isRegExp(pattern)) {
  49506. return pattern.test(name)
  49507. }
  49508. /* istanbul ignore next */
  49509. return false
  49510. }
  49511. function pruneCache (keepAliveInstance, filter) {
  49512. var cache = keepAliveInstance.cache;
  49513. var keys = keepAliveInstance.keys;
  49514. var _vnode = keepAliveInstance._vnode;
  49515. for (var key in cache) {
  49516. var cachedNode = cache[key];
  49517. if (cachedNode) {
  49518. var name = getComponentName(cachedNode.componentOptions);
  49519. if (name && !filter(name)) {
  49520. pruneCacheEntry(cache, key, keys, _vnode);
  49521. }
  49522. }
  49523. }
  49524. }
  49525. function pruneCacheEntry (
  49526. cache,
  49527. key,
  49528. keys,
  49529. current
  49530. ) {
  49531. var cached$$1 = cache[key];
  49532. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  49533. cached$$1.componentInstance.$destroy();
  49534. }
  49535. cache[key] = null;
  49536. remove(keys, key);
  49537. }
  49538. var patternTypes = [String, RegExp, Array];
  49539. var KeepAlive = {
  49540. name: 'keep-alive',
  49541. abstract: true,
  49542. props: {
  49543. include: patternTypes,
  49544. exclude: patternTypes,
  49545. max: [String, Number]
  49546. },
  49547. created: function created () {
  49548. this.cache = Object.create(null);
  49549. this.keys = [];
  49550. },
  49551. destroyed: function destroyed () {
  49552. for (var key in this.cache) {
  49553. pruneCacheEntry(this.cache, key, this.keys);
  49554. }
  49555. },
  49556. mounted: function mounted () {
  49557. var this$1 = this;
  49558. this.$watch('include', function (val) {
  49559. pruneCache(this$1, function (name) { return matches(val, name); });
  49560. });
  49561. this.$watch('exclude', function (val) {
  49562. pruneCache(this$1, function (name) { return !matches(val, name); });
  49563. });
  49564. },
  49565. render: function render () {
  49566. var slot = this.$slots.default;
  49567. var vnode = getFirstComponentChild(slot);
  49568. var componentOptions = vnode && vnode.componentOptions;
  49569. if (componentOptions) {
  49570. // check pattern
  49571. var name = getComponentName(componentOptions);
  49572. var ref = this;
  49573. var include = ref.include;
  49574. var exclude = ref.exclude;
  49575. if (
  49576. // not included
  49577. (include && (!name || !matches(include, name))) ||
  49578. // excluded
  49579. (exclude && name && matches(exclude, name))
  49580. ) {
  49581. return vnode
  49582. }
  49583. var ref$1 = this;
  49584. var cache = ref$1.cache;
  49585. var keys = ref$1.keys;
  49586. var key = vnode.key == null
  49587. // same constructor may get registered as different local components
  49588. // so cid alone is not enough (#3269)
  49589. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  49590. : vnode.key;
  49591. if (cache[key]) {
  49592. vnode.componentInstance = cache[key].componentInstance;
  49593. // make current key freshest
  49594. remove(keys, key);
  49595. keys.push(key);
  49596. } else {
  49597. cache[key] = vnode;
  49598. keys.push(key);
  49599. // prune oldest entry
  49600. if (this.max && keys.length > parseInt(this.max)) {
  49601. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  49602. }
  49603. }
  49604. vnode.data.keepAlive = true;
  49605. }
  49606. return vnode || (slot && slot[0])
  49607. }
  49608. };
  49609. var builtInComponents = {
  49610. KeepAlive: KeepAlive
  49611. };
  49612. /* */
  49613. function initGlobalAPI (Vue) {
  49614. // config
  49615. var configDef = {};
  49616. configDef.get = function () { return config; };
  49617. {
  49618. configDef.set = function () {
  49619. warn(
  49620. 'Do not replace the Vue.config object, set individual fields instead.'
  49621. );
  49622. };
  49623. }
  49624. Object.defineProperty(Vue, 'config', configDef);
  49625. // exposed util methods.
  49626. // NOTE: these are not considered part of the public API - avoid relying on
  49627. // them unless you are aware of the risk.
  49628. Vue.util = {
  49629. warn: warn,
  49630. extend: extend,
  49631. mergeOptions: mergeOptions,
  49632. defineReactive: defineReactive$$1
  49633. };
  49634. Vue.set = set;
  49635. Vue.delete = del;
  49636. Vue.nextTick = nextTick;
  49637. // 2.6 explicit observable API
  49638. Vue.observable = function (obj) {
  49639. observe(obj);
  49640. return obj
  49641. };
  49642. Vue.options = Object.create(null);
  49643. ASSET_TYPES.forEach(function (type) {
  49644. Vue.options[type + 's'] = Object.create(null);
  49645. });
  49646. // this is used to identify the "base" constructor to extend all plain-object
  49647. // components with in Weex's multi-instance scenarios.
  49648. Vue.options._base = Vue;
  49649. extend(Vue.options.components, builtInComponents);
  49650. initUse(Vue);
  49651. initMixin$1(Vue);
  49652. initExtend(Vue);
  49653. initAssetRegisters(Vue);
  49654. }
  49655. initGlobalAPI(Vue);
  49656. Object.defineProperty(Vue.prototype, '$isServer', {
  49657. get: isServerRendering
  49658. });
  49659. Object.defineProperty(Vue.prototype, '$ssrContext', {
  49660. get: function get () {
  49661. /* istanbul ignore next */
  49662. return this.$vnode && this.$vnode.ssrContext
  49663. }
  49664. });
  49665. // expose FunctionalRenderContext for ssr runtime helper installation
  49666. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  49667. value: FunctionalRenderContext
  49668. });
  49669. Vue.version = '2.6.11';
  49670. /* */
  49671. // these are reserved for web because they are directly compiled away
  49672. // during template compilation
  49673. var isReservedAttr = makeMap('style,class');
  49674. // attributes that should be using props for binding
  49675. var acceptValue = makeMap('input,textarea,option,select,progress');
  49676. var mustUseProp = function (tag, type, attr) {
  49677. return (
  49678. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  49679. (attr === 'selected' && tag === 'option') ||
  49680. (attr === 'checked' && tag === 'input') ||
  49681. (attr === 'muted' && tag === 'video')
  49682. )
  49683. };
  49684. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  49685. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  49686. var convertEnumeratedValue = function (key, value) {
  49687. return isFalsyAttrValue(value) || value === 'false'
  49688. ? 'false'
  49689. // allow arbitrary string value for contenteditable
  49690. : key === 'contenteditable' && isValidContentEditableValue(value)
  49691. ? value
  49692. : 'true'
  49693. };
  49694. var isBooleanAttr = makeMap(
  49695. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  49696. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  49697. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  49698. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  49699. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  49700. 'truespeed,typemustmatch,visible'
  49701. );
  49702. var xlinkNS = 'http://www.w3.org/1999/xlink';
  49703. var isXlink = function (name) {
  49704. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  49705. };
  49706. var getXlinkProp = function (name) {
  49707. return isXlink(name) ? name.slice(6, name.length) : ''
  49708. };
  49709. var isFalsyAttrValue = function (val) {
  49710. return val == null || val === false
  49711. };
  49712. /* */
  49713. function genClassForVnode (vnode) {
  49714. var data = vnode.data;
  49715. var parentNode = vnode;
  49716. var childNode = vnode;
  49717. while (isDef(childNode.componentInstance)) {
  49718. childNode = childNode.componentInstance._vnode;
  49719. if (childNode && childNode.data) {
  49720. data = mergeClassData(childNode.data, data);
  49721. }
  49722. }
  49723. while (isDef(parentNode = parentNode.parent)) {
  49724. if (parentNode && parentNode.data) {
  49725. data = mergeClassData(data, parentNode.data);
  49726. }
  49727. }
  49728. return renderClass(data.staticClass, data.class)
  49729. }
  49730. function mergeClassData (child, parent) {
  49731. return {
  49732. staticClass: concat(child.staticClass, parent.staticClass),
  49733. class: isDef(child.class)
  49734. ? [child.class, parent.class]
  49735. : parent.class
  49736. }
  49737. }
  49738. function renderClass (
  49739. staticClass,
  49740. dynamicClass
  49741. ) {
  49742. if (isDef(staticClass) || isDef(dynamicClass)) {
  49743. return concat(staticClass, stringifyClass(dynamicClass))
  49744. }
  49745. /* istanbul ignore next */
  49746. return ''
  49747. }
  49748. function concat (a, b) {
  49749. return a ? b ? (a + ' ' + b) : a : (b || '')
  49750. }
  49751. function stringifyClass (value) {
  49752. if (Array.isArray(value)) {
  49753. return stringifyArray(value)
  49754. }
  49755. if (isObject(value)) {
  49756. return stringifyObject(value)
  49757. }
  49758. if (typeof value === 'string') {
  49759. return value
  49760. }
  49761. /* istanbul ignore next */
  49762. return ''
  49763. }
  49764. function stringifyArray (value) {
  49765. var res = '';
  49766. var stringified;
  49767. for (var i = 0, l = value.length; i < l; i++) {
  49768. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  49769. if (res) { res += ' '; }
  49770. res += stringified;
  49771. }
  49772. }
  49773. return res
  49774. }
  49775. function stringifyObject (value) {
  49776. var res = '';
  49777. for (var key in value) {
  49778. if (value[key]) {
  49779. if (res) { res += ' '; }
  49780. res += key;
  49781. }
  49782. }
  49783. return res
  49784. }
  49785. /* */
  49786. var namespaceMap = {
  49787. svg: 'http://www.w3.org/2000/svg',
  49788. math: 'http://www.w3.org/1998/Math/MathML'
  49789. };
  49790. var isHTMLTag = makeMap(
  49791. 'html,body,base,head,link,meta,style,title,' +
  49792. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  49793. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  49794. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  49795. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  49796. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  49797. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  49798. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  49799. 'output,progress,select,textarea,' +
  49800. 'details,dialog,menu,menuitem,summary,' +
  49801. 'content,element,shadow,template,blockquote,iframe,tfoot'
  49802. );
  49803. // this map is intentionally selective, only covering SVG elements that may
  49804. // contain child elements.
  49805. var isSVG = makeMap(
  49806. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  49807. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  49808. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  49809. true
  49810. );
  49811. var isPreTag = function (tag) { return tag === 'pre'; };
  49812. var isReservedTag = function (tag) {
  49813. return isHTMLTag(tag) || isSVG(tag)
  49814. };
  49815. function getTagNamespace (tag) {
  49816. if (isSVG(tag)) {
  49817. return 'svg'
  49818. }
  49819. // basic support for MathML
  49820. // note it doesn't support other MathML elements being component roots
  49821. if (tag === 'math') {
  49822. return 'math'
  49823. }
  49824. }
  49825. var unknownElementCache = Object.create(null);
  49826. function isUnknownElement (tag) {
  49827. /* istanbul ignore if */
  49828. if (!inBrowser) {
  49829. return true
  49830. }
  49831. if (isReservedTag(tag)) {
  49832. return false
  49833. }
  49834. tag = tag.toLowerCase();
  49835. /* istanbul ignore if */
  49836. if (unknownElementCache[tag] != null) {
  49837. return unknownElementCache[tag]
  49838. }
  49839. var el = document.createElement(tag);
  49840. if (tag.indexOf('-') > -1) {
  49841. // http://stackoverflow.com/a/28210364/1070244
  49842. return (unknownElementCache[tag] = (
  49843. el.constructor === window.HTMLUnknownElement ||
  49844. el.constructor === window.HTMLElement
  49845. ))
  49846. } else {
  49847. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  49848. }
  49849. }
  49850. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  49851. /* */
  49852. /**
  49853. * Query an element selector if it's not an element already.
  49854. */
  49855. function query (el) {
  49856. if (typeof el === 'string') {
  49857. var selected = document.querySelector(el);
  49858. if (!selected) {
  49859. warn(
  49860. 'Cannot find element: ' + el
  49861. );
  49862. return document.createElement('div')
  49863. }
  49864. return selected
  49865. } else {
  49866. return el
  49867. }
  49868. }
  49869. /* */
  49870. function createElement$1 (tagName, vnode) {
  49871. var elm = document.createElement(tagName);
  49872. if (tagName !== 'select') {
  49873. return elm
  49874. }
  49875. // false or null will remove the attribute but undefined will not
  49876. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  49877. elm.setAttribute('multiple', 'multiple');
  49878. }
  49879. return elm
  49880. }
  49881. function createElementNS (namespace, tagName) {
  49882. return document.createElementNS(namespaceMap[namespace], tagName)
  49883. }
  49884. function createTextNode (text) {
  49885. return document.createTextNode(text)
  49886. }
  49887. function createComment (text) {
  49888. return document.createComment(text)
  49889. }
  49890. function insertBefore (parentNode, newNode, referenceNode) {
  49891. parentNode.insertBefore(newNode, referenceNode);
  49892. }
  49893. function removeChild (node, child) {
  49894. node.removeChild(child);
  49895. }
  49896. function appendChild (node, child) {
  49897. node.appendChild(child);
  49898. }
  49899. function parentNode (node) {
  49900. return node.parentNode
  49901. }
  49902. function nextSibling (node) {
  49903. return node.nextSibling
  49904. }
  49905. function tagName (node) {
  49906. return node.tagName
  49907. }
  49908. function setTextContent (node, text) {
  49909. node.textContent = text;
  49910. }
  49911. function setStyleScope (node, scopeId) {
  49912. node.setAttribute(scopeId, '');
  49913. }
  49914. var nodeOps = /*#__PURE__*/Object.freeze({
  49915. createElement: createElement$1,
  49916. createElementNS: createElementNS,
  49917. createTextNode: createTextNode,
  49918. createComment: createComment,
  49919. insertBefore: insertBefore,
  49920. removeChild: removeChild,
  49921. appendChild: appendChild,
  49922. parentNode: parentNode,
  49923. nextSibling: nextSibling,
  49924. tagName: tagName,
  49925. setTextContent: setTextContent,
  49926. setStyleScope: setStyleScope
  49927. });
  49928. /* */
  49929. var ref = {
  49930. create: function create (_, vnode) {
  49931. registerRef(vnode);
  49932. },
  49933. update: function update (oldVnode, vnode) {
  49934. if (oldVnode.data.ref !== vnode.data.ref) {
  49935. registerRef(oldVnode, true);
  49936. registerRef(vnode);
  49937. }
  49938. },
  49939. destroy: function destroy (vnode) {
  49940. registerRef(vnode, true);
  49941. }
  49942. };
  49943. function registerRef (vnode, isRemoval) {
  49944. var key = vnode.data.ref;
  49945. if (!isDef(key)) { return }
  49946. var vm = vnode.context;
  49947. var ref = vnode.componentInstance || vnode.elm;
  49948. var refs = vm.$refs;
  49949. if (isRemoval) {
  49950. if (Array.isArray(refs[key])) {
  49951. remove(refs[key], ref);
  49952. } else if (refs[key] === ref) {
  49953. refs[key] = undefined;
  49954. }
  49955. } else {
  49956. if (vnode.data.refInFor) {
  49957. if (!Array.isArray(refs[key])) {
  49958. refs[key] = [ref];
  49959. } else if (refs[key].indexOf(ref) < 0) {
  49960. // $flow-disable-line
  49961. refs[key].push(ref);
  49962. }
  49963. } else {
  49964. refs[key] = ref;
  49965. }
  49966. }
  49967. }
  49968. /**
  49969. * Virtual DOM patching algorithm based on Snabbdom by
  49970. * Simon Friis Vindum (@paldepind)
  49971. * Licensed under the MIT License
  49972. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  49973. *
  49974. * modified by Evan You (@yyx990803)
  49975. *
  49976. * Not type-checking this because this file is perf-critical and the cost
  49977. * of making flow understand it is not worth it.
  49978. */
  49979. var emptyNode = new VNode('', {}, []);
  49980. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  49981. function sameVnode (a, b) {
  49982. return (
  49983. a.key === b.key && (
  49984. (
  49985. a.tag === b.tag &&
  49986. a.isComment === b.isComment &&
  49987. isDef(a.data) === isDef(b.data) &&
  49988. sameInputType(a, b)
  49989. ) || (
  49990. isTrue(a.isAsyncPlaceholder) &&
  49991. a.asyncFactory === b.asyncFactory &&
  49992. isUndef(b.asyncFactory.error)
  49993. )
  49994. )
  49995. )
  49996. }
  49997. function sameInputType (a, b) {
  49998. if (a.tag !== 'input') { return true }
  49999. var i;
  50000. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  50001. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  50002. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  50003. }
  50004. function createKeyToOldIdx (children, beginIdx, endIdx) {
  50005. var i, key;
  50006. var map = {};
  50007. for (i = beginIdx; i <= endIdx; ++i) {
  50008. key = children[i].key;
  50009. if (isDef(key)) { map[key] = i; }
  50010. }
  50011. return map
  50012. }
  50013. function createPatchFunction (backend) {
  50014. var i, j;
  50015. var cbs = {};
  50016. var modules = backend.modules;
  50017. var nodeOps = backend.nodeOps;
  50018. for (i = 0; i < hooks.length; ++i) {
  50019. cbs[hooks[i]] = [];
  50020. for (j = 0; j < modules.length; ++j) {
  50021. if (isDef(modules[j][hooks[i]])) {
  50022. cbs[hooks[i]].push(modules[j][hooks[i]]);
  50023. }
  50024. }
  50025. }
  50026. function emptyNodeAt (elm) {
  50027. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  50028. }
  50029. function createRmCb (childElm, listeners) {
  50030. function remove$$1 () {
  50031. if (--remove$$1.listeners === 0) {
  50032. removeNode(childElm);
  50033. }
  50034. }
  50035. remove$$1.listeners = listeners;
  50036. return remove$$1
  50037. }
  50038. function removeNode (el) {
  50039. var parent = nodeOps.parentNode(el);
  50040. // element may have already been removed due to v-html / v-text
  50041. if (isDef(parent)) {
  50042. nodeOps.removeChild(parent, el);
  50043. }
  50044. }
  50045. function isUnknownElement$$1 (vnode, inVPre) {
  50046. return (
  50047. !inVPre &&
  50048. !vnode.ns &&
  50049. !(
  50050. config.ignoredElements.length &&
  50051. config.ignoredElements.some(function (ignore) {
  50052. return isRegExp(ignore)
  50053. ? ignore.test(vnode.tag)
  50054. : ignore === vnode.tag
  50055. })
  50056. ) &&
  50057. config.isUnknownElement(vnode.tag)
  50058. )
  50059. }
  50060. var creatingElmInVPre = 0;
  50061. function createElm (
  50062. vnode,
  50063. insertedVnodeQueue,
  50064. parentElm,
  50065. refElm,
  50066. nested,
  50067. ownerArray,
  50068. index
  50069. ) {
  50070. if (isDef(vnode.elm) && isDef(ownerArray)) {
  50071. // This vnode was used in a previous render!
  50072. // now it's used as a new node, overwriting its elm would cause
  50073. // potential patch errors down the road when it's used as an insertion
  50074. // reference node. Instead, we clone the node on-demand before creating
  50075. // associated DOM element for it.
  50076. vnode = ownerArray[index] = cloneVNode(vnode);
  50077. }
  50078. vnode.isRootInsert = !nested; // for transition enter check
  50079. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  50080. return
  50081. }
  50082. var data = vnode.data;
  50083. var children = vnode.children;
  50084. var tag = vnode.tag;
  50085. if (isDef(tag)) {
  50086. {
  50087. if (data && data.pre) {
  50088. creatingElmInVPre++;
  50089. }
  50090. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  50091. warn(
  50092. 'Unknown custom element: <' + tag + '> - did you ' +
  50093. 'register the component correctly? For recursive components, ' +
  50094. 'make sure to provide the "name" option.',
  50095. vnode.context
  50096. );
  50097. }
  50098. }
  50099. vnode.elm = vnode.ns
  50100. ? nodeOps.createElementNS(vnode.ns, tag)
  50101. : nodeOps.createElement(tag, vnode);
  50102. setScope(vnode);
  50103. /* istanbul ignore if */
  50104. {
  50105. createChildren(vnode, children, insertedVnodeQueue);
  50106. if (isDef(data)) {
  50107. invokeCreateHooks(vnode, insertedVnodeQueue);
  50108. }
  50109. insert(parentElm, vnode.elm, refElm);
  50110. }
  50111. if (data && data.pre) {
  50112. creatingElmInVPre--;
  50113. }
  50114. } else if (isTrue(vnode.isComment)) {
  50115. vnode.elm = nodeOps.createComment(vnode.text);
  50116. insert(parentElm, vnode.elm, refElm);
  50117. } else {
  50118. vnode.elm = nodeOps.createTextNode(vnode.text);
  50119. insert(parentElm, vnode.elm, refElm);
  50120. }
  50121. }
  50122. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  50123. var i = vnode.data;
  50124. if (isDef(i)) {
  50125. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  50126. if (isDef(i = i.hook) && isDef(i = i.init)) {
  50127. i(vnode, false /* hydrating */);
  50128. }
  50129. // after calling the init hook, if the vnode is a child component
  50130. // it should've created a child instance and mounted it. the child
  50131. // component also has set the placeholder vnode's elm.
  50132. // in that case we can just return the element and be done.
  50133. if (isDef(vnode.componentInstance)) {
  50134. initComponent(vnode, insertedVnodeQueue);
  50135. insert(parentElm, vnode.elm, refElm);
  50136. if (isTrue(isReactivated)) {
  50137. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  50138. }
  50139. return true
  50140. }
  50141. }
  50142. }
  50143. function initComponent (vnode, insertedVnodeQueue) {
  50144. if (isDef(vnode.data.pendingInsert)) {
  50145. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  50146. vnode.data.pendingInsert = null;
  50147. }
  50148. vnode.elm = vnode.componentInstance.$el;
  50149. if (isPatchable(vnode)) {
  50150. invokeCreateHooks(vnode, insertedVnodeQueue);
  50151. setScope(vnode);
  50152. } else {
  50153. // empty component root.
  50154. // skip all element-related modules except for ref (#3455)
  50155. registerRef(vnode);
  50156. // make sure to invoke the insert hook
  50157. insertedVnodeQueue.push(vnode);
  50158. }
  50159. }
  50160. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  50161. var i;
  50162. // hack for #4339: a reactivated component with inner transition
  50163. // does not trigger because the inner node's created hooks are not called
  50164. // again. It's not ideal to involve module-specific logic in here but
  50165. // there doesn't seem to be a better way to do it.
  50166. var innerNode = vnode;
  50167. while (innerNode.componentInstance) {
  50168. innerNode = innerNode.componentInstance._vnode;
  50169. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  50170. for (i = 0; i < cbs.activate.length; ++i) {
  50171. cbs.activate[i](emptyNode, innerNode);
  50172. }
  50173. insertedVnodeQueue.push(innerNode);
  50174. break
  50175. }
  50176. }
  50177. // unlike a newly created component,
  50178. // a reactivated keep-alive component doesn't insert itself
  50179. insert(parentElm, vnode.elm, refElm);
  50180. }
  50181. function insert (parent, elm, ref$$1) {
  50182. if (isDef(parent)) {
  50183. if (isDef(ref$$1)) {
  50184. if (nodeOps.parentNode(ref$$1) === parent) {
  50185. nodeOps.insertBefore(parent, elm, ref$$1);
  50186. }
  50187. } else {
  50188. nodeOps.appendChild(parent, elm);
  50189. }
  50190. }
  50191. }
  50192. function createChildren (vnode, children, insertedVnodeQueue) {
  50193. if (Array.isArray(children)) {
  50194. {
  50195. checkDuplicateKeys(children);
  50196. }
  50197. for (var i = 0; i < children.length; ++i) {
  50198. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  50199. }
  50200. } else if (isPrimitive(vnode.text)) {
  50201. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  50202. }
  50203. }
  50204. function isPatchable (vnode) {
  50205. while (vnode.componentInstance) {
  50206. vnode = vnode.componentInstance._vnode;
  50207. }
  50208. return isDef(vnode.tag)
  50209. }
  50210. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  50211. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  50212. cbs.create[i$1](emptyNode, vnode);
  50213. }
  50214. i = vnode.data.hook; // Reuse variable
  50215. if (isDef(i)) {
  50216. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  50217. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  50218. }
  50219. }
  50220. // set scope id attribute for scoped CSS.
  50221. // this is implemented as a special case to avoid the overhead
  50222. // of going through the normal attribute patching process.
  50223. function setScope (vnode) {
  50224. var i;
  50225. if (isDef(i = vnode.fnScopeId)) {
  50226. nodeOps.setStyleScope(vnode.elm, i);
  50227. } else {
  50228. var ancestor = vnode;
  50229. while (ancestor) {
  50230. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  50231. nodeOps.setStyleScope(vnode.elm, i);
  50232. }
  50233. ancestor = ancestor.parent;
  50234. }
  50235. }
  50236. // for slot content they should also get the scopeId from the host instance.
  50237. if (isDef(i = activeInstance) &&
  50238. i !== vnode.context &&
  50239. i !== vnode.fnContext &&
  50240. isDef(i = i.$options._scopeId)
  50241. ) {
  50242. nodeOps.setStyleScope(vnode.elm, i);
  50243. }
  50244. }
  50245. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  50246. for (; startIdx <= endIdx; ++startIdx) {
  50247. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  50248. }
  50249. }
  50250. function invokeDestroyHook (vnode) {
  50251. var i, j;
  50252. var data = vnode.data;
  50253. if (isDef(data)) {
  50254. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  50255. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  50256. }
  50257. if (isDef(i = vnode.children)) {
  50258. for (j = 0; j < vnode.children.length; ++j) {
  50259. invokeDestroyHook(vnode.children[j]);
  50260. }
  50261. }
  50262. }
  50263. function removeVnodes (vnodes, startIdx, endIdx) {
  50264. for (; startIdx <= endIdx; ++startIdx) {
  50265. var ch = vnodes[startIdx];
  50266. if (isDef(ch)) {
  50267. if (isDef(ch.tag)) {
  50268. removeAndInvokeRemoveHook(ch);
  50269. invokeDestroyHook(ch);
  50270. } else { // Text node
  50271. removeNode(ch.elm);
  50272. }
  50273. }
  50274. }
  50275. }
  50276. function removeAndInvokeRemoveHook (vnode, rm) {
  50277. if (isDef(rm) || isDef(vnode.data)) {
  50278. var i;
  50279. var listeners = cbs.remove.length + 1;
  50280. if (isDef(rm)) {
  50281. // we have a recursively passed down rm callback
  50282. // increase the listeners count
  50283. rm.listeners += listeners;
  50284. } else {
  50285. // directly removing
  50286. rm = createRmCb(vnode.elm, listeners);
  50287. }
  50288. // recursively invoke hooks on child component root node
  50289. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  50290. removeAndInvokeRemoveHook(i, rm);
  50291. }
  50292. for (i = 0; i < cbs.remove.length; ++i) {
  50293. cbs.remove[i](vnode, rm);
  50294. }
  50295. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  50296. i(vnode, rm);
  50297. } else {
  50298. rm();
  50299. }
  50300. } else {
  50301. removeNode(vnode.elm);
  50302. }
  50303. }
  50304. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  50305. var oldStartIdx = 0;
  50306. var newStartIdx = 0;
  50307. var oldEndIdx = oldCh.length - 1;
  50308. var oldStartVnode = oldCh[0];
  50309. var oldEndVnode = oldCh[oldEndIdx];
  50310. var newEndIdx = newCh.length - 1;
  50311. var newStartVnode = newCh[0];
  50312. var newEndVnode = newCh[newEndIdx];
  50313. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  50314. // removeOnly is a special flag used only by <transition-group>
  50315. // to ensure removed elements stay in correct relative positions
  50316. // during leaving transitions
  50317. var canMove = !removeOnly;
  50318. {
  50319. checkDuplicateKeys(newCh);
  50320. }
  50321. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  50322. if (isUndef(oldStartVnode)) {
  50323. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  50324. } else if (isUndef(oldEndVnode)) {
  50325. oldEndVnode = oldCh[--oldEndIdx];
  50326. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  50327. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  50328. oldStartVnode = oldCh[++oldStartIdx];
  50329. newStartVnode = newCh[++newStartIdx];
  50330. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  50331. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  50332. oldEndVnode = oldCh[--oldEndIdx];
  50333. newEndVnode = newCh[--newEndIdx];
  50334. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  50335. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  50336. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  50337. oldStartVnode = oldCh[++oldStartIdx];
  50338. newEndVnode = newCh[--newEndIdx];
  50339. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  50340. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  50341. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  50342. oldEndVnode = oldCh[--oldEndIdx];
  50343. newStartVnode = newCh[++newStartIdx];
  50344. } else {
  50345. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  50346. idxInOld = isDef(newStartVnode.key)
  50347. ? oldKeyToIdx[newStartVnode.key]
  50348. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  50349. if (isUndef(idxInOld)) { // New element
  50350. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  50351. } else {
  50352. vnodeToMove = oldCh[idxInOld];
  50353. if (sameVnode(vnodeToMove, newStartVnode)) {
  50354. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  50355. oldCh[idxInOld] = undefined;
  50356. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  50357. } else {
  50358. // same key but different element. treat as new element
  50359. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  50360. }
  50361. }
  50362. newStartVnode = newCh[++newStartIdx];
  50363. }
  50364. }
  50365. if (oldStartIdx > oldEndIdx) {
  50366. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  50367. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  50368. } else if (newStartIdx > newEndIdx) {
  50369. removeVnodes(oldCh, oldStartIdx, oldEndIdx);
  50370. }
  50371. }
  50372. function checkDuplicateKeys (children) {
  50373. var seenKeys = {};
  50374. for (var i = 0; i < children.length; i++) {
  50375. var vnode = children[i];
  50376. var key = vnode.key;
  50377. if (isDef(key)) {
  50378. if (seenKeys[key]) {
  50379. warn(
  50380. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  50381. vnode.context
  50382. );
  50383. } else {
  50384. seenKeys[key] = true;
  50385. }
  50386. }
  50387. }
  50388. }
  50389. function findIdxInOld (node, oldCh, start, end) {
  50390. for (var i = start; i < end; i++) {
  50391. var c = oldCh[i];
  50392. if (isDef(c) && sameVnode(node, c)) { return i }
  50393. }
  50394. }
  50395. function patchVnode (
  50396. oldVnode,
  50397. vnode,
  50398. insertedVnodeQueue,
  50399. ownerArray,
  50400. index,
  50401. removeOnly
  50402. ) {
  50403. if (oldVnode === vnode) {
  50404. return
  50405. }
  50406. if (isDef(vnode.elm) && isDef(ownerArray)) {
  50407. // clone reused vnode
  50408. vnode = ownerArray[index] = cloneVNode(vnode);
  50409. }
  50410. var elm = vnode.elm = oldVnode.elm;
  50411. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  50412. if (isDef(vnode.asyncFactory.resolved)) {
  50413. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  50414. } else {
  50415. vnode.isAsyncPlaceholder = true;
  50416. }
  50417. return
  50418. }
  50419. // reuse element for static trees.
  50420. // note we only do this if the vnode is cloned -
  50421. // if the new node is not cloned it means the render functions have been
  50422. // reset by the hot-reload-api and we need to do a proper re-render.
  50423. if (isTrue(vnode.isStatic) &&
  50424. isTrue(oldVnode.isStatic) &&
  50425. vnode.key === oldVnode.key &&
  50426. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  50427. ) {
  50428. vnode.componentInstance = oldVnode.componentInstance;
  50429. return
  50430. }
  50431. var i;
  50432. var data = vnode.data;
  50433. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  50434. i(oldVnode, vnode);
  50435. }
  50436. var oldCh = oldVnode.children;
  50437. var ch = vnode.children;
  50438. if (isDef(data) && isPatchable(vnode)) {
  50439. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  50440. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  50441. }
  50442. if (isUndef(vnode.text)) {
  50443. if (isDef(oldCh) && isDef(ch)) {
  50444. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  50445. } else if (isDef(ch)) {
  50446. {
  50447. checkDuplicateKeys(ch);
  50448. }
  50449. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  50450. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  50451. } else if (isDef(oldCh)) {
  50452. removeVnodes(oldCh, 0, oldCh.length - 1);
  50453. } else if (isDef(oldVnode.text)) {
  50454. nodeOps.setTextContent(elm, '');
  50455. }
  50456. } else if (oldVnode.text !== vnode.text) {
  50457. nodeOps.setTextContent(elm, vnode.text);
  50458. }
  50459. if (isDef(data)) {
  50460. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  50461. }
  50462. }
  50463. function invokeInsertHook (vnode, queue, initial) {
  50464. // delay insert hooks for component root nodes, invoke them after the
  50465. // element is really inserted
  50466. if (isTrue(initial) && isDef(vnode.parent)) {
  50467. vnode.parent.data.pendingInsert = queue;
  50468. } else {
  50469. for (var i = 0; i < queue.length; ++i) {
  50470. queue[i].data.hook.insert(queue[i]);
  50471. }
  50472. }
  50473. }
  50474. var hydrationBailed = false;
  50475. // list of modules that can skip create hook during hydration because they
  50476. // are already rendered on the client or has no need for initialization
  50477. // Note: style is excluded because it relies on initial clone for future
  50478. // deep updates (#7063).
  50479. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  50480. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  50481. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  50482. var i;
  50483. var tag = vnode.tag;
  50484. var data = vnode.data;
  50485. var children = vnode.children;
  50486. inVPre = inVPre || (data && data.pre);
  50487. vnode.elm = elm;
  50488. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  50489. vnode.isAsyncPlaceholder = true;
  50490. return true
  50491. }
  50492. // assert node match
  50493. {
  50494. if (!assertNodeMatch(elm, vnode, inVPre)) {
  50495. return false
  50496. }
  50497. }
  50498. if (isDef(data)) {
  50499. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  50500. if (isDef(i = vnode.componentInstance)) {
  50501. // child component. it should have hydrated its own tree.
  50502. initComponent(vnode, insertedVnodeQueue);
  50503. return true
  50504. }
  50505. }
  50506. if (isDef(tag)) {
  50507. if (isDef(children)) {
  50508. // empty element, allow client to pick up and populate children
  50509. if (!elm.hasChildNodes()) {
  50510. createChildren(vnode, children, insertedVnodeQueue);
  50511. } else {
  50512. // v-html and domProps: innerHTML
  50513. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  50514. if (i !== elm.innerHTML) {
  50515. /* istanbul ignore if */
  50516. if (typeof console !== 'undefined' &&
  50517. !hydrationBailed
  50518. ) {
  50519. hydrationBailed = true;
  50520. console.warn('Parent: ', elm);
  50521. console.warn('server innerHTML: ', i);
  50522. console.warn('client innerHTML: ', elm.innerHTML);
  50523. }
  50524. return false
  50525. }
  50526. } else {
  50527. // iterate and compare children lists
  50528. var childrenMatch = true;
  50529. var childNode = elm.firstChild;
  50530. for (var i$1 = 0; i$1 < children.length; i$1++) {
  50531. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  50532. childrenMatch = false;
  50533. break
  50534. }
  50535. childNode = childNode.nextSibling;
  50536. }
  50537. // if childNode is not null, it means the actual childNodes list is
  50538. // longer than the virtual children list.
  50539. if (!childrenMatch || childNode) {
  50540. /* istanbul ignore if */
  50541. if (typeof console !== 'undefined' &&
  50542. !hydrationBailed
  50543. ) {
  50544. hydrationBailed = true;
  50545. console.warn('Parent: ', elm);
  50546. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  50547. }
  50548. return false
  50549. }
  50550. }
  50551. }
  50552. }
  50553. if (isDef(data)) {
  50554. var fullInvoke = false;
  50555. for (var key in data) {
  50556. if (!isRenderedModule(key)) {
  50557. fullInvoke = true;
  50558. invokeCreateHooks(vnode, insertedVnodeQueue);
  50559. break
  50560. }
  50561. }
  50562. if (!fullInvoke && data['class']) {
  50563. // ensure collecting deps for deep class bindings for future updates
  50564. traverse(data['class']);
  50565. }
  50566. }
  50567. } else if (elm.data !== vnode.text) {
  50568. elm.data = vnode.text;
  50569. }
  50570. return true
  50571. }
  50572. function assertNodeMatch (node, vnode, inVPre) {
  50573. if (isDef(vnode.tag)) {
  50574. return vnode.tag.indexOf('vue-component') === 0 || (
  50575. !isUnknownElement$$1(vnode, inVPre) &&
  50576. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  50577. )
  50578. } else {
  50579. return node.nodeType === (vnode.isComment ? 8 : 3)
  50580. }
  50581. }
  50582. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  50583. if (isUndef(vnode)) {
  50584. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  50585. return
  50586. }
  50587. var isInitialPatch = false;
  50588. var insertedVnodeQueue = [];
  50589. if (isUndef(oldVnode)) {
  50590. // empty mount (likely as component), create new root element
  50591. isInitialPatch = true;
  50592. createElm(vnode, insertedVnodeQueue);
  50593. } else {
  50594. var isRealElement = isDef(oldVnode.nodeType);
  50595. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  50596. // patch existing root node
  50597. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  50598. } else {
  50599. if (isRealElement) {
  50600. // mounting to a real element
  50601. // check if this is server-rendered content and if we can perform
  50602. // a successful hydration.
  50603. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  50604. oldVnode.removeAttribute(SSR_ATTR);
  50605. hydrating = true;
  50606. }
  50607. if (isTrue(hydrating)) {
  50608. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  50609. invokeInsertHook(vnode, insertedVnodeQueue, true);
  50610. return oldVnode
  50611. } else {
  50612. warn(
  50613. 'The client-side rendered virtual DOM tree is not matching ' +
  50614. 'server-rendered content. This is likely caused by incorrect ' +
  50615. 'HTML markup, for example nesting block-level elements inside ' +
  50616. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  50617. 'full client-side render.'
  50618. );
  50619. }
  50620. }
  50621. // either not server-rendered, or hydration failed.
  50622. // create an empty node and replace it
  50623. oldVnode = emptyNodeAt(oldVnode);
  50624. }
  50625. // replacing existing element
  50626. var oldElm = oldVnode.elm;
  50627. var parentElm = nodeOps.parentNode(oldElm);
  50628. // create new node
  50629. createElm(
  50630. vnode,
  50631. insertedVnodeQueue,
  50632. // extremely rare edge case: do not insert if old element is in a
  50633. // leaving transition. Only happens when combining transition +
  50634. // keep-alive + HOCs. (#4590)
  50635. oldElm._leaveCb ? null : parentElm,
  50636. nodeOps.nextSibling(oldElm)
  50637. );
  50638. // update parent placeholder node element, recursively
  50639. if (isDef(vnode.parent)) {
  50640. var ancestor = vnode.parent;
  50641. var patchable = isPatchable(vnode);
  50642. while (ancestor) {
  50643. for (var i = 0; i < cbs.destroy.length; ++i) {
  50644. cbs.destroy[i](ancestor);
  50645. }
  50646. ancestor.elm = vnode.elm;
  50647. if (patchable) {
  50648. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  50649. cbs.create[i$1](emptyNode, ancestor);
  50650. }
  50651. // #6513
  50652. // invoke insert hooks that may have been merged by create hooks.
  50653. // e.g. for directives that uses the "inserted" hook.
  50654. var insert = ancestor.data.hook.insert;
  50655. if (insert.merged) {
  50656. // start at index 1 to avoid re-invoking component mounted hook
  50657. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  50658. insert.fns[i$2]();
  50659. }
  50660. }
  50661. } else {
  50662. registerRef(ancestor);
  50663. }
  50664. ancestor = ancestor.parent;
  50665. }
  50666. }
  50667. // destroy old node
  50668. if (isDef(parentElm)) {
  50669. removeVnodes([oldVnode], 0, 0);
  50670. } else if (isDef(oldVnode.tag)) {
  50671. invokeDestroyHook(oldVnode);
  50672. }
  50673. }
  50674. }
  50675. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  50676. return vnode.elm
  50677. }
  50678. }
  50679. /* */
  50680. var directives = {
  50681. create: updateDirectives,
  50682. update: updateDirectives,
  50683. destroy: function unbindDirectives (vnode) {
  50684. updateDirectives(vnode, emptyNode);
  50685. }
  50686. };
  50687. function updateDirectives (oldVnode, vnode) {
  50688. if (oldVnode.data.directives || vnode.data.directives) {
  50689. _update(oldVnode, vnode);
  50690. }
  50691. }
  50692. function _update (oldVnode, vnode) {
  50693. var isCreate = oldVnode === emptyNode;
  50694. var isDestroy = vnode === emptyNode;
  50695. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  50696. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  50697. var dirsWithInsert = [];
  50698. var dirsWithPostpatch = [];
  50699. var key, oldDir, dir;
  50700. for (key in newDirs) {
  50701. oldDir = oldDirs[key];
  50702. dir = newDirs[key];
  50703. if (!oldDir) {
  50704. // new directive, bind
  50705. callHook$1(dir, 'bind', vnode, oldVnode);
  50706. if (dir.def && dir.def.inserted) {
  50707. dirsWithInsert.push(dir);
  50708. }
  50709. } else {
  50710. // existing directive, update
  50711. dir.oldValue = oldDir.value;
  50712. dir.oldArg = oldDir.arg;
  50713. callHook$1(dir, 'update', vnode, oldVnode);
  50714. if (dir.def && dir.def.componentUpdated) {
  50715. dirsWithPostpatch.push(dir);
  50716. }
  50717. }
  50718. }
  50719. if (dirsWithInsert.length) {
  50720. var callInsert = function () {
  50721. for (var i = 0; i < dirsWithInsert.length; i++) {
  50722. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  50723. }
  50724. };
  50725. if (isCreate) {
  50726. mergeVNodeHook(vnode, 'insert', callInsert);
  50727. } else {
  50728. callInsert();
  50729. }
  50730. }
  50731. if (dirsWithPostpatch.length) {
  50732. mergeVNodeHook(vnode, 'postpatch', function () {
  50733. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  50734. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  50735. }
  50736. });
  50737. }
  50738. if (!isCreate) {
  50739. for (key in oldDirs) {
  50740. if (!newDirs[key]) {
  50741. // no longer present, unbind
  50742. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  50743. }
  50744. }
  50745. }
  50746. }
  50747. var emptyModifiers = Object.create(null);
  50748. function normalizeDirectives$1 (
  50749. dirs,
  50750. vm
  50751. ) {
  50752. var res = Object.create(null);
  50753. if (!dirs) {
  50754. // $flow-disable-line
  50755. return res
  50756. }
  50757. var i, dir;
  50758. for (i = 0; i < dirs.length; i++) {
  50759. dir = dirs[i];
  50760. if (!dir.modifiers) {
  50761. // $flow-disable-line
  50762. dir.modifiers = emptyModifiers;
  50763. }
  50764. res[getRawDirName(dir)] = dir;
  50765. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  50766. }
  50767. // $flow-disable-line
  50768. return res
  50769. }
  50770. function getRawDirName (dir) {
  50771. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  50772. }
  50773. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  50774. var fn = dir.def && dir.def[hook];
  50775. if (fn) {
  50776. try {
  50777. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  50778. } catch (e) {
  50779. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  50780. }
  50781. }
  50782. }
  50783. var baseModules = [
  50784. ref,
  50785. directives
  50786. ];
  50787. /* */
  50788. function updateAttrs (oldVnode, vnode) {
  50789. var opts = vnode.componentOptions;
  50790. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  50791. return
  50792. }
  50793. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  50794. return
  50795. }
  50796. var key, cur, old;
  50797. var elm = vnode.elm;
  50798. var oldAttrs = oldVnode.data.attrs || {};
  50799. var attrs = vnode.data.attrs || {};
  50800. // clone observed objects, as the user probably wants to mutate it
  50801. if (isDef(attrs.__ob__)) {
  50802. attrs = vnode.data.attrs = extend({}, attrs);
  50803. }
  50804. for (key in attrs) {
  50805. cur = attrs[key];
  50806. old = oldAttrs[key];
  50807. if (old !== cur) {
  50808. setAttr(elm, key, cur);
  50809. }
  50810. }
  50811. // #4391: in IE9, setting type can reset value for input[type=radio]
  50812. // #6666: IE/Edge forces progress value down to 1 before setting a max
  50813. /* istanbul ignore if */
  50814. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  50815. setAttr(elm, 'value', attrs.value);
  50816. }
  50817. for (key in oldAttrs) {
  50818. if (isUndef(attrs[key])) {
  50819. if (isXlink(key)) {
  50820. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  50821. } else if (!isEnumeratedAttr(key)) {
  50822. elm.removeAttribute(key);
  50823. }
  50824. }
  50825. }
  50826. }
  50827. function setAttr (el, key, value) {
  50828. if (el.tagName.indexOf('-') > -1) {
  50829. baseSetAttr(el, key, value);
  50830. } else if (isBooleanAttr(key)) {
  50831. // set attribute for blank value
  50832. // e.g. <option disabled>Select one</option>
  50833. if (isFalsyAttrValue(value)) {
  50834. el.removeAttribute(key);
  50835. } else {
  50836. // technically allowfullscreen is a boolean attribute for <iframe>,
  50837. // but Flash expects a value of "true" when used on <embed> tag
  50838. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  50839. ? 'true'
  50840. : key;
  50841. el.setAttribute(key, value);
  50842. }
  50843. } else if (isEnumeratedAttr(key)) {
  50844. el.setAttribute(key, convertEnumeratedValue(key, value));
  50845. } else if (isXlink(key)) {
  50846. if (isFalsyAttrValue(value)) {
  50847. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  50848. } else {
  50849. el.setAttributeNS(xlinkNS, key, value);
  50850. }
  50851. } else {
  50852. baseSetAttr(el, key, value);
  50853. }
  50854. }
  50855. function baseSetAttr (el, key, value) {
  50856. if (isFalsyAttrValue(value)) {
  50857. el.removeAttribute(key);
  50858. } else {
  50859. // #7138: IE10 & 11 fires input event when setting placeholder on
  50860. // <textarea>... block the first input event and remove the blocker
  50861. // immediately.
  50862. /* istanbul ignore if */
  50863. if (
  50864. isIE && !isIE9 &&
  50865. el.tagName === 'TEXTAREA' &&
  50866. key === 'placeholder' && value !== '' && !el.__ieph
  50867. ) {
  50868. var blocker = function (e) {
  50869. e.stopImmediatePropagation();
  50870. el.removeEventListener('input', blocker);
  50871. };
  50872. el.addEventListener('input', blocker);
  50873. // $flow-disable-line
  50874. el.__ieph = true; /* IE placeholder patched */
  50875. }
  50876. el.setAttribute(key, value);
  50877. }
  50878. }
  50879. var attrs = {
  50880. create: updateAttrs,
  50881. update: updateAttrs
  50882. };
  50883. /* */
  50884. function updateClass (oldVnode, vnode) {
  50885. var el = vnode.elm;
  50886. var data = vnode.data;
  50887. var oldData = oldVnode.data;
  50888. if (
  50889. isUndef(data.staticClass) &&
  50890. isUndef(data.class) && (
  50891. isUndef(oldData) || (
  50892. isUndef(oldData.staticClass) &&
  50893. isUndef(oldData.class)
  50894. )
  50895. )
  50896. ) {
  50897. return
  50898. }
  50899. var cls = genClassForVnode(vnode);
  50900. // handle transition classes
  50901. var transitionClass = el._transitionClasses;
  50902. if (isDef(transitionClass)) {
  50903. cls = concat(cls, stringifyClass(transitionClass));
  50904. }
  50905. // set the class
  50906. if (cls !== el._prevClass) {
  50907. el.setAttribute('class', cls);
  50908. el._prevClass = cls;
  50909. }
  50910. }
  50911. var klass = {
  50912. create: updateClass,
  50913. update: updateClass
  50914. };
  50915. /* */
  50916. var validDivisionCharRE = /[\w).+\-_$\]]/;
  50917. function parseFilters (exp) {
  50918. var inSingle = false;
  50919. var inDouble = false;
  50920. var inTemplateString = false;
  50921. var inRegex = false;
  50922. var curly = 0;
  50923. var square = 0;
  50924. var paren = 0;
  50925. var lastFilterIndex = 0;
  50926. var c, prev, i, expression, filters;
  50927. for (i = 0; i < exp.length; i++) {
  50928. prev = c;
  50929. c = exp.charCodeAt(i);
  50930. if (inSingle) {
  50931. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  50932. } else if (inDouble) {
  50933. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  50934. } else if (inTemplateString) {
  50935. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  50936. } else if (inRegex) {
  50937. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  50938. } else if (
  50939. c === 0x7C && // pipe
  50940. exp.charCodeAt(i + 1) !== 0x7C &&
  50941. exp.charCodeAt(i - 1) !== 0x7C &&
  50942. !curly && !square && !paren
  50943. ) {
  50944. if (expression === undefined) {
  50945. // first filter, end of expression
  50946. lastFilterIndex = i + 1;
  50947. expression = exp.slice(0, i).trim();
  50948. } else {
  50949. pushFilter();
  50950. }
  50951. } else {
  50952. switch (c) {
  50953. case 0x22: inDouble = true; break // "
  50954. case 0x27: inSingle = true; break // '
  50955. case 0x60: inTemplateString = true; break // `
  50956. case 0x28: paren++; break // (
  50957. case 0x29: paren--; break // )
  50958. case 0x5B: square++; break // [
  50959. case 0x5D: square--; break // ]
  50960. case 0x7B: curly++; break // {
  50961. case 0x7D: curly--; break // }
  50962. }
  50963. if (c === 0x2f) { // /
  50964. var j = i - 1;
  50965. var p = (void 0);
  50966. // find first non-whitespace prev char
  50967. for (; j >= 0; j--) {
  50968. p = exp.charAt(j);
  50969. if (p !== ' ') { break }
  50970. }
  50971. if (!p || !validDivisionCharRE.test(p)) {
  50972. inRegex = true;
  50973. }
  50974. }
  50975. }
  50976. }
  50977. if (expression === undefined) {
  50978. expression = exp.slice(0, i).trim();
  50979. } else if (lastFilterIndex !== 0) {
  50980. pushFilter();
  50981. }
  50982. function pushFilter () {
  50983. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  50984. lastFilterIndex = i + 1;
  50985. }
  50986. if (filters) {
  50987. for (i = 0; i < filters.length; i++) {
  50988. expression = wrapFilter(expression, filters[i]);
  50989. }
  50990. }
  50991. return expression
  50992. }
  50993. function wrapFilter (exp, filter) {
  50994. var i = filter.indexOf('(');
  50995. if (i < 0) {
  50996. // _f: resolveFilter
  50997. return ("_f(\"" + filter + "\")(" + exp + ")")
  50998. } else {
  50999. var name = filter.slice(0, i);
  51000. var args = filter.slice(i + 1);
  51001. return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
  51002. }
  51003. }
  51004. /* */
  51005. /* eslint-disable no-unused-vars */
  51006. function baseWarn (msg, range) {
  51007. console.error(("[Vue compiler]: " + msg));
  51008. }
  51009. /* eslint-enable no-unused-vars */
  51010. function pluckModuleFunction (
  51011. modules,
  51012. key
  51013. ) {
  51014. return modules
  51015. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  51016. : []
  51017. }
  51018. function addProp (el, name, value, range, dynamic) {
  51019. (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  51020. el.plain = false;
  51021. }
  51022. function addAttr (el, name, value, range, dynamic) {
  51023. var attrs = dynamic
  51024. ? (el.dynamicAttrs || (el.dynamicAttrs = []))
  51025. : (el.attrs || (el.attrs = []));
  51026. attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  51027. el.plain = false;
  51028. }
  51029. // add a raw attr (use this in preTransforms)
  51030. function addRawAttr (el, name, value, range) {
  51031. el.attrsMap[name] = value;
  51032. el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
  51033. }
  51034. function addDirective (
  51035. el,
  51036. name,
  51037. rawName,
  51038. value,
  51039. arg,
  51040. isDynamicArg,
  51041. modifiers,
  51042. range
  51043. ) {
  51044. (el.directives || (el.directives = [])).push(rangeSetItem({
  51045. name: name,
  51046. rawName: rawName,
  51047. value: value,
  51048. arg: arg,
  51049. isDynamicArg: isDynamicArg,
  51050. modifiers: modifiers
  51051. }, range));
  51052. el.plain = false;
  51053. }
  51054. function prependModifierMarker (symbol, name, dynamic) {
  51055. return dynamic
  51056. ? ("_p(" + name + ",\"" + symbol + "\")")
  51057. : symbol + name // mark the event as captured
  51058. }
  51059. function addHandler (
  51060. el,
  51061. name,
  51062. value,
  51063. modifiers,
  51064. important,
  51065. warn,
  51066. range,
  51067. dynamic
  51068. ) {
  51069. modifiers = modifiers || emptyObject;
  51070. // warn prevent and passive modifier
  51071. /* istanbul ignore if */
  51072. if (
  51073. warn &&
  51074. modifiers.prevent && modifiers.passive
  51075. ) {
  51076. warn(
  51077. 'passive and prevent can\'t be used together. ' +
  51078. 'Passive handler can\'t prevent default event.',
  51079. range
  51080. );
  51081. }
  51082. // normalize click.right and click.middle since they don't actually fire
  51083. // this is technically browser-specific, but at least for now browsers are
  51084. // the only target envs that have right/middle clicks.
  51085. if (modifiers.right) {
  51086. if (dynamic) {
  51087. name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
  51088. } else if (name === 'click') {
  51089. name = 'contextmenu';
  51090. delete modifiers.right;
  51091. }
  51092. } else if (modifiers.middle) {
  51093. if (dynamic) {
  51094. name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
  51095. } else if (name === 'click') {
  51096. name = 'mouseup';
  51097. }
  51098. }
  51099. // check capture modifier
  51100. if (modifiers.capture) {
  51101. delete modifiers.capture;
  51102. name = prependModifierMarker('!', name, dynamic);
  51103. }
  51104. if (modifiers.once) {
  51105. delete modifiers.once;
  51106. name = prependModifierMarker('~', name, dynamic);
  51107. }
  51108. /* istanbul ignore if */
  51109. if (modifiers.passive) {
  51110. delete modifiers.passive;
  51111. name = prependModifierMarker('&', name, dynamic);
  51112. }
  51113. var events;
  51114. if (modifiers.native) {
  51115. delete modifiers.native;
  51116. events = el.nativeEvents || (el.nativeEvents = {});
  51117. } else {
  51118. events = el.events || (el.events = {});
  51119. }
  51120. var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
  51121. if (modifiers !== emptyObject) {
  51122. newHandler.modifiers = modifiers;
  51123. }
  51124. var handlers = events[name];
  51125. /* istanbul ignore if */
  51126. if (Array.isArray(handlers)) {
  51127. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  51128. } else if (handlers) {
  51129. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  51130. } else {
  51131. events[name] = newHandler;
  51132. }
  51133. el.plain = false;
  51134. }
  51135. function getRawBindingAttr (
  51136. el,
  51137. name
  51138. ) {
  51139. return el.rawAttrsMap[':' + name] ||
  51140. el.rawAttrsMap['v-bind:' + name] ||
  51141. el.rawAttrsMap[name]
  51142. }
  51143. function getBindingAttr (
  51144. el,
  51145. name,
  51146. getStatic
  51147. ) {
  51148. var dynamicValue =
  51149. getAndRemoveAttr(el, ':' + name) ||
  51150. getAndRemoveAttr(el, 'v-bind:' + name);
  51151. if (dynamicValue != null) {
  51152. return parseFilters(dynamicValue)
  51153. } else if (getStatic !== false) {
  51154. var staticValue = getAndRemoveAttr(el, name);
  51155. if (staticValue != null) {
  51156. return JSON.stringify(staticValue)
  51157. }
  51158. }
  51159. }
  51160. // note: this only removes the attr from the Array (attrsList) so that it
  51161. // doesn't get processed by processAttrs.
  51162. // By default it does NOT remove it from the map (attrsMap) because the map is
  51163. // needed during codegen.
  51164. function getAndRemoveAttr (
  51165. el,
  51166. name,
  51167. removeFromMap
  51168. ) {
  51169. var val;
  51170. if ((val = el.attrsMap[name]) != null) {
  51171. var list = el.attrsList;
  51172. for (var i = 0, l = list.length; i < l; i++) {
  51173. if (list[i].name === name) {
  51174. list.splice(i, 1);
  51175. break
  51176. }
  51177. }
  51178. }
  51179. if (removeFromMap) {
  51180. delete el.attrsMap[name];
  51181. }
  51182. return val
  51183. }
  51184. function getAndRemoveAttrByRegex (
  51185. el,
  51186. name
  51187. ) {
  51188. var list = el.attrsList;
  51189. for (var i = 0, l = list.length; i < l; i++) {
  51190. var attr = list[i];
  51191. if (name.test(attr.name)) {
  51192. list.splice(i, 1);
  51193. return attr
  51194. }
  51195. }
  51196. }
  51197. function rangeSetItem (
  51198. item,
  51199. range
  51200. ) {
  51201. if (range) {
  51202. if (range.start != null) {
  51203. item.start = range.start;
  51204. }
  51205. if (range.end != null) {
  51206. item.end = range.end;
  51207. }
  51208. }
  51209. return item
  51210. }
  51211. /* */
  51212. /**
  51213. * Cross-platform code generation for component v-model
  51214. */
  51215. function genComponentModel (
  51216. el,
  51217. value,
  51218. modifiers
  51219. ) {
  51220. var ref = modifiers || {};
  51221. var number = ref.number;
  51222. var trim = ref.trim;
  51223. var baseValueExpression = '$$v';
  51224. var valueExpression = baseValueExpression;
  51225. if (trim) {
  51226. valueExpression =
  51227. "(typeof " + baseValueExpression + " === 'string'" +
  51228. "? " + baseValueExpression + ".trim()" +
  51229. ": " + baseValueExpression + ")";
  51230. }
  51231. if (number) {
  51232. valueExpression = "_n(" + valueExpression + ")";
  51233. }
  51234. var assignment = genAssignmentCode(value, valueExpression);
  51235. el.model = {
  51236. value: ("(" + value + ")"),
  51237. expression: JSON.stringify(value),
  51238. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  51239. };
  51240. }
  51241. /**
  51242. * Cross-platform codegen helper for generating v-model value assignment code.
  51243. */
  51244. function genAssignmentCode (
  51245. value,
  51246. assignment
  51247. ) {
  51248. var res = parseModel(value);
  51249. if (res.key === null) {
  51250. return (value + "=" + assignment)
  51251. } else {
  51252. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  51253. }
  51254. }
  51255. /**
  51256. * Parse a v-model expression into a base path and a final key segment.
  51257. * Handles both dot-path and possible square brackets.
  51258. *
  51259. * Possible cases:
  51260. *
  51261. * - test
  51262. * - test[key]
  51263. * - test[test1[key]]
  51264. * - test["a"][key]
  51265. * - xxx.test[a[a].test1[key]]
  51266. * - test.xxx.a["asa"][test1[key]]
  51267. *
  51268. */
  51269. var len, str, chr, index$1, expressionPos, expressionEndPos;
  51270. function parseModel (val) {
  51271. // Fix https://github.com/vuejs/vue/pull/7730
  51272. // allow v-model="obj.val " (trailing whitespace)
  51273. val = val.trim();
  51274. len = val.length;
  51275. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  51276. index$1 = val.lastIndexOf('.');
  51277. if (index$1 > -1) {
  51278. return {
  51279. exp: val.slice(0, index$1),
  51280. key: '"' + val.slice(index$1 + 1) + '"'
  51281. }
  51282. } else {
  51283. return {
  51284. exp: val,
  51285. key: null
  51286. }
  51287. }
  51288. }
  51289. str = val;
  51290. index$1 = expressionPos = expressionEndPos = 0;
  51291. while (!eof()) {
  51292. chr = next();
  51293. /* istanbul ignore if */
  51294. if (isStringStart(chr)) {
  51295. parseString(chr);
  51296. } else if (chr === 0x5B) {
  51297. parseBracket(chr);
  51298. }
  51299. }
  51300. return {
  51301. exp: val.slice(0, expressionPos),
  51302. key: val.slice(expressionPos + 1, expressionEndPos)
  51303. }
  51304. }
  51305. function next () {
  51306. return str.charCodeAt(++index$1)
  51307. }
  51308. function eof () {
  51309. return index$1 >= len
  51310. }
  51311. function isStringStart (chr) {
  51312. return chr === 0x22 || chr === 0x27
  51313. }
  51314. function parseBracket (chr) {
  51315. var inBracket = 1;
  51316. expressionPos = index$1;
  51317. while (!eof()) {
  51318. chr = next();
  51319. if (isStringStart(chr)) {
  51320. parseString(chr);
  51321. continue
  51322. }
  51323. if (chr === 0x5B) { inBracket++; }
  51324. if (chr === 0x5D) { inBracket--; }
  51325. if (inBracket === 0) {
  51326. expressionEndPos = index$1;
  51327. break
  51328. }
  51329. }
  51330. }
  51331. function parseString (chr) {
  51332. var stringQuote = chr;
  51333. while (!eof()) {
  51334. chr = next();
  51335. if (chr === stringQuote) {
  51336. break
  51337. }
  51338. }
  51339. }
  51340. /* */
  51341. var warn$1;
  51342. // in some cases, the event used has to be determined at runtime
  51343. // so we used some reserved tokens during compile.
  51344. var RANGE_TOKEN = '__r';
  51345. var CHECKBOX_RADIO_TOKEN = '__c';
  51346. function model (
  51347. el,
  51348. dir,
  51349. _warn
  51350. ) {
  51351. warn$1 = _warn;
  51352. var value = dir.value;
  51353. var modifiers = dir.modifiers;
  51354. var tag = el.tag;
  51355. var type = el.attrsMap.type;
  51356. {
  51357. // inputs with type="file" are read only and setting the input's
  51358. // value will throw an error.
  51359. if (tag === 'input' && type === 'file') {
  51360. warn$1(
  51361. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  51362. "File inputs are read only. Use a v-on:change listener instead.",
  51363. el.rawAttrsMap['v-model']
  51364. );
  51365. }
  51366. }
  51367. if (el.component) {
  51368. genComponentModel(el, value, modifiers);
  51369. // component v-model doesn't need extra runtime
  51370. return false
  51371. } else if (tag === 'select') {
  51372. genSelect(el, value, modifiers);
  51373. } else if (tag === 'input' && type === 'checkbox') {
  51374. genCheckboxModel(el, value, modifiers);
  51375. } else if (tag === 'input' && type === 'radio') {
  51376. genRadioModel(el, value, modifiers);
  51377. } else if (tag === 'input' || tag === 'textarea') {
  51378. genDefaultModel(el, value, modifiers);
  51379. } else if (!config.isReservedTag(tag)) {
  51380. genComponentModel(el, value, modifiers);
  51381. // component v-model doesn't need extra runtime
  51382. return false
  51383. } else {
  51384. warn$1(
  51385. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  51386. "v-model is not supported on this element type. " +
  51387. 'If you are working with contenteditable, it\'s recommended to ' +
  51388. 'wrap a library dedicated for that purpose inside a custom component.',
  51389. el.rawAttrsMap['v-model']
  51390. );
  51391. }
  51392. // ensure runtime directive metadata
  51393. return true
  51394. }
  51395. function genCheckboxModel (
  51396. el,
  51397. value,
  51398. modifiers
  51399. ) {
  51400. var number = modifiers && modifiers.number;
  51401. var valueBinding = getBindingAttr(el, 'value') || 'null';
  51402. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  51403. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  51404. addProp(el, 'checked',
  51405. "Array.isArray(" + value + ")" +
  51406. "?_i(" + value + "," + valueBinding + ")>-1" + (
  51407. trueValueBinding === 'true'
  51408. ? (":(" + value + ")")
  51409. : (":_q(" + value + "," + trueValueBinding + ")")
  51410. )
  51411. );
  51412. addHandler(el, 'change',
  51413. "var $$a=" + value + "," +
  51414. '$$el=$event.target,' +
  51415. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  51416. 'if(Array.isArray($$a)){' +
  51417. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  51418. '$$i=_i($$a,$$v);' +
  51419. "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
  51420. "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
  51421. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  51422. null, true
  51423. );
  51424. }
  51425. function genRadioModel (
  51426. el,
  51427. value,
  51428. modifiers
  51429. ) {
  51430. var number = modifiers && modifiers.number;
  51431. var valueBinding = getBindingAttr(el, 'value') || 'null';
  51432. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  51433. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  51434. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  51435. }
  51436. function genSelect (
  51437. el,
  51438. value,
  51439. modifiers
  51440. ) {
  51441. var number = modifiers && modifiers.number;
  51442. var selectedVal = "Array.prototype.filter" +
  51443. ".call($event.target.options,function(o){return o.selected})" +
  51444. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  51445. "return " + (number ? '_n(val)' : 'val') + "})";
  51446. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  51447. var code = "var $$selectedVal = " + selectedVal + ";";
  51448. code = code + " " + (genAssignmentCode(value, assignment));
  51449. addHandler(el, 'change', code, null, true);
  51450. }
  51451. function genDefaultModel (
  51452. el,
  51453. value,
  51454. modifiers
  51455. ) {
  51456. var type = el.attrsMap.type;
  51457. // warn if v-bind:value conflicts with v-model
  51458. // except for inputs with v-bind:type
  51459. {
  51460. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  51461. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  51462. if (value$1 && !typeBinding) {
  51463. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  51464. warn$1(
  51465. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  51466. 'because the latter already expands to a value binding internally',
  51467. el.rawAttrsMap[binding]
  51468. );
  51469. }
  51470. }
  51471. var ref = modifiers || {};
  51472. var lazy = ref.lazy;
  51473. var number = ref.number;
  51474. var trim = ref.trim;
  51475. var needCompositionGuard = !lazy && type !== 'range';
  51476. var event = lazy
  51477. ? 'change'
  51478. : type === 'range'
  51479. ? RANGE_TOKEN
  51480. : 'input';
  51481. var valueExpression = '$event.target.value';
  51482. if (trim) {
  51483. valueExpression = "$event.target.value.trim()";
  51484. }
  51485. if (number) {
  51486. valueExpression = "_n(" + valueExpression + ")";
  51487. }
  51488. var code = genAssignmentCode(value, valueExpression);
  51489. if (needCompositionGuard) {
  51490. code = "if($event.target.composing)return;" + code;
  51491. }
  51492. addProp(el, 'value', ("(" + value + ")"));
  51493. addHandler(el, event, code, null, true);
  51494. if (trim || number) {
  51495. addHandler(el, 'blur', '$forceUpdate()');
  51496. }
  51497. }
  51498. /* */
  51499. // normalize v-model event tokens that can only be determined at runtime.
  51500. // it's important to place the event as the first in the array because
  51501. // the whole point is ensuring the v-model callback gets called before
  51502. // user-attached handlers.
  51503. function normalizeEvents (on) {
  51504. /* istanbul ignore if */
  51505. if (isDef(on[RANGE_TOKEN])) {
  51506. // IE input[type=range] only supports `change` event
  51507. var event = isIE ? 'change' : 'input';
  51508. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  51509. delete on[RANGE_TOKEN];
  51510. }
  51511. // This was originally intended to fix #4521 but no longer necessary
  51512. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  51513. /* istanbul ignore if */
  51514. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  51515. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  51516. delete on[CHECKBOX_RADIO_TOKEN];
  51517. }
  51518. }
  51519. var target$1;
  51520. function createOnceHandler$1 (event, handler, capture) {
  51521. var _target = target$1; // save current target element in closure
  51522. return function onceHandler () {
  51523. var res = handler.apply(null, arguments);
  51524. if (res !== null) {
  51525. remove$2(event, onceHandler, capture, _target);
  51526. }
  51527. }
  51528. }
  51529. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  51530. // implementation and does not fire microtasks in between event propagation, so
  51531. // safe to exclude.
  51532. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  51533. function add$1 (
  51534. name,
  51535. handler,
  51536. capture,
  51537. passive
  51538. ) {
  51539. // async edge case #6566: inner click event triggers patch, event handler
  51540. // attached to outer element during patch, and triggered again. This
  51541. // happens because browsers fire microtask ticks between event propagation.
  51542. // the solution is simple: we save the timestamp when a handler is attached,
  51543. // and the handler would only fire if the event passed to it was fired
  51544. // AFTER it was attached.
  51545. if (useMicrotaskFix) {
  51546. var attachedTimestamp = currentFlushTimestamp;
  51547. var original = handler;
  51548. handler = original._wrapper = function (e) {
  51549. if (
  51550. // no bubbling, should always fire.
  51551. // this is just a safety net in case event.timeStamp is unreliable in
  51552. // certain weird environments...
  51553. e.target === e.currentTarget ||
  51554. // event is fired after handler attachment
  51555. e.timeStamp >= attachedTimestamp ||
  51556. // bail for environments that have buggy event.timeStamp implementations
  51557. // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
  51558. // #9681 QtWebEngine event.timeStamp is negative value
  51559. e.timeStamp <= 0 ||
  51560. // #9448 bail if event is fired in another document in a multi-page
  51561. // electron/nw.js app, since event.timeStamp will be using a different
  51562. // starting reference
  51563. e.target.ownerDocument !== document
  51564. ) {
  51565. return original.apply(this, arguments)
  51566. }
  51567. };
  51568. }
  51569. target$1.addEventListener(
  51570. name,
  51571. handler,
  51572. supportsPassive
  51573. ? { capture: capture, passive: passive }
  51574. : capture
  51575. );
  51576. }
  51577. function remove$2 (
  51578. name,
  51579. handler,
  51580. capture,
  51581. _target
  51582. ) {
  51583. (_target || target$1).removeEventListener(
  51584. name,
  51585. handler._wrapper || handler,
  51586. capture
  51587. );
  51588. }
  51589. function updateDOMListeners (oldVnode, vnode) {
  51590. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  51591. return
  51592. }
  51593. var on = vnode.data.on || {};
  51594. var oldOn = oldVnode.data.on || {};
  51595. target$1 = vnode.elm;
  51596. normalizeEvents(on);
  51597. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  51598. target$1 = undefined;
  51599. }
  51600. var events = {
  51601. create: updateDOMListeners,
  51602. update: updateDOMListeners
  51603. };
  51604. /* */
  51605. var svgContainer;
  51606. function updateDOMProps (oldVnode, vnode) {
  51607. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  51608. return
  51609. }
  51610. var key, cur;
  51611. var elm = vnode.elm;
  51612. var oldProps = oldVnode.data.domProps || {};
  51613. var props = vnode.data.domProps || {};
  51614. // clone observed objects, as the user probably wants to mutate it
  51615. if (isDef(props.__ob__)) {
  51616. props = vnode.data.domProps = extend({}, props);
  51617. }
  51618. for (key in oldProps) {
  51619. if (!(key in props)) {
  51620. elm[key] = '';
  51621. }
  51622. }
  51623. for (key in props) {
  51624. cur = props[key];
  51625. // ignore children if the node has textContent or innerHTML,
  51626. // as these will throw away existing DOM nodes and cause removal errors
  51627. // on subsequent patches (#3360)
  51628. if (key === 'textContent' || key === 'innerHTML') {
  51629. if (vnode.children) { vnode.children.length = 0; }
  51630. if (cur === oldProps[key]) { continue }
  51631. // #6601 work around Chrome version <= 55 bug where single textNode
  51632. // replaced by innerHTML/textContent retains its parentNode property
  51633. if (elm.childNodes.length === 1) {
  51634. elm.removeChild(elm.childNodes[0]);
  51635. }
  51636. }
  51637. if (key === 'value' && elm.tagName !== 'PROGRESS') {
  51638. // store value as _value as well since
  51639. // non-string values will be stringified
  51640. elm._value = cur;
  51641. // avoid resetting cursor position when value is the same
  51642. var strCur = isUndef(cur) ? '' : String(cur);
  51643. if (shouldUpdateValue(elm, strCur)) {
  51644. elm.value = strCur;
  51645. }
  51646. } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
  51647. // IE doesn't support innerHTML for SVG elements
  51648. svgContainer = svgContainer || document.createElement('div');
  51649. svgContainer.innerHTML = "<svg>" + cur + "</svg>";
  51650. var svg = svgContainer.firstChild;
  51651. while (elm.firstChild) {
  51652. elm.removeChild(elm.firstChild);
  51653. }
  51654. while (svg.firstChild) {
  51655. elm.appendChild(svg.firstChild);
  51656. }
  51657. } else if (
  51658. // skip the update if old and new VDOM state is the same.
  51659. // `value` is handled separately because the DOM value may be temporarily
  51660. // out of sync with VDOM state due to focus, composition and modifiers.
  51661. // This #4521 by skipping the unnecesarry `checked` update.
  51662. cur !== oldProps[key]
  51663. ) {
  51664. // some property updates can throw
  51665. // e.g. `value` on <progress> w/ non-finite value
  51666. try {
  51667. elm[key] = cur;
  51668. } catch (e) {}
  51669. }
  51670. }
  51671. }
  51672. // check platforms/web/util/attrs.js acceptValue
  51673. function shouldUpdateValue (elm, checkVal) {
  51674. return (!elm.composing && (
  51675. elm.tagName === 'OPTION' ||
  51676. isNotInFocusAndDirty(elm, checkVal) ||
  51677. isDirtyWithModifiers(elm, checkVal)
  51678. ))
  51679. }
  51680. function isNotInFocusAndDirty (elm, checkVal) {
  51681. // return true when textbox (.number and .trim) loses focus and its value is
  51682. // not equal to the updated value
  51683. var notInFocus = true;
  51684. // #6157
  51685. // work around IE bug when accessing document.activeElement in an iframe
  51686. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  51687. return notInFocus && elm.value !== checkVal
  51688. }
  51689. function isDirtyWithModifiers (elm, newVal) {
  51690. var value = elm.value;
  51691. var modifiers = elm._vModifiers; // injected by v-model runtime
  51692. if (isDef(modifiers)) {
  51693. if (modifiers.number) {
  51694. return toNumber(value) !== toNumber(newVal)
  51695. }
  51696. if (modifiers.trim) {
  51697. return value.trim() !== newVal.trim()
  51698. }
  51699. }
  51700. return value !== newVal
  51701. }
  51702. var domProps = {
  51703. create: updateDOMProps,
  51704. update: updateDOMProps
  51705. };
  51706. /* */
  51707. var parseStyleText = cached(function (cssText) {
  51708. var res = {};
  51709. var listDelimiter = /;(?![^(]*\))/g;
  51710. var propertyDelimiter = /:(.+)/;
  51711. cssText.split(listDelimiter).forEach(function (item) {
  51712. if (item) {
  51713. var tmp = item.split(propertyDelimiter);
  51714. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  51715. }
  51716. });
  51717. return res
  51718. });
  51719. // merge static and dynamic style data on the same vnode
  51720. function normalizeStyleData (data) {
  51721. var style = normalizeStyleBinding(data.style);
  51722. // static style is pre-processed into an object during compilation
  51723. // and is always a fresh object, so it's safe to merge into it
  51724. return data.staticStyle
  51725. ? extend(data.staticStyle, style)
  51726. : style
  51727. }
  51728. // normalize possible array / string values into Object
  51729. function normalizeStyleBinding (bindingStyle) {
  51730. if (Array.isArray(bindingStyle)) {
  51731. return toObject(bindingStyle)
  51732. }
  51733. if (typeof bindingStyle === 'string') {
  51734. return parseStyleText(bindingStyle)
  51735. }
  51736. return bindingStyle
  51737. }
  51738. /**
  51739. * parent component style should be after child's
  51740. * so that parent component's style could override it
  51741. */
  51742. function getStyle (vnode, checkChild) {
  51743. var res = {};
  51744. var styleData;
  51745. if (checkChild) {
  51746. var childNode = vnode;
  51747. while (childNode.componentInstance) {
  51748. childNode = childNode.componentInstance._vnode;
  51749. if (
  51750. childNode && childNode.data &&
  51751. (styleData = normalizeStyleData(childNode.data))
  51752. ) {
  51753. extend(res, styleData);
  51754. }
  51755. }
  51756. }
  51757. if ((styleData = normalizeStyleData(vnode.data))) {
  51758. extend(res, styleData);
  51759. }
  51760. var parentNode = vnode;
  51761. while ((parentNode = parentNode.parent)) {
  51762. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  51763. extend(res, styleData);
  51764. }
  51765. }
  51766. return res
  51767. }
  51768. /* */
  51769. var cssVarRE = /^--/;
  51770. var importantRE = /\s*!important$/;
  51771. var setProp = function (el, name, val) {
  51772. /* istanbul ignore if */
  51773. if (cssVarRE.test(name)) {
  51774. el.style.setProperty(name, val);
  51775. } else if (importantRE.test(val)) {
  51776. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  51777. } else {
  51778. var normalizedName = normalize(name);
  51779. if (Array.isArray(val)) {
  51780. // Support values array created by autoprefixer, e.g.
  51781. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  51782. // Set them one by one, and the browser will only set those it can recognize
  51783. for (var i = 0, len = val.length; i < len; i++) {
  51784. el.style[normalizedName] = val[i];
  51785. }
  51786. } else {
  51787. el.style[normalizedName] = val;
  51788. }
  51789. }
  51790. };
  51791. var vendorNames = ['Webkit', 'Moz', 'ms'];
  51792. var emptyStyle;
  51793. var normalize = cached(function (prop) {
  51794. emptyStyle = emptyStyle || document.createElement('div').style;
  51795. prop = camelize(prop);
  51796. if (prop !== 'filter' && (prop in emptyStyle)) {
  51797. return prop
  51798. }
  51799. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  51800. for (var i = 0; i < vendorNames.length; i++) {
  51801. var name = vendorNames[i] + capName;
  51802. if (name in emptyStyle) {
  51803. return name
  51804. }
  51805. }
  51806. });
  51807. function updateStyle (oldVnode, vnode) {
  51808. var data = vnode.data;
  51809. var oldData = oldVnode.data;
  51810. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  51811. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  51812. ) {
  51813. return
  51814. }
  51815. var cur, name;
  51816. var el = vnode.elm;
  51817. var oldStaticStyle = oldData.staticStyle;
  51818. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  51819. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  51820. var oldStyle = oldStaticStyle || oldStyleBinding;
  51821. var style = normalizeStyleBinding(vnode.data.style) || {};
  51822. // store normalized style under a different key for next diff
  51823. // make sure to clone it if it's reactive, since the user likely wants
  51824. // to mutate it.
  51825. vnode.data.normalizedStyle = isDef(style.__ob__)
  51826. ? extend({}, style)
  51827. : style;
  51828. var newStyle = getStyle(vnode, true);
  51829. for (name in oldStyle) {
  51830. if (isUndef(newStyle[name])) {
  51831. setProp(el, name, '');
  51832. }
  51833. }
  51834. for (name in newStyle) {
  51835. cur = newStyle[name];
  51836. if (cur !== oldStyle[name]) {
  51837. // ie9 setting to null has no effect, must use empty string
  51838. setProp(el, name, cur == null ? '' : cur);
  51839. }
  51840. }
  51841. }
  51842. var style = {
  51843. create: updateStyle,
  51844. update: updateStyle
  51845. };
  51846. /* */
  51847. var whitespaceRE = /\s+/;
  51848. /**
  51849. * Add class with compatibility for SVG since classList is not supported on
  51850. * SVG elements in IE
  51851. */
  51852. function addClass (el, cls) {
  51853. /* istanbul ignore if */
  51854. if (!cls || !(cls = cls.trim())) {
  51855. return
  51856. }
  51857. /* istanbul ignore else */
  51858. if (el.classList) {
  51859. if (cls.indexOf(' ') > -1) {
  51860. cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
  51861. } else {
  51862. el.classList.add(cls);
  51863. }
  51864. } else {
  51865. var cur = " " + (el.getAttribute('class') || '') + " ";
  51866. if (cur.indexOf(' ' + cls + ' ') < 0) {
  51867. el.setAttribute('class', (cur + cls).trim());
  51868. }
  51869. }
  51870. }
  51871. /**
  51872. * Remove class with compatibility for SVG since classList is not supported on
  51873. * SVG elements in IE
  51874. */
  51875. function removeClass (el, cls) {
  51876. /* istanbul ignore if */
  51877. if (!cls || !(cls = cls.trim())) {
  51878. return
  51879. }
  51880. /* istanbul ignore else */
  51881. if (el.classList) {
  51882. if (cls.indexOf(' ') > -1) {
  51883. cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
  51884. } else {
  51885. el.classList.remove(cls);
  51886. }
  51887. if (!el.classList.length) {
  51888. el.removeAttribute('class');
  51889. }
  51890. } else {
  51891. var cur = " " + (el.getAttribute('class') || '') + " ";
  51892. var tar = ' ' + cls + ' ';
  51893. while (cur.indexOf(tar) >= 0) {
  51894. cur = cur.replace(tar, ' ');
  51895. }
  51896. cur = cur.trim();
  51897. if (cur) {
  51898. el.setAttribute('class', cur);
  51899. } else {
  51900. el.removeAttribute('class');
  51901. }
  51902. }
  51903. }
  51904. /* */
  51905. function resolveTransition (def$$1) {
  51906. if (!def$$1) {
  51907. return
  51908. }
  51909. /* istanbul ignore else */
  51910. if (typeof def$$1 === 'object') {
  51911. var res = {};
  51912. if (def$$1.css !== false) {
  51913. extend(res, autoCssTransition(def$$1.name || 'v'));
  51914. }
  51915. extend(res, def$$1);
  51916. return res
  51917. } else if (typeof def$$1 === 'string') {
  51918. return autoCssTransition(def$$1)
  51919. }
  51920. }
  51921. var autoCssTransition = cached(function (name) {
  51922. return {
  51923. enterClass: (name + "-enter"),
  51924. enterToClass: (name + "-enter-to"),
  51925. enterActiveClass: (name + "-enter-active"),
  51926. leaveClass: (name + "-leave"),
  51927. leaveToClass: (name + "-leave-to"),
  51928. leaveActiveClass: (name + "-leave-active")
  51929. }
  51930. });
  51931. var hasTransition = inBrowser && !isIE9;
  51932. var TRANSITION = 'transition';
  51933. var ANIMATION = 'animation';
  51934. // Transition property/event sniffing
  51935. var transitionProp = 'transition';
  51936. var transitionEndEvent = 'transitionend';
  51937. var animationProp = 'animation';
  51938. var animationEndEvent = 'animationend';
  51939. if (hasTransition) {
  51940. /* istanbul ignore if */
  51941. if (window.ontransitionend === undefined &&
  51942. window.onwebkittransitionend !== undefined
  51943. ) {
  51944. transitionProp = 'WebkitTransition';
  51945. transitionEndEvent = 'webkitTransitionEnd';
  51946. }
  51947. if (window.onanimationend === undefined &&
  51948. window.onwebkitanimationend !== undefined
  51949. ) {
  51950. animationProp = 'WebkitAnimation';
  51951. animationEndEvent = 'webkitAnimationEnd';
  51952. }
  51953. }
  51954. // binding to window is necessary to make hot reload work in IE in strict mode
  51955. var raf = inBrowser
  51956. ? window.requestAnimationFrame
  51957. ? window.requestAnimationFrame.bind(window)
  51958. : setTimeout
  51959. : /* istanbul ignore next */ function (fn) { return fn(); };
  51960. function nextFrame (fn) {
  51961. raf(function () {
  51962. raf(fn);
  51963. });
  51964. }
  51965. function addTransitionClass (el, cls) {
  51966. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  51967. if (transitionClasses.indexOf(cls) < 0) {
  51968. transitionClasses.push(cls);
  51969. addClass(el, cls);
  51970. }
  51971. }
  51972. function removeTransitionClass (el, cls) {
  51973. if (el._transitionClasses) {
  51974. remove(el._transitionClasses, cls);
  51975. }
  51976. removeClass(el, cls);
  51977. }
  51978. function whenTransitionEnds (
  51979. el,
  51980. expectedType,
  51981. cb
  51982. ) {
  51983. var ref = getTransitionInfo(el, expectedType);
  51984. var type = ref.type;
  51985. var timeout = ref.timeout;
  51986. var propCount = ref.propCount;
  51987. if (!type) { return cb() }
  51988. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  51989. var ended = 0;
  51990. var end = function () {
  51991. el.removeEventListener(event, onEnd);
  51992. cb();
  51993. };
  51994. var onEnd = function (e) {
  51995. if (e.target === el) {
  51996. if (++ended >= propCount) {
  51997. end();
  51998. }
  51999. }
  52000. };
  52001. setTimeout(function () {
  52002. if (ended < propCount) {
  52003. end();
  52004. }
  52005. }, timeout + 1);
  52006. el.addEventListener(event, onEnd);
  52007. }
  52008. var transformRE = /\b(transform|all)(,|$)/;
  52009. function getTransitionInfo (el, expectedType) {
  52010. var styles = window.getComputedStyle(el);
  52011. // JSDOM may return undefined for transition properties
  52012. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  52013. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  52014. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  52015. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  52016. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  52017. var animationTimeout = getTimeout(animationDelays, animationDurations);
  52018. var type;
  52019. var timeout = 0;
  52020. var propCount = 0;
  52021. /* istanbul ignore if */
  52022. if (expectedType === TRANSITION) {
  52023. if (transitionTimeout > 0) {
  52024. type = TRANSITION;
  52025. timeout = transitionTimeout;
  52026. propCount = transitionDurations.length;
  52027. }
  52028. } else if (expectedType === ANIMATION) {
  52029. if (animationTimeout > 0) {
  52030. type = ANIMATION;
  52031. timeout = animationTimeout;
  52032. propCount = animationDurations.length;
  52033. }
  52034. } else {
  52035. timeout = Math.max(transitionTimeout, animationTimeout);
  52036. type = timeout > 0
  52037. ? transitionTimeout > animationTimeout
  52038. ? TRANSITION
  52039. : ANIMATION
  52040. : null;
  52041. propCount = type
  52042. ? type === TRANSITION
  52043. ? transitionDurations.length
  52044. : animationDurations.length
  52045. : 0;
  52046. }
  52047. var hasTransform =
  52048. type === TRANSITION &&
  52049. transformRE.test(styles[transitionProp + 'Property']);
  52050. return {
  52051. type: type,
  52052. timeout: timeout,
  52053. propCount: propCount,
  52054. hasTransform: hasTransform
  52055. }
  52056. }
  52057. function getTimeout (delays, durations) {
  52058. /* istanbul ignore next */
  52059. while (delays.length < durations.length) {
  52060. delays = delays.concat(delays);
  52061. }
  52062. return Math.max.apply(null, durations.map(function (d, i) {
  52063. return toMs(d) + toMs(delays[i])
  52064. }))
  52065. }
  52066. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  52067. // in a locale-dependent way, using a comma instead of a dot.
  52068. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  52069. // as a floor function) causing unexpected behaviors
  52070. function toMs (s) {
  52071. return Number(s.slice(0, -1).replace(',', '.')) * 1000
  52072. }
  52073. /* */
  52074. function enter (vnode, toggleDisplay) {
  52075. var el = vnode.elm;
  52076. // call leave callback now
  52077. if (isDef(el._leaveCb)) {
  52078. el._leaveCb.cancelled = true;
  52079. el._leaveCb();
  52080. }
  52081. var data = resolveTransition(vnode.data.transition);
  52082. if (isUndef(data)) {
  52083. return
  52084. }
  52085. /* istanbul ignore if */
  52086. if (isDef(el._enterCb) || el.nodeType !== 1) {
  52087. return
  52088. }
  52089. var css = data.css;
  52090. var type = data.type;
  52091. var enterClass = data.enterClass;
  52092. var enterToClass = data.enterToClass;
  52093. var enterActiveClass = data.enterActiveClass;
  52094. var appearClass = data.appearClass;
  52095. var appearToClass = data.appearToClass;
  52096. var appearActiveClass = data.appearActiveClass;
  52097. var beforeEnter = data.beforeEnter;
  52098. var enter = data.enter;
  52099. var afterEnter = data.afterEnter;
  52100. var enterCancelled = data.enterCancelled;
  52101. var beforeAppear = data.beforeAppear;
  52102. var appear = data.appear;
  52103. var afterAppear = data.afterAppear;
  52104. var appearCancelled = data.appearCancelled;
  52105. var duration = data.duration;
  52106. // activeInstance will always be the <transition> component managing this
  52107. // transition. One edge case to check is when the <transition> is placed
  52108. // as the root node of a child component. In that case we need to check
  52109. // <transition>'s parent for appear check.
  52110. var context = activeInstance;
  52111. var transitionNode = activeInstance.$vnode;
  52112. while (transitionNode && transitionNode.parent) {
  52113. context = transitionNode.context;
  52114. transitionNode = transitionNode.parent;
  52115. }
  52116. var isAppear = !context._isMounted || !vnode.isRootInsert;
  52117. if (isAppear && !appear && appear !== '') {
  52118. return
  52119. }
  52120. var startClass = isAppear && appearClass
  52121. ? appearClass
  52122. : enterClass;
  52123. var activeClass = isAppear && appearActiveClass
  52124. ? appearActiveClass
  52125. : enterActiveClass;
  52126. var toClass = isAppear && appearToClass
  52127. ? appearToClass
  52128. : enterToClass;
  52129. var beforeEnterHook = isAppear
  52130. ? (beforeAppear || beforeEnter)
  52131. : beforeEnter;
  52132. var enterHook = isAppear
  52133. ? (typeof appear === 'function' ? appear : enter)
  52134. : enter;
  52135. var afterEnterHook = isAppear
  52136. ? (afterAppear || afterEnter)
  52137. : afterEnter;
  52138. var enterCancelledHook = isAppear
  52139. ? (appearCancelled || enterCancelled)
  52140. : enterCancelled;
  52141. var explicitEnterDuration = toNumber(
  52142. isObject(duration)
  52143. ? duration.enter
  52144. : duration
  52145. );
  52146. if (explicitEnterDuration != null) {
  52147. checkDuration(explicitEnterDuration, 'enter', vnode);
  52148. }
  52149. var expectsCSS = css !== false && !isIE9;
  52150. var userWantsControl = getHookArgumentsLength(enterHook);
  52151. var cb = el._enterCb = once(function () {
  52152. if (expectsCSS) {
  52153. removeTransitionClass(el, toClass);
  52154. removeTransitionClass(el, activeClass);
  52155. }
  52156. if (cb.cancelled) {
  52157. if (expectsCSS) {
  52158. removeTransitionClass(el, startClass);
  52159. }
  52160. enterCancelledHook && enterCancelledHook(el);
  52161. } else {
  52162. afterEnterHook && afterEnterHook(el);
  52163. }
  52164. el._enterCb = null;
  52165. });
  52166. if (!vnode.data.show) {
  52167. // remove pending leave element on enter by injecting an insert hook
  52168. mergeVNodeHook(vnode, 'insert', function () {
  52169. var parent = el.parentNode;
  52170. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  52171. if (pendingNode &&
  52172. pendingNode.tag === vnode.tag &&
  52173. pendingNode.elm._leaveCb
  52174. ) {
  52175. pendingNode.elm._leaveCb();
  52176. }
  52177. enterHook && enterHook(el, cb);
  52178. });
  52179. }
  52180. // start enter transition
  52181. beforeEnterHook && beforeEnterHook(el);
  52182. if (expectsCSS) {
  52183. addTransitionClass(el, startClass);
  52184. addTransitionClass(el, activeClass);
  52185. nextFrame(function () {
  52186. removeTransitionClass(el, startClass);
  52187. if (!cb.cancelled) {
  52188. addTransitionClass(el, toClass);
  52189. if (!userWantsControl) {
  52190. if (isValidDuration(explicitEnterDuration)) {
  52191. setTimeout(cb, explicitEnterDuration);
  52192. } else {
  52193. whenTransitionEnds(el, type, cb);
  52194. }
  52195. }
  52196. }
  52197. });
  52198. }
  52199. if (vnode.data.show) {
  52200. toggleDisplay && toggleDisplay();
  52201. enterHook && enterHook(el, cb);
  52202. }
  52203. if (!expectsCSS && !userWantsControl) {
  52204. cb();
  52205. }
  52206. }
  52207. function leave (vnode, rm) {
  52208. var el = vnode.elm;
  52209. // call enter callback now
  52210. if (isDef(el._enterCb)) {
  52211. el._enterCb.cancelled = true;
  52212. el._enterCb();
  52213. }
  52214. var data = resolveTransition(vnode.data.transition);
  52215. if (isUndef(data) || el.nodeType !== 1) {
  52216. return rm()
  52217. }
  52218. /* istanbul ignore if */
  52219. if (isDef(el._leaveCb)) {
  52220. return
  52221. }
  52222. var css = data.css;
  52223. var type = data.type;
  52224. var leaveClass = data.leaveClass;
  52225. var leaveToClass = data.leaveToClass;
  52226. var leaveActiveClass = data.leaveActiveClass;
  52227. var beforeLeave = data.beforeLeave;
  52228. var leave = data.leave;
  52229. var afterLeave = data.afterLeave;
  52230. var leaveCancelled = data.leaveCancelled;
  52231. var delayLeave = data.delayLeave;
  52232. var duration = data.duration;
  52233. var expectsCSS = css !== false && !isIE9;
  52234. var userWantsControl = getHookArgumentsLength(leave);
  52235. var explicitLeaveDuration = toNumber(
  52236. isObject(duration)
  52237. ? duration.leave
  52238. : duration
  52239. );
  52240. if (isDef(explicitLeaveDuration)) {
  52241. checkDuration(explicitLeaveDuration, 'leave', vnode);
  52242. }
  52243. var cb = el._leaveCb = once(function () {
  52244. if (el.parentNode && el.parentNode._pending) {
  52245. el.parentNode._pending[vnode.key] = null;
  52246. }
  52247. if (expectsCSS) {
  52248. removeTransitionClass(el, leaveToClass);
  52249. removeTransitionClass(el, leaveActiveClass);
  52250. }
  52251. if (cb.cancelled) {
  52252. if (expectsCSS) {
  52253. removeTransitionClass(el, leaveClass);
  52254. }
  52255. leaveCancelled && leaveCancelled(el);
  52256. } else {
  52257. rm();
  52258. afterLeave && afterLeave(el);
  52259. }
  52260. el._leaveCb = null;
  52261. });
  52262. if (delayLeave) {
  52263. delayLeave(performLeave);
  52264. } else {
  52265. performLeave();
  52266. }
  52267. function performLeave () {
  52268. // the delayed leave may have already been cancelled
  52269. if (cb.cancelled) {
  52270. return
  52271. }
  52272. // record leaving element
  52273. if (!vnode.data.show && el.parentNode) {
  52274. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  52275. }
  52276. beforeLeave && beforeLeave(el);
  52277. if (expectsCSS) {
  52278. addTransitionClass(el, leaveClass);
  52279. addTransitionClass(el, leaveActiveClass);
  52280. nextFrame(function () {
  52281. removeTransitionClass(el, leaveClass);
  52282. if (!cb.cancelled) {
  52283. addTransitionClass(el, leaveToClass);
  52284. if (!userWantsControl) {
  52285. if (isValidDuration(explicitLeaveDuration)) {
  52286. setTimeout(cb, explicitLeaveDuration);
  52287. } else {
  52288. whenTransitionEnds(el, type, cb);
  52289. }
  52290. }
  52291. }
  52292. });
  52293. }
  52294. leave && leave(el, cb);
  52295. if (!expectsCSS && !userWantsControl) {
  52296. cb();
  52297. }
  52298. }
  52299. }
  52300. // only used in dev mode
  52301. function checkDuration (val, name, vnode) {
  52302. if (typeof val !== 'number') {
  52303. warn(
  52304. "<transition> explicit " + name + " duration is not a valid number - " +
  52305. "got " + (JSON.stringify(val)) + ".",
  52306. vnode.context
  52307. );
  52308. } else if (isNaN(val)) {
  52309. warn(
  52310. "<transition> explicit " + name + " duration is NaN - " +
  52311. 'the duration expression might be incorrect.',
  52312. vnode.context
  52313. );
  52314. }
  52315. }
  52316. function isValidDuration (val) {
  52317. return typeof val === 'number' && !isNaN(val)
  52318. }
  52319. /**
  52320. * Normalize a transition hook's argument length. The hook may be:
  52321. * - a merged hook (invoker) with the original in .fns
  52322. * - a wrapped component method (check ._length)
  52323. * - a plain function (.length)
  52324. */
  52325. function getHookArgumentsLength (fn) {
  52326. if (isUndef(fn)) {
  52327. return false
  52328. }
  52329. var invokerFns = fn.fns;
  52330. if (isDef(invokerFns)) {
  52331. // invoker
  52332. return getHookArgumentsLength(
  52333. Array.isArray(invokerFns)
  52334. ? invokerFns[0]
  52335. : invokerFns
  52336. )
  52337. } else {
  52338. return (fn._length || fn.length) > 1
  52339. }
  52340. }
  52341. function _enter (_, vnode) {
  52342. if (vnode.data.show !== true) {
  52343. enter(vnode);
  52344. }
  52345. }
  52346. var transition = inBrowser ? {
  52347. create: _enter,
  52348. activate: _enter,
  52349. remove: function remove$$1 (vnode, rm) {
  52350. /* istanbul ignore else */
  52351. if (vnode.data.show !== true) {
  52352. leave(vnode, rm);
  52353. } else {
  52354. rm();
  52355. }
  52356. }
  52357. } : {};
  52358. var platformModules = [
  52359. attrs,
  52360. klass,
  52361. events,
  52362. domProps,
  52363. style,
  52364. transition
  52365. ];
  52366. /* */
  52367. // the directive module should be applied last, after all
  52368. // built-in modules have been applied.
  52369. var modules = platformModules.concat(baseModules);
  52370. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  52371. /**
  52372. * Not type checking this file because flow doesn't like attaching
  52373. * properties to Elements.
  52374. */
  52375. /* istanbul ignore if */
  52376. if (isIE9) {
  52377. // http://www.matts411.com/post/internet-explorer-9-oninput/
  52378. document.addEventListener('selectionchange', function () {
  52379. var el = document.activeElement;
  52380. if (el && el.vmodel) {
  52381. trigger(el, 'input');
  52382. }
  52383. });
  52384. }
  52385. var directive = {
  52386. inserted: function inserted (el, binding, vnode, oldVnode) {
  52387. if (vnode.tag === 'select') {
  52388. // #6903
  52389. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  52390. mergeVNodeHook(vnode, 'postpatch', function () {
  52391. directive.componentUpdated(el, binding, vnode);
  52392. });
  52393. } else {
  52394. setSelected(el, binding, vnode.context);
  52395. }
  52396. el._vOptions = [].map.call(el.options, getValue);
  52397. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  52398. el._vModifiers = binding.modifiers;
  52399. if (!binding.modifiers.lazy) {
  52400. el.addEventListener('compositionstart', onCompositionStart);
  52401. el.addEventListener('compositionend', onCompositionEnd);
  52402. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  52403. // switching focus before confirming composition choice
  52404. // this also fixes the issue where some browsers e.g. iOS Chrome
  52405. // fires "change" instead of "input" on autocomplete.
  52406. el.addEventListener('change', onCompositionEnd);
  52407. /* istanbul ignore if */
  52408. if (isIE9) {
  52409. el.vmodel = true;
  52410. }
  52411. }
  52412. }
  52413. },
  52414. componentUpdated: function componentUpdated (el, binding, vnode) {
  52415. if (vnode.tag === 'select') {
  52416. setSelected(el, binding, vnode.context);
  52417. // in case the options rendered by v-for have changed,
  52418. // it's possible that the value is out-of-sync with the rendered options.
  52419. // detect such cases and filter out values that no longer has a matching
  52420. // option in the DOM.
  52421. var prevOptions = el._vOptions;
  52422. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  52423. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  52424. // trigger change event if
  52425. // no matching option found for at least one value
  52426. var needReset = el.multiple
  52427. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  52428. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  52429. if (needReset) {
  52430. trigger(el, 'change');
  52431. }
  52432. }
  52433. }
  52434. }
  52435. };
  52436. function setSelected (el, binding, vm) {
  52437. actuallySetSelected(el, binding, vm);
  52438. /* istanbul ignore if */
  52439. if (isIE || isEdge) {
  52440. setTimeout(function () {
  52441. actuallySetSelected(el, binding, vm);
  52442. }, 0);
  52443. }
  52444. }
  52445. function actuallySetSelected (el, binding, vm) {
  52446. var value = binding.value;
  52447. var isMultiple = el.multiple;
  52448. if (isMultiple && !Array.isArray(value)) {
  52449. warn(
  52450. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  52451. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  52452. vm
  52453. );
  52454. return
  52455. }
  52456. var selected, option;
  52457. for (var i = 0, l = el.options.length; i < l; i++) {
  52458. option = el.options[i];
  52459. if (isMultiple) {
  52460. selected = looseIndexOf(value, getValue(option)) > -1;
  52461. if (option.selected !== selected) {
  52462. option.selected = selected;
  52463. }
  52464. } else {
  52465. if (looseEqual(getValue(option), value)) {
  52466. if (el.selectedIndex !== i) {
  52467. el.selectedIndex = i;
  52468. }
  52469. return
  52470. }
  52471. }
  52472. }
  52473. if (!isMultiple) {
  52474. el.selectedIndex = -1;
  52475. }
  52476. }
  52477. function hasNoMatchingOption (value, options) {
  52478. return options.every(function (o) { return !looseEqual(o, value); })
  52479. }
  52480. function getValue (option) {
  52481. return '_value' in option
  52482. ? option._value
  52483. : option.value
  52484. }
  52485. function onCompositionStart (e) {
  52486. e.target.composing = true;
  52487. }
  52488. function onCompositionEnd (e) {
  52489. // prevent triggering an input event for no reason
  52490. if (!e.target.composing) { return }
  52491. e.target.composing = false;
  52492. trigger(e.target, 'input');
  52493. }
  52494. function trigger (el, type) {
  52495. var e = document.createEvent('HTMLEvents');
  52496. e.initEvent(type, true, true);
  52497. el.dispatchEvent(e);
  52498. }
  52499. /* */
  52500. // recursively search for possible transition defined inside the component root
  52501. function locateNode (vnode) {
  52502. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  52503. ? locateNode(vnode.componentInstance._vnode)
  52504. : vnode
  52505. }
  52506. var show = {
  52507. bind: function bind (el, ref, vnode) {
  52508. var value = ref.value;
  52509. vnode = locateNode(vnode);
  52510. var transition$$1 = vnode.data && vnode.data.transition;
  52511. var originalDisplay = el.__vOriginalDisplay =
  52512. el.style.display === 'none' ? '' : el.style.display;
  52513. if (value && transition$$1) {
  52514. vnode.data.show = true;
  52515. enter(vnode, function () {
  52516. el.style.display = originalDisplay;
  52517. });
  52518. } else {
  52519. el.style.display = value ? originalDisplay : 'none';
  52520. }
  52521. },
  52522. update: function update (el, ref, vnode) {
  52523. var value = ref.value;
  52524. var oldValue = ref.oldValue;
  52525. /* istanbul ignore if */
  52526. if (!value === !oldValue) { return }
  52527. vnode = locateNode(vnode);
  52528. var transition$$1 = vnode.data && vnode.data.transition;
  52529. if (transition$$1) {
  52530. vnode.data.show = true;
  52531. if (value) {
  52532. enter(vnode, function () {
  52533. el.style.display = el.__vOriginalDisplay;
  52534. });
  52535. } else {
  52536. leave(vnode, function () {
  52537. el.style.display = 'none';
  52538. });
  52539. }
  52540. } else {
  52541. el.style.display = value ? el.__vOriginalDisplay : 'none';
  52542. }
  52543. },
  52544. unbind: function unbind (
  52545. el,
  52546. binding,
  52547. vnode,
  52548. oldVnode,
  52549. isDestroy
  52550. ) {
  52551. if (!isDestroy) {
  52552. el.style.display = el.__vOriginalDisplay;
  52553. }
  52554. }
  52555. };
  52556. var platformDirectives = {
  52557. model: directive,
  52558. show: show
  52559. };
  52560. /* */
  52561. var transitionProps = {
  52562. name: String,
  52563. appear: Boolean,
  52564. css: Boolean,
  52565. mode: String,
  52566. type: String,
  52567. enterClass: String,
  52568. leaveClass: String,
  52569. enterToClass: String,
  52570. leaveToClass: String,
  52571. enterActiveClass: String,
  52572. leaveActiveClass: String,
  52573. appearClass: String,
  52574. appearActiveClass: String,
  52575. appearToClass: String,
  52576. duration: [Number, String, Object]
  52577. };
  52578. // in case the child is also an abstract component, e.g. <keep-alive>
  52579. // we want to recursively retrieve the real component to be rendered
  52580. function getRealChild (vnode) {
  52581. var compOptions = vnode && vnode.componentOptions;
  52582. if (compOptions && compOptions.Ctor.options.abstract) {
  52583. return getRealChild(getFirstComponentChild(compOptions.children))
  52584. } else {
  52585. return vnode
  52586. }
  52587. }
  52588. function extractTransitionData (comp) {
  52589. var data = {};
  52590. var options = comp.$options;
  52591. // props
  52592. for (var key in options.propsData) {
  52593. data[key] = comp[key];
  52594. }
  52595. // events.
  52596. // extract listeners and pass them directly to the transition methods
  52597. var listeners = options._parentListeners;
  52598. for (var key$1 in listeners) {
  52599. data[camelize(key$1)] = listeners[key$1];
  52600. }
  52601. return data
  52602. }
  52603. function placeholder (h, rawChild) {
  52604. if (/\d-keep-alive$/.test(rawChild.tag)) {
  52605. return h('keep-alive', {
  52606. props: rawChild.componentOptions.propsData
  52607. })
  52608. }
  52609. }
  52610. function hasParentTransition (vnode) {
  52611. while ((vnode = vnode.parent)) {
  52612. if (vnode.data.transition) {
  52613. return true
  52614. }
  52615. }
  52616. }
  52617. function isSameChild (child, oldChild) {
  52618. return oldChild.key === child.key && oldChild.tag === child.tag
  52619. }
  52620. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  52621. var isVShowDirective = function (d) { return d.name === 'show'; };
  52622. var Transition = {
  52623. name: 'transition',
  52624. props: transitionProps,
  52625. abstract: true,
  52626. render: function render (h) {
  52627. var this$1 = this;
  52628. var children = this.$slots.default;
  52629. if (!children) {
  52630. return
  52631. }
  52632. // filter out text nodes (possible whitespaces)
  52633. children = children.filter(isNotTextNode);
  52634. /* istanbul ignore if */
  52635. if (!children.length) {
  52636. return
  52637. }
  52638. // warn multiple elements
  52639. if (children.length > 1) {
  52640. warn(
  52641. '<transition> can only be used on a single element. Use ' +
  52642. '<transition-group> for lists.',
  52643. this.$parent
  52644. );
  52645. }
  52646. var mode = this.mode;
  52647. // warn invalid mode
  52648. if (mode && mode !== 'in-out' && mode !== 'out-in'
  52649. ) {
  52650. warn(
  52651. 'invalid <transition> mode: ' + mode,
  52652. this.$parent
  52653. );
  52654. }
  52655. var rawChild = children[0];
  52656. // if this is a component root node and the component's
  52657. // parent container node also has transition, skip.
  52658. if (hasParentTransition(this.$vnode)) {
  52659. return rawChild
  52660. }
  52661. // apply transition data to child
  52662. // use getRealChild() to ignore abstract components e.g. keep-alive
  52663. var child = getRealChild(rawChild);
  52664. /* istanbul ignore if */
  52665. if (!child) {
  52666. return rawChild
  52667. }
  52668. if (this._leaving) {
  52669. return placeholder(h, rawChild)
  52670. }
  52671. // ensure a key that is unique to the vnode type and to this transition
  52672. // component instance. This key will be used to remove pending leaving nodes
  52673. // during entering.
  52674. var id = "__transition-" + (this._uid) + "-";
  52675. child.key = child.key == null
  52676. ? child.isComment
  52677. ? id + 'comment'
  52678. : id + child.tag
  52679. : isPrimitive(child.key)
  52680. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  52681. : child.key;
  52682. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  52683. var oldRawChild = this._vnode;
  52684. var oldChild = getRealChild(oldRawChild);
  52685. // mark v-show
  52686. // so that the transition module can hand over the control to the directive
  52687. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  52688. child.data.show = true;
  52689. }
  52690. if (
  52691. oldChild &&
  52692. oldChild.data &&
  52693. !isSameChild(child, oldChild) &&
  52694. !isAsyncPlaceholder(oldChild) &&
  52695. // #6687 component root is a comment node
  52696. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  52697. ) {
  52698. // replace old child transition data with fresh one
  52699. // important for dynamic transitions!
  52700. var oldData = oldChild.data.transition = extend({}, data);
  52701. // handle transition mode
  52702. if (mode === 'out-in') {
  52703. // return placeholder node and queue update when leave finishes
  52704. this._leaving = true;
  52705. mergeVNodeHook(oldData, 'afterLeave', function () {
  52706. this$1._leaving = false;
  52707. this$1.$forceUpdate();
  52708. });
  52709. return placeholder(h, rawChild)
  52710. } else if (mode === 'in-out') {
  52711. if (isAsyncPlaceholder(child)) {
  52712. return oldRawChild
  52713. }
  52714. var delayedLeave;
  52715. var performLeave = function () { delayedLeave(); };
  52716. mergeVNodeHook(data, 'afterEnter', performLeave);
  52717. mergeVNodeHook(data, 'enterCancelled', performLeave);
  52718. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  52719. }
  52720. }
  52721. return rawChild
  52722. }
  52723. };
  52724. /* */
  52725. var props = extend({
  52726. tag: String,
  52727. moveClass: String
  52728. }, transitionProps);
  52729. delete props.mode;
  52730. var TransitionGroup = {
  52731. props: props,
  52732. beforeMount: function beforeMount () {
  52733. var this$1 = this;
  52734. var update = this._update;
  52735. this._update = function (vnode, hydrating) {
  52736. var restoreActiveInstance = setActiveInstance(this$1);
  52737. // force removing pass
  52738. this$1.__patch__(
  52739. this$1._vnode,
  52740. this$1.kept,
  52741. false, // hydrating
  52742. true // removeOnly (!important, avoids unnecessary moves)
  52743. );
  52744. this$1._vnode = this$1.kept;
  52745. restoreActiveInstance();
  52746. update.call(this$1, vnode, hydrating);
  52747. };
  52748. },
  52749. render: function render (h) {
  52750. var tag = this.tag || this.$vnode.data.tag || 'span';
  52751. var map = Object.create(null);
  52752. var prevChildren = this.prevChildren = this.children;
  52753. var rawChildren = this.$slots.default || [];
  52754. var children = this.children = [];
  52755. var transitionData = extractTransitionData(this);
  52756. for (var i = 0; i < rawChildren.length; i++) {
  52757. var c = rawChildren[i];
  52758. if (c.tag) {
  52759. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  52760. children.push(c);
  52761. map[c.key] = c
  52762. ;(c.data || (c.data = {})).transition = transitionData;
  52763. } else {
  52764. var opts = c.componentOptions;
  52765. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  52766. warn(("<transition-group> children must be keyed: <" + name + ">"));
  52767. }
  52768. }
  52769. }
  52770. if (prevChildren) {
  52771. var kept = [];
  52772. var removed = [];
  52773. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  52774. var c$1 = prevChildren[i$1];
  52775. c$1.data.transition = transitionData;
  52776. c$1.data.pos = c$1.elm.getBoundingClientRect();
  52777. if (map[c$1.key]) {
  52778. kept.push(c$1);
  52779. } else {
  52780. removed.push(c$1);
  52781. }
  52782. }
  52783. this.kept = h(tag, null, kept);
  52784. this.removed = removed;
  52785. }
  52786. return h(tag, null, children)
  52787. },
  52788. updated: function updated () {
  52789. var children = this.prevChildren;
  52790. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  52791. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  52792. return
  52793. }
  52794. // we divide the work into three loops to avoid mixing DOM reads and writes
  52795. // in each iteration - which helps prevent layout thrashing.
  52796. children.forEach(callPendingCbs);
  52797. children.forEach(recordPosition);
  52798. children.forEach(applyTranslation);
  52799. // force reflow to put everything in position
  52800. // assign to this to avoid being removed in tree-shaking
  52801. // $flow-disable-line
  52802. this._reflow = document.body.offsetHeight;
  52803. children.forEach(function (c) {
  52804. if (c.data.moved) {
  52805. var el = c.elm;
  52806. var s = el.style;
  52807. addTransitionClass(el, moveClass);
  52808. s.transform = s.WebkitTransform = s.transitionDuration = '';
  52809. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  52810. if (e && e.target !== el) {
  52811. return
  52812. }
  52813. if (!e || /transform$/.test(e.propertyName)) {
  52814. el.removeEventListener(transitionEndEvent, cb);
  52815. el._moveCb = null;
  52816. removeTransitionClass(el, moveClass);
  52817. }
  52818. });
  52819. }
  52820. });
  52821. },
  52822. methods: {
  52823. hasMove: function hasMove (el, moveClass) {
  52824. /* istanbul ignore if */
  52825. if (!hasTransition) {
  52826. return false
  52827. }
  52828. /* istanbul ignore if */
  52829. if (this._hasMove) {
  52830. return this._hasMove
  52831. }
  52832. // Detect whether an element with the move class applied has
  52833. // CSS transitions. Since the element may be inside an entering
  52834. // transition at this very moment, we make a clone of it and remove
  52835. // all other transition classes applied to ensure only the move class
  52836. // is applied.
  52837. var clone = el.cloneNode();
  52838. if (el._transitionClasses) {
  52839. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  52840. }
  52841. addClass(clone, moveClass);
  52842. clone.style.display = 'none';
  52843. this.$el.appendChild(clone);
  52844. var info = getTransitionInfo(clone);
  52845. this.$el.removeChild(clone);
  52846. return (this._hasMove = info.hasTransform)
  52847. }
  52848. }
  52849. };
  52850. function callPendingCbs (c) {
  52851. /* istanbul ignore if */
  52852. if (c.elm._moveCb) {
  52853. c.elm._moveCb();
  52854. }
  52855. /* istanbul ignore if */
  52856. if (c.elm._enterCb) {
  52857. c.elm._enterCb();
  52858. }
  52859. }
  52860. function recordPosition (c) {
  52861. c.data.newPos = c.elm.getBoundingClientRect();
  52862. }
  52863. function applyTranslation (c) {
  52864. var oldPos = c.data.pos;
  52865. var newPos = c.data.newPos;
  52866. var dx = oldPos.left - newPos.left;
  52867. var dy = oldPos.top - newPos.top;
  52868. if (dx || dy) {
  52869. c.data.moved = true;
  52870. var s = c.elm.style;
  52871. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  52872. s.transitionDuration = '0s';
  52873. }
  52874. }
  52875. var platformComponents = {
  52876. Transition: Transition,
  52877. TransitionGroup: TransitionGroup
  52878. };
  52879. /* */
  52880. // install platform specific utils
  52881. Vue.config.mustUseProp = mustUseProp;
  52882. Vue.config.isReservedTag = isReservedTag;
  52883. Vue.config.isReservedAttr = isReservedAttr;
  52884. Vue.config.getTagNamespace = getTagNamespace;
  52885. Vue.config.isUnknownElement = isUnknownElement;
  52886. // install platform runtime directives & components
  52887. extend(Vue.options.directives, platformDirectives);
  52888. extend(Vue.options.components, platformComponents);
  52889. // install platform patch function
  52890. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  52891. // public mount method
  52892. Vue.prototype.$mount = function (
  52893. el,
  52894. hydrating
  52895. ) {
  52896. el = el && inBrowser ? query(el) : undefined;
  52897. return mountComponent(this, el, hydrating)
  52898. };
  52899. // devtools global hook
  52900. /* istanbul ignore next */
  52901. if (inBrowser) {
  52902. setTimeout(function () {
  52903. if (config.devtools) {
  52904. if (devtools) {
  52905. devtools.emit('init', Vue);
  52906. } else {
  52907. console[console.info ? 'info' : 'log'](
  52908. 'Download the Vue Devtools extension for a better development experience:\n' +
  52909. 'https://github.com/vuejs/vue-devtools'
  52910. );
  52911. }
  52912. }
  52913. if (config.productionTip !== false &&
  52914. typeof console !== 'undefined'
  52915. ) {
  52916. console[console.info ? 'info' : 'log'](
  52917. "You are running Vue in development mode.\n" +
  52918. "Make sure to turn on production mode when deploying for production.\n" +
  52919. "See more tips at https://vuejs.org/guide/deployment.html"
  52920. );
  52921. }
  52922. }, 0);
  52923. }
  52924. /* */
  52925. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  52926. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  52927. var buildRegex = cached(function (delimiters) {
  52928. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  52929. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  52930. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  52931. });
  52932. function parseText (
  52933. text,
  52934. delimiters
  52935. ) {
  52936. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  52937. if (!tagRE.test(text)) {
  52938. return
  52939. }
  52940. var tokens = [];
  52941. var rawTokens = [];
  52942. var lastIndex = tagRE.lastIndex = 0;
  52943. var match, index, tokenValue;
  52944. while ((match = tagRE.exec(text))) {
  52945. index = match.index;
  52946. // push text token
  52947. if (index > lastIndex) {
  52948. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  52949. tokens.push(JSON.stringify(tokenValue));
  52950. }
  52951. // tag token
  52952. var exp = parseFilters(match[1].trim());
  52953. tokens.push(("_s(" + exp + ")"));
  52954. rawTokens.push({ '@binding': exp });
  52955. lastIndex = index + match[0].length;
  52956. }
  52957. if (lastIndex < text.length) {
  52958. rawTokens.push(tokenValue = text.slice(lastIndex));
  52959. tokens.push(JSON.stringify(tokenValue));
  52960. }
  52961. return {
  52962. expression: tokens.join('+'),
  52963. tokens: rawTokens
  52964. }
  52965. }
  52966. /* */
  52967. function transformNode (el, options) {
  52968. var warn = options.warn || baseWarn;
  52969. var staticClass = getAndRemoveAttr(el, 'class');
  52970. if (staticClass) {
  52971. var res = parseText(staticClass, options.delimiters);
  52972. if (res) {
  52973. warn(
  52974. "class=\"" + staticClass + "\": " +
  52975. 'Interpolation inside attributes has been removed. ' +
  52976. 'Use v-bind or the colon shorthand instead. For example, ' +
  52977. 'instead of <div class="{{ val }}">, use <div :class="val">.',
  52978. el.rawAttrsMap['class']
  52979. );
  52980. }
  52981. }
  52982. if (staticClass) {
  52983. el.staticClass = JSON.stringify(staticClass);
  52984. }
  52985. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  52986. if (classBinding) {
  52987. el.classBinding = classBinding;
  52988. }
  52989. }
  52990. function genData (el) {
  52991. var data = '';
  52992. if (el.staticClass) {
  52993. data += "staticClass:" + (el.staticClass) + ",";
  52994. }
  52995. if (el.classBinding) {
  52996. data += "class:" + (el.classBinding) + ",";
  52997. }
  52998. return data
  52999. }
  53000. var klass$1 = {
  53001. staticKeys: ['staticClass'],
  53002. transformNode: transformNode,
  53003. genData: genData
  53004. };
  53005. /* */
  53006. function transformNode$1 (el, options) {
  53007. var warn = options.warn || baseWarn;
  53008. var staticStyle = getAndRemoveAttr(el, 'style');
  53009. if (staticStyle) {
  53010. /* istanbul ignore if */
  53011. {
  53012. var res = parseText(staticStyle, options.delimiters);
  53013. if (res) {
  53014. warn(
  53015. "style=\"" + staticStyle + "\": " +
  53016. 'Interpolation inside attributes has been removed. ' +
  53017. 'Use v-bind or the colon shorthand instead. For example, ' +
  53018. 'instead of <div style="{{ val }}">, use <div :style="val">.',
  53019. el.rawAttrsMap['style']
  53020. );
  53021. }
  53022. }
  53023. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  53024. }
  53025. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  53026. if (styleBinding) {
  53027. el.styleBinding = styleBinding;
  53028. }
  53029. }
  53030. function genData$1 (el) {
  53031. var data = '';
  53032. if (el.staticStyle) {
  53033. data += "staticStyle:" + (el.staticStyle) + ",";
  53034. }
  53035. if (el.styleBinding) {
  53036. data += "style:(" + (el.styleBinding) + "),";
  53037. }
  53038. return data
  53039. }
  53040. var style$1 = {
  53041. staticKeys: ['staticStyle'],
  53042. transformNode: transformNode$1,
  53043. genData: genData$1
  53044. };
  53045. /* */
  53046. var decoder;
  53047. var he = {
  53048. decode: function decode (html) {
  53049. decoder = decoder || document.createElement('div');
  53050. decoder.innerHTML = html;
  53051. return decoder.textContent
  53052. }
  53053. };
  53054. /* */
  53055. var isUnaryTag = makeMap(
  53056. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  53057. 'link,meta,param,source,track,wbr'
  53058. );
  53059. // Elements that you can, intentionally, leave open
  53060. // (and which close themselves)
  53061. var canBeLeftOpenTag = makeMap(
  53062. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  53063. );
  53064. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  53065. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  53066. var isNonPhrasingTag = makeMap(
  53067. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  53068. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  53069. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  53070. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  53071. 'title,tr,track'
  53072. );
  53073. /**
  53074. * Not type-checking this file because it's mostly vendor code.
  53075. */
  53076. // Regular Expressions for parsing tags and attributes
  53077. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  53078. var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  53079. var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
  53080. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  53081. var startTagOpen = new RegExp(("^<" + qnameCapture));
  53082. var startTagClose = /^\s*(\/?)>/;
  53083. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  53084. var doctype = /^<!DOCTYPE [^>]+>/i;
  53085. // #7298: escape - to avoid being passed as HTML comment when inlined in page
  53086. var comment = /^<!\--/;
  53087. var conditionalComment = /^<!\[/;
  53088. // Special Elements (can contain anything)
  53089. var isPlainTextElement = makeMap('script,style,textarea', true);
  53090. var reCache = {};
  53091. var decodingMap = {
  53092. '&lt;': '<',
  53093. '&gt;': '>',
  53094. '&quot;': '"',
  53095. '&amp;': '&',
  53096. '&#10;': '\n',
  53097. '&#9;': '\t',
  53098. '&#39;': "'"
  53099. };
  53100. var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
  53101. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
  53102. // #5992
  53103. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  53104. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  53105. function decodeAttr (value, shouldDecodeNewlines) {
  53106. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  53107. return value.replace(re, function (match) { return decodingMap[match]; })
  53108. }
  53109. function parseHTML (html, options) {
  53110. var stack = [];
  53111. var expectHTML = options.expectHTML;
  53112. var isUnaryTag$$1 = options.isUnaryTag || no;
  53113. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  53114. var index = 0;
  53115. var last, lastTag;
  53116. while (html) {
  53117. last = html;
  53118. // Make sure we're not in a plaintext content element like script/style
  53119. if (!lastTag || !isPlainTextElement(lastTag)) {
  53120. var textEnd = html.indexOf('<');
  53121. if (textEnd === 0) {
  53122. // Comment:
  53123. if (comment.test(html)) {
  53124. var commentEnd = html.indexOf('-->');
  53125. if (commentEnd >= 0) {
  53126. if (options.shouldKeepComment) {
  53127. options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
  53128. }
  53129. advance(commentEnd + 3);
  53130. continue
  53131. }
  53132. }
  53133. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  53134. if (conditionalComment.test(html)) {
  53135. var conditionalEnd = html.indexOf(']>');
  53136. if (conditionalEnd >= 0) {
  53137. advance(conditionalEnd + 2);
  53138. continue
  53139. }
  53140. }
  53141. // Doctype:
  53142. var doctypeMatch = html.match(doctype);
  53143. if (doctypeMatch) {
  53144. advance(doctypeMatch[0].length);
  53145. continue
  53146. }
  53147. // End tag:
  53148. var endTagMatch = html.match(endTag);
  53149. if (endTagMatch) {
  53150. var curIndex = index;
  53151. advance(endTagMatch[0].length);
  53152. parseEndTag(endTagMatch[1], curIndex, index);
  53153. continue
  53154. }
  53155. // Start tag:
  53156. var startTagMatch = parseStartTag();
  53157. if (startTagMatch) {
  53158. handleStartTag(startTagMatch);
  53159. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  53160. advance(1);
  53161. }
  53162. continue
  53163. }
  53164. }
  53165. var text = (void 0), rest = (void 0), next = (void 0);
  53166. if (textEnd >= 0) {
  53167. rest = html.slice(textEnd);
  53168. while (
  53169. !endTag.test(rest) &&
  53170. !startTagOpen.test(rest) &&
  53171. !comment.test(rest) &&
  53172. !conditionalComment.test(rest)
  53173. ) {
  53174. // < in plain text, be forgiving and treat it as text
  53175. next = rest.indexOf('<', 1);
  53176. if (next < 0) { break }
  53177. textEnd += next;
  53178. rest = html.slice(textEnd);
  53179. }
  53180. text = html.substring(0, textEnd);
  53181. }
  53182. if (textEnd < 0) {
  53183. text = html;
  53184. }
  53185. if (text) {
  53186. advance(text.length);
  53187. }
  53188. if (options.chars && text) {
  53189. options.chars(text, index - text.length, index);
  53190. }
  53191. } else {
  53192. var endTagLength = 0;
  53193. var stackedTag = lastTag.toLowerCase();
  53194. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  53195. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  53196. endTagLength = endTag.length;
  53197. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  53198. text = text
  53199. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  53200. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  53201. }
  53202. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  53203. text = text.slice(1);
  53204. }
  53205. if (options.chars) {
  53206. options.chars(text);
  53207. }
  53208. return ''
  53209. });
  53210. index += html.length - rest$1.length;
  53211. html = rest$1;
  53212. parseEndTag(stackedTag, index - endTagLength, index);
  53213. }
  53214. if (html === last) {
  53215. options.chars && options.chars(html);
  53216. if (!stack.length && options.warn) {
  53217. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
  53218. }
  53219. break
  53220. }
  53221. }
  53222. // Clean up any remaining tags
  53223. parseEndTag();
  53224. function advance (n) {
  53225. index += n;
  53226. html = html.substring(n);
  53227. }
  53228. function parseStartTag () {
  53229. var start = html.match(startTagOpen);
  53230. if (start) {
  53231. var match = {
  53232. tagName: start[1],
  53233. attrs: [],
  53234. start: index
  53235. };
  53236. advance(start[0].length);
  53237. var end, attr;
  53238. while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
  53239. attr.start = index;
  53240. advance(attr[0].length);
  53241. attr.end = index;
  53242. match.attrs.push(attr);
  53243. }
  53244. if (end) {
  53245. match.unarySlash = end[1];
  53246. advance(end[0].length);
  53247. match.end = index;
  53248. return match
  53249. }
  53250. }
  53251. }
  53252. function handleStartTag (match) {
  53253. var tagName = match.tagName;
  53254. var unarySlash = match.unarySlash;
  53255. if (expectHTML) {
  53256. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  53257. parseEndTag(lastTag);
  53258. }
  53259. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  53260. parseEndTag(tagName);
  53261. }
  53262. }
  53263. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  53264. var l = match.attrs.length;
  53265. var attrs = new Array(l);
  53266. for (var i = 0; i < l; i++) {
  53267. var args = match.attrs[i];
  53268. var value = args[3] || args[4] || args[5] || '';
  53269. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  53270. ? options.shouldDecodeNewlinesForHref
  53271. : options.shouldDecodeNewlines;
  53272. attrs[i] = {
  53273. name: args[1],
  53274. value: decodeAttr(value, shouldDecodeNewlines)
  53275. };
  53276. if (options.outputSourceRange) {
  53277. attrs[i].start = args.start + args[0].match(/^\s*/).length;
  53278. attrs[i].end = args.end;
  53279. }
  53280. }
  53281. if (!unary) {
  53282. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
  53283. lastTag = tagName;
  53284. }
  53285. if (options.start) {
  53286. options.start(tagName, attrs, unary, match.start, match.end);
  53287. }
  53288. }
  53289. function parseEndTag (tagName, start, end) {
  53290. var pos, lowerCasedTagName;
  53291. if (start == null) { start = index; }
  53292. if (end == null) { end = index; }
  53293. // Find the closest opened tag of the same type
  53294. if (tagName) {
  53295. lowerCasedTagName = tagName.toLowerCase();
  53296. for (pos = stack.length - 1; pos >= 0; pos--) {
  53297. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  53298. break
  53299. }
  53300. }
  53301. } else {
  53302. // If no tag name is provided, clean shop
  53303. pos = 0;
  53304. }
  53305. if (pos >= 0) {
  53306. // Close all the open elements, up the stack
  53307. for (var i = stack.length - 1; i >= pos; i--) {
  53308. if (i > pos || !tagName &&
  53309. options.warn
  53310. ) {
  53311. options.warn(
  53312. ("tag <" + (stack[i].tag) + "> has no matching end tag."),
  53313. { start: stack[i].start, end: stack[i].end }
  53314. );
  53315. }
  53316. if (options.end) {
  53317. options.end(stack[i].tag, start, end);
  53318. }
  53319. }
  53320. // Remove the open elements from the stack
  53321. stack.length = pos;
  53322. lastTag = pos && stack[pos - 1].tag;
  53323. } else if (lowerCasedTagName === 'br') {
  53324. if (options.start) {
  53325. options.start(tagName, [], true, start, end);
  53326. }
  53327. } else if (lowerCasedTagName === 'p') {
  53328. if (options.start) {
  53329. options.start(tagName, [], false, start, end);
  53330. }
  53331. if (options.end) {
  53332. options.end(tagName, start, end);
  53333. }
  53334. }
  53335. }
  53336. }
  53337. /* */
  53338. var onRE = /^@|^v-on:/;
  53339. var dirRE = /^v-|^@|^:|^#/;
  53340. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  53341. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  53342. var stripParensRE = /^\(|\)$/g;
  53343. var dynamicArgRE = /^\[.*\]$/;
  53344. var argRE = /:(.*)$/;
  53345. var bindRE = /^:|^\.|^v-bind:/;
  53346. var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
  53347. var slotRE = /^v-slot(:|$)|^#/;
  53348. var lineBreakRE = /[\r\n]/;
  53349. var whitespaceRE$1 = /\s+/g;
  53350. var invalidAttributeRE = /[\s"'<>\/=]/;
  53351. var decodeHTMLCached = cached(he.decode);
  53352. var emptySlotScopeToken = "_empty_";
  53353. // configurable state
  53354. var warn$2;
  53355. var delimiters;
  53356. var transforms;
  53357. var preTransforms;
  53358. var postTransforms;
  53359. var platformIsPreTag;
  53360. var platformMustUseProp;
  53361. var platformGetTagNamespace;
  53362. var maybeComponent;
  53363. function createASTElement (
  53364. tag,
  53365. attrs,
  53366. parent
  53367. ) {
  53368. return {
  53369. type: 1,
  53370. tag: tag,
  53371. attrsList: attrs,
  53372. attrsMap: makeAttrsMap(attrs),
  53373. rawAttrsMap: {},
  53374. parent: parent,
  53375. children: []
  53376. }
  53377. }
  53378. /**
  53379. * Convert HTML string to AST.
  53380. */
  53381. function parse (
  53382. template,
  53383. options
  53384. ) {
  53385. warn$2 = options.warn || baseWarn;
  53386. platformIsPreTag = options.isPreTag || no;
  53387. platformMustUseProp = options.mustUseProp || no;
  53388. platformGetTagNamespace = options.getTagNamespace || no;
  53389. var isReservedTag = options.isReservedTag || no;
  53390. maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  53391. transforms = pluckModuleFunction(options.modules, 'transformNode');
  53392. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  53393. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  53394. delimiters = options.delimiters;
  53395. var stack = [];
  53396. var preserveWhitespace = options.preserveWhitespace !== false;
  53397. var whitespaceOption = options.whitespace;
  53398. var root;
  53399. var currentParent;
  53400. var inVPre = false;
  53401. var inPre = false;
  53402. var warned = false;
  53403. function warnOnce (msg, range) {
  53404. if (!warned) {
  53405. warned = true;
  53406. warn$2(msg, range);
  53407. }
  53408. }
  53409. function closeElement (element) {
  53410. trimEndingWhitespace(element);
  53411. if (!inVPre && !element.processed) {
  53412. element = processElement(element, options);
  53413. }
  53414. // tree management
  53415. if (!stack.length && element !== root) {
  53416. // allow root elements with v-if, v-else-if and v-else
  53417. if (root.if && (element.elseif || element.else)) {
  53418. {
  53419. checkRootConstraints(element);
  53420. }
  53421. addIfCondition(root, {
  53422. exp: element.elseif,
  53423. block: element
  53424. });
  53425. } else {
  53426. warnOnce(
  53427. "Component template should contain exactly one root element. " +
  53428. "If you are using v-if on multiple elements, " +
  53429. "use v-else-if to chain them instead.",
  53430. { start: element.start }
  53431. );
  53432. }
  53433. }
  53434. if (currentParent && !element.forbidden) {
  53435. if (element.elseif || element.else) {
  53436. processIfConditions(element, currentParent);
  53437. } else {
  53438. if (element.slotScope) {
  53439. // scoped slot
  53440. // keep it in the children list so that v-else(-if) conditions can
  53441. // find it as the prev node.
  53442. var name = element.slotTarget || '"default"'
  53443. ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  53444. }
  53445. currentParent.children.push(element);
  53446. element.parent = currentParent;
  53447. }
  53448. }
  53449. // final children cleanup
  53450. // filter out scoped slots
  53451. element.children = element.children.filter(function (c) { return !(c).slotScope; });
  53452. // remove trailing whitespace node again
  53453. trimEndingWhitespace(element);
  53454. // check pre state
  53455. if (element.pre) {
  53456. inVPre = false;
  53457. }
  53458. if (platformIsPreTag(element.tag)) {
  53459. inPre = false;
  53460. }
  53461. // apply post-transforms
  53462. for (var i = 0; i < postTransforms.length; i++) {
  53463. postTransforms[i](element, options);
  53464. }
  53465. }
  53466. function trimEndingWhitespace (el) {
  53467. // remove trailing whitespace node
  53468. if (!inPre) {
  53469. var lastNode;
  53470. while (
  53471. (lastNode = el.children[el.children.length - 1]) &&
  53472. lastNode.type === 3 &&
  53473. lastNode.text === ' '
  53474. ) {
  53475. el.children.pop();
  53476. }
  53477. }
  53478. }
  53479. function checkRootConstraints (el) {
  53480. if (el.tag === 'slot' || el.tag === 'template') {
  53481. warnOnce(
  53482. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  53483. 'contain multiple nodes.',
  53484. { start: el.start }
  53485. );
  53486. }
  53487. if (el.attrsMap.hasOwnProperty('v-for')) {
  53488. warnOnce(
  53489. 'Cannot use v-for on stateful component root element because ' +
  53490. 'it renders multiple elements.',
  53491. el.rawAttrsMap['v-for']
  53492. );
  53493. }
  53494. }
  53495. parseHTML(template, {
  53496. warn: warn$2,
  53497. expectHTML: options.expectHTML,
  53498. isUnaryTag: options.isUnaryTag,
  53499. canBeLeftOpenTag: options.canBeLeftOpenTag,
  53500. shouldDecodeNewlines: options.shouldDecodeNewlines,
  53501. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  53502. shouldKeepComment: options.comments,
  53503. outputSourceRange: options.outputSourceRange,
  53504. start: function start (tag, attrs, unary, start$1, end) {
  53505. // check namespace.
  53506. // inherit parent ns if there is one
  53507. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  53508. // handle IE svg bug
  53509. /* istanbul ignore if */
  53510. if (isIE && ns === 'svg') {
  53511. attrs = guardIESVGBug(attrs);
  53512. }
  53513. var element = createASTElement(tag, attrs, currentParent);
  53514. if (ns) {
  53515. element.ns = ns;
  53516. }
  53517. {
  53518. if (options.outputSourceRange) {
  53519. element.start = start$1;
  53520. element.end = end;
  53521. element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
  53522. cumulated[attr.name] = attr;
  53523. return cumulated
  53524. }, {});
  53525. }
  53526. attrs.forEach(function (attr) {
  53527. if (invalidAttributeRE.test(attr.name)) {
  53528. warn$2(
  53529. "Invalid dynamic argument expression: attribute names cannot contain " +
  53530. "spaces, quotes, <, >, / or =.",
  53531. {
  53532. start: attr.start + attr.name.indexOf("["),
  53533. end: attr.start + attr.name.length
  53534. }
  53535. );
  53536. }
  53537. });
  53538. }
  53539. if (isForbiddenTag(element) && !isServerRendering()) {
  53540. element.forbidden = true;
  53541. warn$2(
  53542. 'Templates should only be responsible for mapping the state to the ' +
  53543. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  53544. "<" + tag + ">" + ', as they will not be parsed.',
  53545. { start: element.start }
  53546. );
  53547. }
  53548. // apply pre-transforms
  53549. for (var i = 0; i < preTransforms.length; i++) {
  53550. element = preTransforms[i](element, options) || element;
  53551. }
  53552. if (!inVPre) {
  53553. processPre(element);
  53554. if (element.pre) {
  53555. inVPre = true;
  53556. }
  53557. }
  53558. if (platformIsPreTag(element.tag)) {
  53559. inPre = true;
  53560. }
  53561. if (inVPre) {
  53562. processRawAttrs(element);
  53563. } else if (!element.processed) {
  53564. // structural directives
  53565. processFor(element);
  53566. processIf(element);
  53567. processOnce(element);
  53568. }
  53569. if (!root) {
  53570. root = element;
  53571. {
  53572. checkRootConstraints(root);
  53573. }
  53574. }
  53575. if (!unary) {
  53576. currentParent = element;
  53577. stack.push(element);
  53578. } else {
  53579. closeElement(element);
  53580. }
  53581. },
  53582. end: function end (tag, start, end$1) {
  53583. var element = stack[stack.length - 1];
  53584. // pop stack
  53585. stack.length -= 1;
  53586. currentParent = stack[stack.length - 1];
  53587. if (options.outputSourceRange) {
  53588. element.end = end$1;
  53589. }
  53590. closeElement(element);
  53591. },
  53592. chars: function chars (text, start, end) {
  53593. if (!currentParent) {
  53594. {
  53595. if (text === template) {
  53596. warnOnce(
  53597. 'Component template requires a root element, rather than just text.',
  53598. { start: start }
  53599. );
  53600. } else if ((text = text.trim())) {
  53601. warnOnce(
  53602. ("text \"" + text + "\" outside root element will be ignored."),
  53603. { start: start }
  53604. );
  53605. }
  53606. }
  53607. return
  53608. }
  53609. // IE textarea placeholder bug
  53610. /* istanbul ignore if */
  53611. if (isIE &&
  53612. currentParent.tag === 'textarea' &&
  53613. currentParent.attrsMap.placeholder === text
  53614. ) {
  53615. return
  53616. }
  53617. var children = currentParent.children;
  53618. if (inPre || text.trim()) {
  53619. text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
  53620. } else if (!children.length) {
  53621. // remove the whitespace-only node right after an opening tag
  53622. text = '';
  53623. } else if (whitespaceOption) {
  53624. if (whitespaceOption === 'condense') {
  53625. // in condense mode, remove the whitespace node if it contains
  53626. // line break, otherwise condense to a single space
  53627. text = lineBreakRE.test(text) ? '' : ' ';
  53628. } else {
  53629. text = ' ';
  53630. }
  53631. } else {
  53632. text = preserveWhitespace ? ' ' : '';
  53633. }
  53634. if (text) {
  53635. if (!inPre && whitespaceOption === 'condense') {
  53636. // condense consecutive whitespaces into single space
  53637. text = text.replace(whitespaceRE$1, ' ');
  53638. }
  53639. var res;
  53640. var child;
  53641. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  53642. child = {
  53643. type: 2,
  53644. expression: res.expression,
  53645. tokens: res.tokens,
  53646. text: text
  53647. };
  53648. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  53649. child = {
  53650. type: 3,
  53651. text: text
  53652. };
  53653. }
  53654. if (child) {
  53655. if (options.outputSourceRange) {
  53656. child.start = start;
  53657. child.end = end;
  53658. }
  53659. children.push(child);
  53660. }
  53661. }
  53662. },
  53663. comment: function comment (text, start, end) {
  53664. // adding anyting as a sibling to the root node is forbidden
  53665. // comments should still be allowed, but ignored
  53666. if (currentParent) {
  53667. var child = {
  53668. type: 3,
  53669. text: text,
  53670. isComment: true
  53671. };
  53672. if (options.outputSourceRange) {
  53673. child.start = start;
  53674. child.end = end;
  53675. }
  53676. currentParent.children.push(child);
  53677. }
  53678. }
  53679. });
  53680. return root
  53681. }
  53682. function processPre (el) {
  53683. if (getAndRemoveAttr(el, 'v-pre') != null) {
  53684. el.pre = true;
  53685. }
  53686. }
  53687. function processRawAttrs (el) {
  53688. var list = el.attrsList;
  53689. var len = list.length;
  53690. if (len) {
  53691. var attrs = el.attrs = new Array(len);
  53692. for (var i = 0; i < len; i++) {
  53693. attrs[i] = {
  53694. name: list[i].name,
  53695. value: JSON.stringify(list[i].value)
  53696. };
  53697. if (list[i].start != null) {
  53698. attrs[i].start = list[i].start;
  53699. attrs[i].end = list[i].end;
  53700. }
  53701. }
  53702. } else if (!el.pre) {
  53703. // non root node in pre blocks with no attributes
  53704. el.plain = true;
  53705. }
  53706. }
  53707. function processElement (
  53708. element,
  53709. options
  53710. ) {
  53711. processKey(element);
  53712. // determine whether this is a plain element after
  53713. // removing structural attributes
  53714. element.plain = (
  53715. !element.key &&
  53716. !element.scopedSlots &&
  53717. !element.attrsList.length
  53718. );
  53719. processRef(element);
  53720. processSlotContent(element);
  53721. processSlotOutlet(element);
  53722. processComponent(element);
  53723. for (var i = 0; i < transforms.length; i++) {
  53724. element = transforms[i](element, options) || element;
  53725. }
  53726. processAttrs(element);
  53727. return element
  53728. }
  53729. function processKey (el) {
  53730. var exp = getBindingAttr(el, 'key');
  53731. if (exp) {
  53732. {
  53733. if (el.tag === 'template') {
  53734. warn$2(
  53735. "<template> cannot be keyed. Place the key on real elements instead.",
  53736. getRawBindingAttr(el, 'key')
  53737. );
  53738. }
  53739. if (el.for) {
  53740. var iterator = el.iterator2 || el.iterator1;
  53741. var parent = el.parent;
  53742. if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
  53743. warn$2(
  53744. "Do not use v-for index as key on <transition-group> children, " +
  53745. "this is the same as not using keys.",
  53746. getRawBindingAttr(el, 'key'),
  53747. true /* tip */
  53748. );
  53749. }
  53750. }
  53751. }
  53752. el.key = exp;
  53753. }
  53754. }
  53755. function processRef (el) {
  53756. var ref = getBindingAttr(el, 'ref');
  53757. if (ref) {
  53758. el.ref = ref;
  53759. el.refInFor = checkInFor(el);
  53760. }
  53761. }
  53762. function processFor (el) {
  53763. var exp;
  53764. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  53765. var res = parseFor(exp);
  53766. if (res) {
  53767. extend(el, res);
  53768. } else {
  53769. warn$2(
  53770. ("Invalid v-for expression: " + exp),
  53771. el.rawAttrsMap['v-for']
  53772. );
  53773. }
  53774. }
  53775. }
  53776. function parseFor (exp) {
  53777. var inMatch = exp.match(forAliasRE);
  53778. if (!inMatch) { return }
  53779. var res = {};
  53780. res.for = inMatch[2].trim();
  53781. var alias = inMatch[1].trim().replace(stripParensRE, '');
  53782. var iteratorMatch = alias.match(forIteratorRE);
  53783. if (iteratorMatch) {
  53784. res.alias = alias.replace(forIteratorRE, '').trim();
  53785. res.iterator1 = iteratorMatch[1].trim();
  53786. if (iteratorMatch[2]) {
  53787. res.iterator2 = iteratorMatch[2].trim();
  53788. }
  53789. } else {
  53790. res.alias = alias;
  53791. }
  53792. return res
  53793. }
  53794. function processIf (el) {
  53795. var exp = getAndRemoveAttr(el, 'v-if');
  53796. if (exp) {
  53797. el.if = exp;
  53798. addIfCondition(el, {
  53799. exp: exp,
  53800. block: el
  53801. });
  53802. } else {
  53803. if (getAndRemoveAttr(el, 'v-else') != null) {
  53804. el.else = true;
  53805. }
  53806. var elseif = getAndRemoveAttr(el, 'v-else-if');
  53807. if (elseif) {
  53808. el.elseif = elseif;
  53809. }
  53810. }
  53811. }
  53812. function processIfConditions (el, parent) {
  53813. var prev = findPrevElement(parent.children);
  53814. if (prev && prev.if) {
  53815. addIfCondition(prev, {
  53816. exp: el.elseif,
  53817. block: el
  53818. });
  53819. } else {
  53820. warn$2(
  53821. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  53822. "used on element <" + (el.tag) + "> without corresponding v-if.",
  53823. el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
  53824. );
  53825. }
  53826. }
  53827. function findPrevElement (children) {
  53828. var i = children.length;
  53829. while (i--) {
  53830. if (children[i].type === 1) {
  53831. return children[i]
  53832. } else {
  53833. if (children[i].text !== ' ') {
  53834. warn$2(
  53835. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  53836. "will be ignored.",
  53837. children[i]
  53838. );
  53839. }
  53840. children.pop();
  53841. }
  53842. }
  53843. }
  53844. function addIfCondition (el, condition) {
  53845. if (!el.ifConditions) {
  53846. el.ifConditions = [];
  53847. }
  53848. el.ifConditions.push(condition);
  53849. }
  53850. function processOnce (el) {
  53851. var once$$1 = getAndRemoveAttr(el, 'v-once');
  53852. if (once$$1 != null) {
  53853. el.once = true;
  53854. }
  53855. }
  53856. // handle content being passed to a component as slot,
  53857. // e.g. <template slot="xxx">, <div slot-scope="xxx">
  53858. function processSlotContent (el) {
  53859. var slotScope;
  53860. if (el.tag === 'template') {
  53861. slotScope = getAndRemoveAttr(el, 'scope');
  53862. /* istanbul ignore if */
  53863. if (slotScope) {
  53864. warn$2(
  53865. "the \"scope\" attribute for scoped slots have been deprecated and " +
  53866. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  53867. "can also be used on plain elements in addition to <template> to " +
  53868. "denote scoped slots.",
  53869. el.rawAttrsMap['scope'],
  53870. true
  53871. );
  53872. }
  53873. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  53874. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  53875. /* istanbul ignore if */
  53876. if (el.attrsMap['v-for']) {
  53877. warn$2(
  53878. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  53879. "(v-for takes higher priority). Use a wrapper <template> for the " +
  53880. "scoped slot to make it clearer.",
  53881. el.rawAttrsMap['slot-scope'],
  53882. true
  53883. );
  53884. }
  53885. el.slotScope = slotScope;
  53886. }
  53887. // slot="xxx"
  53888. var slotTarget = getBindingAttr(el, 'slot');
  53889. if (slotTarget) {
  53890. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  53891. el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
  53892. // preserve slot as an attribute for native shadow DOM compat
  53893. // only for non-scoped slots.
  53894. if (el.tag !== 'template' && !el.slotScope) {
  53895. addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
  53896. }
  53897. }
  53898. // 2.6 v-slot syntax
  53899. {
  53900. if (el.tag === 'template') {
  53901. // v-slot on <template>
  53902. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  53903. if (slotBinding) {
  53904. {
  53905. if (el.slotTarget || el.slotScope) {
  53906. warn$2(
  53907. "Unexpected mixed usage of different slot syntaxes.",
  53908. el
  53909. );
  53910. }
  53911. if (el.parent && !maybeComponent(el.parent)) {
  53912. warn$2(
  53913. "<template v-slot> can only appear at the root level inside " +
  53914. "the receiving component",
  53915. el
  53916. );
  53917. }
  53918. }
  53919. var ref = getSlotName(slotBinding);
  53920. var name = ref.name;
  53921. var dynamic = ref.dynamic;
  53922. el.slotTarget = name;
  53923. el.slotTargetDynamic = dynamic;
  53924. el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
  53925. }
  53926. } else {
  53927. // v-slot on component, denotes default slot
  53928. var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
  53929. if (slotBinding$1) {
  53930. {
  53931. if (!maybeComponent(el)) {
  53932. warn$2(
  53933. "v-slot can only be used on components or <template>.",
  53934. slotBinding$1
  53935. );
  53936. }
  53937. if (el.slotScope || el.slotTarget) {
  53938. warn$2(
  53939. "Unexpected mixed usage of different slot syntaxes.",
  53940. el
  53941. );
  53942. }
  53943. if (el.scopedSlots) {
  53944. warn$2(
  53945. "To avoid scope ambiguity, the default slot should also use " +
  53946. "<template> syntax when there are other named slots.",
  53947. slotBinding$1
  53948. );
  53949. }
  53950. }
  53951. // add the component's children to its default slot
  53952. var slots = el.scopedSlots || (el.scopedSlots = {});
  53953. var ref$1 = getSlotName(slotBinding$1);
  53954. var name$1 = ref$1.name;
  53955. var dynamic$1 = ref$1.dynamic;
  53956. var slotContainer = slots[name$1] = createASTElement('template', [], el);
  53957. slotContainer.slotTarget = name$1;
  53958. slotContainer.slotTargetDynamic = dynamic$1;
  53959. slotContainer.children = el.children.filter(function (c) {
  53960. if (!c.slotScope) {
  53961. c.parent = slotContainer;
  53962. return true
  53963. }
  53964. });
  53965. slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
  53966. // remove children as they are returned from scopedSlots now
  53967. el.children = [];
  53968. // mark el non-plain so data gets generated
  53969. el.plain = false;
  53970. }
  53971. }
  53972. }
  53973. }
  53974. function getSlotName (binding) {
  53975. var name = binding.name.replace(slotRE, '');
  53976. if (!name) {
  53977. if (binding.name[0] !== '#') {
  53978. name = 'default';
  53979. } else {
  53980. warn$2(
  53981. "v-slot shorthand syntax requires a slot name.",
  53982. binding
  53983. );
  53984. }
  53985. }
  53986. return dynamicArgRE.test(name)
  53987. // dynamic [name]
  53988. ? { name: name.slice(1, -1), dynamic: true }
  53989. // static name
  53990. : { name: ("\"" + name + "\""), dynamic: false }
  53991. }
  53992. // handle <slot/> outlets
  53993. function processSlotOutlet (el) {
  53994. if (el.tag === 'slot') {
  53995. el.slotName = getBindingAttr(el, 'name');
  53996. if (el.key) {
  53997. warn$2(
  53998. "`key` does not work on <slot> because slots are abstract outlets " +
  53999. "and can possibly expand into multiple elements. " +
  54000. "Use the key on a wrapping element instead.",
  54001. getRawBindingAttr(el, 'key')
  54002. );
  54003. }
  54004. }
  54005. }
  54006. function processComponent (el) {
  54007. var binding;
  54008. if ((binding = getBindingAttr(el, 'is'))) {
  54009. el.component = binding;
  54010. }
  54011. if (getAndRemoveAttr(el, 'inline-template') != null) {
  54012. el.inlineTemplate = true;
  54013. }
  54014. }
  54015. function processAttrs (el) {
  54016. var list = el.attrsList;
  54017. var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
  54018. for (i = 0, l = list.length; i < l; i++) {
  54019. name = rawName = list[i].name;
  54020. value = list[i].value;
  54021. if (dirRE.test(name)) {
  54022. // mark element as dynamic
  54023. el.hasBindings = true;
  54024. // modifiers
  54025. modifiers = parseModifiers(name.replace(dirRE, ''));
  54026. // support .foo shorthand syntax for the .prop modifier
  54027. if (modifiers) {
  54028. name = name.replace(modifierRE, '');
  54029. }
  54030. if (bindRE.test(name)) { // v-bind
  54031. name = name.replace(bindRE, '');
  54032. value = parseFilters(value);
  54033. isDynamic = dynamicArgRE.test(name);
  54034. if (isDynamic) {
  54035. name = name.slice(1, -1);
  54036. }
  54037. if (
  54038. value.trim().length === 0
  54039. ) {
  54040. warn$2(
  54041. ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
  54042. );
  54043. }
  54044. if (modifiers) {
  54045. if (modifiers.prop && !isDynamic) {
  54046. name = camelize(name);
  54047. if (name === 'innerHtml') { name = 'innerHTML'; }
  54048. }
  54049. if (modifiers.camel && !isDynamic) {
  54050. name = camelize(name);
  54051. }
  54052. if (modifiers.sync) {
  54053. syncGen = genAssignmentCode(value, "$event");
  54054. if (!isDynamic) {
  54055. addHandler(
  54056. el,
  54057. ("update:" + (camelize(name))),
  54058. syncGen,
  54059. null,
  54060. false,
  54061. warn$2,
  54062. list[i]
  54063. );
  54064. if (hyphenate(name) !== camelize(name)) {
  54065. addHandler(
  54066. el,
  54067. ("update:" + (hyphenate(name))),
  54068. syncGen,
  54069. null,
  54070. false,
  54071. warn$2,
  54072. list[i]
  54073. );
  54074. }
  54075. } else {
  54076. // handler w/ dynamic event name
  54077. addHandler(
  54078. el,
  54079. ("\"update:\"+(" + name + ")"),
  54080. syncGen,
  54081. null,
  54082. false,
  54083. warn$2,
  54084. list[i],
  54085. true // dynamic
  54086. );
  54087. }
  54088. }
  54089. }
  54090. if ((modifiers && modifiers.prop) || (
  54091. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  54092. )) {
  54093. addProp(el, name, value, list[i], isDynamic);
  54094. } else {
  54095. addAttr(el, name, value, list[i], isDynamic);
  54096. }
  54097. } else if (onRE.test(name)) { // v-on
  54098. name = name.replace(onRE, '');
  54099. isDynamic = dynamicArgRE.test(name);
  54100. if (isDynamic) {
  54101. name = name.slice(1, -1);
  54102. }
  54103. addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
  54104. } else { // normal directives
  54105. name = name.replace(dirRE, '');
  54106. // parse arg
  54107. var argMatch = name.match(argRE);
  54108. var arg = argMatch && argMatch[1];
  54109. isDynamic = false;
  54110. if (arg) {
  54111. name = name.slice(0, -(arg.length + 1));
  54112. if (dynamicArgRE.test(arg)) {
  54113. arg = arg.slice(1, -1);
  54114. isDynamic = true;
  54115. }
  54116. }
  54117. addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
  54118. if (name === 'model') {
  54119. checkForAliasModel(el, value);
  54120. }
  54121. }
  54122. } else {
  54123. // literal attribute
  54124. {
  54125. var res = parseText(value, delimiters);
  54126. if (res) {
  54127. warn$2(
  54128. name + "=\"" + value + "\": " +
  54129. 'Interpolation inside attributes has been removed. ' +
  54130. 'Use v-bind or the colon shorthand instead. For example, ' +
  54131. 'instead of <div id="{{ val }}">, use <div :id="val">.',
  54132. list[i]
  54133. );
  54134. }
  54135. }
  54136. addAttr(el, name, JSON.stringify(value), list[i]);
  54137. // #6887 firefox doesn't update muted state if set via attribute
  54138. // even immediately after element creation
  54139. if (!el.component &&
  54140. name === 'muted' &&
  54141. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  54142. addProp(el, name, 'true', list[i]);
  54143. }
  54144. }
  54145. }
  54146. }
  54147. function checkInFor (el) {
  54148. var parent = el;
  54149. while (parent) {
  54150. if (parent.for !== undefined) {
  54151. return true
  54152. }
  54153. parent = parent.parent;
  54154. }
  54155. return false
  54156. }
  54157. function parseModifiers (name) {
  54158. var match = name.match(modifierRE);
  54159. if (match) {
  54160. var ret = {};
  54161. match.forEach(function (m) { ret[m.slice(1)] = true; });
  54162. return ret
  54163. }
  54164. }
  54165. function makeAttrsMap (attrs) {
  54166. var map = {};
  54167. for (var i = 0, l = attrs.length; i < l; i++) {
  54168. if (
  54169. map[attrs[i].name] && !isIE && !isEdge
  54170. ) {
  54171. warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
  54172. }
  54173. map[attrs[i].name] = attrs[i].value;
  54174. }
  54175. return map
  54176. }
  54177. // for script (e.g. type="x/template") or style, do not decode content
  54178. function isTextTag (el) {
  54179. return el.tag === 'script' || el.tag === 'style'
  54180. }
  54181. function isForbiddenTag (el) {
  54182. return (
  54183. el.tag === 'style' ||
  54184. (el.tag === 'script' && (
  54185. !el.attrsMap.type ||
  54186. el.attrsMap.type === 'text/javascript'
  54187. ))
  54188. )
  54189. }
  54190. var ieNSBug = /^xmlns:NS\d+/;
  54191. var ieNSPrefix = /^NS\d+:/;
  54192. /* istanbul ignore next */
  54193. function guardIESVGBug (attrs) {
  54194. var res = [];
  54195. for (var i = 0; i < attrs.length; i++) {
  54196. var attr = attrs[i];
  54197. if (!ieNSBug.test(attr.name)) {
  54198. attr.name = attr.name.replace(ieNSPrefix, '');
  54199. res.push(attr);
  54200. }
  54201. }
  54202. return res
  54203. }
  54204. function checkForAliasModel (el, value) {
  54205. var _el = el;
  54206. while (_el) {
  54207. if (_el.for && _el.alias === value) {
  54208. warn$2(
  54209. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  54210. "You are binding v-model directly to a v-for iteration alias. " +
  54211. "This will not be able to modify the v-for source array because " +
  54212. "writing to the alias is like modifying a function local variable. " +
  54213. "Consider using an array of objects and use v-model on an object property instead.",
  54214. el.rawAttrsMap['v-model']
  54215. );
  54216. }
  54217. _el = _el.parent;
  54218. }
  54219. }
  54220. /* */
  54221. function preTransformNode (el, options) {
  54222. if (el.tag === 'input') {
  54223. var map = el.attrsMap;
  54224. if (!map['v-model']) {
  54225. return
  54226. }
  54227. var typeBinding;
  54228. if (map[':type'] || map['v-bind:type']) {
  54229. typeBinding = getBindingAttr(el, 'type');
  54230. }
  54231. if (!map.type && !typeBinding && map['v-bind']) {
  54232. typeBinding = "(" + (map['v-bind']) + ").type";
  54233. }
  54234. if (typeBinding) {
  54235. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  54236. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  54237. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  54238. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  54239. // 1. checkbox
  54240. var branch0 = cloneASTElement(el);
  54241. // process for on the main node
  54242. processFor(branch0);
  54243. addRawAttr(branch0, 'type', 'checkbox');
  54244. processElement(branch0, options);
  54245. branch0.processed = true; // prevent it from double-processed
  54246. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  54247. addIfCondition(branch0, {
  54248. exp: branch0.if,
  54249. block: branch0
  54250. });
  54251. // 2. add radio else-if condition
  54252. var branch1 = cloneASTElement(el);
  54253. getAndRemoveAttr(branch1, 'v-for', true);
  54254. addRawAttr(branch1, 'type', 'radio');
  54255. processElement(branch1, options);
  54256. addIfCondition(branch0, {
  54257. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  54258. block: branch1
  54259. });
  54260. // 3. other
  54261. var branch2 = cloneASTElement(el);
  54262. getAndRemoveAttr(branch2, 'v-for', true);
  54263. addRawAttr(branch2, ':type', typeBinding);
  54264. processElement(branch2, options);
  54265. addIfCondition(branch0, {
  54266. exp: ifCondition,
  54267. block: branch2
  54268. });
  54269. if (hasElse) {
  54270. branch0.else = true;
  54271. } else if (elseIfCondition) {
  54272. branch0.elseif = elseIfCondition;
  54273. }
  54274. return branch0
  54275. }
  54276. }
  54277. }
  54278. function cloneASTElement (el) {
  54279. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  54280. }
  54281. var model$1 = {
  54282. preTransformNode: preTransformNode
  54283. };
  54284. var modules$1 = [
  54285. klass$1,
  54286. style$1,
  54287. model$1
  54288. ];
  54289. /* */
  54290. function text (el, dir) {
  54291. if (dir.value) {
  54292. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
  54293. }
  54294. }
  54295. /* */
  54296. function html (el, dir) {
  54297. if (dir.value) {
  54298. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
  54299. }
  54300. }
  54301. var directives$1 = {
  54302. model: model,
  54303. text: text,
  54304. html: html
  54305. };
  54306. /* */
  54307. var baseOptions = {
  54308. expectHTML: true,
  54309. modules: modules$1,
  54310. directives: directives$1,
  54311. isPreTag: isPreTag,
  54312. isUnaryTag: isUnaryTag,
  54313. mustUseProp: mustUseProp,
  54314. canBeLeftOpenTag: canBeLeftOpenTag,
  54315. isReservedTag: isReservedTag,
  54316. getTagNamespace: getTagNamespace,
  54317. staticKeys: genStaticKeys(modules$1)
  54318. };
  54319. /* */
  54320. var isStaticKey;
  54321. var isPlatformReservedTag;
  54322. var genStaticKeysCached = cached(genStaticKeys$1);
  54323. /**
  54324. * Goal of the optimizer: walk the generated template AST tree
  54325. * and detect sub-trees that are purely static, i.e. parts of
  54326. * the DOM that never needs to change.
  54327. *
  54328. * Once we detect these sub-trees, we can:
  54329. *
  54330. * 1. Hoist them into constants, so that we no longer need to
  54331. * create fresh nodes for them on each re-render;
  54332. * 2. Completely skip them in the patching process.
  54333. */
  54334. function optimize (root, options) {
  54335. if (!root) { return }
  54336. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  54337. isPlatformReservedTag = options.isReservedTag || no;
  54338. // first pass: mark all non-static nodes.
  54339. markStatic$1(root);
  54340. // second pass: mark static roots.
  54341. markStaticRoots(root, false);
  54342. }
  54343. function genStaticKeys$1 (keys) {
  54344. return makeMap(
  54345. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
  54346. (keys ? ',' + keys : '')
  54347. )
  54348. }
  54349. function markStatic$1 (node) {
  54350. node.static = isStatic(node);
  54351. if (node.type === 1) {
  54352. // do not make component slot content static. this avoids
  54353. // 1. components not able to mutate slot nodes
  54354. // 2. static slot content fails for hot-reloading
  54355. if (
  54356. !isPlatformReservedTag(node.tag) &&
  54357. node.tag !== 'slot' &&
  54358. node.attrsMap['inline-template'] == null
  54359. ) {
  54360. return
  54361. }
  54362. for (var i = 0, l = node.children.length; i < l; i++) {
  54363. var child = node.children[i];
  54364. markStatic$1(child);
  54365. if (!child.static) {
  54366. node.static = false;
  54367. }
  54368. }
  54369. if (node.ifConditions) {
  54370. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  54371. var block = node.ifConditions[i$1].block;
  54372. markStatic$1(block);
  54373. if (!block.static) {
  54374. node.static = false;
  54375. }
  54376. }
  54377. }
  54378. }
  54379. }
  54380. function markStaticRoots (node, isInFor) {
  54381. if (node.type === 1) {
  54382. if (node.static || node.once) {
  54383. node.staticInFor = isInFor;
  54384. }
  54385. // For a node to qualify as a static root, it should have children that
  54386. // are not just static text. Otherwise the cost of hoisting out will
  54387. // outweigh the benefits and it's better off to just always render it fresh.
  54388. if (node.static && node.children.length && !(
  54389. node.children.length === 1 &&
  54390. node.children[0].type === 3
  54391. )) {
  54392. node.staticRoot = true;
  54393. return
  54394. } else {
  54395. node.staticRoot = false;
  54396. }
  54397. if (node.children) {
  54398. for (var i = 0, l = node.children.length; i < l; i++) {
  54399. markStaticRoots(node.children[i], isInFor || !!node.for);
  54400. }
  54401. }
  54402. if (node.ifConditions) {
  54403. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  54404. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  54405. }
  54406. }
  54407. }
  54408. }
  54409. function isStatic (node) {
  54410. if (node.type === 2) { // expression
  54411. return false
  54412. }
  54413. if (node.type === 3) { // text
  54414. return true
  54415. }
  54416. return !!(node.pre || (
  54417. !node.hasBindings && // no dynamic bindings
  54418. !node.if && !node.for && // not v-if or v-for or v-else
  54419. !isBuiltInTag(node.tag) && // not a built-in
  54420. isPlatformReservedTag(node.tag) && // not a component
  54421. !isDirectChildOfTemplateFor(node) &&
  54422. Object.keys(node).every(isStaticKey)
  54423. ))
  54424. }
  54425. function isDirectChildOfTemplateFor (node) {
  54426. while (node.parent) {
  54427. node = node.parent;
  54428. if (node.tag !== 'template') {
  54429. return false
  54430. }
  54431. if (node.for) {
  54432. return true
  54433. }
  54434. }
  54435. return false
  54436. }
  54437. /* */
  54438. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
  54439. var fnInvokeRE = /\([^)]*?\);*$/;
  54440. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  54441. // KeyboardEvent.keyCode aliases
  54442. var keyCodes = {
  54443. esc: 27,
  54444. tab: 9,
  54445. enter: 13,
  54446. space: 32,
  54447. up: 38,
  54448. left: 37,
  54449. right: 39,
  54450. down: 40,
  54451. 'delete': [8, 46]
  54452. };
  54453. // KeyboardEvent.key aliases
  54454. var keyNames = {
  54455. // #7880: IE11 and Edge use `Esc` for Escape key name.
  54456. esc: ['Esc', 'Escape'],
  54457. tab: 'Tab',
  54458. enter: 'Enter',
  54459. // #9112: IE11 uses `Spacebar` for Space key name.
  54460. space: [' ', 'Spacebar'],
  54461. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  54462. up: ['Up', 'ArrowUp'],
  54463. left: ['Left', 'ArrowLeft'],
  54464. right: ['Right', 'ArrowRight'],
  54465. down: ['Down', 'ArrowDown'],
  54466. // #9112: IE11 uses `Del` for Delete key name.
  54467. 'delete': ['Backspace', 'Delete', 'Del']
  54468. };
  54469. // #4868: modifiers that prevent the execution of the listener
  54470. // need to explicitly return null so that we can determine whether to remove
  54471. // the listener for .once
  54472. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  54473. var modifierCode = {
  54474. stop: '$event.stopPropagation();',
  54475. prevent: '$event.preventDefault();',
  54476. self: genGuard("$event.target !== $event.currentTarget"),
  54477. ctrl: genGuard("!$event.ctrlKey"),
  54478. shift: genGuard("!$event.shiftKey"),
  54479. alt: genGuard("!$event.altKey"),
  54480. meta: genGuard("!$event.metaKey"),
  54481. left: genGuard("'button' in $event && $event.button !== 0"),
  54482. middle: genGuard("'button' in $event && $event.button !== 1"),
  54483. right: genGuard("'button' in $event && $event.button !== 2")
  54484. };
  54485. function genHandlers (
  54486. events,
  54487. isNative
  54488. ) {
  54489. var prefix = isNative ? 'nativeOn:' : 'on:';
  54490. var staticHandlers = "";
  54491. var dynamicHandlers = "";
  54492. for (var name in events) {
  54493. var handlerCode = genHandler(events[name]);
  54494. if (events[name] && events[name].dynamic) {
  54495. dynamicHandlers += name + "," + handlerCode + ",";
  54496. } else {
  54497. staticHandlers += "\"" + name + "\":" + handlerCode + ",";
  54498. }
  54499. }
  54500. staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
  54501. if (dynamicHandlers) {
  54502. return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
  54503. } else {
  54504. return prefix + staticHandlers
  54505. }
  54506. }
  54507. function genHandler (handler) {
  54508. if (!handler) {
  54509. return 'function(){}'
  54510. }
  54511. if (Array.isArray(handler)) {
  54512. return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
  54513. }
  54514. var isMethodPath = simplePathRE.test(handler.value);
  54515. var isFunctionExpression = fnExpRE.test(handler.value);
  54516. var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
  54517. if (!handler.modifiers) {
  54518. if (isMethodPath || isFunctionExpression) {
  54519. return handler.value
  54520. }
  54521. return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
  54522. } else {
  54523. var code = '';
  54524. var genModifierCode = '';
  54525. var keys = [];
  54526. for (var key in handler.modifiers) {
  54527. if (modifierCode[key]) {
  54528. genModifierCode += modifierCode[key];
  54529. // left/right
  54530. if (keyCodes[key]) {
  54531. keys.push(key);
  54532. }
  54533. } else if (key === 'exact') {
  54534. var modifiers = (handler.modifiers);
  54535. genModifierCode += genGuard(
  54536. ['ctrl', 'shift', 'alt', 'meta']
  54537. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  54538. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  54539. .join('||')
  54540. );
  54541. } else {
  54542. keys.push(key);
  54543. }
  54544. }
  54545. if (keys.length) {
  54546. code += genKeyFilter(keys);
  54547. }
  54548. // Make sure modifiers like prevent and stop get executed after key filtering
  54549. if (genModifierCode) {
  54550. code += genModifierCode;
  54551. }
  54552. var handlerCode = isMethodPath
  54553. ? ("return " + (handler.value) + "($event)")
  54554. : isFunctionExpression
  54555. ? ("return (" + (handler.value) + ")($event)")
  54556. : isFunctionInvocation
  54557. ? ("return " + (handler.value))
  54558. : handler.value;
  54559. return ("function($event){" + code + handlerCode + "}")
  54560. }
  54561. }
  54562. function genKeyFilter (keys) {
  54563. return (
  54564. // make sure the key filters only apply to KeyboardEvents
  54565. // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
  54566. // key events that do not have keyCode property...
  54567. "if(!$event.type.indexOf('key')&&" +
  54568. (keys.map(genFilterCode).join('&&')) + ")return null;"
  54569. )
  54570. }
  54571. function genFilterCode (key) {
  54572. var keyVal = parseInt(key, 10);
  54573. if (keyVal) {
  54574. return ("$event.keyCode!==" + keyVal)
  54575. }
  54576. var keyCode = keyCodes[key];
  54577. var keyName = keyNames[key];
  54578. return (
  54579. "_k($event.keyCode," +
  54580. (JSON.stringify(key)) + "," +
  54581. (JSON.stringify(keyCode)) + "," +
  54582. "$event.key," +
  54583. "" + (JSON.stringify(keyName)) +
  54584. ")"
  54585. )
  54586. }
  54587. /* */
  54588. function on (el, dir) {
  54589. if (dir.modifiers) {
  54590. warn("v-on without argument does not support modifiers.");
  54591. }
  54592. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  54593. }
  54594. /* */
  54595. function bind$1 (el, dir) {
  54596. el.wrapData = function (code) {
  54597. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  54598. };
  54599. }
  54600. /* */
  54601. var baseDirectives = {
  54602. on: on,
  54603. bind: bind$1,
  54604. cloak: noop
  54605. };
  54606. /* */
  54607. var CodegenState = function CodegenState (options) {
  54608. this.options = options;
  54609. this.warn = options.warn || baseWarn;
  54610. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  54611. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  54612. this.directives = extend(extend({}, baseDirectives), options.directives);
  54613. var isReservedTag = options.isReservedTag || no;
  54614. this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  54615. this.onceId = 0;
  54616. this.staticRenderFns = [];
  54617. this.pre = false;
  54618. };
  54619. function generate (
  54620. ast,
  54621. options
  54622. ) {
  54623. var state = new CodegenState(options);
  54624. var code = ast ? genElement(ast, state) : '_c("div")';
  54625. return {
  54626. render: ("with(this){return " + code + "}"),
  54627. staticRenderFns: state.staticRenderFns
  54628. }
  54629. }
  54630. function genElement (el, state) {
  54631. if (el.parent) {
  54632. el.pre = el.pre || el.parent.pre;
  54633. }
  54634. if (el.staticRoot && !el.staticProcessed) {
  54635. return genStatic(el, state)
  54636. } else if (el.once && !el.onceProcessed) {
  54637. return genOnce(el, state)
  54638. } else if (el.for && !el.forProcessed) {
  54639. return genFor(el, state)
  54640. } else if (el.if && !el.ifProcessed) {
  54641. return genIf(el, state)
  54642. } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  54643. return genChildren(el, state) || 'void 0'
  54644. } else if (el.tag === 'slot') {
  54645. return genSlot(el, state)
  54646. } else {
  54647. // component or element
  54648. var code;
  54649. if (el.component) {
  54650. code = genComponent(el.component, el, state);
  54651. } else {
  54652. var data;
  54653. if (!el.plain || (el.pre && state.maybeComponent(el))) {
  54654. data = genData$2(el, state);
  54655. }
  54656. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  54657. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  54658. }
  54659. // module transforms
  54660. for (var i = 0; i < state.transforms.length; i++) {
  54661. code = state.transforms[i](el, code);
  54662. }
  54663. return code
  54664. }
  54665. }
  54666. // hoist static sub-trees out
  54667. function genStatic (el, state) {
  54668. el.staticProcessed = true;
  54669. // Some elements (templates) need to behave differently inside of a v-pre
  54670. // node. All pre nodes are static roots, so we can use this as a location to
  54671. // wrap a state change and reset it upon exiting the pre node.
  54672. var originalPreState = state.pre;
  54673. if (el.pre) {
  54674. state.pre = el.pre;
  54675. }
  54676. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  54677. state.pre = originalPreState;
  54678. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  54679. }
  54680. // v-once
  54681. function genOnce (el, state) {
  54682. el.onceProcessed = true;
  54683. if (el.if && !el.ifProcessed) {
  54684. return genIf(el, state)
  54685. } else if (el.staticInFor) {
  54686. var key = '';
  54687. var parent = el.parent;
  54688. while (parent) {
  54689. if (parent.for) {
  54690. key = parent.key;
  54691. break
  54692. }
  54693. parent = parent.parent;
  54694. }
  54695. if (!key) {
  54696. state.warn(
  54697. "v-once can only be used inside v-for that is keyed. ",
  54698. el.rawAttrsMap['v-once']
  54699. );
  54700. return genElement(el, state)
  54701. }
  54702. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  54703. } else {
  54704. return genStatic(el, state)
  54705. }
  54706. }
  54707. function genIf (
  54708. el,
  54709. state,
  54710. altGen,
  54711. altEmpty
  54712. ) {
  54713. el.ifProcessed = true; // avoid recursion
  54714. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  54715. }
  54716. function genIfConditions (
  54717. conditions,
  54718. state,
  54719. altGen,
  54720. altEmpty
  54721. ) {
  54722. if (!conditions.length) {
  54723. return altEmpty || '_e()'
  54724. }
  54725. var condition = conditions.shift();
  54726. if (condition.exp) {
  54727. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  54728. } else {
  54729. return ("" + (genTernaryExp(condition.block)))
  54730. }
  54731. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  54732. function genTernaryExp (el) {
  54733. return altGen
  54734. ? altGen(el, state)
  54735. : el.once
  54736. ? genOnce(el, state)
  54737. : genElement(el, state)
  54738. }
  54739. }
  54740. function genFor (
  54741. el,
  54742. state,
  54743. altGen,
  54744. altHelper
  54745. ) {
  54746. var exp = el.for;
  54747. var alias = el.alias;
  54748. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  54749. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  54750. if (state.maybeComponent(el) &&
  54751. el.tag !== 'slot' &&
  54752. el.tag !== 'template' &&
  54753. !el.key
  54754. ) {
  54755. state.warn(
  54756. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  54757. "v-for should have explicit keys. " +
  54758. "See https://vuejs.org/guide/list.html#key for more info.",
  54759. el.rawAttrsMap['v-for'],
  54760. true /* tip */
  54761. );
  54762. }
  54763. el.forProcessed = true; // avoid recursion
  54764. return (altHelper || '_l') + "((" + exp + ")," +
  54765. "function(" + alias + iterator1 + iterator2 + "){" +
  54766. "return " + ((altGen || genElement)(el, state)) +
  54767. '})'
  54768. }
  54769. function genData$2 (el, state) {
  54770. var data = '{';
  54771. // directives first.
  54772. // directives may mutate the el's other properties before they are generated.
  54773. var dirs = genDirectives(el, state);
  54774. if (dirs) { data += dirs + ','; }
  54775. // key
  54776. if (el.key) {
  54777. data += "key:" + (el.key) + ",";
  54778. }
  54779. // ref
  54780. if (el.ref) {
  54781. data += "ref:" + (el.ref) + ",";
  54782. }
  54783. if (el.refInFor) {
  54784. data += "refInFor:true,";
  54785. }
  54786. // pre
  54787. if (el.pre) {
  54788. data += "pre:true,";
  54789. }
  54790. // record original tag name for components using "is" attribute
  54791. if (el.component) {
  54792. data += "tag:\"" + (el.tag) + "\",";
  54793. }
  54794. // module data generation functions
  54795. for (var i = 0; i < state.dataGenFns.length; i++) {
  54796. data += state.dataGenFns[i](el);
  54797. }
  54798. // attributes
  54799. if (el.attrs) {
  54800. data += "attrs:" + (genProps(el.attrs)) + ",";
  54801. }
  54802. // DOM props
  54803. if (el.props) {
  54804. data += "domProps:" + (genProps(el.props)) + ",";
  54805. }
  54806. // event handlers
  54807. if (el.events) {
  54808. data += (genHandlers(el.events, false)) + ",";
  54809. }
  54810. if (el.nativeEvents) {
  54811. data += (genHandlers(el.nativeEvents, true)) + ",";
  54812. }
  54813. // slot target
  54814. // only for non-scoped slots
  54815. if (el.slotTarget && !el.slotScope) {
  54816. data += "slot:" + (el.slotTarget) + ",";
  54817. }
  54818. // scoped slots
  54819. if (el.scopedSlots) {
  54820. data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
  54821. }
  54822. // component v-model
  54823. if (el.model) {
  54824. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  54825. }
  54826. // inline-template
  54827. if (el.inlineTemplate) {
  54828. var inlineTemplate = genInlineTemplate(el, state);
  54829. if (inlineTemplate) {
  54830. data += inlineTemplate + ",";
  54831. }
  54832. }
  54833. data = data.replace(/,$/, '') + '}';
  54834. // v-bind dynamic argument wrap
  54835. // v-bind with dynamic arguments must be applied using the same v-bind object
  54836. // merge helper so that class/style/mustUseProp attrs are handled correctly.
  54837. if (el.dynamicAttrs) {
  54838. data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
  54839. }
  54840. // v-bind data wrap
  54841. if (el.wrapData) {
  54842. data = el.wrapData(data);
  54843. }
  54844. // v-on data wrap
  54845. if (el.wrapListeners) {
  54846. data = el.wrapListeners(data);
  54847. }
  54848. return data
  54849. }
  54850. function genDirectives (el, state) {
  54851. var dirs = el.directives;
  54852. if (!dirs) { return }
  54853. var res = 'directives:[';
  54854. var hasRuntime = false;
  54855. var i, l, dir, needRuntime;
  54856. for (i = 0, l = dirs.length; i < l; i++) {
  54857. dir = dirs[i];
  54858. needRuntime = true;
  54859. var gen = state.directives[dir.name];
  54860. if (gen) {
  54861. // compile-time directive that manipulates AST.
  54862. // returns true if it also needs a runtime counterpart.
  54863. needRuntime = !!gen(el, dir, state.warn);
  54864. }
  54865. if (needRuntime) {
  54866. hasRuntime = true;
  54867. 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))) : '') + "},";
  54868. }
  54869. }
  54870. if (hasRuntime) {
  54871. return res.slice(0, -1) + ']'
  54872. }
  54873. }
  54874. function genInlineTemplate (el, state) {
  54875. var ast = el.children[0];
  54876. if (el.children.length !== 1 || ast.type !== 1) {
  54877. state.warn(
  54878. 'Inline-template components must have exactly one child element.',
  54879. { start: el.start }
  54880. );
  54881. }
  54882. if (ast && ast.type === 1) {
  54883. var inlineRenderFns = generate(ast, state.options);
  54884. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  54885. }
  54886. }
  54887. function genScopedSlots (
  54888. el,
  54889. slots,
  54890. state
  54891. ) {
  54892. // by default scoped slots are considered "stable", this allows child
  54893. // components with only scoped slots to skip forced updates from parent.
  54894. // but in some cases we have to bail-out of this optimization
  54895. // for example if the slot contains dynamic names, has v-if or v-for on them...
  54896. var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
  54897. var slot = slots[key];
  54898. return (
  54899. slot.slotTargetDynamic ||
  54900. slot.if ||
  54901. slot.for ||
  54902. containsSlotChild(slot) // is passing down slot from parent which may be dynamic
  54903. )
  54904. });
  54905. // #9534: if a component with scoped slots is inside a conditional branch,
  54906. // it's possible for the same component to be reused but with different
  54907. // compiled slot content. To avoid that, we generate a unique key based on
  54908. // the generated code of all the slot contents.
  54909. var needsKey = !!el.if;
  54910. // OR when it is inside another scoped slot or v-for (the reactivity may be
  54911. // disconnected due to the intermediate scope variable)
  54912. // #9438, #9506
  54913. // TODO: this can be further optimized by properly analyzing in-scope bindings
  54914. // and skip force updating ones that do not actually use scope variables.
  54915. if (!needsForceUpdate) {
  54916. var parent = el.parent;
  54917. while (parent) {
  54918. if (
  54919. (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
  54920. parent.for
  54921. ) {
  54922. needsForceUpdate = true;
  54923. break
  54924. }
  54925. if (parent.if) {
  54926. needsKey = true;
  54927. }
  54928. parent = parent.parent;
  54929. }
  54930. }
  54931. var generatedSlots = Object.keys(slots)
  54932. .map(function (key) { return genScopedSlot(slots[key], state); })
  54933. .join(',');
  54934. return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
  54935. }
  54936. function hash(str) {
  54937. var hash = 5381;
  54938. var i = str.length;
  54939. while(i) {
  54940. hash = (hash * 33) ^ str.charCodeAt(--i);
  54941. }
  54942. return hash >>> 0
  54943. }
  54944. function containsSlotChild (el) {
  54945. if (el.type === 1) {
  54946. if (el.tag === 'slot') {
  54947. return true
  54948. }
  54949. return el.children.some(containsSlotChild)
  54950. }
  54951. return false
  54952. }
  54953. function genScopedSlot (
  54954. el,
  54955. state
  54956. ) {
  54957. var isLegacySyntax = el.attrsMap['slot-scope'];
  54958. if (el.if && !el.ifProcessed && !isLegacySyntax) {
  54959. return genIf(el, state, genScopedSlot, "null")
  54960. }
  54961. if (el.for && !el.forProcessed) {
  54962. return genFor(el, state, genScopedSlot)
  54963. }
  54964. var slotScope = el.slotScope === emptySlotScopeToken
  54965. ? ""
  54966. : String(el.slotScope);
  54967. var fn = "function(" + slotScope + "){" +
  54968. "return " + (el.tag === 'template'
  54969. ? el.if && isLegacySyntax
  54970. ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
  54971. : genChildren(el, state) || 'undefined'
  54972. : genElement(el, state)) + "}";
  54973. // reverse proxy v-slot without scope on this.$slots
  54974. var reverseProxy = slotScope ? "" : ",proxy:true";
  54975. return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
  54976. }
  54977. function genChildren (
  54978. el,
  54979. state,
  54980. checkSkip,
  54981. altGenElement,
  54982. altGenNode
  54983. ) {
  54984. var children = el.children;
  54985. if (children.length) {
  54986. var el$1 = children[0];
  54987. // optimize single v-for
  54988. if (children.length === 1 &&
  54989. el$1.for &&
  54990. el$1.tag !== 'template' &&
  54991. el$1.tag !== 'slot'
  54992. ) {
  54993. var normalizationType = checkSkip
  54994. ? state.maybeComponent(el$1) ? ",1" : ",0"
  54995. : "";
  54996. return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
  54997. }
  54998. var normalizationType$1 = checkSkip
  54999. ? getNormalizationType(children, state.maybeComponent)
  55000. : 0;
  55001. var gen = altGenNode || genNode;
  55002. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
  55003. }
  55004. }
  55005. // determine the normalization needed for the children array.
  55006. // 0: no normalization needed
  55007. // 1: simple normalization needed (possible 1-level deep nested array)
  55008. // 2: full normalization needed
  55009. function getNormalizationType (
  55010. children,
  55011. maybeComponent
  55012. ) {
  55013. var res = 0;
  55014. for (var i = 0; i < children.length; i++) {
  55015. var el = children[i];
  55016. if (el.type !== 1) {
  55017. continue
  55018. }
  55019. if (needsNormalization(el) ||
  55020. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  55021. res = 2;
  55022. break
  55023. }
  55024. if (maybeComponent(el) ||
  55025. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  55026. res = 1;
  55027. }
  55028. }
  55029. return res
  55030. }
  55031. function needsNormalization (el) {
  55032. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  55033. }
  55034. function genNode (node, state) {
  55035. if (node.type === 1) {
  55036. return genElement(node, state)
  55037. } else if (node.type === 3 && node.isComment) {
  55038. return genComment(node)
  55039. } else {
  55040. return genText(node)
  55041. }
  55042. }
  55043. function genText (text) {
  55044. return ("_v(" + (text.type === 2
  55045. ? text.expression // no need for () because already wrapped in _s()
  55046. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  55047. }
  55048. function genComment (comment) {
  55049. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  55050. }
  55051. function genSlot (el, state) {
  55052. var slotName = el.slotName || '"default"';
  55053. var children = genChildren(el, state);
  55054. var res = "_t(" + slotName + (children ? ("," + children) : '');
  55055. var attrs = el.attrs || el.dynamicAttrs
  55056. ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
  55057. // slot props are camelized
  55058. name: camelize(attr.name),
  55059. value: attr.value,
  55060. dynamic: attr.dynamic
  55061. }); }))
  55062. : null;
  55063. var bind$$1 = el.attrsMap['v-bind'];
  55064. if ((attrs || bind$$1) && !children) {
  55065. res += ",null";
  55066. }
  55067. if (attrs) {
  55068. res += "," + attrs;
  55069. }
  55070. if (bind$$1) {
  55071. res += (attrs ? '' : ',null') + "," + bind$$1;
  55072. }
  55073. return res + ')'
  55074. }
  55075. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  55076. function genComponent (
  55077. componentName,
  55078. el,
  55079. state
  55080. ) {
  55081. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  55082. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  55083. }
  55084. function genProps (props) {
  55085. var staticProps = "";
  55086. var dynamicProps = "";
  55087. for (var i = 0; i < props.length; i++) {
  55088. var prop = props[i];
  55089. var value = transformSpecialNewlines(prop.value);
  55090. if (prop.dynamic) {
  55091. dynamicProps += (prop.name) + "," + value + ",";
  55092. } else {
  55093. staticProps += "\"" + (prop.name) + "\":" + value + ",";
  55094. }
  55095. }
  55096. staticProps = "{" + (staticProps.slice(0, -1)) + "}";
  55097. if (dynamicProps) {
  55098. return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
  55099. } else {
  55100. return staticProps
  55101. }
  55102. }
  55103. // #3895, #4268
  55104. function transformSpecialNewlines (text) {
  55105. return text
  55106. .replace(/\u2028/g, '\\u2028')
  55107. .replace(/\u2029/g, '\\u2029')
  55108. }
  55109. /* */
  55110. // these keywords should not appear inside expressions, but operators like
  55111. // typeof, instanceof and in are allowed
  55112. var prohibitedKeywordRE = new RegExp('\\b' + (
  55113. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  55114. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  55115. 'extends,finally,continue,debugger,function,arguments'
  55116. ).split(',').join('\\b|\\b') + '\\b');
  55117. // these unary operators should not be used as property/method names
  55118. var unaryOperatorsRE = new RegExp('\\b' + (
  55119. 'delete,typeof,void'
  55120. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  55121. // strip strings in expressions
  55122. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  55123. // detect problematic expressions in a template
  55124. function detectErrors (ast, warn) {
  55125. if (ast) {
  55126. checkNode(ast, warn);
  55127. }
  55128. }
  55129. function checkNode (node, warn) {
  55130. if (node.type === 1) {
  55131. for (var name in node.attrsMap) {
  55132. if (dirRE.test(name)) {
  55133. var value = node.attrsMap[name];
  55134. if (value) {
  55135. var range = node.rawAttrsMap[name];
  55136. if (name === 'v-for') {
  55137. checkFor(node, ("v-for=\"" + value + "\""), warn, range);
  55138. } else if (name === 'v-slot' || name[0] === '#') {
  55139. checkFunctionParameterExpression(value, (name + "=\"" + value + "\""), warn, range);
  55140. } else if (onRE.test(name)) {
  55141. checkEvent(value, (name + "=\"" + value + "\""), warn, range);
  55142. } else {
  55143. checkExpression(value, (name + "=\"" + value + "\""), warn, range);
  55144. }
  55145. }
  55146. }
  55147. }
  55148. if (node.children) {
  55149. for (var i = 0; i < node.children.length; i++) {
  55150. checkNode(node.children[i], warn);
  55151. }
  55152. }
  55153. } else if (node.type === 2) {
  55154. checkExpression(node.expression, node.text, warn, node);
  55155. }
  55156. }
  55157. function checkEvent (exp, text, warn, range) {
  55158. var stripped = exp.replace(stripStringRE, '');
  55159. var keywordMatch = stripped.match(unaryOperatorsRE);
  55160. if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
  55161. warn(
  55162. "avoid using JavaScript unary operator as property name: " +
  55163. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
  55164. range
  55165. );
  55166. }
  55167. checkExpression(exp, text, warn, range);
  55168. }
  55169. function checkFor (node, text, warn, range) {
  55170. checkExpression(node.for || '', text, warn, range);
  55171. checkIdentifier(node.alias, 'v-for alias', text, warn, range);
  55172. checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
  55173. checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
  55174. }
  55175. function checkIdentifier (
  55176. ident,
  55177. type,
  55178. text,
  55179. warn,
  55180. range
  55181. ) {
  55182. if (typeof ident === 'string') {
  55183. try {
  55184. new Function(("var " + ident + "=_"));
  55185. } catch (e) {
  55186. warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
  55187. }
  55188. }
  55189. }
  55190. function checkExpression (exp, text, warn, range) {
  55191. try {
  55192. new Function(("return " + exp));
  55193. } catch (e) {
  55194. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  55195. if (keywordMatch) {
  55196. warn(
  55197. "avoid using JavaScript keyword as property name: " +
  55198. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
  55199. range
  55200. );
  55201. } else {
  55202. warn(
  55203. "invalid expression: " + (e.message) + " in\n\n" +
  55204. " " + exp + "\n\n" +
  55205. " Raw expression: " + (text.trim()) + "\n",
  55206. range
  55207. );
  55208. }
  55209. }
  55210. }
  55211. function checkFunctionParameterExpression (exp, text, warn, range) {
  55212. try {
  55213. new Function(exp, '');
  55214. } catch (e) {
  55215. warn(
  55216. "invalid function parameter expression: " + (e.message) + " in\n\n" +
  55217. " " + exp + "\n\n" +
  55218. " Raw expression: " + (text.trim()) + "\n",
  55219. range
  55220. );
  55221. }
  55222. }
  55223. /* */
  55224. var range = 2;
  55225. function generateCodeFrame (
  55226. source,
  55227. start,
  55228. end
  55229. ) {
  55230. if ( start === void 0 ) start = 0;
  55231. if ( end === void 0 ) end = source.length;
  55232. var lines = source.split(/\r?\n/);
  55233. var count = 0;
  55234. var res = [];
  55235. for (var i = 0; i < lines.length; i++) {
  55236. count += lines[i].length + 1;
  55237. if (count >= start) {
  55238. for (var j = i - range; j <= i + range || end > count; j++) {
  55239. if (j < 0 || j >= lines.length) { continue }
  55240. res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
  55241. var lineLength = lines[j].length;
  55242. if (j === i) {
  55243. // push underline
  55244. var pad = start - (count - lineLength) + 1;
  55245. var length = end > count ? lineLength - pad : end - start;
  55246. res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
  55247. } else if (j > i) {
  55248. if (end > count) {
  55249. var length$1 = Math.min(end - count, lineLength);
  55250. res.push(" | " + repeat$1("^", length$1));
  55251. }
  55252. count += lineLength + 1;
  55253. }
  55254. }
  55255. break
  55256. }
  55257. }
  55258. return res.join('\n')
  55259. }
  55260. function repeat$1 (str, n) {
  55261. var result = '';
  55262. if (n > 0) {
  55263. while (true) { // eslint-disable-line
  55264. if (n & 1) { result += str; }
  55265. n >>>= 1;
  55266. if (n <= 0) { break }
  55267. str += str;
  55268. }
  55269. }
  55270. return result
  55271. }
  55272. /* */
  55273. function createFunction (code, errors) {
  55274. try {
  55275. return new Function(code)
  55276. } catch (err) {
  55277. errors.push({ err: err, code: code });
  55278. return noop
  55279. }
  55280. }
  55281. function createCompileToFunctionFn (compile) {
  55282. var cache = Object.create(null);
  55283. return function compileToFunctions (
  55284. template,
  55285. options,
  55286. vm
  55287. ) {
  55288. options = extend({}, options);
  55289. var warn$$1 = options.warn || warn;
  55290. delete options.warn;
  55291. /* istanbul ignore if */
  55292. {
  55293. // detect possible CSP restriction
  55294. try {
  55295. new Function('return 1');
  55296. } catch (e) {
  55297. if (e.toString().match(/unsafe-eval|CSP/)) {
  55298. warn$$1(
  55299. 'It seems you are using the standalone build of Vue.js in an ' +
  55300. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  55301. 'The template compiler cannot work in this environment. Consider ' +
  55302. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  55303. 'templates into render functions.'
  55304. );
  55305. }
  55306. }
  55307. }
  55308. // check cache
  55309. var key = options.delimiters
  55310. ? String(options.delimiters) + template
  55311. : template;
  55312. if (cache[key]) {
  55313. return cache[key]
  55314. }
  55315. // compile
  55316. var compiled = compile(template, options);
  55317. // check compilation errors/tips
  55318. {
  55319. if (compiled.errors && compiled.errors.length) {
  55320. if (options.outputSourceRange) {
  55321. compiled.errors.forEach(function (e) {
  55322. warn$$1(
  55323. "Error compiling template:\n\n" + (e.msg) + "\n\n" +
  55324. generateCodeFrame(template, e.start, e.end),
  55325. vm
  55326. );
  55327. });
  55328. } else {
  55329. warn$$1(
  55330. "Error compiling template:\n\n" + template + "\n\n" +
  55331. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  55332. vm
  55333. );
  55334. }
  55335. }
  55336. if (compiled.tips && compiled.tips.length) {
  55337. if (options.outputSourceRange) {
  55338. compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
  55339. } else {
  55340. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  55341. }
  55342. }
  55343. }
  55344. // turn code into functions
  55345. var res = {};
  55346. var fnGenErrors = [];
  55347. res.render = createFunction(compiled.render, fnGenErrors);
  55348. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  55349. return createFunction(code, fnGenErrors)
  55350. });
  55351. // check function generation errors.
  55352. // this should only happen if there is a bug in the compiler itself.
  55353. // mostly for codegen development use
  55354. /* istanbul ignore if */
  55355. {
  55356. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  55357. warn$$1(
  55358. "Failed to generate render function:\n\n" +
  55359. fnGenErrors.map(function (ref) {
  55360. var err = ref.err;
  55361. var code = ref.code;
  55362. return ((err.toString()) + " in\n\n" + code + "\n");
  55363. }).join('\n'),
  55364. vm
  55365. );
  55366. }
  55367. }
  55368. return (cache[key] = res)
  55369. }
  55370. }
  55371. /* */
  55372. function createCompilerCreator (baseCompile) {
  55373. return function createCompiler (baseOptions) {
  55374. function compile (
  55375. template,
  55376. options
  55377. ) {
  55378. var finalOptions = Object.create(baseOptions);
  55379. var errors = [];
  55380. var tips = [];
  55381. var warn = function (msg, range, tip) {
  55382. (tip ? tips : errors).push(msg);
  55383. };
  55384. if (options) {
  55385. if (options.outputSourceRange) {
  55386. // $flow-disable-line
  55387. var leadingSpaceLength = template.match(/^\s*/)[0].length;
  55388. warn = function (msg, range, tip) {
  55389. var data = { msg: msg };
  55390. if (range) {
  55391. if (range.start != null) {
  55392. data.start = range.start + leadingSpaceLength;
  55393. }
  55394. if (range.end != null) {
  55395. data.end = range.end + leadingSpaceLength;
  55396. }
  55397. }
  55398. (tip ? tips : errors).push(data);
  55399. };
  55400. }
  55401. // merge custom modules
  55402. if (options.modules) {
  55403. finalOptions.modules =
  55404. (baseOptions.modules || []).concat(options.modules);
  55405. }
  55406. // merge custom directives
  55407. if (options.directives) {
  55408. finalOptions.directives = extend(
  55409. Object.create(baseOptions.directives || null),
  55410. options.directives
  55411. );
  55412. }
  55413. // copy other options
  55414. for (var key in options) {
  55415. if (key !== 'modules' && key !== 'directives') {
  55416. finalOptions[key] = options[key];
  55417. }
  55418. }
  55419. }
  55420. finalOptions.warn = warn;
  55421. var compiled = baseCompile(template.trim(), finalOptions);
  55422. {
  55423. detectErrors(compiled.ast, warn);
  55424. }
  55425. compiled.errors = errors;
  55426. compiled.tips = tips;
  55427. return compiled
  55428. }
  55429. return {
  55430. compile: compile,
  55431. compileToFunctions: createCompileToFunctionFn(compile)
  55432. }
  55433. }
  55434. }
  55435. /* */
  55436. // `createCompilerCreator` allows creating compilers that use alternative
  55437. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  55438. // Here we just export a default compiler using the default parts.
  55439. var createCompiler = createCompilerCreator(function baseCompile (
  55440. template,
  55441. options
  55442. ) {
  55443. var ast = parse(template.trim(), options);
  55444. if (options.optimize !== false) {
  55445. optimize(ast, options);
  55446. }
  55447. var code = generate(ast, options);
  55448. return {
  55449. ast: ast,
  55450. render: code.render,
  55451. staticRenderFns: code.staticRenderFns
  55452. }
  55453. });
  55454. /* */
  55455. var ref$1 = createCompiler(baseOptions);
  55456. var compile = ref$1.compile;
  55457. var compileToFunctions = ref$1.compileToFunctions;
  55458. /* */
  55459. // check whether current browser encodes a char inside attribute values
  55460. var div;
  55461. function getShouldDecode (href) {
  55462. div = div || document.createElement('div');
  55463. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  55464. return div.innerHTML.indexOf('&#10;') > 0
  55465. }
  55466. // #3663: IE encodes newlines inside attribute values while other browsers don't
  55467. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  55468. // #6828: chrome encodes content in a[href]
  55469. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  55470. /* */
  55471. var idToTemplate = cached(function (id) {
  55472. var el = query(id);
  55473. return el && el.innerHTML
  55474. });
  55475. var mount = Vue.prototype.$mount;
  55476. Vue.prototype.$mount = function (
  55477. el,
  55478. hydrating
  55479. ) {
  55480. el = el && query(el);
  55481. /* istanbul ignore if */
  55482. if (el === document.body || el === document.documentElement) {
  55483. warn(
  55484. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  55485. );
  55486. return this
  55487. }
  55488. var options = this.$options;
  55489. // resolve template/el and convert to render function
  55490. if (!options.render) {
  55491. var template = options.template;
  55492. if (template) {
  55493. if (typeof template === 'string') {
  55494. if (template.charAt(0) === '#') {
  55495. template = idToTemplate(template);
  55496. /* istanbul ignore if */
  55497. if (!template) {
  55498. warn(
  55499. ("Template element not found or is empty: " + (options.template)),
  55500. this
  55501. );
  55502. }
  55503. }
  55504. } else if (template.nodeType) {
  55505. template = template.innerHTML;
  55506. } else {
  55507. {
  55508. warn('invalid template option:' + template, this);
  55509. }
  55510. return this
  55511. }
  55512. } else if (el) {
  55513. template = getOuterHTML(el);
  55514. }
  55515. if (template) {
  55516. /* istanbul ignore if */
  55517. if (config.performance && mark) {
  55518. mark('compile');
  55519. }
  55520. var ref = compileToFunctions(template, {
  55521. outputSourceRange: "development" !== 'production',
  55522. shouldDecodeNewlines: shouldDecodeNewlines,
  55523. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  55524. delimiters: options.delimiters,
  55525. comments: options.comments
  55526. }, this);
  55527. var render = ref.render;
  55528. var staticRenderFns = ref.staticRenderFns;
  55529. options.render = render;
  55530. options.staticRenderFns = staticRenderFns;
  55531. /* istanbul ignore if */
  55532. if (config.performance && mark) {
  55533. mark('compile end');
  55534. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  55535. }
  55536. }
  55537. }
  55538. return mount.call(this, el, hydrating)
  55539. };
  55540. /**
  55541. * Get outerHTML of elements, taking care
  55542. * of SVG elements in IE as well.
  55543. */
  55544. function getOuterHTML (el) {
  55545. if (el.outerHTML) {
  55546. return el.outerHTML
  55547. } else {
  55548. var container = document.createElement('div');
  55549. container.appendChild(el.cloneNode(true));
  55550. return container.innerHTML
  55551. }
  55552. }
  55553. Vue.compile = compileToFunctions;
  55554. module.exports = Vue;
  55555. /* 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))
  55556. /***/ }),
  55557. /***/ "./node_modules/vue/dist/vue.common.js":
  55558. /*!*********************************************!*\
  55559. !*** ./node_modules/vue/dist/vue.common.js ***!
  55560. \*********************************************/
  55561. /*! no static exports found */
  55562. /***/ (function(module, exports, __webpack_require__) {
  55563. if (false) {} else {
  55564. module.exports = __webpack_require__(/*! ./vue.common.dev.js */ "./node_modules/vue/dist/vue.common.dev.js")
  55565. }
  55566. /***/ }),
  55567. /***/ "./node_modules/webpack/buildin/global.js":
  55568. /*!***********************************!*\
  55569. !*** (webpack)/buildin/global.js ***!
  55570. \***********************************/
  55571. /*! no static exports found */
  55572. /***/ (function(module, exports) {
  55573. var g;
  55574. // This works in non-strict mode
  55575. g = (function() {
  55576. return this;
  55577. })();
  55578. try {
  55579. // This works if eval is allowed (see CSP)
  55580. g = g || new Function("return this")();
  55581. } catch (e) {
  55582. // This works if the window reference is available
  55583. if (typeof window === "object") g = window;
  55584. }
  55585. // g can still be undefined, but nothing to do about it...
  55586. // We return undefined, instead of nothing here, so it's
  55587. // easier to handle this case. if(!global) { ...}
  55588. module.exports = g;
  55589. /***/ }),
  55590. /***/ "./node_modules/webpack/buildin/module.js":
  55591. /*!***********************************!*\
  55592. !*** (webpack)/buildin/module.js ***!
  55593. \***********************************/
  55594. /*! no static exports found */
  55595. /***/ (function(module, exports) {
  55596. module.exports = function(module) {
  55597. if (!module.webpackPolyfill) {
  55598. module.deprecate = function() {};
  55599. module.paths = [];
  55600. // module.parent = undefined by default
  55601. if (!module.children) module.children = [];
  55602. Object.defineProperty(module, "loaded", {
  55603. enumerable: true,
  55604. get: function() {
  55605. return module.l;
  55606. }
  55607. });
  55608. Object.defineProperty(module, "id", {
  55609. enumerable: true,
  55610. get: function() {
  55611. return module.i;
  55612. }
  55613. });
  55614. module.webpackPolyfill = 1;
  55615. }
  55616. return module;
  55617. };
  55618. /***/ }),
  55619. /***/ "./resources/js/app.js":
  55620. /*!*****************************!*\
  55621. !*** ./resources/js/app.js ***!
  55622. \*****************************/
  55623. /*! no static exports found */
  55624. /***/ (function(module, exports, __webpack_require__) {
  55625. /**
  55626. * First we will load all of this project's JavaScript dependencies which
  55627. * includes Vue and other libraries. It is a great starting point when
  55628. * building robust, powerful web applications using Vue and Laravel.
  55629. */
  55630. __webpack_require__(/*! ./bootstrap */ "./resources/js/bootstrap.js");
  55631. window.Clipboard = __webpack_require__(/*! clipboard */ "./node_modules/clipboard/dist/clipboard.js");
  55632. __webpack_require__(/*! ./notify.min.js */ "./resources/js/notify.min.js");
  55633. window.Vue = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.common.js");
  55634. /**
  55635. * The following block of code may be used to automatically register your
  55636. * Vue components. It will recursively scan this directory for the Vue
  55637. * components and automatically register them with their "basename".
  55638. *
  55639. * Eg. ./components/ExampleComponent.vue -> <example-component></example-component>
  55640. */
  55641. // const files = require.context('./', true, /\.vue$/i)
  55642. // files.keys().map(key => Vue.component(key.split('/').pop().split('.')[0], files(key).default))
  55643. Vue.component('example-component', __webpack_require__(/*! ./components/ExampleComponent.vue */ "./resources/js/components/ExampleComponent.vue")["default"]);
  55644. Vue.component('woinfo', __webpack_require__(/*! ./components/woinfo.vue */ "./resources/js/components/woinfo.vue")["default"]);
  55645. Vue.component('assetinfo', __webpack_require__(/*! ./components/assetinfo.vue */ "./resources/js/components/assetinfo.vue")["default"]);
  55646. Vue.component('credential', __webpack_require__(/*! ./components/credential.vue */ "./resources/js/components/credential.vue")["default"]);
  55647. Vue.component('notes', __webpack_require__(/*! ./components/notes.vue */ "./resources/js/components/notes.vue")["default"]);
  55648. Vue.component('modal', __webpack_require__(/*! ./components/modal.vue */ "./resources/js/components/modal.vue")["default"]);
  55649. Vue.component('woinfo-edit-modal', __webpack_require__(/*! ./components/woinfo-edit-modal.vue */ "./resources/js/components/woinfo-edit-modal.vue")["default"]);
  55650. Vue.component('errorlist', __webpack_require__(/*! ./components/errorlist.vue */ "./resources/js/components/errorlist.vue")["default"]);
  55651. Vue.component('credential-form-modal', __webpack_require__(/*! ./components/credential-form-modal.vue */ "./resources/js/components/credential-form-modal.vue")["default"]);
  55652. Vue.component('autocomplete-custom-dropdown', __webpack_require__(/*! ./components/autocomplete-custom-dropdown.vue */ "./resources/js/components/autocomplete-custom-dropdown.vue")["default"]);
  55653. Vue.component('credential-list', __webpack_require__(/*! ./components/credential-list.vue */ "./resources/js/components/credential-list.vue")["default"]);
  55654. Vue.component('note-form-modal', __webpack_require__(/*! ./components/note-form-modal.vue */ "./resources/js/components/note-form-modal.vue")["default"]);
  55655. /**
  55656. * Next, we will create a fresh Vue application instance and attach it to
  55657. * the page. Then, you may begin adding components to this application
  55658. * or customize the JavaScript scaffolding to fit your unique needs.
  55659. */
  55660. var app = new Vue({
  55661. el: '#app'
  55662. });
  55663. $(function () {
  55664. $('[data-toggle="tooltip"]').tooltip();
  55665. });
  55666. var clipboard = new Clipboard('.btn-clip');
  55667. clipboard.on('success', function (e) {
  55668. $('#' + e.trigger.getAttribute('id')).notify('Copied to Clipboard', {
  55669. position: "right",
  55670. className: 'success'
  55671. });
  55672. e.clearSelection();
  55673. });
  55674. /***/ }),
  55675. /***/ "./resources/js/bootstrap.js":
  55676. /*!***********************************!*\
  55677. !*** ./resources/js/bootstrap.js ***!
  55678. \***********************************/
  55679. /*! no exports provided */
  55680. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55681. "use strict";
  55682. __webpack_require__.r(__webpack_exports__);
  55683. /* harmony import */ var laravel_echo__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! laravel-echo */ "./node_modules/laravel-echo/dist/echo.js");
  55684. window._ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js");
  55685. /**
  55686. * We'll load jQuery and the Bootstrap jQuery plugin which provides support
  55687. * for JavaScript based Bootstrap features such as modals and tabs. This
  55688. * code may be modified to fit the specific needs of your application.
  55689. */
  55690. try {
  55691. window.Popper = __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")["default"];
  55692. window.$ = window.jQuery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  55693. __webpack_require__(/*! bootstrap */ "./node_modules/bootstrap/dist/js/bootstrap.js");
  55694. } catch (e) {}
  55695. /**
  55696. * We'll load the axios HTTP library which allows us to easily issue requests
  55697. * to our Laravel back-end. This library automatically handles sending the
  55698. * CSRF token as a header based on the value of the "XSRF" token cookie.
  55699. */
  55700. window.axios = __webpack_require__(/*! axios */ "./node_modules/axios/index.js");
  55701. window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
  55702. /**
  55703. * Echo exposes an expressive API for subscribing to channels and listening
  55704. * for events that are broadcast by Laravel. Echo and event broadcasting
  55705. * allows your team to easily build robust real-time web applications.
  55706. */
  55707. window.Pusher = __webpack_require__(/*! pusher-js */ "./node_modules/pusher-js/dist/web/pusher.js");
  55708. window.Echo = new laravel_echo__WEBPACK_IMPORTED_MODULE_0__["default"]({
  55709. broadcaster: 'pusher',
  55710. key: "upccrt",
  55711. authEndpoint: '/broadcasting/auth',
  55712. wsHost: window.location.hostname,
  55713. wsPort: 6001,
  55714. disableStats: true
  55715. });
  55716. /***/ }),
  55717. /***/ "./resources/js/components/ExampleComponent.vue":
  55718. /*!******************************************************!*\
  55719. !*** ./resources/js/components/ExampleComponent.vue ***!
  55720. \******************************************************/
  55721. /*! exports provided: default */
  55722. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55723. "use strict";
  55724. __webpack_require__.r(__webpack_exports__);
  55725. /* 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&");
  55726. /* 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&");
  55727. /* 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");
  55728. /* normalize component */
  55729. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55730. _ExampleComponent_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55731. _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["render"],
  55732. _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55733. false,
  55734. null,
  55735. null,
  55736. null
  55737. )
  55738. /* hot reload */
  55739. if (false) { var api; }
  55740. component.options.__file = "resources/js/components/ExampleComponent.vue"
  55741. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55742. /***/ }),
  55743. /***/ "./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js&":
  55744. /*!*******************************************************************************!*\
  55745. !*** ./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js& ***!
  55746. \*******************************************************************************/
  55747. /*! exports provided: default */
  55748. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55749. "use strict";
  55750. __webpack_require__.r(__webpack_exports__);
  55751. /* 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&");
  55752. /* 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"]);
  55753. /***/ }),
  55754. /***/ "./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e&":
  55755. /*!*************************************************************************************!*\
  55756. !*** ./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e& ***!
  55757. \*************************************************************************************/
  55758. /*! exports provided: render, staticRenderFns */
  55759. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55760. "use strict";
  55761. __webpack_require__.r(__webpack_exports__);
  55762. /* 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&");
  55763. /* 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"]; });
  55764. /* 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"]; });
  55765. /***/ }),
  55766. /***/ "./resources/js/components/assetinfo.vue":
  55767. /*!***********************************************!*\
  55768. !*** ./resources/js/components/assetinfo.vue ***!
  55769. \***********************************************/
  55770. /*! exports provided: default */
  55771. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55772. "use strict";
  55773. __webpack_require__.r(__webpack_exports__);
  55774. /* 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&");
  55775. /* 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&");
  55776. /* 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");
  55777. /* normalize component */
  55778. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55779. _assetinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55780. _assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__["render"],
  55781. _assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55782. false,
  55783. null,
  55784. null,
  55785. null
  55786. )
  55787. /* hot reload */
  55788. if (false) { var api; }
  55789. component.options.__file = "resources/js/components/assetinfo.vue"
  55790. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55791. /***/ }),
  55792. /***/ "./resources/js/components/assetinfo.vue?vue&type=script&lang=js&":
  55793. /*!************************************************************************!*\
  55794. !*** ./resources/js/components/assetinfo.vue?vue&type=script&lang=js& ***!
  55795. \************************************************************************/
  55796. /*! exports provided: default */
  55797. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55798. "use strict";
  55799. __webpack_require__.r(__webpack_exports__);
  55800. /* 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&");
  55801. /* 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"]);
  55802. /***/ }),
  55803. /***/ "./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3&":
  55804. /*!******************************************************************************!*\
  55805. !*** ./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3& ***!
  55806. \******************************************************************************/
  55807. /*! exports provided: render, staticRenderFns */
  55808. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55809. "use strict";
  55810. __webpack_require__.r(__webpack_exports__);
  55811. /* 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&");
  55812. /* 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"]; });
  55813. /* 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"]; });
  55814. /***/ }),
  55815. /***/ "./resources/js/components/autocomplete-custom-dropdown.vue":
  55816. /*!******************************************************************!*\
  55817. !*** ./resources/js/components/autocomplete-custom-dropdown.vue ***!
  55818. \******************************************************************/
  55819. /*! exports provided: default */
  55820. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55821. "use strict";
  55822. __webpack_require__.r(__webpack_exports__);
  55823. /* harmony import */ var _autocomplete_custom_dropdown_vue_vue_type_template_id_18875e5a___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./autocomplete-custom-dropdown.vue?vue&type=template&id=18875e5a& */ "./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=template&id=18875e5a&");
  55824. /* harmony import */ var _autocomplete_custom_dropdown_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./autocomplete-custom-dropdown.vue?vue&type=script&lang=js& */ "./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=script&lang=js&");
  55825. /* 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");
  55826. /* normalize component */
  55827. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55828. _autocomplete_custom_dropdown_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55829. _autocomplete_custom_dropdown_vue_vue_type_template_id_18875e5a___WEBPACK_IMPORTED_MODULE_0__["render"],
  55830. _autocomplete_custom_dropdown_vue_vue_type_template_id_18875e5a___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55831. false,
  55832. null,
  55833. null,
  55834. null
  55835. )
  55836. /* hot reload */
  55837. if (false) { var api; }
  55838. component.options.__file = "resources/js/components/autocomplete-custom-dropdown.vue"
  55839. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55840. /***/ }),
  55841. /***/ "./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=script&lang=js&":
  55842. /*!*******************************************************************************************!*\
  55843. !*** ./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=script&lang=js& ***!
  55844. \*******************************************************************************************/
  55845. /*! exports provided: default */
  55846. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55847. "use strict";
  55848. __webpack_require__.r(__webpack_exports__);
  55849. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_autocomplete_custom_dropdown_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib??ref--4-0!../../../node_modules/vue-loader/lib??vue-loader-options!./autocomplete-custom-dropdown.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=script&lang=js&");
  55850. /* empty/unused harmony star reexport */ /* harmony default export */ __webpack_exports__["default"] = (_node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_autocomplete_custom_dropdown_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  55851. /***/ }),
  55852. /***/ "./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=template&id=18875e5a&":
  55853. /*!*************************************************************************************************!*\
  55854. !*** ./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=template&id=18875e5a& ***!
  55855. \*************************************************************************************************/
  55856. /*! exports provided: render, staticRenderFns */
  55857. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55858. "use strict";
  55859. __webpack_require__.r(__webpack_exports__);
  55860. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_autocomplete_custom_dropdown_vue_vue_type_template_id_18875e5a___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../node_modules/vue-loader/lib??vue-loader-options!./autocomplete-custom-dropdown.vue?vue&type=template&id=18875e5a& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=template&id=18875e5a&");
  55861. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "render", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_autocomplete_custom_dropdown_vue_vue_type_template_id_18875e5a___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  55862. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_autocomplete_custom_dropdown_vue_vue_type_template_id_18875e5a___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  55863. /***/ }),
  55864. /***/ "./resources/js/components/credential-form-modal.vue":
  55865. /*!***********************************************************!*\
  55866. !*** ./resources/js/components/credential-form-modal.vue ***!
  55867. \***********************************************************/
  55868. /*! exports provided: default */
  55869. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55870. "use strict";
  55871. __webpack_require__.r(__webpack_exports__);
  55872. /* harmony import */ var _credential_form_modal_vue_vue_type_template_id_5ba19d42___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./credential-form-modal.vue?vue&type=template&id=5ba19d42& */ "./resources/js/components/credential-form-modal.vue?vue&type=template&id=5ba19d42&");
  55873. /* harmony import */ var _credential_form_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./credential-form-modal.vue?vue&type=script&lang=js& */ "./resources/js/components/credential-form-modal.vue?vue&type=script&lang=js&");
  55874. /* 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");
  55875. /* normalize component */
  55876. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55877. _credential_form_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55878. _credential_form_modal_vue_vue_type_template_id_5ba19d42___WEBPACK_IMPORTED_MODULE_0__["render"],
  55879. _credential_form_modal_vue_vue_type_template_id_5ba19d42___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55880. false,
  55881. null,
  55882. null,
  55883. null
  55884. )
  55885. /* hot reload */
  55886. if (false) { var api; }
  55887. component.options.__file = "resources/js/components/credential-form-modal.vue"
  55888. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55889. /***/ }),
  55890. /***/ "./resources/js/components/credential-form-modal.vue?vue&type=script&lang=js&":
  55891. /*!************************************************************************************!*\
  55892. !*** ./resources/js/components/credential-form-modal.vue?vue&type=script&lang=js& ***!
  55893. \************************************************************************************/
  55894. /*! exports provided: default */
  55895. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55896. "use strict";
  55897. __webpack_require__.r(__webpack_exports__);
  55898. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_credential_form_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib??ref--4-0!../../../node_modules/vue-loader/lib??vue-loader-options!./credential-form-modal.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential-form-modal.vue?vue&type=script&lang=js&");
  55899. /* empty/unused harmony star reexport */ /* harmony default export */ __webpack_exports__["default"] = (_node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_credential_form_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  55900. /***/ }),
  55901. /***/ "./resources/js/components/credential-form-modal.vue?vue&type=template&id=5ba19d42&":
  55902. /*!******************************************************************************************!*\
  55903. !*** ./resources/js/components/credential-form-modal.vue?vue&type=template&id=5ba19d42& ***!
  55904. \******************************************************************************************/
  55905. /*! exports provided: render, staticRenderFns */
  55906. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55907. "use strict";
  55908. __webpack_require__.r(__webpack_exports__);
  55909. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_credential_form_modal_vue_vue_type_template_id_5ba19d42___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../node_modules/vue-loader/lib??vue-loader-options!./credential-form-modal.vue?vue&type=template&id=5ba19d42& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential-form-modal.vue?vue&type=template&id=5ba19d42&");
  55910. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "render", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_credential_form_modal_vue_vue_type_template_id_5ba19d42___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  55911. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_credential_form_modal_vue_vue_type_template_id_5ba19d42___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  55912. /***/ }),
  55913. /***/ "./resources/js/components/credential-list.vue":
  55914. /*!*****************************************************!*\
  55915. !*** ./resources/js/components/credential-list.vue ***!
  55916. \*****************************************************/
  55917. /*! exports provided: default */
  55918. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55919. "use strict";
  55920. __webpack_require__.r(__webpack_exports__);
  55921. /* harmony import */ var _credential_list_vue_vue_type_template_id_06d8fa4e___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./credential-list.vue?vue&type=template&id=06d8fa4e& */ "./resources/js/components/credential-list.vue?vue&type=template&id=06d8fa4e&");
  55922. /* harmony import */ var _credential_list_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./credential-list.vue?vue&type=script&lang=js& */ "./resources/js/components/credential-list.vue?vue&type=script&lang=js&");
  55923. /* 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");
  55924. /* normalize component */
  55925. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55926. _credential_list_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55927. _credential_list_vue_vue_type_template_id_06d8fa4e___WEBPACK_IMPORTED_MODULE_0__["render"],
  55928. _credential_list_vue_vue_type_template_id_06d8fa4e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55929. false,
  55930. null,
  55931. null,
  55932. null
  55933. )
  55934. /* hot reload */
  55935. if (false) { var api; }
  55936. component.options.__file = "resources/js/components/credential-list.vue"
  55937. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55938. /***/ }),
  55939. /***/ "./resources/js/components/credential-list.vue?vue&type=script&lang=js&":
  55940. /*!******************************************************************************!*\
  55941. !*** ./resources/js/components/credential-list.vue?vue&type=script&lang=js& ***!
  55942. \******************************************************************************/
  55943. /*! exports provided: default */
  55944. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55945. "use strict";
  55946. __webpack_require__.r(__webpack_exports__);
  55947. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_credential_list_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib??ref--4-0!../../../node_modules/vue-loader/lib??vue-loader-options!./credential-list.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential-list.vue?vue&type=script&lang=js&");
  55948. /* empty/unused harmony star reexport */ /* harmony default export */ __webpack_exports__["default"] = (_node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_credential_list_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  55949. /***/ }),
  55950. /***/ "./resources/js/components/credential-list.vue?vue&type=template&id=06d8fa4e&":
  55951. /*!************************************************************************************!*\
  55952. !*** ./resources/js/components/credential-list.vue?vue&type=template&id=06d8fa4e& ***!
  55953. \************************************************************************************/
  55954. /*! exports provided: render, staticRenderFns */
  55955. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55956. "use strict";
  55957. __webpack_require__.r(__webpack_exports__);
  55958. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_credential_list_vue_vue_type_template_id_06d8fa4e___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../node_modules/vue-loader/lib??vue-loader-options!./credential-list.vue?vue&type=template&id=06d8fa4e& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential-list.vue?vue&type=template&id=06d8fa4e&");
  55959. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "render", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_credential_list_vue_vue_type_template_id_06d8fa4e___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  55960. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_credential_list_vue_vue_type_template_id_06d8fa4e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  55961. /***/ }),
  55962. /***/ "./resources/js/components/credential.vue":
  55963. /*!************************************************!*\
  55964. !*** ./resources/js/components/credential.vue ***!
  55965. \************************************************/
  55966. /*! exports provided: default */
  55967. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55968. "use strict";
  55969. __webpack_require__.r(__webpack_exports__);
  55970. /* 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&");
  55971. /* 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&");
  55972. /* 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");
  55973. /* normalize component */
  55974. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55975. _credential_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55976. _credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__["render"],
  55977. _credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55978. false,
  55979. null,
  55980. null,
  55981. null
  55982. )
  55983. /* hot reload */
  55984. if (false) { var api; }
  55985. component.options.__file = "resources/js/components/credential.vue"
  55986. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55987. /***/ }),
  55988. /***/ "./resources/js/components/credential.vue?vue&type=script&lang=js&":
  55989. /*!*************************************************************************!*\
  55990. !*** ./resources/js/components/credential.vue?vue&type=script&lang=js& ***!
  55991. \*************************************************************************/
  55992. /*! exports provided: default */
  55993. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55994. "use strict";
  55995. __webpack_require__.r(__webpack_exports__);
  55996. /* 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&");
  55997. /* 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"]);
  55998. /***/ }),
  55999. /***/ "./resources/js/components/credential.vue?vue&type=template&id=0f5cc562&":
  56000. /*!*******************************************************************************!*\
  56001. !*** ./resources/js/components/credential.vue?vue&type=template&id=0f5cc562& ***!
  56002. \*******************************************************************************/
  56003. /*! exports provided: render, staticRenderFns */
  56004. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56005. "use strict";
  56006. __webpack_require__.r(__webpack_exports__);
  56007. /* 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&");
  56008. /* 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"]; });
  56009. /* 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"]; });
  56010. /***/ }),
  56011. /***/ "./resources/js/components/errorlist.vue":
  56012. /*!***********************************************!*\
  56013. !*** ./resources/js/components/errorlist.vue ***!
  56014. \***********************************************/
  56015. /*! exports provided: default */
  56016. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56017. "use strict";
  56018. __webpack_require__.r(__webpack_exports__);
  56019. /* 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&");
  56020. /* 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&");
  56021. /* 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");
  56022. /* normalize component */
  56023. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  56024. _errorlist_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  56025. _errorlist_vue_vue_type_template_id_1546f5eb___WEBPACK_IMPORTED_MODULE_0__["render"],
  56026. _errorlist_vue_vue_type_template_id_1546f5eb___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  56027. false,
  56028. null,
  56029. null,
  56030. null
  56031. )
  56032. /* hot reload */
  56033. if (false) { var api; }
  56034. component.options.__file = "resources/js/components/errorlist.vue"
  56035. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  56036. /***/ }),
  56037. /***/ "./resources/js/components/errorlist.vue?vue&type=script&lang=js&":
  56038. /*!************************************************************************!*\
  56039. !*** ./resources/js/components/errorlist.vue?vue&type=script&lang=js& ***!
  56040. \************************************************************************/
  56041. /*! exports provided: default */
  56042. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56043. "use strict";
  56044. __webpack_require__.r(__webpack_exports__);
  56045. /* 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&");
  56046. /* 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"]);
  56047. /***/ }),
  56048. /***/ "./resources/js/components/errorlist.vue?vue&type=template&id=1546f5eb&":
  56049. /*!******************************************************************************!*\
  56050. !*** ./resources/js/components/errorlist.vue?vue&type=template&id=1546f5eb& ***!
  56051. \******************************************************************************/
  56052. /*! exports provided: render, staticRenderFns */
  56053. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56054. "use strict";
  56055. __webpack_require__.r(__webpack_exports__);
  56056. /* 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&");
  56057. /* 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"]; });
  56058. /* 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"]; });
  56059. /***/ }),
  56060. /***/ "./resources/js/components/modal.vue":
  56061. /*!*******************************************!*\
  56062. !*** ./resources/js/components/modal.vue ***!
  56063. \*******************************************/
  56064. /*! exports provided: default */
  56065. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56066. "use strict";
  56067. __webpack_require__.r(__webpack_exports__);
  56068. /* 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&");
  56069. /* 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");
  56070. var script = {}
  56071. /* normalize component */
  56072. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_1__["default"])(
  56073. script,
  56074. _modal_vue_vue_type_template_id_478d961c___WEBPACK_IMPORTED_MODULE_0__["render"],
  56075. _modal_vue_vue_type_template_id_478d961c___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  56076. false,
  56077. null,
  56078. null,
  56079. null
  56080. )
  56081. /* hot reload */
  56082. if (false) { var api; }
  56083. component.options.__file = "resources/js/components/modal.vue"
  56084. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  56085. /***/ }),
  56086. /***/ "./resources/js/components/modal.vue?vue&type=template&id=478d961c&":
  56087. /*!**************************************************************************!*\
  56088. !*** ./resources/js/components/modal.vue?vue&type=template&id=478d961c& ***!
  56089. \**************************************************************************/
  56090. /*! exports provided: render, staticRenderFns */
  56091. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56092. "use strict";
  56093. __webpack_require__.r(__webpack_exports__);
  56094. /* 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&");
  56095. /* 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"]; });
  56096. /* 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"]; });
  56097. /***/ }),
  56098. /***/ "./resources/js/components/note-form-modal.vue":
  56099. /*!*****************************************************!*\
  56100. !*** ./resources/js/components/note-form-modal.vue ***!
  56101. \*****************************************************/
  56102. /*! exports provided: default */
  56103. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56104. "use strict";
  56105. __webpack_require__.r(__webpack_exports__);
  56106. /* harmony import */ var _note_form_modal_vue_vue_type_template_id_0435c624___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./note-form-modal.vue?vue&type=template&id=0435c624& */ "./resources/js/components/note-form-modal.vue?vue&type=template&id=0435c624&");
  56107. /* harmony import */ var _note_form_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./note-form-modal.vue?vue&type=script&lang=js& */ "./resources/js/components/note-form-modal.vue?vue&type=script&lang=js&");
  56108. /* 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");
  56109. /* normalize component */
  56110. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  56111. _note_form_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  56112. _note_form_modal_vue_vue_type_template_id_0435c624___WEBPACK_IMPORTED_MODULE_0__["render"],
  56113. _note_form_modal_vue_vue_type_template_id_0435c624___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  56114. false,
  56115. null,
  56116. null,
  56117. null
  56118. )
  56119. /* hot reload */
  56120. if (false) { var api; }
  56121. component.options.__file = "resources/js/components/note-form-modal.vue"
  56122. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  56123. /***/ }),
  56124. /***/ "./resources/js/components/note-form-modal.vue?vue&type=script&lang=js&":
  56125. /*!******************************************************************************!*\
  56126. !*** ./resources/js/components/note-form-modal.vue?vue&type=script&lang=js& ***!
  56127. \******************************************************************************/
  56128. /*! exports provided: default */
  56129. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56130. "use strict";
  56131. __webpack_require__.r(__webpack_exports__);
  56132. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_note_form_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib??ref--4-0!../../../node_modules/vue-loader/lib??vue-loader-options!./note-form-modal.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/note-form-modal.vue?vue&type=script&lang=js&");
  56133. /* 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_note_form_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  56134. /***/ }),
  56135. /***/ "./resources/js/components/note-form-modal.vue?vue&type=template&id=0435c624&":
  56136. /*!************************************************************************************!*\
  56137. !*** ./resources/js/components/note-form-modal.vue?vue&type=template&id=0435c624& ***!
  56138. \************************************************************************************/
  56139. /*! exports provided: render, staticRenderFns */
  56140. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56141. "use strict";
  56142. __webpack_require__.r(__webpack_exports__);
  56143. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_note_form_modal_vue_vue_type_template_id_0435c624___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!./note-form-modal.vue?vue&type=template&id=0435c624& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/note-form-modal.vue?vue&type=template&id=0435c624&");
  56144. /* 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_note_form_modal_vue_vue_type_template_id_0435c624___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  56145. /* 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_note_form_modal_vue_vue_type_template_id_0435c624___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  56146. /***/ }),
  56147. /***/ "./resources/js/components/notes.vue":
  56148. /*!*******************************************!*\
  56149. !*** ./resources/js/components/notes.vue ***!
  56150. \*******************************************/
  56151. /*! exports provided: default */
  56152. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56153. "use strict";
  56154. __webpack_require__.r(__webpack_exports__);
  56155. /* 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&");
  56156. /* 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&");
  56157. /* 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");
  56158. /* normalize component */
  56159. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  56160. _notes_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  56161. _notes_vue_vue_type_template_id_73d141f4___WEBPACK_IMPORTED_MODULE_0__["render"],
  56162. _notes_vue_vue_type_template_id_73d141f4___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  56163. false,
  56164. null,
  56165. null,
  56166. null
  56167. )
  56168. /* hot reload */
  56169. if (false) { var api; }
  56170. component.options.__file = "resources/js/components/notes.vue"
  56171. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  56172. /***/ }),
  56173. /***/ "./resources/js/components/notes.vue?vue&type=script&lang=js&":
  56174. /*!********************************************************************!*\
  56175. !*** ./resources/js/components/notes.vue?vue&type=script&lang=js& ***!
  56176. \********************************************************************/
  56177. /*! exports provided: default */
  56178. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56179. "use strict";
  56180. __webpack_require__.r(__webpack_exports__);
  56181. /* 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&");
  56182. /* 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"]);
  56183. /***/ }),
  56184. /***/ "./resources/js/components/notes.vue?vue&type=template&id=73d141f4&":
  56185. /*!**************************************************************************!*\
  56186. !*** ./resources/js/components/notes.vue?vue&type=template&id=73d141f4& ***!
  56187. \**************************************************************************/
  56188. /*! exports provided: render, staticRenderFns */
  56189. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56190. "use strict";
  56191. __webpack_require__.r(__webpack_exports__);
  56192. /* 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&");
  56193. /* 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"]; });
  56194. /* 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"]; });
  56195. /***/ }),
  56196. /***/ "./resources/js/components/woinfo-edit-modal.vue":
  56197. /*!*******************************************************!*\
  56198. !*** ./resources/js/components/woinfo-edit-modal.vue ***!
  56199. \*******************************************************/
  56200. /*! exports provided: default */
  56201. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56202. "use strict";
  56203. __webpack_require__.r(__webpack_exports__);
  56204. /* 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&");
  56205. /* 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&");
  56206. /* 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");
  56207. /* normalize component */
  56208. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  56209. _woinfo_edit_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  56210. _woinfo_edit_modal_vue_vue_type_template_id_ad3662d4___WEBPACK_IMPORTED_MODULE_0__["render"],
  56211. _woinfo_edit_modal_vue_vue_type_template_id_ad3662d4___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  56212. false,
  56213. null,
  56214. null,
  56215. null
  56216. )
  56217. /* hot reload */
  56218. if (false) { var api; }
  56219. component.options.__file = "resources/js/components/woinfo-edit-modal.vue"
  56220. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  56221. /***/ }),
  56222. /***/ "./resources/js/components/woinfo-edit-modal.vue?vue&type=script&lang=js&":
  56223. /*!********************************************************************************!*\
  56224. !*** ./resources/js/components/woinfo-edit-modal.vue?vue&type=script&lang=js& ***!
  56225. \********************************************************************************/
  56226. /*! exports provided: default */
  56227. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56228. "use strict";
  56229. __webpack_require__.r(__webpack_exports__);
  56230. /* 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&");
  56231. /* 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"]);
  56232. /***/ }),
  56233. /***/ "./resources/js/components/woinfo-edit-modal.vue?vue&type=template&id=ad3662d4&":
  56234. /*!**************************************************************************************!*\
  56235. !*** ./resources/js/components/woinfo-edit-modal.vue?vue&type=template&id=ad3662d4& ***!
  56236. \**************************************************************************************/
  56237. /*! exports provided: render, staticRenderFns */
  56238. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56239. "use strict";
  56240. __webpack_require__.r(__webpack_exports__);
  56241. /* 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&");
  56242. /* 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"]; });
  56243. /* 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"]; });
  56244. /***/ }),
  56245. /***/ "./resources/js/components/woinfo.vue":
  56246. /*!********************************************!*\
  56247. !*** ./resources/js/components/woinfo.vue ***!
  56248. \********************************************/
  56249. /*! exports provided: default */
  56250. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56251. "use strict";
  56252. __webpack_require__.r(__webpack_exports__);
  56253. /* 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&");
  56254. /* 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&");
  56255. /* 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");
  56256. /* normalize component */
  56257. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  56258. _woinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  56259. _woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__["render"],
  56260. _woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  56261. false,
  56262. null,
  56263. null,
  56264. null
  56265. )
  56266. /* hot reload */
  56267. if (false) { var api; }
  56268. component.options.__file = "resources/js/components/woinfo.vue"
  56269. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  56270. /***/ }),
  56271. /***/ "./resources/js/components/woinfo.vue?vue&type=script&lang=js&":
  56272. /*!*********************************************************************!*\
  56273. !*** ./resources/js/components/woinfo.vue?vue&type=script&lang=js& ***!
  56274. \*********************************************************************/
  56275. /*! exports provided: default */
  56276. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56277. "use strict";
  56278. __webpack_require__.r(__webpack_exports__);
  56279. /* 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&");
  56280. /* 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"]);
  56281. /***/ }),
  56282. /***/ "./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de&":
  56283. /*!***************************************************************************!*\
  56284. !*** ./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de& ***!
  56285. \***************************************************************************/
  56286. /*! exports provided: render, staticRenderFns */
  56287. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56288. "use strict";
  56289. __webpack_require__.r(__webpack_exports__);
  56290. /* 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&");
  56291. /* 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"]; });
  56292. /* 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"]; });
  56293. /***/ }),
  56294. /***/ "./resources/js/mixins/dateMixin.js":
  56295. /*!******************************************!*\
  56296. !*** ./resources/js/mixins/dateMixin.js ***!
  56297. \******************************************/
  56298. /*! exports provided: default */
  56299. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56300. "use strict";
  56301. __webpack_require__.r(__webpack_exports__);
  56302. /* harmony default export */ __webpack_exports__["default"] = ({
  56303. methods: {
  56304. treatAsUTC: function treatAsUTC(date) {
  56305. var result = new Date(date);
  56306. result.setMinutes(result.getMinutes() - result.getTimezoneOffset());
  56307. return result;
  56308. },
  56309. daysSinceToday: function daysSinceToday(date) {
  56310. var currentDate = new Date();
  56311. var millisecondsPerDay = 24 * 60 * 60 * 1000;
  56312. return (this.treatAsUTC(currentDate) - this.treatAsUTC(date)) / millisecondsPerDay;
  56313. },
  56314. getHRDate: function getHRDate(dateString) {
  56315. var date = new Date(dateString);
  56316. return date.toLocaleString('default', {
  56317. month: 'short',
  56318. day: 'numeric',
  56319. year: 'numeric',
  56320. hour: 'numeric',
  56321. minute: 'numeric'
  56322. });
  56323. },
  56324. isZero: function isZero(dateString) {
  56325. return dateString === '0000-00-00 00:00:00';
  56326. }
  56327. }
  56328. });
  56329. /***/ }),
  56330. /***/ "./resources/js/notify.min.js":
  56331. /*!************************************!*\
  56332. !*** ./resources/js/notify.min.js ***!
  56333. \************************************/
  56334. /*! no static exports found */
  56335. /***/ (function(module, exports, __webpack_require__) {
  56336. 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); }
  56337. (function (e) {
  56338. true ? !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js")], __WEBPACK_AMD_DEFINE_FACTORY__ = (e),
  56339. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  56340. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  56341. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : undefined;
  56342. })(function (e) {
  56343. function A(t, n, i) {
  56344. typeof i == "string" && (i = {
  56345. className: i
  56346. }), 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);
  56347. }
  56348. var t = [].indexOf || function (e) {
  56349. for (var t = 0, n = this.length; t < n; t++) {
  56350. if (t in this && this[t] === e) return t;
  56351. }
  56352. return -1;
  56353. },
  56354. n = "notify",
  56355. r = n + "js",
  56356. i = n + "!blank",
  56357. s = {
  56358. t: "top",
  56359. m: "middle",
  56360. b: "bottom",
  56361. l: "left",
  56362. c: "center",
  56363. r: "right"
  56364. },
  56365. o = ["l", "c", "r"],
  56366. u = ["t", "m", "b"],
  56367. a = ["t", "b", "l", "r"],
  56368. f = {
  56369. t: "b",
  56370. m: null,
  56371. b: "t",
  56372. l: "r",
  56373. c: null,
  56374. r: "l"
  56375. },
  56376. l = function l(t) {
  56377. var n;
  56378. return n = [], e.each(t.split(/\W+/), function (e, t) {
  56379. var r;
  56380. r = t.toLowerCase().charAt(0);
  56381. if (s[r]) return n.push(r);
  56382. }), n;
  56383. },
  56384. c = {},
  56385. h = {
  56386. name: "core",
  56387. html: '<div class="' + r + '-wrapper">\n <div class="' + r + '-arrow"></div>\n <div class="' + r + '-container"></div>\n</div>',
  56388. 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}"
  56389. },
  56390. p = {
  56391. "border-radius": ["-webkit-", "-moz-"]
  56392. },
  56393. d = function d(e) {
  56394. return c[e];
  56395. },
  56396. v = function v(e) {
  56397. if (!e) throw "Missing Style name";
  56398. c[e] && delete c[e];
  56399. },
  56400. m = function m(t, i) {
  56401. if (!t) throw "Missing Style name";
  56402. if (!i) throw "Missing Style definition";
  56403. if (!i.html) throw "Missing Style HTML";
  56404. var s = c[t];
  56405. s && s.cssElem && (window.console && console.warn(n + ": overwriting style '" + t + "'"), c[t].cssElem.remove()), i.name = t, c[t] = i;
  56406. var o = "";
  56407. i.classes && e.each(i.classes, function (t, n) {
  56408. return o += "." + r + "-" + i.name + "-" + t + " {\n", e.each(n, function (t, n) {
  56409. return p[t] && e.each(p[t], function (e, r) {
  56410. return o += " " + r + t + ": " + n + ";\n";
  56411. }), o += " " + t + ": " + n + ";\n";
  56412. }), o += "}\n";
  56413. }), i.css && (o += "/* styles for " + i.name + " */\n" + i.css), o && (i.cssElem = g(o), i.cssElem.attr("id", "notify-" + i.name));
  56414. var u = {},
  56415. a = e(i.html);
  56416. y("html", a, u), y("text", a, u), i.fields = u;
  56417. },
  56418. g = function g(t) {
  56419. var n, r, i;
  56420. r = x("style"), r.attr("type", "text/css"), e("head").append(r);
  56421. try {
  56422. r.html(t);
  56423. } catch (s) {
  56424. r[0].styleSheet.cssText = t;
  56425. }
  56426. return r;
  56427. },
  56428. y = function y(t, n, r) {
  56429. var s;
  56430. return t !== "html" && (t = "text"), s = "data-notify-" + t, b(n, "[" + s + "]").each(function () {
  56431. var n;
  56432. n = e(this).attr(s), n || (n = i), r[n] = t;
  56433. });
  56434. },
  56435. b = function b(e, t) {
  56436. return e.is(t) ? e : e.find(t);
  56437. },
  56438. w = {
  56439. clickToHide: !0,
  56440. autoHide: !0,
  56441. autoHideDelay: 5e3,
  56442. arrowShow: !0,
  56443. arrowSize: 5,
  56444. breakNewLines: !0,
  56445. elementPosition: "bottom",
  56446. globalPosition: "top right",
  56447. style: "bootstrap",
  56448. className: "error",
  56449. showAnimation: "slideDown",
  56450. showDuration: 400,
  56451. hideAnimation: "slideUp",
  56452. hideDuration: 200,
  56453. gap: 5
  56454. },
  56455. E = function E(t, n) {
  56456. var r;
  56457. return r = function r() {}, r.prototype = t, e.extend(!0, new r(), n);
  56458. },
  56459. S = function S(t) {
  56460. return e.extend(w, t);
  56461. },
  56462. x = function x(t) {
  56463. return e("<" + t + "></" + t + ">");
  56464. },
  56465. T = {},
  56466. N = function N(t) {
  56467. var n;
  56468. return t.is("[type=radio]") && (n = t.parents("form:first").find("[type=radio]").filter(function (n, r) {
  56469. return e(r).attr("name") === t.attr("name");
  56470. }), t = n.first()), t;
  56471. },
  56472. C = function C(e, t, n) {
  56473. var r, i;
  56474. if (typeof n == "string") n = parseInt(n, 10);else if (typeof n != "number") return;
  56475. if (isNaN(n)) return;
  56476. 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;
  56477. },
  56478. k = function k(e, t, n) {
  56479. if (e === "l" || e === "t") return 0;
  56480. if (e === "c" || e === "m") return n / 2 - t / 2;
  56481. if (e === "r" || e === "b") return n - t;
  56482. throw "Invalid alignment";
  56483. },
  56484. L = function L(e) {
  56485. return L.e = L.e || x("div"), L.e.text(e).html();
  56486. };
  56487. A.prototype.loadHTML = function () {
  56488. var t;
  56489. t = this.getStyle(), this.userContainer = e(t.html), this.userFields = t.fields;
  56490. }, A.prototype.show = function (e, t) {
  56491. var n, r, i, s, o;
  56492. r = function (n) {
  56493. return function () {
  56494. !e && !n.elem && n.destroy();
  56495. if (t) return t();
  56496. };
  56497. }(this), o = this.container.parent().parents(":hidden").length > 0, i = this.container.add(this.arrow), n = [];
  56498. 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 {
  56499. if (!!o || !!e) return r();
  56500. s = this.options.hideAnimation, n.push(this.options.hideDuration);
  56501. }
  56502. return n.push(r), i[s].apply(i, n);
  56503. }, A.prototype.setGlobalPosition = function () {
  56504. var t = this.getPosition(),
  56505. n = t[0],
  56506. i = t[1],
  56507. o = s[n],
  56508. u = s[i],
  56509. a = n + "|" + i,
  56510. f = T[a];
  56511. if (!f || !document.body.contains(f[0])) {
  56512. f = T[a] = x("div");
  56513. var l = {};
  56514. 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);
  56515. }
  56516. return f.prepend(this.wrapper);
  56517. }, A.prototype.setElementPosition = function () {
  56518. 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;
  56519. 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"];
  56520. for (w = 0, S = B.length; w < S; w++) {
  56521. D = B[w], N = parseInt(this.elem.css("margin-" + D), 10), N && C(p, D, N);
  56522. }
  56523. b = Math.max(0, this.options.gap - (this.options.arrowShow ? i : 0)), C(p, A, b);
  56524. if (!this.options.arrowShow) this.arrow.hide();else {
  56525. 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";
  56526. for (E = 0, x = a.length; E < x; E++) {
  56527. D = a[E], P = s[D];
  56528. if (D === L) continue;
  56529. l = P === T ? n : "transparent", r["border-" + P] = i + "px solid " + l;
  56530. }
  56531. C(p, s[L], i), t.call(a, O) >= 0 && C(r, s[O], i * 2);
  56532. }
  56533. 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);
  56534. if (r) return this.arrow.removeAttr("style").css(r);
  56535. }, A.prototype.getPosition = function () {
  56536. var e, n, r, i, s, f, c, h;
  56537. h = this.options.position || (this.elem ? this.options.elementPosition : this.options.globalPosition), e = l(h), e.length === 0 && (e[0] = "b");
  56538. if (n = e[0], t.call(a, n) < 0) throw "Must be one of [" + a + "]";
  56539. 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";
  56540. return e.length === 2 && (e[2] = e[1]), e;
  56541. }, A.prototype.getStyle = function (e) {
  56542. var t;
  56543. e || (e = this.options.style), e || (e = "default"), t = c[e];
  56544. if (!t) throw "Missing style: " + e;
  56545. return t;
  56546. }, A.prototype.updateClasses = function () {
  56547. var t, n;
  56548. 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) {
  56549. return r + "-" + n.name + "-" + e;
  56550. }).join(" "), this.userContainer.attr("class", t);
  56551. }, A.prototype.run = function (t, n) {
  56552. var r, s, o, u, a;
  56553. e.isPlainObject(n) ? e.extend(this.options, n) : e.type(n) === "string" && (this.options.className = n);
  56554. if (this.container && !t) {
  56555. this.show(!1);
  56556. return;
  56557. }
  56558. if (!this.container && !t) return;
  56559. s = {}, e.isPlainObject(t) ? s = t : s[i] = t;
  56560. for (o in s) {
  56561. r = s[o], u = this.userFields[o];
  56562. if (!u) continue;
  56563. 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);
  56564. }
  56565. 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));
  56566. }, A.prototype.destroy = function () {
  56567. this.wrapper.data(r, null), this.wrapper.remove();
  56568. }, e[n] = function (t, r, i) {
  56569. return t && t.nodeName || t.jquery ? e(t)[n](r, i) : (i = r, r = t, new A(null, r, i)), t;
  56570. }, e.fn[n] = function (t, n) {
  56571. return e(this).each(function () {
  56572. var i = N(e(this)).data(r);
  56573. i && i.destroy();
  56574. var s = new A(e(this), t, n);
  56575. }), this;
  56576. }, e.extend(e[n], {
  56577. defaults: S,
  56578. addStyle: m,
  56579. removeStyle: v,
  56580. pluginOptions: w,
  56581. getStyle: d,
  56582. insertCSS: g
  56583. }), m("bootstrap", {
  56584. html: "<div>\n<span data-notify-text></span>\n</div>",
  56585. classes: {
  56586. base: {
  56587. "font-weight": "bold",
  56588. padding: "8px 15px 8px 14px",
  56589. "text-shadow": "0 1px 0 rgba(255, 255, 255, 0.5)",
  56590. "background-color": "#fcf8e3",
  56591. border: "1px solid #fbeed5",
  56592. "border-radius": "4px",
  56593. "white-space": "nowrap",
  56594. "padding-left": "25px",
  56595. "background-repeat": "no-repeat",
  56596. "background-position": "3px 7px"
  56597. },
  56598. error: {
  56599. color: "#B94A48",
  56600. "background-color": "#F2DEDE",
  56601. "border-color": "#EED3D7",
  56602. "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=)"
  56603. },
  56604. success: {
  56605. color: "#468847",
  56606. "background-color": "#DFF0D8",
  56607. "border-color": "#D6E9C6",
  56608. "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==)"
  56609. },
  56610. info: {
  56611. color: "#3A87AD",
  56612. "background-color": "#D9EDF7",
  56613. "border-color": "#BCE8F1",
  56614. "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=)"
  56615. },
  56616. warn: {
  56617. color: "#C09853",
  56618. "background-color": "#FCF8E3",
  56619. "border-color": "#FBEED5",
  56620. "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)"
  56621. }
  56622. }
  56623. }), e(function () {
  56624. g(h.css).attr("id", "core-notify"), e(document).on("click", "." + r + "-hidable", function (t) {
  56625. e(this).trigger("notify-hide");
  56626. }), e(document).on("notify-hide", "." + r + "-wrapper", function (t) {
  56627. var n = e(this).data(r);
  56628. n && n.show(!1);
  56629. });
  56630. });
  56631. });
  56632. /***/ }),
  56633. /***/ "./resources/sass/app.scss":
  56634. /*!*********************************!*\
  56635. !*** ./resources/sass/app.scss ***!
  56636. \*********************************/
  56637. /*! no static exports found */
  56638. /***/ (function(module, exports) {
  56639. // removed by extract-text-webpack-plugin
  56640. /***/ }),
  56641. /***/ 0:
  56642. /*!*************************************************************!*\
  56643. !*** multi ./resources/js/app.js ./resources/sass/app.scss ***!
  56644. \*************************************************************/
  56645. /*! no static exports found */
  56646. /***/ (function(module, exports, __webpack_require__) {
  56647. __webpack_require__(/*! /home/vagrant/upccrt/resources/js/app.js */"./resources/js/app.js");
  56648. module.exports = __webpack_require__(/*! /home/vagrant/upccrt/resources/sass/app.scss */"./resources/sass/app.scss");
  56649. /***/ })
  56650. /******/ });